hibernate设计数据思想和实体映射关系配置及各种复杂查询语句(1)

    仿饿了吗的一个数据库及其实体映射关系

1.数据库设计

用户:用户id、用户名称、登录账号、登录密码、联系电话、性别、年龄、注册时间、销户时间、用户状态(0正常、1注销)

地址:地址id、用户id、城市编码、城市名、区县编码、区县名、乡镇编码、乡镇名、街道编码、街道名    (一个用户对多个地址)

商户:商户id、商户名称、商户地址、评价、手机号,人均价格,(每次对购买这家的商品的时候都要进行一次平均值计算),状态(0营业中1暂停营业2注销)

商品:商品id、商户id、菜品名称、菜品库存、菜品实际价格、菜品打折价格(可以为空,为空不显示)
(一个菜品对应一个商户,一个商户对应多个商品)

商品类别:类别id,类别名称

商品所属类别表:商品类别id、商品id

骑手:骑手id、骑手姓名、联系电话、入职时间、离职时间、在职状态(0代表在职,1代表离职、2代表休假)、工资、家庭住址、身份证

满足优惠活动的商家:活动id、商户id         (和商户是多对多的关系)

优惠活动:活动id、活动名称,优惠开始时间、优惠结束时间,优惠状态(0进行中、1结束)

订单:订单id、送达时间、地址id、骑手id、下单时间,订单状态(0进行中,1结束、2售后中)

订单商品: 商品id,订单id,数量

评论表:评论表id、订单id,评论内容,评论时间,回复内容

管理员:管理员id,管理员密码,管理员权限(0最高级管理员,对普通管理员进行增删改查1表示管理用户的增删改查、2表示管理商家的增删改查、3表示对骑手的增删改查)

create table consumer(
  customer_id number(4) not null,
  customer_name nvarchar2(20) not null,
  customer_account nvarchar2(20) not null,
  customer_password nvarchar2(20) not null,
  customer_phone nvarchar2(20) not null,
  customer_sex nvarchar2(20) not null,
  customer_age number(3) not null,
  customer_starttime nvarchar2(20) not null,
  customer_endtime nvarchar2(20),
  customer_state nvarchar2(20) not null
);

create table address(
       address_id number(4) not null,
       address_city nvarchar2(20) not null,
	     adress_district nvarchar2(20) not null,
	     adress_town nvarchar2(20) not null,
	     adress_street nvarchar2(20) not null,
	     customer_id number(4) not null
);

create table seller(
   seller_id number(4) not null,
	 seller_name nvarchar2(50) not null,
	 seller_address nvarchar2(100) not null,
   seller_phone nvarchar2(20) not null,
	 seller_grade number(8,3),
	 seller_avgprice number(4,3),
   seller_state nvarchar2(20) not null
);

create table food(
    food_id number(4) not null,
	  food_name nvarchar2(30) not null,
	  food_number number(4) not null,
	  food_realprice number(8,4) not null,
	  food_discountprice number(8,4),
	  seller_id number(4) not null
);

create table foodtype(
       foodtype_id number(4) not null,
       foodtype_name nvarchar2(20) not null
);
  
create table foodtype_food(
       foodtype_id number(4) not null,
       food_id number(4) not null
);

create table activity(
       activity_id number(4) not null,
       activity_name nvarchar2(100) not null
);

select * from activity;

create table activity_seller(
       seller_id number(4) not null,
       activity_id number(4) not null
);


create table controller(
       controller_id number(4) not null,
       controller_password nvarchar2(20) not null,
       controller_power nvarchar2(4) not null
);

create table orderfoods(
       orderfoods_id number(4) not null,
       orderfoods_time nvarchar2(40) not null,
       orderfoods_deliverytime nvarchar2(40) not null,
       orderfoods_state nvarchar2(4) not null,
       address_id number(4) not null,
       rider_id number(4) not null
);


create table rider(
      rider_id number(4) not null,
      rider_name nvarchar2(20) not null,
      rider_phone nvarchar2(20) not null,
      rider_entertime nvarchar2(20) not null,
      rider_leavetime nvarchar2(20) ,
      rider_state nvarchar2(20) not null,
      rider_wages number(8,2) not null,
      rider_address nvarchar2(100) not null,
      rider_idcard nvarchar2(40) not null
);

create table comments(
       comments_id number(4) not null,
       comments_context nvarchar2(1000) ,
       comments_time nvarchar2(100) ,
       comments_reply nvarchar2(1000),
       orderfoods_id number(4) not null
);

create table order_food(
       order_food_id number(4) not null,
       food_id number(4) not null,
       orderfoods_id number(4) not null,
       order_food_number number(4) not null
);








2.数据库关系

关系:
1.用户和地址是一对多的关系
2.商户和商品是一对多的关系
3.商户和活动是多对多的关系
4.订单和用户、骑手、商家是一对多的关系
5.订单和订单商品是一对多的关系
6.商品和商品类别是多对多的关系

7评论表和订单是多对一的关系

3.配置目录





4.实体类编写及配置

package com.vo;

import java.util.HashSet;
import java.util.Set;

public class Activity {

	private int activity_id;
	private String activity_name;
	private Set<Seller> setSeller = new HashSet<Seller>();

	public Activity() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Activity(int activity_id, String activity_name) {
		super();
		this.activity_id = activity_id;
		this.activity_name = activity_name;
	}

	public int getActivity_id() {
		return activity_id;
	}

	public void setActivity_id(int activity_id) {
		this.activity_id = activity_id;
	}

	public String getActivity_name() {
		return activity_name;
	}

	public void setActivity_name(String activity_name) {
		this.activity_name = activity_name;
	}

	public Set<Seller> getSetSeller() {
		return setSeller;
	}

	public void setSetSeller(Set<Seller> setSeller) {
		this.setSeller = setSeller;
	}

	@Override
	public String toString() {
		return "Activity [activity_id=" + activity_id + ", activity_name=" + activity_name + "]";
	}

}

package com.vo;

public class Address {

	// 地址:地址id、用户id、城市名、区县名、乡镇名、街道名 (一个用户对多个地址)

	private int address_id;
	private String address_city;
	private String adress_district;
	private String adress_town;
	private String adress_street;
	private Consumer consumer;

	public Address() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Address(int address_id) {
		super();
		this.address_id = address_id;
	}

	public Address(int address_id, String address_city, String adress_district, String adress_town,
			String adress_street) {
		super();
		this.address_id = address_id;
		this.address_city = address_city;
		this.adress_district = adress_district;
		this.adress_town = adress_town;
		this.adress_street = adress_street;
	}

	public Address(int address_id, String address_city, String adress_district, String adress_town,
			String adress_street, Consumer consumer) {
		super();
		this.address_id = address_id;
		this.address_city = address_city;
		this.adress_district = adress_district;
		this.adress_town = adress_town;
		this.adress_street = adress_street;
		this.consumer = consumer;
	}

	public int getAddress_id() {
		return address_id;
	}

	public void setAddress_id(int address_id) {
		this.address_id = address_id;
	}

	public String getAddress_city() {
		return address_city;
	}

	public void setAddress_city(String address_city) {
		this.address_city = address_city;
	}

	public String getAdress_district() {
		return adress_district;
	}

	public void setAdress_district(String adress_district) {
		this.adress_district = adress_district;
	}

	public String getAdress_town() {
		return adress_town;
	}

	public void setAdress_town(String adress_town) {
		this.adress_town = adress_town;
	}

	public String getAdress_street() {
		return adress_street;
	}

	public void setAdress_street(String adress_street) {
		this.adress_street = adress_street;
	}

	public Consumer getConsumer() {
		return consumer;
	}

	public void setConsumer(Consumer consumer) {
		this.consumer = consumer;
	}

	@Override
	public String toString() {
		return "Address [addresss_id=" + address_id + ", address_city=" + address_city + ", adress_district="
				+ adress_district + ", adress_town=" + adress_town + ", adress_street=" + adress_street + ", consumer="
				+ consumer + "]";
	}

}

package com.vo;

public class Comments {

	private int comments_id;
	private String comments_context;
	private String comments_time;
	private String comments_reply;
	private OrderFoods orderfoods;

	public Comments() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Comments(int comments_id, String comments_context, String comments_time, String comments_reply) {
		super();
		this.comments_id = comments_id;
		this.comments_context = comments_context;
		this.comments_time = comments_time;
		this.comments_reply = comments_reply;
	}

	public Comments(int comments_id, String comments_context, String comments_time, String comments_reply,
			OrderFoods orderfoods) {
		super();
		this.comments_id = comments_id;
		this.comments_context = comments_context;
		this.comments_time = comments_time;
		this.comments_reply = comments_reply;
		this.orderfoods = orderfoods;
	}

	public int getComments_id() {
		return comments_id;
	}

	public void setComments_id(int comments_id) {
		this.comments_id = comments_id;
	}

	public String getComments_context() {
		return comments_context;
	}

	public void setComments_context(String comments_context) {
		this.comments_context = comments_context;
	}

	public String getComments_time() {
		return comments_time;
	}

	public void setComments_time(String comments_time) {
		this.comments_time = comments_time;
	}

	public String getComments_reply() {
		return comments_reply;
	}

	public void setComments_reply(String comments_reply) {
		this.comments_reply = comments_reply;
	}

	public OrderFoods getOrderfoods() {
		return orderfoods;
	}

	public void setOrderfoods(OrderFoods orderfoods) {
		this.orderfoods = orderfoods;
	}

	@Override
	public String toString() {
		return "Comments [comments_id=" + comments_id + ", comments_context=" + comments_context + ", comments_time="
				+ comments_time + ", comments_reply=" + comments_reply + ", orderfoods=" + orderfoods + "]";
	}

}

package com.vo;

//用户:用户id、用户名称、登录账号、登录密码、联系电话、性别、
//年龄、注册时间、销户时间、用户状态(0正常、1注销)
public class Consumer {

	private int customer_id;
	private String customer_name;
	private String customer_account;
	private String customer_password;
	private String customer_phone;
	private String customer_sex;
	private int customer_age;
	private String customer_starttime;
	private String customer_endtime;
	private String customer_state;

	public Consumer() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Consumer(int customer_id, String customer_name, String customer_account, String customer_password,
			String customer_phone, String customer_sex, int customer_age, String customer_starttime,
			String customer_endtime, String customer_state) {
		super();
		this.customer_id = customer_id;
		this.customer_name = customer_name;
		this.customer_account = customer_account;
		this.customer_password = customer_password;
		this.customer_phone = customer_phone;
		this.customer_sex = customer_sex;
		this.customer_age = customer_age;
		this.customer_starttime = customer_starttime;
		this.customer_endtime = customer_endtime;
		this.customer_state = customer_state;
	}

	public int getCustomer_id() {
		return customer_id;
	}

	public void setCustomer_id(int customer_id) {
		this.customer_id = customer_id;
	}

	public String getCustomer_name() {
		return customer_name;
	}

	public void setCustomer_name(String customer_name) {
		this.customer_name = customer_name;
	}

	public String getCustomer_account() {
		return customer_account;
	}

	public void setCustomer_account(String customer_account) {
		this.customer_account = customer_account;
	}

	public String getCustomer_password() {
		return customer_password;
	}

	public void setCustomer_password(String customer_password) {
		this.customer_password = customer_password;
	}

	public String getCustomer_phone() {
		return customer_phone;
	}

	public void setCustomer_phone(String customer_phone) {
		this.customer_phone = customer_phone;
	}

	public String getCustomer_sex() {
		return customer_sex;
	}

	public void setCustomer_sex(String customer_sex) {
		this.customer_sex = customer_sex;
	}

	public int getCustomer_age() {
		return customer_age;
	}

	public void setCustomer_age(int customer_age) {
		this.customer_age = customer_age;
	}

