Commit ddd5d6d5 authored by yff's avatar yff

修改like

parent 28d1a1f8
package com.gavel.kwell.controller;
import com.gavel.common.BaseURL;
import com.gavel.common.base.BaseEditJSON;
import com.gavel.common.base.controller.BaseController;
import com.gavel.common.converter.DataConvert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.common.annotation.ResourcePermissions;
import com.gavel.common.SystemOperation;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.utils.ThreadContext;
import com.gavel.kwell.service.ZjhService;
import com.gavel.kwell.vo.ZjhCondition;
import com.gavel.kwell.vo.ZjhVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
@RequestMapping("kmes/zjh")
public class ZjhController extends BaseController {
@Autowired
private ZjhService zjhService;
@ResourcePermissions()
@RequestMapping("/index")
public String index() {
return "kmes/zjh/index";
}
@ResourcePermissions({SystemOperation.BottonResource.ADD})
@RequestMapping("/add")
public String add() {
return "kmes/zjh/edit";
}
@ResourcePermissions({SystemOperation.BottonResource.EDIT})
@RequestMapping("/edit")
public String edit() {
return "kmes/zjh/edit";
}
@RequestMapping(value = BaseURL.GET, method = RequestMethod.POST)
@ResponseBody
public Object get(@RequestBody JSONObject param) {
ZjhCondition condition = DataConvert.getCondition(param, ZjhCondition.class);
RecordSet<ZjhVO> records = zjhService.query(condition);
if ( records.getRecords()!=null && records.getRecords().size()>=1 ){
return buildReturnData(ZjhVO.class, records.getRecords().get(0));
}
return buildReturnData(ZjhVO.class, null);
}
@RequestMapping(value = BaseURL.QUERY, method = RequestMethod.POST)
@ResponseBody
public Object query(@RequestBody JSONObject param) {
ZjhCondition condition = DataConvert.getCondition(param, ZjhCondition.class);
RecordSet<ZjhVO> records = zjhService.query(condition);
return buildReturnData(records, ZjhVO.class);
}
@ResourcePermissions(SystemOperation.BottonResource.ADD)
@RequestMapping(value = BaseURL.ADD, method = RequestMethod.POST)
@ResponseBody
public Object insert(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
zjhService.insert(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EDIT)
@RequestMapping(value = BaseURL.UPDATE, method = RequestMethod.POST)
@ResponseBody
public Object update(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
zjhService.update(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.DELETE)
@RequestMapping(value = BaseURL.DELETE, method = RequestMethod.POST)
@ResponseBody
public Object delete(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
zjhService.delete(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EXPORT)
@RequestMapping(value = BaseURL.EXPORT, method = RequestMethod.POST)
@ResponseBody
public void export(HttpServletRequest request,HttpServletResponse response, @RequestBody JSONObject param) throws Exception {
ZjhCondition condition = DataConvert.getCondition(param, ZjhCondition.class);
RecordSet<ZjhVO> records = zjhService.query(condition);
doExport(request, response, param, records.getRecords());
}
}
package com.gavel.kwell.dao;
import com.gavel.common.base.dao.BaseDao;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.kwell.vo.ZjhCondition;
import com.gavel.kwell.vo.ZjhVO;
public interface ZjhDao extends BaseDao {
public RecordSet<ZjhVO> query(ZjhCondition condition);
}
...@@ -884,8 +884,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao { ...@@ -884,8 +884,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.setParamValue("pFKRID",condition.getFkrid()); sqlMap.setParamValue("pFKRID",condition.getFkrid());
} }
if (StringUtils.isNotEmpty(condition.getWosnid())){ if (StringUtils.isNotEmpty(condition.getWosnid())){
sqlMap.append("and GPFK_WOSNID like :pWOSNID "); sqlMap.append("and GPFK_WOSNID = :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", condition.getWosnid()); sqlMap.setParamValue("pWOSNID", condition.getWosnid());
} }
if (condition.getStart() != null) { if (condition.getStart() != null) {
sqlMap.append(" and GPFK_FKSJ >= :pFKSJS "); sqlMap.append(" and GPFK_FKSJ >= :pFKSJS ");
...@@ -1202,8 +1202,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao { ...@@ -1202,8 +1202,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.setParamValue("pWOGYLX",condition.getWogylx()); sqlMap.setParamValue("pWOGYLX",condition.getWogylx());
} }
if (StringUtils.isNotEmpty(condition.getWosncode())){ if (StringUtils.isNotEmpty(condition.getWosncode())){
sqlMap.append("and GPFK_WOSNID like :pWOSNID "); sqlMap.append("and GPFK_WOSNID = :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", condition.getWosncode()); sqlMap.setParamValue("pWOSNID", condition.getWosncode());
} }
sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX "); sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX ");
return sqlMap.queryEntity(FkVO.class); return sqlMap.queryEntity(FkVO.class);
...@@ -1330,8 +1330,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao { ...@@ -1330,8 +1330,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.append("from WOSN"); sqlMap.append("from WOSN");
sqlMap.append("where 1=1"); sqlMap.append("where 1=1");
if (StringUtils.isNotEmpty(sn)){ if (StringUtils.isNotEmpty(sn)){
sqlMap.append("and WOSN_CODE like :pWOSNID "); sqlMap.append("and WOSN_CODE = :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", sn); sqlMap.setParamValue("pWOSNID", sn);
} }
System.out.println(sqlMap.getSqlText()); System.out.println(sqlMap.getSqlText());
return sqlMap.queryDouble(); return sqlMap.queryDouble();
...@@ -1376,8 +1376,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao { ...@@ -1376,8 +1376,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.append("LEFT JOIN WLXX ON WLXX_ID = GPHY_WLID "); sqlMap.append("LEFT JOIN WLXX ON WLXX_ID = GPHY_WLID ");
sqlMap.append("where 1 = 1 "); sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getSnid())){ if (StringUtils.isNotEmpty(condition.getSnid())){
sqlMap.append(" and (GPHY_WLSNID like :pSnid or WLXX_CODE like :pSnid or WLXX_NAME like :pSnid) "); sqlMap.append(" and (WLXX_CODE = :pSnid) ");
sqlMap.setParamValueLike("pSnid", condition.getSnid()); sqlMap.setParamValue("pSnid", condition.getSnid());
} }
if (StringUtils.isNotEmpty(condition.getMid())){ if (StringUtils.isNotEmpty(condition.getMid())){
sqlMap.append(" and " + SqlUtil.getWhereSql("GPHY_MID", condition.getMid())); sqlMap.append(" and " + SqlUtil.getWhereSql("GPHY_MID", condition.getMid()));
...@@ -1410,8 +1410,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao { ...@@ -1410,8 +1410,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.setParamValue("pBZGXID",bzgxid); sqlMap.setParamValue("pBZGXID",bzgxid);
} }
if (StringUtils.isNotEmpty(wosnid)){ if (StringUtils.isNotEmpty(wosnid)){
sqlMap.append("and GPFK_WOSNID like :pWOSNID "); sqlMap.append("and GPFK_WOSNID = :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", wosnid); sqlMap.setParamValue("pWOSNID", wosnid);
} }
sqlMap.append("order by GPFK_FKSJ desc "); sqlMap.append("order by GPFK_FKSJ desc ");
return sqlMap.queryEntity(FkVO.class); return sqlMap.queryEntity(FkVO.class);
...@@ -1441,8 +1441,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao { ...@@ -1441,8 +1441,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.setParamValue("pBZGXID",bzgxid); sqlMap.setParamValue("pBZGXID",bzgxid);
} }
if (StringUtils.isNotEmpty(wosnid)){ if (StringUtils.isNotEmpty(wosnid)){
sqlMap.append("and GPFK_WOSNID like :pWOSNID "); sqlMap.append("and GPFK_WOSNID = :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", wosnid); sqlMap.setParamValue("pWOSNID", wosnid);
} }
sqlMap.append("order by GPFK_FKSJ desc "); sqlMap.append("order by GPFK_FKSJ desc ");
return sqlMap.query(FkVO.class); return sqlMap.query(FkVO.class);
...@@ -1496,8 +1496,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao { ...@@ -1496,8 +1496,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.setParamValue("pWOGYLX",condition.getWogylx()); sqlMap.setParamValue("pWOGYLX",condition.getWogylx());
} }
if (StringUtils.isNotEmpty(condition.getWosncode())){ if (StringUtils.isNotEmpty(condition.getWosncode())){
sqlMap.append("and GPFK_WOSNID like :pWOSNID "); sqlMap.append("and GPFK_WOSNID = :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", condition.getWosncode()); sqlMap.setParamValue("pWOSNID", condition.getWosncode());
} }
sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX "); sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX ");
return sqlMap.query(FkVO.class); return sqlMap.query(FkVO.class);
...@@ -1523,8 +1523,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao { ...@@ -1523,8 +1523,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID "); sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where 1 = 1 "); sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(wosnid)){ if (StringUtils.isNotEmpty(wosnid)){
sqlMap.append("and GPFK_WOSNID like :pWOSNID "); sqlMap.append("and GPFK_WOSNID = :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", wosnid); sqlMap.setParamValue("pWOSNID", wosnid);
} }
sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX "); sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX ");
return sqlMap.queryEntity(GpfkVO.class); return sqlMap.queryEntity(GpfkVO.class);
...@@ -1665,8 +1665,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao { ...@@ -1665,8 +1665,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.append(" LEFT JOIN WLXX ON WLXX_ID = GPHY_WLID "); sqlMap.append(" LEFT JOIN WLXX ON WLXX_ID = GPHY_WLID ");
sqlMap.append(" where 1 = 1 "); sqlMap.append(" where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getSnid())){ if (StringUtils.isNotEmpty(condition.getSnid())){
sqlMap.append(" and (GPHY_WLSNID like :pSnid or WLXX_CODE like :pSnid or WLXX_NAME like :pSnid) "); sqlMap.append(" and ( WLXX_CODE = :pSnid ) ");
sqlMap.setParamValueLike("pSnid", condition.getSnid()); sqlMap.setParamValue("pSnid", condition.getSnid());
} }
if (StringUtils.isNotEmpty(condition.getWosncode())){ if (StringUtils.isNotEmpty(condition.getWosncode())){
sqlMap.append(" and " + SqlUtil.getWhereSql("GPFK_WOSNID", condition.getWosncode())); sqlMap.append(" and " + SqlUtil.getWhereSql("GPFK_WOSNID", condition.getWosncode()));
...@@ -1755,8 +1755,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao { ...@@ -1755,8 +1755,8 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID "); sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where 1 = 1 and BZGX_GXLX ='JY' "); sqlMap.append("where 1 = 1 and BZGX_GXLX ='JY' ");
if (StringUtils.isNotEmpty(wosnid)){ if (StringUtils.isNotEmpty(wosnid)){
sqlMap.append("and GPFK_WOSNID like :pWOSNID "); sqlMap.append("and GPFK_WOSNID = :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", wosnid); sqlMap.setParamValue("pWOSNID", wosnid);
} }
sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX "); sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX ");
return sqlMap.queryEntity(GpfkVO.class); return sqlMap.queryEntity(GpfkVO.class);
......
package com.gavel.kwell.dao.impl;
import com.gavel.common.base.dao.impl.BaseDaoImpl;
import com.gavel.common.utils.StringUtils;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.persistence.sql.SqlMap;
import com.gavel.persistence.sql.SqlUtil;
import org.springframework.stereotype.Repository;
import com.gavel.kwell.dao.ZjhDao;
import com.gavel.kwell.vo.ZjhCondition;
import com.gavel.kwell.vo.ZjhVO;
@Repository("zjhDao")
public class ZjhDaoImpl extends BaseDaoImpl implements ZjhDao {
public RecordSet<ZjhVO> query(ZjhCondition condition){
SqlMap sqlMap = new SqlMap();
sqlMap.setPageNo(condition.getPageNo());
sqlMap.setRowCount(condition.getPageSize());
sqlMap.append("select ZJH_ID, ZJH_DJID, ZJH_BMID, ZJH_WOID, ZJH_KSRQ, ");
sqlMap.append(" ZJH_WLID, ZJH_JHSL, ZJH_WGSL, ZJH_HGSL, ZJH_BHGSL, ");
sqlMap.append(" ZJH_BZ, ZJH_WHRID, ZJH_WHR, ZJH_WHSJ, ZJH_CJRID, ");
sqlMap.append(" ZJH_CJR, ZJH_CJSJ, ZJH_SYSVERSION, ZJH_JHR, ZJH_JSRQ ");
sqlMap.append("from ZJH ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getId())){
sqlMap.append(" and " + SqlUtil.getWhereSql("ZJH_ID", condition.getId()));
sqlMap.setParamValue("ZJH_ID", condition.getId());
}
sqlMap.query(ZjhVO.class);
return sqlMap.getRecordSet();
}
}
package com.gavel.kwell.persistent;
import java.util.Date;
import com.gavel.common.base.entity.BaseEntity;
import com.gavel.common.utils.CodeStrategy;
import com.gavel.persistence.annotation.FieldMeta;
import com.gavel.persistence.annotation.TableMeta;
@TableMeta(id = "ZJH", name = "ZJH")
public class Zjh extends BaseEntity {
private static final long serialVersionUID = 1L;
@FieldMeta(fieldName = "ZJH_ID", caption = "ID", primaryKey = true, notEmpty = true, codeStrategy = CodeStrategy.UUID)
private String id;
@FieldMeta(fieldName = "ZJH_DJID", caption = "计划编码")
private String djid;
@FieldMeta(fieldName = "ZJH_BMID", caption = "部门编码")
private String bmid;
@FieldMeta(fieldName = "ZJH_WOID", caption = "生产订单ID")
private String woid;
@FieldMeta(fieldName = "ZJH_KSRQ", caption = "计划开始日期")
private Date ksrq;
@FieldMeta(fieldName = "ZJH_WLID", caption = "物料ID")
private String wlid;
@FieldMeta(fieldName = "ZJH_JHSL", caption = "计划数量")
private Double jhsl;
@FieldMeta(fieldName = "ZJH_WGSL", caption = "完工数量")
private Double wgsl;
@FieldMeta(fieldName = "ZJH_HGSL", caption = "合格数量")
private Double hgsl;
@FieldMeta(fieldName = "ZJH_BHGSL", caption = "不合格数量")
private Double bhgsl;
@FieldMeta(fieldName = "ZJH_BZ", caption = "备注")
private String bz;
@FieldMeta(fieldName = "ZJH_WHRID", caption = "维护人编码", autoUserId = true)
private String whrid;
@FieldMeta(fieldName = "ZJH_WHR", caption = "维护人", autoUserName = true)
private String whr;
@FieldMeta(fieldName = "ZJH_WHSJ", caption = "维护时间", autoDateTime = true)
private Date whsj;
@FieldMeta(fieldName = "ZJH_CJRID", caption = "创建人编码", autoUserId = true, initial = true)
private String cjrid;
@FieldMeta(fieldName = "ZJH_CJR", caption = "创建人", autoUserName = true, initial = true)
private String cjr;
@FieldMeta(fieldName = "ZJH_CJSJ", caption = "创建时间", autoDateTime = true, initial = true)
private Date cjsj;
@FieldMeta(fieldName = "ZJH_SYSVERSION", caption = "系统版本")
private Integer sysversion;
@FieldMeta(fieldName = "ZJH_JHR", caption = "计划人")
private String jhr;
@FieldMeta(fieldName = "ZJH_JSRQ", caption = "结束日期")
private Date jsrq;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDjid() {
return djid;
}
public void setDjid(String djid) {
this.djid = djid;
}
public String getBmid() {
return bmid;
}
public void setBmid(String bmid) {
this.bmid = bmid;
}
public String getWoid() {
return woid;
}
public void setWoid(String woid) {
this.woid = woid;
}
public Date getKsrq() {
return ksrq;
}
public void setKsrq(Date ksrq) {
this.ksrq = ksrq;
}
public String getWlid() {
return wlid;
}
public void setWlid(String wlid) {
this.wlid = wlid;
}
public Double getJhsl() {
return jhsl;
}
public void setJhsl(Double jhsl) {
this.jhsl = jhsl;
}
public Double getWgsl() {
return wgsl;
}
public void setWgsl(Double wgsl) {
this.wgsl = wgsl;
}
public Double getHgsl() {
return hgsl;
}
public void setHgsl(Double hgsl) {
this.hgsl = hgsl;
}
public Double getBhgsl() {
return bhgsl;
}
public void setBhgsl(Double bhgsl) {
this.bhgsl = bhgsl;
}
public String getBz() {
return bz;
}
public void setBz(String bz) {
this.bz = bz;
}
public String getWhrid() {
return whrid;
}
public void setWhrid(String whrid) {
this.whrid = whrid;
}
public String getWhr() {
return whr;
}
public void setWhr(String whr) {
this.whr = whr;
}
public Date getWhsj() {
return whsj;
}
public void setWhsj(Date whsj) {
this.whsj = whsj;
}
public String getCjrid() {
return cjrid;
}
public void setCjrid(String cjrid) {
this.cjrid = cjrid;
}
public String getCjr() {
return cjr;
}
public void setCjr(String cjr) {
this.cjr = cjr;
}
public Date getCjsj() {
return cjsj;
}
public void setCjsj(Date cjsj) {
this.cjsj = cjsj;
}
public Integer getSysversion() {
return sysversion;
}
public void setSysversion(Integer sysversion) {
this.sysversion = sysversion;
}
public String getJhr() {
return jhr;
}
public void setJhr(String jhr) {
this.jhr = jhr;
}
public Date getJsrq() {
return jsrq;
}
public void setJsrq(Date jsrq) {
this.jsrq = jsrq;
}
}
package com.gavel.kwell.service;
import com.gavel.common.base.service.BaseEditService;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.kwell.vo.ZjhCondition;
import com.gavel.kwell.vo.ZjhVO;
public interface ZjhService extends BaseEditService {
public RecordSet<ZjhVO> query(ZjhCondition condition);
}
package com.gavel.kwell.service.impl;
import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.persistence.sql.RecordSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.gavel.kwell.dao.ZjhDao;
import com.gavel.kwell.persistent.Zjh;
import com.gavel.kwell.service.ZjhService;
import com.gavel.kwell.vo.ZjhCondition;
import com.gavel.kwell.vo.ZjhVO;
@Service("zjhService")
@Transactional
public class ZjhServiceImpl extends BaseEditServiceImpl implements ZjhService {
@Autowired
private ZjhDao zjhDao;
@Override
public void initService() {
addMaster( Zjh.class);
}
@Override
public RecordSet<ZjhVO> query(ZjhCondition condition) {
return zjhDao.query(condition);
}
}
package com.gavel.kwell.vo;
import com.gavel.common.base.entity.BaseEntity;
public class ZjhCondition extends BaseEntity {
private static final long serialVersionUID = 1L;
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
package com.gavel.kwell.vo;
import com.gavel.kwell.persistent.Zjh;
public class ZjhVO extends Zjh {
private static final long serialVersionUID = 1L;
/*---------AutoBegin-----------*/
/*---------AutoEnd-------------*/
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment