感人= = 终于弄好了
String hql="select new Shop(s.strid,s.shopname,s.tradearea,s.discountinfo,s.begintime,s.finishtime) from Shop as s where s.strid in (select strid from Moneythreeshop m where m.strid = s.strid)"; Query query=session.createQuery(hql); List<Shop> list=query.list();
package com.dazhe.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; //create table shop(id int primary key auto_increment,strid varchar(50),shopname varchar(100),city varchar(40),county varchar(40),tradearea varchar(40), //mainphoto varchar(40),discountinfo varchar(200),begintime varchar(30),finishtime varchar(30),shopgoods varchar(200),addressx double, //addressy double,mindiscount double,detailedaddress varchar(50),maintel varchar(20),reservetel varchar(20),shopinfo varchar(300), //goodsinfo varchar(300),popularity int,brand varchar(50) //)default charset=utf8; @Entity public class Shop { // private int id; private String strid; private String shopname; //店名 private String city; //城市 默认福州把 private String county; //区县 private String tradearea; //商圈 private String mainphoto; //主照片 private String discountinfo; //打折信息 private String begintime; //开始时间 private String finishtime; //结束时间 private String shopgoods; //店内商品有哪些 private double addressx; //地图坐标 private double addressy; //地图坐标 private double mindiscount; //最低折扣 private String detailedaddress; //详细地址 private String maintel; //主要电话 private String reservetel; //备用电话 private String shopinfo; //商店简介 和美团那个三级界面一样 private String goodsinfo; //打折商品简介 和美团一样 private String popularity; //人气 默认0 用户每访问一次 就+1 private String brand; //品牌 比如 耐克店的品牌就是 NIKE private String lanmutype; //栏目类别 lanmu表没了 public Shop(String strid,String shopname,String tradearea,String discountinfo ,String begintime,String finishtime){ // this.id=id; super(); this.strid=strid; this.shopname=shopname; this.tradearea=tradearea; this.discountinfo=discountinfo; this.begintime=begintime; this.finishtime=finishtime; } public Shop(){ } // public int getId() { // return id; // } // public void setId(int id) { // this.id = id; // } public String getLanmutype() { return lanmutype; } public void setLanmutype(String lanmutype) { this.lanmutype = lanmutype; } @Id // @GeneratedValue 不自动生成 public String getStrid() { return strid; } public void setStrid(String strid) { this.strid = strid; } public String getShopname() { return shopname; } public void setShopname(String shopname) { this.shopname = shopname; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getCounty() { return county; } public void setCounty(String county) { this.county = county; } public String getTradearea() { return tradearea; } public void setTradearea(String tradearea) { this.tradearea = tradearea; } public String getMainphoto() { return mainphoto; } public void setMainphoto(String mainphoto) { this.mainphoto = mainphoto; } public String getDiscountinfo() { return discountinfo; } public void setDiscountinfo(String discountinfo) { this.discountinfo = discountinfo; } public String getBegintime() { return begintime; } public void setBegintime(String begintime) { this.begintime = begintime; } public String getFinishtime() { return finishtime; } public void setFinishtime(String finishtime) { this.finishtime = finishtime; } public String getShopgoods() { return shopgoods; } public void setShopgoods(String shopgoods) { this.shopgoods = shopgoods; } public double getAddressx() { return addressx; } public void setAddressx(double addressx) { this.addressx = addressx; } public double getAddressy() { return addressy; } public void setAddressy(double addressy) { this.addressy = addressy; } public double getMindiscount() { return mindiscount; } public void setMindiscount(double mindiscount) { this.mindiscount = mindiscount; } public String getDetailedaddress() { return detailedaddress; } public void setDetailedaddress(String detailedaddress) { this.detailedaddress = detailedaddress; } public String getMaintel() { return maintel; } public void setMaintel(String maintel) { this.maintel = maintel; } public String getReservetel() { return reservetel; } public void setReservetel(String reservetel) { this.reservetel = reservetel; } public String getShopinfo() { return shopinfo; } public void setShopinfo(String shopinfo) { this.shopinfo = shopinfo; } public String getGoodsinfo() { return goodsinfo; } public void setGoodsinfo(String goodsinfo) { this.goodsinfo = goodsinfo; } public String getPopularity() { return popularity; } public void setPopularity(String popularity) { this.popularity = popularity; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
today lazy . tomorrow die .