	public String getCustomer_starttime() {
		return customer_starttime;
	}

	public void setCustomer_starttime(String customer_starttime) {
		this.customer_starttime = customer_starttime;
	}

	public String getCustomer_endtime() {
		return customer_endtime;
	}

	public void setCustomer_endtime(String customer_endtime) {
		this.customer_endtime = customer_endtime;
	}

	public String getCustomer_state() {
		return customer_state;
	}

	public void setCustomer_state(String customer_state) {
		this.customer_state = customer_state;
	}

	@Override
	public String toString() {
		return "Consumer [customer_id=" + customer_id + ", customer_name=" + customer_name + ", customer_account="
				+ customer_account + ", customer_password=" + customer_password + ", customer_phone=" + customer_phone
				+ ", customer_sex=" + customer_sex + ", customer_age=" + customer_age + ", customer_starttime="
				+ customer_starttime + ", customer_endtime=" + customer_endtime + ", customer_state=" + customer_state
				+ "]";
	}

}

package com.vo;

public class Controller {

	private int controller_id;
	private String controller_password;
	private String controller_power;

	public Controller() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Controller(int controller_id, String controller_password, String controller_power) {
		super();
		this.controller_id = controller_id;
		this.controller_password = controller_password;
		this.controller_power = controller_power;
	}

	public int getController_id() {
		return controller_id;
	}

	public void setController_id(int controller_id) {
		this.controller_id = controller_id;
	}

	public String getController_password() {
		return controller_password;
	}

	public void setController_password(String controller_password) {
		this.controller_password = controller_password;
	}

	public String getController_power() {
		return controller_power;
	}

	public void setController_power(String controller_power) {
		this.controller_power = controller_power;
	}

	@Override
	public String toString() {
		return "Controller [controller_id=" + controller_id + ", controller_password=" + controller_password
				+ ", controller_power=" + controller_power + "]";
	}

}

package com.vo;

import java.util.HashSet;
import java.util.Set;

public class Food {
	// 商品:商品id、商户id、菜品名称、菜品库存、菜品实际价格、菜品打折价格(可以为空,为空不显示)
	// (一个菜品对应一个商户,一个商户对应多个商品)
	private int food_id;
	private String food_name;
	private int food_number;
	private double food_realprice;
	private double food_discountprice;
	private Seller seller;
	private Set<FoodType> setFoodType = new HashSet<FoodType>();

	public Food() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Food(int food_id, String food_name, int food_number, double food_realprice, double food_discountprice) {
		super();
		this.food_id = food_id;
		this.food_name = food_name;
		this.food_number = food_number;
		this.food_realprice = food_realprice;
		this.food_discountprice = food_discountprice;
	}

	public Food(int food_id, String food_name, int food_number, double food_realprice, double food_discountprice,
			Seller seller) {
		super();
		this.food_id = food_id;
		this.food_name = food_name;
		this.food_number = food_number;
		this.food_realprice = food_realprice;
		this.food_discountprice = food_discountprice;
		this.seller = seller;
	}

	public int getFood_id() {
		return food_id;
	}

	public void setFood_id(int food_id) {
		this.food_id = food_id;
	}

	public String getFood_name() {
		return food_name;
	}

	public void setFood_name(String food_name) {
		this.food_name = food_name;
	}

	public int getFood_number() {
		return food_number;
	}

	public void setFood_number(int food_number) {
		this.food_number = food_number;
	}

	public double getFood_realprice() {
		return food_realprice;
	}

	public void setFood_realprice(double food_realprice) {
		this.food_realprice = food_realprice;
	}

	public double getFood_discountprice() {
		return food_discountprice;
	}

	public void setFood_discountprice(double food_discountprice) {
		this.food_discountprice = food_discountprice;
	}

	public Seller getSeller() {
		return seller;
	}

	public void setSeller(Seller seller) {
		this.seller = seller;
	}

	public Set<FoodType> getSetFoodType() {
		return setFoodType;
	}

