今天没事干总结一下uep查询语句:

第一种方法:

注意在实体写上对应的构造方法

package com.haiyisoft.entity.wz;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.haiyisoft.entity.EntityBean;
import com.haiyisoft.ep.common.db.Record;
import com.haiyisoft.ep.common.jpa.meta.EntityMetaData;
import com.haiyisoft.ep.common.jpa.util.EntityMetaDataUtil;
import com.haiyisoft.ep.common.util.PrintUtil;
import com.haiyisoft.ep.exception.BaseRunException;

@Entity
@Table(name = "wz_initialize_store_info")
public class WzInitializeStoreInfo extends EntityBean{
private static final long serialVersionUID = 1L;

@Id
@Column(name = "INCODE")
private Long incode;

@Column(name = "BATCH_ID")
private Long batchId;

@Column(name = "HS_UNIT")
private Long hsUnit;

@Column(name = "WZ_INCODE")
private Long wzIncode;

@Column(name = "STORE_ID")
private Long storeId;

@Column(name = "BUY_PRICE")
private BigDecimal buyPrice;

@Column(name = "TAX_RATIO")
private BigDecimal taxRatio;

@Column(name = "STORE_SITE")
private String storeSite;

@Column(name = "PAN_NUM")
private Integer panNum;

@Column(name = "MONTH_END_NUM")
private BigDecimal monthEndNum;

@Column(name = "MONTH_END_MONEY")
private BigDecimal monthEndMoney;

@Column(name = "STORE_ADVANCE_NUM")
private BigDecimal storeAdvanceNum;

@Column(name = "STORE_FACT_NUM")
private BigDecimal storeFactNum;

@Column(name = "STORE_CW_NUM")
private BigDecimal storeCwNum;

@Column(name = "CW_END_MONEY")
private BigDecimal cwEndMoney;

@Column(name = "MADE_DATE")
private Timestamp madeDate;

@Column(name = "VALID_DATE")
private Timestamp validDate;

@Column(name = "ACCOUNT_ID")
private Long accountId;

@Column(name = "PROJECT_CODE")
private Long projectCode;

@Column(name = "STORE_STATUS")
private String storeStatus;

@Column(name = "MADE_INCODE")
private Long madeIncode;

@Column(name = "PRODUCT_INCODE")
private Long productIncode;

@Column(name = "DEDUCE_POINT")
private BigDecimal deducePoint;

@Column(name = "JSFS")
private String jsfs;

@Column(name = "MODEL_DES")
private String modelDes;

@Column(name = "TAX_RATIO1")
private BigDecimal taxRatio1;

@Column(name = "STORE_FACT_NUM_ACCOUNT")
private Long storeFactNumAccount;

@Column(name = "STORE_ADVANCE_NUM_ACCOUNT")
private Long storeAdvanceNumAccount;

@Column(name = "STORE_ADVANCE_NUM_LIST")
private Long storeAdvanceNumList;

@Column(name = "STORE_FACT_NUM_LIST")
private Long storeFactNumList;

@Column(name = "SFJY")
private String sfjy;

@Column(name = "REMARK")
private String remark;

@Column(name = "APP_ID")
private String appId;

@Column(name = "COMPANY_ID")
private Long companyId;

@Column(name = "batch_type")
private Integer batchType;

@Column(name = "ORDER_NO")
private Long orderNo;

@Column(name = "ORDER_CODE")
private String orderCode;

@Transient
private String modelDesc;
@Transient
private String wzCode;
//商品名称
@Transient
private String wzName;
//商品条码
@Transient
private String wzEntry;
//单位
@Transient
private String jlUnit;

@Column(name = "CREATE_DATE")
private Timestamp createDate;

@Column(name = "MODIFY_DATE")
private Timestamp modifyDate;

@Column(name = "STANDARD_BOX")
private String standardBox;

@Column(name = "BOX_TYPE_ID")
private Long boxTypeId;

public Long getBoxTypeId() {
return boxTypeId;
}

public void setBoxTypeId(Long boxTypeId) {
this.boxTypeId = boxTypeId;
}

public String getStandardBox() {
return standardBox;
}

public void setStandardBox(String standardBox) {
this.standardBox = standardBox;
}
public Timestamp getCreateDate() {
return createDate;
}

public void setCreateDate(Timestamp createDate) {
this.createDate = createDate;
}

public Timestamp getModifyDate() {
return modifyDate;
}

public void setModifyDate(Timestamp modifyDate) {
this.modifyDate = modifyDate;
}

//有参构造方法
public WzInitializeStoreInfo(){}

public WzInitializeStoreInfo(Long incode, Long batchId,
Long wzIncode, Long storeId, BigDecimal buyPrice,
BigDecimal taxRatio, String storeSite,
BigDecimal storeAdvanceNum, BigDecimal storeFactNum,
Date madeDate,Date validDate, Long productIncode, Integer batchType, String wzName, String wzEntry,String jlUnit,
String modelDesc,String wzCode,String orderCode,Long hsUnit,Date createDate,Date modifyDate,String standardBox,Long boxTypeId,Integer panNum) {
super();
this.incode = incode;
this.batchId = batchId;
this.wzIncode = wzIncode;
this.storeId = storeId;
this.buyPrice = buyPrice;
this.taxRatio = taxRatio;
this.storeSite = storeSite;
this.storeAdvanceNum = storeAdvanceNum;
this.storeFactNum = storeFactNum;
this.madeDate = (Timestamp)madeDate;
this.validDate = (Timestamp)validDate;
this.productIncode = productIncode;
this.batchType = batchType;
this.wzName = wzName;
this.wzEntry = wzEntry;
this.jlUnit = jlUnit;
this.modelDesc=modelDesc;
this.wzCode=wzCode;
this.orderCode=orderCode;
this.hsUnit=hsUnit;
this.createDate = (Timestamp)createDate;
this.modifyDate = (Timestamp)modifyDate;
this.standardBox = standardBox;
this.boxTypeId=boxTypeId;
this.panNum=panNum;
}

public String getModelDesc() {
return modelDesc;
}

public void setModelDesc(String modelDesc) {
this.modelDesc = modelDesc;
}

public String getWzCode() {
return wzCode;
}

public void setWzCode(String wzCode) {
this.wzCode = wzCode;
}
public String getWzName() {
return wzName;
}
public void setWzName(String wzName) {
this.wzName = wzName;
}
public String getWzEntry() {
return wzEntry;
}
public void setWzEntry(String wzEntry) {
this.wzEntry = wzEntry;
}
public String getJlUnit() {
return jlUnit;
}
public void setJlUnit(String jlUnit) {
this.jlUnit = jlUnit;
}
public Long getIncode() {
return incode;
}
public void setIncode(Long incode){
this.incode = incode;
}

public Long getBatchId() {
return batchId;
}

public void setBatchId(Long batchId){
this.batchId = batchId;
}

public Long getHsUnit() {
return hsUnit;
}

public void setHsUnit(Long hsUnit){
this.hsUnit = hsUnit;
}

public Long getWzIncode() {
return wzIncode;
}

public void setWzIncode(Long wzIncode){
this.wzIncode = wzIncode;
}

public Long getStoreId() {
return storeId;
}

public void setStoreId(Long storeId){
this.storeId = storeId;
}

public BigDecimal getBuyPrice() {
return buyPrice;
}

public void setBuyPrice(BigDecimal buyPrice){
this.buyPrice = buyPrice;
}

public BigDecimal getTaxRatio() {
return taxRatio;
}

public void setTaxRatio(BigDecimal taxRatio){
this.taxRatio = taxRatio;
}

public String getStoreSite() {
return storeSite;
}

public void setStoreSite(String storeSite){
this.storeSite = storeSite;
}

public Integer getPanNum() {
return panNum;
}

public void setPanNum(Integer panNum){
this.panNum = panNum;
}

public BigDecimal getMonthEndNum() {
return monthEndNum;
}

public void setMonthEndNum(BigDecimal monthEndNum){
this.monthEndNum = monthEndNum;
}

public BigDecimal getMonthEndMoney() {
return monthEndMoney;
}

public void setMonthEndMoney(BigDecimal monthEndMoney){
this.monthEndMoney = monthEndMoney;
}

public BigDecimal getStoreAdvanceNum() {
return storeAdvanceNum;
}

public void setStoreAdvanceNum(BigDecimal storeAdvanceNum){
this.storeAdvanceNum = storeAdvanceNum;
}

public BigDecimal getStoreFactNum() {
return storeFactNum;
}

public void setStoreFactNum(BigDecimal storeFactNum){
this.storeFactNum = storeFactNum;
}

public BigDecimal getStoreCwNum() {
return storeCwNum;
}

public void setStoreCwNum(BigDecimal storeCwNum){
this.storeCwNum = storeCwNum;
}

public BigDecimal getCwEndMoney() {
return cwEndMoney;
}

public void setCwEndMoney(BigDecimal cwEndMoney){
this.cwEndMoney = cwEndMoney;
}

public Timestamp getMadeDate() {
return madeDate;
}

public void setMadeDate(Timestamp madeDate){
this.madeDate = madeDate;
}

public Timestamp getValidDate() {
return validDate;
}

public void setValidDate(Timestamp validDate){
this.validDate = validDate;
}

public Long getAccountId() {
return accountId;
}

public void setAccountId(Long accountId){
this.accountId = accountId;
}

public Long getProjectCode() {
return projectCode;
}

public void setProjectCode(Long projectCode){
this.projectCode = projectCode;
}

public String getStoreStatus() {
return storeStatus;
}

public void setStoreStatus(String storeStatus){
this.storeStatus = storeStatus;
}

public Long getMadeIncode() {
return madeIncode;
}

public void setMadeIncode(Long madeIncode){
this.madeIncode = madeIncode;
}

public Long getProductIncode() {
return productIncode;
}

public void setProductIncode(Long productIncode){
this.productIncode = productIncode;
}

public BigDecimal getDeducePoint() {
return deducePoint;
}

public void setDeducePoint(BigDecimal deducePoint){
this.deducePoint = deducePoint;
}

public String getJsfs() {
return jsfs;
}

public void setJsfs(String jsfs){
this.jsfs = jsfs;
}

public String getModelDes() {
return modelDes;
}

public void setModelDes(String modelDes){
this.modelDes = modelDes;
}

public BigDecimal getTaxRatio1() {
return taxRatio1;
}

public void setTaxRatio1(BigDecimal taxRatio1){
this.taxRatio1 = taxRatio1;
}

public Long getStoreFactNumAccount() {
return storeFactNumAccount;
}

public void setStoreFactNumAccount(Long storeFactNumAccount){
this.storeFactNumAccount = storeFactNumAccount;
}

public Long getStoreAdvanceNumAccount() {
return storeAdvanceNumAccount;
}

public void setStoreAdvanceNumAccount(Long storeAdvanceNumAccount){
this.storeAdvanceNumAccount = storeAdvanceNumAccount;
}

public Long getStoreAdvanceNumList() {
return storeAdvanceNumList;
}

public void setStoreAdvanceNumList(Long storeAdvanceNumList){
this.storeAdvanceNumList = storeAdvanceNumList;
}

public Long getStoreFactNumList() {
return storeFactNumList;
}

public void setStoreFactNumList(Long storeFactNumList){
this.storeFactNumList = storeFactNumList;
}

public String getSfjy() {
return sfjy;
}

public void setSfjy(String sfjy){
this.sfjy = sfjy;
}

public String getRemark() {
return remark;
}

public void setRemark(String remark){
this.remark = remark;
}

public String getAppId() {
return appId;
}

public void setAppId(String appId){
this.appId = appId;
}

public Long getCompanyId() {
return companyId;
}

public void setCompanyId(Long companyId){
this.companyId = companyId;
}

public Integer getBatchType() {
return batchType;
}

public void setBatchType(Integer batchType) {
this.batchType = batchType;
}

public Long getOrderNo() {
return orderNo;
}

public void setOrderNo(Long orderNo) {
this.orderNo = orderNo;
}

public String getOrderCode() {
return orderCode;
}

public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}

@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);
record.set("HS_UNIT", this.hsUnit);
record.set("WZ_INCODE", this.wzIncode);
record.set("STORE_ID", this.storeId);
record.set("BUY_PRICE", this.buyPrice);
record.set("TAX_RATIO", this.taxRatio);
record.set("STORE_SITE", this.storeSite);
record.set("PAN_NUM", this.panNum);
record.set("MONTH_END_NUM", this.monthEndNum);
record.set("MONTH_END_MONEY", this.monthEndMoney);
record.set("STORE_ADVANCE_NUM", this.storeAdvanceNum);
record.set("STORE_FACT_NUM", this.storeFactNum);
record.set("STORE_CW_NUM", this.storeCwNum);
record.set("CW_END_MONEY", this.cwEndMoney);
record.set("MADE_DATE", this.madeDate);
record.set("VALID_DATE", this.validDate);
record.set("ACCOUNT_ID", this.accountId);
record.set("PROJECT_CODE", this.projectCode);
record.set("STORE_STATUS", this.storeStatus);
record.set("MADE_INCODE", this.madeIncode);
record.set("PRODUCT_INCODE", this.productIncode);
record.set("DEDUCE_POINT", this.deducePoint);
record.set("JSFS", this.jsfs);
record.set("MODEL_DES", this.modelDes);
record.set("TAX_RATIO1", this.taxRatio1);
record.set("STORE_FACT_NUM_ACCOUNT", this.storeFactNumAccount);
record.set("STORE_ADVANCE_NUM_ACCOUNT", this.storeAdvanceNumAccount);
record.set("STORE_ADVANCE_NUM_LIST", this.storeAdvanceNumList);
record.set("STORE_FACT_NUM_LIST", this.storeFactNumList);
record.set("SFJY", this.sfjy);
record.set("REMARK", this.remark);
record.set("APP_ID", this.appId);
record.set("COMPANY_ID", this.companyId);
record.set("batch_type", this.batchType);
record.set("checked", super.getChecked());
return record;
}

}

