实体类: @Entity @Table(name = "xxxxx") public class WzInitializeStoreInfo extends EntityBean{ private static final long serialVersionUID = 1L; //字段都需要get、set方法 @Id @Column(name = "INCODE") private Long incode; @Column(name = "BATCH_ID") private Long batchId; @Column(name = "VALID_DATE") private Timestamp validDate; //其他表的字段 @Transient private String modelDesc;//无参参构造方法 public WzInitializeStoreInfo(){} //有参构造方法 public WzInitializeStoreInfo(Long incode, Long batchId, String modelDesc,Date validDate) { super(); this.incode = incode; this.batchId = batchId; this.modelDesc=modelDesc; this.validDate = (Timestamp)validDate; } public Long getIncode() { return incode; } public void setIncode(Long incode){ this.incode = incode; } public String getModelDesc() { return modelDesc; } public void setModelDesc(String modelDesc) { this.modelDesc = modelDesc; } @Override public Record exportToRecord() { EntityMetaData metaData = EntityMetaDataUtil.getEntityMetaData(this.getClass().getName()); if (metaData == null) { new BaseRunException("Java类"+this.getClass().getName()+"没有元数据信息!不能导出为Record!").handle(); } Record record = PrintUtil.genEmptyExportRecord(metaData); record.set("INCODE", this.incode); record.set("BATCH_ID", this.batchId); return record; } } Ipml @Component("wzInitializeStoreInfoDetailService") public class WzInitializeStoreInfoDetailServiceImpl implements WzInitializeStoreInfoDetailService { IDAO supplyDAO = JPAUtil.useJPATool("SupplyChainJPAToolDAO");//仓储用户 public Listretrieve(QueryParamList param, PageInfo pageInfo,SortParamList sort) throws BaseRunException { StringBuffer jpql=new StringBuffer(); jpql.append("select new com.haiyisoft.entity.wz.WzInitializeStoreInfo(w.incode,w.batchId,c.modelDesc,w.validDate)"); jpql.append(" from WzInitializeStoreInfo w,WzCode c where w.incode=c.incode " + "AND w.storeId in ("+StoreCommonUtil.getLowStoreStr(((AdminView)ContextUtil.getUserView()).getOrgPartyId())+")"); //查询自己仓库的数据 } if(param.get("batchId")!=null){ jpql.append(" and w.batchId=:batchId"); } if(param.get("modelDesc")!=null){ jpql.append(" and c.modelDesc like :modelDesc"); 76 } jpql.append(" order by w.batchId desc"); List
查询 适用于前台下拉Integer类型报错 if (param.get("laiyuanType")!=null) { String laiyuan=param.get("laiyuanType").getValue().toString(); param.get("laiyuanType").setValue(Integer.valueOf(laiyuan)); jpql.append("and w.laiyuanType=:laiyuanType"); }