	public void setSetFoodType(Set<FoodType> setFoodType) {
		this.setFoodType = setFoodType;
	}

	@Override
	public String toString() {
		return "Food [food_id=" + food_id + ", food_name=" + food_name + ", food_number=" + food_number
				+ ", food_realprice=" + food_realprice + ", food_discountprice=" + food_discountprice + ", seller="
				+ seller + "]";
	}

}

package com.vo;

import java.util.HashSet;
import java.util.Set;

public class FoodType {

	private int foodtype_id;
	private String foodType_name;
	private Set<Food> setFood = new HashSet<Food>();

	public FoodType() {
		super();
		// TODO Auto-generated constructor stub
	}

	public FoodType(int foodtype_id, String foodType_name) {
		super();
		this.foodtype_id = foodtype_id;
		this.foodType_name = foodType_name;
	}

	public Set<Food> getSetFood() {
		return setFood;
	}

	public void setSetFood(Set<Food> setFood) {
		this.setFood = setFood;
	}

	public int getFoodtype_id() {
		return foodtype_id;
	}

	public void setFoodtype_id(int foodtype_id) {
		this.foodtype_id = foodtype_id;
	}

	public String getFoodType_name() {
		return foodType_name;
	}

	public void setFoodType_name(String foodType_name) {
		this.foodType_name = foodType_name;
	}

	@Override
	public String toString() {
		return "FoodType [foodtype_id=" + foodtype_id + ", foodType_name=" + foodType_name + "]";
	}

}

package com.vo;

public class Order_Food {

	private int order_food_id;
	private OrderFoods orderfood;
	private Food food;
	private int order_food_number;

	public Order_Food() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Order_Food(int order_food_id, OrderFoods orderfood, com.vo.Food food, int order_food_number) {
		super();
		this.order_food_id = order_food_id;
		this.orderfood = orderfood;
		food = food;
		this.order_food_number = order_food_number;
	}

	public Order_Food(int order_food_id, int order_food_number) {
		super();
		this.order_food_id = order_food_id;
		this.order_food_number = order_food_number;
	}

	public int getOrder_food_id() {
		return order_food_id;
	}

	public void setOrder_food_id(int order_food_id) {
		this.order_food_id = order_food_id;
	}

	public OrderFoods getOrderfood() {
		return orderfood;
	}

	public void setOrderfood(OrderFoods orderfood) {
		this.orderfood = orderfood;
	}

	public Food getFood() {
		return food;
	}

	public void setFood(Food food) {
		this.food = food;
	}

	public int getOrder_food_number() {
		return order_food_number;
	}

	public void setOrder_food_number(int order_food_number) {
		this.order_food_number = order_food_number;
	}

	@Override
	public String toString() {
		return "Order_Food [order_food_id=" + order_food_id + ", orderfood=" + orderfood + ", Food=" + food
				+ ", order_food_number=" + order_food_number + "]";
	}

}

package com.vo;

public class OrderFoods {

	// --订单:订单id、用户id,商家id、地址id、下单时间,送达时间,
	// 订单状态(0进行中,1结束、2售后中)
	private int orderfoods_id;
	private String orderfoods_time;
	private String orderfoods_deliverytime;
	private String orderfoods_state;
	private Address address;
	private Rider rider;

	public OrderFoods() {
		super();
		// TODO Auto-generated constructor stub
	}

	public OrderFoods(int orderfoods_id, String orderfoods_time, String orderfoods_deliverytime,
			String orderfoods_state) {
		super();
		this.orderfoods_id = orderfoods_id;
		this.orderfoods_time = orderfoods_time;
		this.orderfoods_deliverytime = orderfoods_deliverytime;
		this.orderfoods_state = orderfoods_state;
	}

	public OrderFoods(int orderfoods_id, String orderfoods_time, String orderfoods_deliverytime,
			String orderfoods_state, Address address) {
		super();
		this.orderfoods_id = orderfoods_id;
		this.orderfoods_time = orderfoods_time;
		this.orderfoods_deliverytime = orderfoods_deliverytime;
		this.orderfoods_state = orderfoods_state;
		this.address = address;
	}