然后写查询语句,语句对应参数和实体顺序一样

public List<WzInitializeStoreInfo> retrieve(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,w.wzIncode,w.storeId,w.buyPrice,w.taxRatio,w.storeSite,w.storeAdvanceNum,w.storeFactNum,w.madeDate,w.validDate,w.productIncode,"
+ "w.batchType,c.wzName,c.wzEntry,c.jlUnit)");
jpql.append(" from WzInitializeStoreInfo w,WzCode c where w.wzIncode=c.wzIncode");

if(param.get("batchId")!=null){
jpql.append(" and w.batchId="+param.get("batchId").getValue());
}
if(param.get("wzEntry")!=null){
jpql.append(" and c.wzEntry="+param.get("wzEntry").getValue());
}
if(param.get("wzName")!=null){
jpql.append(" and c.wzName like "+"'"+param.get("wzName").getValue()+"'");
}
if(param.get("companyId")!=null){

jpql.append(" and c.companyId="+param.get("companyId").getValue());
}

List<Object> list=supplyDAO.find(jpql.toString(), sort,pageInfo);
List<WzInitializeStoreInfo> siteList=new ArrayList<WzInitializeStoreInfo>();
for(int i=0;i<list.size();i++){
siteList.add((WzInitializeStoreInfo)list.get(i));
}
return siteList;

}

第二种方法:

public List<WzInitializeStoreInfo> retrieve(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,w.wzIncode,w.storeId,w.buyPrice,w.taxRatio,w.storeSite,w.storeAdvanceNum,w.storeFactNum,w.madeDate,w.validDate,w.productIncode,"
+ "w.batchType,c.wzName,c.wzEntry,c.jlUnit)");  
jpql.append(" from WzInitializeStoreInfo w,WzCode c where w.wzIncode=c.wzIncode");

if(param.get("batchId")!=null){
jpql.append(" and w.batchId=  :batchId");
}
if(param.get("wzEntry")!=null){
jpql.append(" and c.wzEntry= :wzEntry");
}
if(param.get("wzName")!=null){
jpql.append(" and c.wzName like   :wzName ");
}
if(param.get("companyId")!=null){

jpql.append(" and c.companyId= :companyId");
}

List<Object> list=supplyDAO.find(jpql.toString(), param,sort,pageInfo);
List<WzInitializeStoreInfo> siteList=new ArrayList<WzInitializeStoreInfo>();
for(int i=0;i<list.size();i++){
siteList.add((WzInitializeStoreInfo)list.get(i));
}
return siteList;

}

主要是赋值和执行语句的参数有所差别。

然后是uep前台数据传入后台的俩种方式