	public int getOrderfoods_id() {
		return orderfoods_id;
	}

	public void setOrderfoods_id(int orderfoods_id) {
		this.orderfoods_id = orderfoods_id;
	}

	public String getOrderfoods_time() {
		return orderfoods_time;
	}

	public void setOrderfoods_time(String orderfoods_time) {
		this.orderfoods_time = orderfoods_time;
	}

	public String getOrderfoods_deliverytime() {
		return orderfoods_deliverytime;
	}

	public void setOrderfoods_deliverytime(String orderfoods_deliverytime) {
		this.orderfoods_deliverytime = orderfoods_deliverytime;
	}

	public String getOrderfoods_state() {
		return orderfoods_state;
	}

	public void setOrderfoods_state(String orderfoods_state) {
		this.orderfoods_state = orderfoods_state;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public Rider getRider() {
		return rider;
	}

	public void setRider(Rider rider) {
		this.rider = rider;
	}

	@Override
	public String toString() {
		return "OrderFoods [orderfoods_id=" + orderfoods_id + ", orderfoods_time=" + orderfoods_time
				+ ", orderfoods_deliverytime=" + orderfoods_deliverytime + ", orderfoods_state=" + orderfoods_state
				+ ", address=" + address + ", rider=" + rider + "]";
	}

}

package com.vo;

public class Rider {

	// 骑手:骑手id、骑手姓名、联系电话、入职时间、离职时间、
	// 在职状态(0代表在职,1代表离职、2代表休假)、工资、家庭住址、身份证
	private int rider_id;
	private String rider_name;
	private String rider_phone;
	private String rider_entertime;
	private String rider_leavetime;
	private String rider_state;
	private double rider_wages;
	private String rider_address;
	private String rider_idcard;

	public Rider() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Rider(int rider_id, String rider_name, String rider_phone, String rider_entertime, String rider_leavetime,
			String rider_state, double rider_wages, String rider_address, String rider_idcard) {
		super();
		this.rider_id = rider_id;
		this.rider_name = rider_name;
		this.rider_phone = rider_phone;
		this.rider_entertime = rider_entertime;
		this.rider_leavetime = rider_leavetime;
		this.rider_state = rider_state;
		this.rider_wages = rider_wages;
		this.rider_address = rider_address;
		this.rider_idcard = rider_idcard;
	}

	public int getRider_id() {
		return rider_id;
	}

	public void setRider_id(int rider_id) {
		this.rider_id = rider_id;
	}

	public String getRider_name() {
		return rider_name;
	}

	public void setRider_name(String rider_name) {
		this.rider_name = rider_name;
	}

	public String getRider_phone() {
		return rider_phone;
	}

	public void setRider_phone(String rider_phone) {
		this.rider_phone = rider_phone;
	}

	public String getRider_entertime() {
		return rider_entertime;
	}

	public void setRider_entertime(String rider_entertime) {
		this.rider_entertime = rider_entertime;
	}

	public String getRider_leavetime() {
		return rider_leavetime;
	}

	public void setRider_leavetime(String rider_leavetime) {
		this.rider_leavetime = rider_leavetime;
	}

	public String getRider_state() {
		return rider_state;
	}

	public void setRider_state(String rider_state) {
		this.rider_state = rider_state;
	}

	public double getRider_wages() {
		return rider_wages;
	}

	public void setRider_wages(double rider_wages) {
		this.rider_wages = rider_wages;
	}

	public String getRider_address() {
		return rider_address;
	}

	public void setRider_address(String rider_address) {
		this.rider_address = rider_address;
	}

	public String getRider_idcard() {
		return rider_idcard;
	}

	public void setRider_idcard(String rider_idcard) {
		this.rider_idcard = rider_idcard;
	}