function showDetail(cell) {
//此时要问后台要数据,要新主数据的从数据,
var data = ajaxgrid.collectData(true, "all");
var unitDate = unitGrid.collectData(true, "all");
var a =cell["storeId"];
var dataArr = [];
dataArr.push(data);
dataArr.push(unitDate);
$.request({
action : "retrieveAll",
data : dataArr,

params : {
"storeId" : cell["storeId"],  对于这种后台Action需要private String storeId;然后setter和getter方法
"property.storeId" : a    对于这种传值后台接收只需要this.getProperty("storeId);
},
success : ajax_initdb
});
}

Uep查询语句总结的更多相关文章

  1. SQL Server-简单查询语句,疑惑篇(三)

    前言 对于一些原理性文章园中已有大量的文章尤其是关于索引这一块,我也是花费大量时间去学习,对于了解索引原理对于后续理解查询计划和性能调优有很大的帮助,而我们只是一些内容进行概括和总结,这一节我们开始正 ...

  2. thinkphp中的查询语句

    <?php namespace Admin\Controller; use Think\Controller; class MainController extends Controller { ...

  3. Oracle 查询语句(where,order by ,like,in,distinct)

    select * from production;alter table production add productionprice number(7,2); UPDATE production s ...

  4. 45 个非常有用的 Oracle 查询语句

    ​ 这里我们介绍的是 40+ 个非常有用的 Oracle 查询语句,主要涵盖了日期操作,获取服务器信息,获取执行状态,计算数据库大小等等方面的查询.这些是所有 Oracle 开发者都必备的技能,所以快 ...

  5. mysql查询语句select-子查询

    1 子查询定义 在一个表表达中可以调用另一个表表达式,这个被调用的表表达式叫做子查询(subquery),我么也称作子选择(subselect)或内嵌选择(inner select).子查询的结果传递 ...

  6. mongodb的查询语句学习摘要

    看了些资料,对应只需要知道怎么查询和使用mongodb的我来说,这些足够啦. 左边是mongodb查询语句,右边是sql语句.对照着用,挺方便. db.users.find() select * fr ...

  7. SqlServer 一个查询语句以致tempdb增大55G (转载)

    SqlServer 一个查询语句导致tempdb增大55G 今天操作着服务器,突然右下角提示“C盘空间不足”! 吓一跳!~ 看看C盘,还有7M!!!这么大的C盘空间怎么会没了呢?搞不好等下服务器会动不 ...

  8. ThinkPHP(3)SQL查询语句

    ThinkPHP中对查询语句,包含了基本的查询方式.表达方式.快速查询.区间查询.组合查询.SQL查询.动态查询和子查询. 一.查询方式 ThinkPHP提供了三种基本的查询方式:字符串条件查询.索引 ...

  9. MySQL知识树-查询语句

    在日常的web应用开发过程中,一般会涉及到数据库方面的操作,其中查询又是占绝大部分的.我们不仅要会写查询,最好能系统的学习下与查询相关的知识点,这篇随笔我们就来一起看看MySQL查询知识相关的树是什么 ...

随机推荐

  1. ES6基本常见语法

    特色:写法更加优雅,更加像面像对象的编程,其思想和 ES5 是一致的. 箭头函数.this ES6中可以使用 => 作为函数表达形式,极简风格,参数+ => +函数体. var foo = ...

  2. arcgis 地图如何转到supermap平台

    场景:客户使用arcmap配置好的地图数据,由于项目需要转换到超图平台.有如下几种思路供参考. 1. 使用arcmap生成地图缓存,supermap-iServer支持发布arcgis的地图缓存以及t ...

  3. 在Chrome中使用IE浏览器!

    学校的毕业论文系统,无法完整显示网页,特别是下部的"提交"按钮看不见. IE11无效. 发现"360极速浏览器 7.5.3.186"能正常显示,百度网盘下载太慢 ...

  4. 多线程的些许理解(平台x86,具体考虑linux,windows)

    多线程的些许理解 一.体系架构 1.原子操作 1) 定义 不可中断的一个或者一系列操作,也就是不会被线程调度机制打断的操作,在运行期间不会有任何的上下文切换(context switch). 2) 我 ...

  5. 团队作业-Beta冲刺(周五)

    一. 这个作业属于哪个课程 https://edu.cnblogs.com/campus/xnsy/SoftwareEngineeringClass1/ 这个作业要求在哪里 https://edu.c ...

  6. JavaScript入门学习之一——初级语法

    JavaScript是前端编辑的一种编程语言(不同于html,html是一种标记语言),所以和其他的编程语言一样,我们将会从下面几点学习 基础语法 数据类型 函数 面向对象 JavaScript的组成 ...

  7. HTML5日期时间输入类型注意事项(time,date)

    原文链接:http://www.webhek.com/post/html5-date.html 1.HTML5规范里只规定date新型input输入类型,并没有规定日历弹出框的实现和样式.所以,各浏览 ...

  8. Mysql 查看连接数,状态及最大并发数(转载)

    -- show variables like '%max_connections%'; 查看最大连接数 set global max_connections=1000 重新设置   mysql> ...

  9. Linux 内核源代码的几个C语言技巧

    1.#define中使用do{statement}while(0)保证statement无论在何处都能正确执行一次2.将链表操作抽象出来,与宿主结果相互独立.所有的链表操作都作用与list_head, ...

  10. DEDE怎么让栏目列表以权重拍排列

    方法/步骤     进入后台到栏目里,新发布文章也行,编辑文章也行,你会看到有个权重值,不管你怎么改变保存后依然没有变化.   修改权重值,打开dede\album_edit.php文件,找到 UPD ...