	@Override
	public String toString() {
		return "Rider [rider_id=" + rider_id + ", rider_name=" + rider_name + ", rider_phone=" + rider_phone
				+ ", rider_entertime=" + rider_entertime + ", rider_leavetime=" + rider_leavetime + ", rider_state="
				+ rider_state + ", rider_wages=" + rider_wages + ", rider_address=" + rider_address + ", rider_idcard="
				+ rider_idcard + "]";
	}

}

package com.vo;

import java.util.HashSet;
import java.util.Set;

public class Seller {

	// 商户:商户id、商户名称、商户地址、评价、人均价格
	private int seller_id;
	private String seller_name;
	private String seller_address;
	private String seller_phone;
	private double seller_grade;
	private double seller_avgprice;
	private String seller_state;
	private Set<Activity> setActivity = new HashSet<Activity>();

	public Seller() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Seller(int seller_id, String seller_name, String seller_address, String seller_phone, double seller_grade,
			double seller_avgprice, String seller_state) {
		super();
		this.seller_id = seller_id;
		this.seller_name = seller_name;
		this.seller_address = seller_address;
		this.seller_phone = seller_phone;
		this.seller_grade = seller_grade;
		this.seller_avgprice = seller_avgprice;
		this.seller_state = seller_state;
	}

	public int getSeller_id() {
		return seller_id;
	}

	public void setSeller_id(int seller_id) {
		this.seller_id = seller_id;
	}

	public String getSeller_name() {
		return seller_name;
	}

	public void setSeller_name(String seller_name) {
		this.seller_name = seller_name;
	}

	public String getSeller_address() {
		return seller_address;
	}

	public void setSeller_address(String seller_address) {
		this.seller_address = seller_address;
	}

	public double getSeller_grade() {
		return seller_grade;
	}

	public void setSeller_grade(double seller_grade) {
		this.seller_grade = seller_grade;
	}

	public double getSeller_avgprice() {
		return seller_avgprice;
	}

	public void setSeller_avgprice(double seller_avgprice) {
		this.seller_avgprice = seller_avgprice;
	}

	public String getSeller_phone() {
		return seller_phone;
	}

	public void setSeller_phone(String seller_phone) {
		this.seller_phone = seller_phone;
	}

	public String getSeller_state() {
		return seller_state;
	}

	public void setSeller_state(String seller_state) {
		this.seller_state = seller_state;
	}

	public Set<Activity> getSetActivity() {
		return setActivity;
	}

	public void setSetActivity(Set<Activity> setActivity) {
		this.setActivity = setActivity;
	}

	@Override
	public String toString() {
		return "Seller [seller_id=" + seller_id + ", seller_name=" + seller_name + ", seller_address=" + seller_address
				+ ", seller_phone=" + seller_phone + ", seller_grade=" + seller_grade + ", seller_avgprice="
				+ seller_avgprice + "]";
	}

}

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="Activity" table="activity">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="activity_id" column="activity_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="activity_name" column="activity_name" type="string" />
		<set name="setSeller" table="activity_seller" cascade="save-update,delete">
			<key column="activity_id"></key>
			<many-to-many class="com.vo.Seller" column="seller_id"></many-to-many>
		</set>
	</class>


</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="Address" table="address">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="address_id" column="address_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="address_city" column="address_city" type="string" />
		<property name="adress_district" column="adress_district"
			type="string" />
		<property name="adress_town" column="adress_town" type="string" />
		<property name="adress_street" column="adress_street" type="string" />
		<many-to-one name="consumer" column="customer_id" cascade="delete"></many-to-one>
	</class>

</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="Comments" table="comments">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="comments_id" column="comments_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="comments_context" column="comments_context" type="string" />
		<property name="comments_time" column="comments_time"
			type="string" />
		<property name="comments_reply" column="comments_reply" type="string" />
		<many-to-one name="orderfoods" column="orderfoods_id" lazy="false" fetch="join" cascade="delete"></many-to-one>
	</class>

</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="Consumer" table="consumer">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="customer_id" column="customer_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="customer_name" column="customer_name" type="string" />
		<property name="customer_account" column="customer_account"
			type="string" />
		<property name="customer_password" column="customer_password"
			type="string" />
		<property name="customer_phone" column="customer_phone" type="string" />
		<property name="customer_sex" column="customer_sex" type="string" />
		<property name="customer_age" column="customer_age" type="int" />
		<property name="customer_starttime" column="customer_starttime"
			type="string" />
		<property name="customer_endtime" column="customer_endtime"
			type="string" />
		<property name="customer_state" column="customer_state" type="string" />
	</class>

</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="Controller" table="controller">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="controller_id" column="controller_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="controller_password" column="controller_password"
			type="string" />
		<property name="controller_power" column="controller_power"
			type="string" />
	</class>


</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="Food" table="food">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="food_id" column="food_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="food_name" column="food_name" type="string" />
		<property name="food_number" column="food_number" type="int" />
		<property name="food_realprice" column="food_realprice" type="double" />
		<property name="food_discountprice" column="food_discountprice"
			type="double" />
		<many-to-one name="seller" column="seller_id" cascade="delete"></many-to-one>
		<set name="setFoodType" table="foodtype_food" lazy="false" cascade="save-update,delete">
			<key column="food_id"></key>
			<many-to-many class="com.vo.FoodType" column="foodtype_id"></many-to-many>
		</set>
	</class>

</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="FoodType" table="foodtype">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="foodtype_id" column="foodtype_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="foodType_name" column="foodType_name" type="string" />
		<set name="setFood" table="foodtype_food" lazy="false" cascade="save-update,delete">
			<key column="foodtype_id"></key>
			<many-to-many class="com.vo.Food" column="food_id"></many-to-many>
		</set>
	</class>

</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="Order_Food" table="order_food">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="order_food_id" column="order_food_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="order_food_number" column="order_food_number"
			type="int" />

		<many-to-one name="orderfood" column="orderfoods_id"
			cascade="delete"></many-to-one>
		<many-to-one name="food" column="food_id" cascade="none"></many-to-one>
	</class>

</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="OrderFoods" table="orderfoods">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="orderfoods_id" column="orderfoods_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="orderfoods_time" column="orderfoods_time"
			type="string" />
		<property name="orderfoods_deliverytime" column="orderfoods_deliverytime"
			type="string" />
		<property name="orderfoods_state" column="orderfoods_state"
			type="string" />
		<many-to-one name="address" column="address_id"></many-to-one>
		<many-to-one name="rider" column="rider_id"></many-to-one>

	</class>


</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="Rider" table="rider">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="rider_id" column="rider_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="rider_name" column="rider_name" type="string" />
		<property name="rider_phone" column="rider_phone" type="string" />
		<property name="rider_entertime" column="rider_entertime"
			type="string" />
		<property name="rider_leavetime" column="rider_leavetime"
			type="string" />
		<property name="rider_state" column="rider_state" type="string" />
		<property name="rider_wages" column="rider_wages" type="double" />
		<property name="rider_address" column="rider_address" type="string" />
		<property name="rider_idcard" column="rider_idcard" type="string" />
	</class>

</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.vo"><!-- 包名 -->
	<!-- name是类名,table是数据库中的表名 -->
	<class name="Seller" table="seller">
		<!-- name是Person类中的属性,column是数据库中表的字段名 -->
		<id name="seller_id" column="seller_id">
			<generator class="increment" />
		</id>
		<!-- 使用property标签来映射 -->
		<property name="seller_name" column="seller_name" type="string" />
		<property name="seller_address" column="seller_address" type="string" />
		<property name="seller_phone" column="seller_phone" type="string" />
		<property name="seller_grade" column="seller_grade" type="double" />
		<property name="seller_avgprice" column="seller_avgprice"
			type="double" />
		<property name="seller_state" column="seller_state" type="string" />
		<set name="setActivity" table="activity_seller" cascade="save-update,delete">
			<key column="seller_id"></key>
			<many-to-many class="com.vo.Activity" column="activity_id"></many-to-many>
		</set>
	</class>

</hibernate-mapping>

阅读更多
换一批

没有更多推荐了,返回首页