'feat():完成HPSC002'

parent 12d827a1
/**
* Generate time : 2024-01-10 16:44:48
* Version : 1.0
*/
package com.baosight.hpjx.hp.sc.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal;
import com.baosight.iplat4j.core.util.DateUtils;
import java.sql.Timestamp;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* THpsc002
*
*/
public class THPSC002 extends DaoEPBase {
private Long id = 0L;
private String companyCode = " "; /* 企业编码 预留*/
private String deptCode = " "; /* 部门编码 预留*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String parentPrdtCode = " "; /* 父节点-产品编码*/
private String parentPrdtName = " "; /* 父节点-产品名称*/
private String type = " "; /* 类别*/
private String leaf = "1"; /* 是否有叶子节点*/
private String sort = " "; /* 排序字段*/
private String icon = " "; /* 图片地址*/
private String prdtCode = " "; /* 产品编码*/
private String prdtName = " "; /* 产品名称*/
private Integer num = Integer.valueOf(0); /* 数量*/
private BigDecimal unitWt = new BigDecimal(0.000); /* 单重*/
private BigDecimal totalWt = new BigDecimal(0.000); /* 总重*/
private String filePath1 = " "; /* 文件地址1*/
private String filePath2 = " "; /* 文件地址2*/
private String filePath3 = " "; /* 文件地址3*/
private String filePath4 = " "; /* 文件地址4*/
private String filePath5 = " "; /* 文件地址5*/
private Integer status = 0; /* 状态 0-未审核,1-已审核*/
private Integer delStatus = 0; /* 状态 1未删除,0已删除*/
private String createdBy = " "; /* 创建人*/
private String createdTime; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedTime; /* 更新时间*/
private String remark = " "; /* 备注*/
/**
* initialize the metadata
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn("id");
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("companyCode");
eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("deptCode");
eiColumn.setDescName("部门编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("projCode");
eiColumn.setDescName("项目编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("projName");
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("parentPrdtCode");
eiColumn.setDescName("父节点-产品编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("parentPrdtName");
eiColumn.setDescName("父节点-产品名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("type");
eiColumn.setDescName("类别");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("leaf");
eiColumn.setDescName("是否有叶子节点");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("sort");
eiColumn.setDescName("排序字段");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("icon");
eiColumn.setDescName("图片地址");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("prdtCode");
eiColumn.setDescName("产品编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("prdtName");
eiColumn.setDescName("产品名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("num");
eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("unitWt");
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("单重");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("totalWt");
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("总重");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("filePath1");
eiColumn.setDescName("文件地址1");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("filePath2");
eiColumn.setDescName("文件地址2");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("filePath3");
eiColumn.setDescName("文件地址3");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("filePath4");
eiColumn.setDescName("文件地址4");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("filePath5");
eiColumn.setDescName("文件地址5");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("status");
eiColumn.setDescName("状态 0-未审核,1-已审核");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("delStatus");
eiColumn.setDescName("状态 1未删除,0已删除");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("createdBy");
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("createdTime");
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("updatedBy");
eiColumn.setDescName("更新人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("updatedTime");
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("remark");
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor
*/
public THPSC002() {
initMetaData();
}
/**
* get the id
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the companyCode - 企业编码 预留
* @return the companyCode
*/
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode - 企业编码 预留
*/
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* get the deptCode - 部门编码 预留
* @return the deptCode
*/
public String getDeptCode() {
return this.deptCode;
}
/**
* set the deptCode - 部门编码 预留
*/
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
/**
* get the projCode - 项目编码
* @return the projCode
*/
public String getProjCode() {
return this.projCode;
}
/**
* set the projCode - 项目编码
*/
public void setProjCode(String projCode) {
this.projCode = projCode;
}
/**
* get the projName - 项目名称
* @return the projName
*/
public String getProjName() {
return this.projName;
}
/**
* set the projName - 项目名称
*/
public void setProjName(String projName) {
this.projName = projName;
}
/**
* get the parentPrdtCode - 父节点-产品编码
* @return the parentPrdtCode
*/
public String getParentPrdtCode() {
return this.parentPrdtCode;
}
/**
* set the parentPrdtCode - 父节点-产品编码
*/
public void setParentPrdtCode(String parentPrdtCode) {
this.parentPrdtCode = parentPrdtCode;
}
/**
* get the parentPrdtName - 父节点-产品名称
* @return the parentPrdtName
*/
public String getParentPrdtName() {
return this.parentPrdtName;
}
/**
* set the parentPrdtName - 父节点-产品名称
*/
public void setParentPrdtName(String parentPrdtName) {
this.parentPrdtName = parentPrdtName;
}
/**
* get the type - 类别
* @return the type
*/
public String getType() {
return this.type;
}
/**
* set the type - 类别
*/
public void setType(String type) {
this.type = type;
}
/**
* get the leaf - 是否有叶子节点
* @return the leaf
*/
public String getLeaf() {
return this.leaf;
}
/**
* set the leaf - 是否有叶子节点
*/
public void setLeaf(String leaf) {
this.leaf = leaf;
}
/**
* get the sort - 排序字段
* @return the sort
*/
public String getSort() {
return this.sort;
}
/**
* set the sort - 排序字段
*/
public void setSort(String sort) {
this.sort = sort;
}
/**
* get the icon - 图片地址
* @return the icon
*/
public String getIcon() {
return this.icon;
}
/**
* set the icon - 图片地址
*/
public void setIcon(String icon) {
this.icon = icon;
}
/**
* get the prdtCode - 产品编码
* @return the prdtCode
*/
public String getPrdtCode() {
return this.prdtCode;
}
/**
* set the prdtCode - 产品编码
*/
public void setPrdtCode(String prdtCode) {
this.prdtCode = prdtCode;
}
/**
* get the prdtName - 产品名称
* @return the prdtName
*/
public String getPrdtName() {
return this.prdtName;
}
/**
* set the prdtName - 产品名称
*/
public void setPrdtName(String prdtName) {
this.prdtName = prdtName;
}
/**
* get the num - 数量
* @return the num
*/
public Integer getNum() {
return this.num;
}
/**
* set the num - 数量
*/
public void setNum(Integer num) {
this.num = num;
}
/**
* get the unitWt - 单重
* @return the unitWt
*/
public BigDecimal getUnitWt() {
return this.unitWt;
}
/**
* set the unitWt - 单重
*/
public void setUnitWt(BigDecimal unitWt) {
this.unitWt = unitWt;
}
/**
* get the totalWt - 总重
* @return the totalWt
*/
public BigDecimal getTotalWt() {
return this.totalWt;
}
/**
* set the totalWt - 总重
*/
public void setTotalWt(BigDecimal totalWt) {
this.totalWt = totalWt;
}
/**
* get the filePath1 - 文件地址1
* @return the filePath1
*/
public String getFilePath1() {
return this.filePath1;
}
/**
* set the filePath1 - 文件地址1
*/
public void setFilePath1(String filePath1) {
this.filePath1 = filePath1;
}
/**
* get the filePath2 - 文件地址2
* @return the filePath2
*/
public String getFilePath2() {
return this.filePath2;
}
/**
* set the filePath2 - 文件地址2
*/
public void setFilePath2(String filePath2) {
this.filePath2 = filePath2;
}
/**
* get the filePath3 - 文件地址3
* @return the filePath3
*/
public String getFilePath3() {
return this.filePath3;
}
/**
* set the filePath3 - 文件地址3
*/
public void setFilePath3(String filePath3) {
this.filePath3 = filePath3;
}
/**
* get the filePath4 - 文件地址4
* @return the filePath4
*/
public String getFilePath4() {
return this.filePath4;
}
/**
* set the filePath4 - 文件地址4
*/
public void setFilePath4(String filePath4) {
this.filePath4 = filePath4;
}
/**
* get the filePath5 - 文件地址5
* @return the filePath5
*/
public String getFilePath5() {
return this.filePath5;
}
/**
* set the filePath5 - 文件地址5
*/
public void setFilePath5(String filePath5) {
this.filePath5 = filePath5;
}
/**
* get the status - 状态 0-未审核,1-已审核
* @return the status
*/
public Integer getStatus() {
return this.status;
}
/**
* set the status - 状态 0-未审核,1-已审核
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* get the delStatus - 状态 1未删除,0已删除
* @return the delStatus
*/
public Integer getDelStatus() {
return this.delStatus;
}
/**
* set the delStatus - 状态 1未删除,0已删除
*/
public void setDelStatus(Integer delStatus) {
this.delStatus = delStatus;
}
/**
* get the createdBy - 创建人
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdTime - 创建时间
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedTime - 更新时间
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the remark - 备注
* @return the remark
*/
public String getRemark() {
return this.remark;
}
/**
* set the remark - 备注
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* get the value from Map
*/
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get("id")), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("companyCode")), companyCode));
setDeptCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("deptCode")), deptCode));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("projCode")), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("projName")), projName));
setParentPrdtCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("parentPrdtCode")), parentPrdtCode));
setParentPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("parentPrdtName")), parentPrdtName));
setType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("type")), type));
setLeaf(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("leaf")), leaf));
setSort(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("sort")), sort));
setIcon(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("icon")), icon));
setPrdtCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("prdtCode")), prdtCode));
setPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("prdtName")), prdtName));
setNum(NumberUtils.toInteger(StringUtils.toString(map.get("num")), num));
setUnitWt(NumberUtils.toBigDecimal(StringUtils.toString(map.get("unitWt")), unitWt));
setTotalWt(NumberUtils.toBigDecimal(StringUtils.toString(map.get("totalWt")), totalWt));
setFilePath1(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("filePath1")), filePath1));
setFilePath2(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("filePath2")), filePath2));
setFilePath3(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("filePath3")), filePath3));
setFilePath4(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("filePath4")), filePath4));
setFilePath5(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("filePath5")), filePath5));
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get("status")), status));
setDelStatus(NumberUtils.toInteger(StringUtils.toString(map.get("delStatus")), delStatus));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("createdBy")), createdBy));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("createdTime")),createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("updatedBy")), updatedBy));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("updatedTime")),updatedTime));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("remark")), remark));
}
/**
* set the value to Map
*/
public Map toMap() {
Map map = new HashMap();
map.put("id", StringUtils.toString(id, eiMetadata.getMeta("id")));
map.put("companyCode", StringUtils.toString(companyCode, eiMetadata.getMeta("companyCode")));
map.put("deptCode", StringUtils.toString(deptCode, eiMetadata.getMeta("deptCode")));
map.put("projCode", StringUtils.toString(projCode, eiMetadata.getMeta("projCode")));
map.put("projName", StringUtils.toString(projName, eiMetadata.getMeta("projName")));
map.put("parentPrdtCode", StringUtils.toString(parentPrdtCode, eiMetadata.getMeta("parentPrdtCode")));
map.put("parentPrdtName", StringUtils.toString(parentPrdtName, eiMetadata.getMeta("parentPrdtName")));
map.put("type", StringUtils.toString(type, eiMetadata.getMeta("type")));
map.put("leaf", StringUtils.toString(leaf, eiMetadata.getMeta("leaf")));
map.put("sort", StringUtils.toString(sort, eiMetadata.getMeta("sort")));
map.put("icon", StringUtils.toString(icon, eiMetadata.getMeta("icon")));
map.put("prdtCode", StringUtils.toString(prdtCode, eiMetadata.getMeta("prdtCode")));
map.put("prdtName", StringUtils.toString(prdtName, eiMetadata.getMeta("prdtName")));
map.put("num", StringUtils.toString(num, eiMetadata.getMeta("num")));
map.put("unitWt", StringUtils.toString(unitWt, eiMetadata.getMeta("unitWt")));
map.put("totalWt", StringUtils.toString(totalWt, eiMetadata.getMeta("totalWt")));
map.put("filePath1", StringUtils.toString(filePath1, eiMetadata.getMeta("filePath1")));
map.put("filePath2", StringUtils.toString(filePath2, eiMetadata.getMeta("filePath2")));
map.put("filePath3", StringUtils.toString(filePath3, eiMetadata.getMeta("filePath3")));
map.put("filePath4", StringUtils.toString(filePath4, eiMetadata.getMeta("filePath4")));
map.put("filePath5", StringUtils.toString(filePath5, eiMetadata.getMeta("filePath5")));
map.put("status", StringUtils.toString(status, eiMetadata.getMeta("status")));
map.put("delStatus", StringUtils.toString(delStatus, eiMetadata.getMeta("delStatus")));
map.put("createdBy", StringUtils.toString(createdBy, eiMetadata.getMeta("createdBy")));
map.put("createdTime", StringUtils.toString(createdTime, eiMetadata.getMeta("createdTime")));
map.put("updatedBy", StringUtils.toString(updatedBy, eiMetadata.getMeta("updatedBy")));
map.put("updatedTime", StringUtils.toString(updatedTime, eiMetadata.getMeta("updatedTime")));
map.put("remark", StringUtils.toString(remark, eiMetadata.getMeta("remark")));
return map;
}
}
\ No newline at end of file
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.hp.sc.domain.THPSC002;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*/
public class ServiceHPSC002 extends ServiceBase {
/**
* 画面初始化.
*/
public EiInfo initLoad(EiInfo inInfo) {
THPSC002 hppz002 = new THPSC002();
EiInfo outInfo = super.initLoad(inInfo, hppz002);
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(hppz002.eiMetadata);
return inInfo;
}
/**
* 查询操作.
*/
@Override
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/
EiInfo outInfo = super.query(inInfo, "HPSC002.query", new THPSC002());
return outInfo;
}
/**
* 新增操作.
*/
@Override
public EiInfo insert(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
THPSC002 hppz002 = new THPSC002();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz002.fromMap(map);
hppz002.setLeaf("1");
// 计算总重
BigDecimal num = new BigDecimal(hppz002.getNum());
BigDecimal unitWt = hppz002.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue())));
hppz002.setTotalWt(totalWt);
hppz002.setCreatedBy(UserSession.getUserId());
hppz002.setCreatedTime(sdf.format(new Date()));
hppz002.setUpdatedBy(null);
hppz002.setUpdatedTime(null);
this.dao.insert("HPSC002.insert", hppz002.toMap());
if(!hppz002.getParentPrdtCode().equals("root")){
this.checkTreeNodeLeaf(new Long(hppz002.getParentPrdtCode()));
}
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!");
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo;
}
return query(inInfo);
}
/**
* 修改操作.
*/
public EiInfo update(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
THPSC002 hppz002 = new THPSC002();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz002.fromMap(map);
hppz002.setUpdatedBy(UserSession.getUserId());
hppz002.setUpdatedTime(sdf.format(new Date()));
this.dao.update("HPSC001.update", hppz002.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
} catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
}
return query(inInfo);
}
/**
* 删除操作.
*/
public EiInfo delete(EiInfo eiInfo) {
THPSC002 hppz002 = new THPSC002();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz002.fromMap(map);
this.dao.delete("HPSC002.delete", hppz002.toMap());
}
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("删除失败,原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage());
logError("删除失败!", e.getMessage());
return eiInfo;
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
}
//树查询服务
public EiInfo queryTreeNode(EiInfo inInfo) {
//1 获取参数
String pEname = inInfo.getCellStr(EiConstant.queryBlock, 0, "node");
Map queryMap = new HashMap();
queryMap.put("pEname",pEname);
//2 查询节点
List rows = dao.query("HPSC002.queryTree", queryMap);
//3 增加节点block块
EiInfo outInfo = new EiInfo();
EiBlock outBlock = outInfo.addBlock(pEname);
outBlock.addRows(rows);
return outInfo;
}
/**
* 修改父级节点的LEAF状态为1
* @param id
*/
public void checkTreeNodeLeaf(Long id) {
//1 获取参数
Map queryMap = new HashMap();
queryMap.put("id", id);
queryMap.put("leaf", "0");
//2 查询节点
this.dao.update("HPSC002.updateTreeNodeLeaf", queryMap);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-01-11 11:34:26
Version : 1.0
tableName :hpjx.t_hpsc002
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
DEPT_CODE VARCHAR NOT NULL,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PARENT_PRDT_CODE VARCHAR,
PARENT_PRDT_NAME VARCHAR,
TYPE VARCHAR NOT NULL,
LEAF VARCHAR NOT NULL,
SORT VARCHAR NOT NULL,
ICON VARCHAR NOT NULL,
PRDT_CODE VARCHAR,
PRDT_NAME VARCHAR,
NUM INTEGER NOT NULL,
UNIT_WT DECIMAL NOT NULL,
TOTAL_WT DECIMAL NOT NULL,
FILE_PATH1 VARCHAR,
FILE_PATH2 VARCHAR,
FILE_PATH3 VARCHAR,
FILE_PATH4 VARCHAR,
FILE_PATH5 VARCHAR,
STATUS TINYINT,
DEL_STATUS TINYINT,
CREATED_BY VARCHAR,
CREATED_TIME DATETIME,
UPDATED_BY VARCHAR,
UPDATED_TIME DATETIME,
REMARK VARCHAR
-->
<sqlMap namespace="HPSC002">
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.THPSC002">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEPT_CODE as "deptCode", <!-- 部门编码 预留 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PARENT_PRDT_CODE as "parentPrdtCode", <!-- 父节点-产品编码 -->
PARENT_PRDT_NAME as "parentPrdtName", <!-- 父节点-产品名称 -->
TYPE as "type", <!-- 类别 -->
LEAF as "leaf", <!-- 是否有叶子节点 -->
SORT as "sort", <!-- 排序字段 -->
ICON as "icon", <!-- 图片地址 -->
PRDT_CODE as "prdtCode", <!-- 产品编码 -->
PRDT_NAME as "prdtName", <!-- 产品名称 -->
NUM as "num", <!-- 数量 -->
UNIT_WT as "unitWt", <!-- 单重 -->
TOTAL_WT as "totalWt", <!-- 总重 -->
FILE_PATH1 as "filePath1", <!-- 文件地址1 -->
FILE_PATH2 as "filePath2", <!-- 文件地址2 -->
FILE_PATH3 as "filePath3", <!-- 文件地址3 -->
FILE_PATH4 as "filePath4", <!-- 文件地址4 -->
FILE_PATH5 as "filePath5", <!-- 文件地址5 -->
STATUS as "status", <!-- 状态 0-未审核,1-已审核 -->
DEL_STATUS as "delStatus", <!-- 状态 1未删除,0已删除 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
REMARK as "remark" <!-- 备注 -->
FROM hpjx.t_hpsc002 WHERE 1=1
AND PARENT_PRDT_CODE NOT IN ('root')
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isEmpty property="orderBy">
CREATED_TIME DESC
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpsc002 WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deptCode">
DEPT_CODE = #deptCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtCode">
PARENT_PRDT_CODE = #parentPrdtCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtName">
PARENT_PRDT_NAME = #parentPrdtName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="type">
TYPE = #type#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="leaf">
LEAF = #leaf#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="sort">
SORT = #sort#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="icon">
ICON = #icon#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtCode">
PRDT_CODE = #prdtCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtName">
PRDT_NAME = #prdtName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="num">
NUM = #num#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unitWt">
UNIT_WT = #unitWt#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="totalWt">
TOTAL_WT = #totalWt#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath1">
FILE_PATH1 = #filePath1#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath2">
FILE_PATH2 = #filePath2#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath3">
FILE_PATH3 = #filePath3#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath4">
FILE_PATH4 = #filePath4#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath5">
FILE_PATH5 = #filePath5#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="delStatus">
DEL_STATUS = #delStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO hpjx.t_hpsc002 (ID,
COMPANY_CODE, <!-- 企业编码 预留 -->
DEPT_CODE, <!-- 部门编码 预留 -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
PARENT_PRDT_CODE, <!-- 父节点-产品编码 -->
PARENT_PRDT_NAME, <!-- 父节点-产品名称 -->
TYPE, <!-- 类别 -->
LEAF, <!-- 是否有叶子节点 -->
SORT, <!-- 排序字段 -->
ICON, <!-- 图片地址 -->
PRDT_CODE, <!-- 产品编码 -->
PRDT_NAME, <!-- 产品名称 -->
NUM, <!-- 数量 -->
UNIT_WT, <!-- 单重 -->
TOTAL_WT, <!-- 总重 -->
FILE_PATH1, <!-- 文件地址1 -->
FILE_PATH2, <!-- 文件地址2 -->
FILE_PATH3, <!-- 文件地址3 -->
FILE_PATH4, <!-- 文件地址4 -->
FILE_PATH5, <!-- 文件地址5 -->
STATUS, <!-- 状态 0-未审核,1-已审核 -->
DEL_STATUS, <!-- 状态 1未删除,0已删除 -->
CREATED_BY, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_TIME, <!-- 更新时间 -->
REMARK <!-- 备注 -->
)
VALUES (#id#, #companyCode#, #deptCode#, #projCode#, #projName#, #parentPrdtCode#, #parentPrdtName#, #type#, #leaf#, #sort#, #icon#, #prdtCode#, #prdtName#, #num#, #unitWt#, #totalWt#, #filePath1#, #filePath2#, #filePath3#, #filePath4#, #filePath5#, #status#, #delStatus#, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#, #remark#)
</insert>
<delete id="delete">
DELETE FROM hpjx.t_hpsc002 WHERE
ID = #id#
</delete>
<update id="update">
UPDATE hpjx.t_hpsc002
SET
COMPANY_CODE = #companyCode#, <!-- 企业编码 预留 -->
DEPT_CODE = #deptCode#, <!-- 部门编码 预留 -->
PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
PARENT_PRDT_CODE = #parentPrdtCode#, <!-- 父节点-产品编码 -->
PARENT_PRDT_NAME = #parentPrdtName#, <!-- 父节点-产品名称 -->
TYPE = #type#, <!-- 类别 -->
LEAF = #leaf#, <!-- 是否有叶子节点 -->
SORT = #sort#, <!-- 排序字段 -->
ICON = #icon#, <!-- 图片地址 -->
PRDT_CODE = #prdtCode#, <!-- 产品编码 -->
PRDT_NAME = #prdtName#, <!-- 产品名称 -->
NUM = #num#, <!-- 数量 -->
UNIT_WT = #unitWt#, <!-- 单重 -->
TOTAL_WT = #totalWt#, <!-- 总重 -->
FILE_PATH1 = #filePath1#, <!-- 文件地址1 -->
FILE_PATH2 = #filePath2#, <!-- 文件地址2 -->
FILE_PATH3 = #filePath3#, <!-- 文件地址3 -->
FILE_PATH4 = #filePath4#, <!-- 文件地址4 -->
FILE_PATH5 = #filePath5#, <!-- 文件地址5 -->
STATUS = #status#, <!-- 状态 0-未审核,1-已审核 -->
DEL_STATUS = #delStatus#, <!-- 状态 1未删除,0已删除 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
REMARK = #remark# <!-- 备注 -->
WHERE
ID = #id#
</update>
<select id="queryTree" resultClass="java.util.HashMap">
SELECT
ID as "nodeId",
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as projName,<!-- 项目名称 -->
ID as "label", <!-- 名产品编码-->
PRDT_NAME as "text", <!-- 产品名称 -->
PARENT_PRDT_CODE as "pId", <!-- 父节点编码 -->
TYPE as "type", <!-- 类别 -->
LEAF as "leaf", <!-- 是否有叶子节点 -->
SORT as "sort", <!-- 排序字段 -->
ICON as "icon" <!-- 图片地址 -->
FROM
hpjx.t_hpsc002
WHERE
1=1
<isNotEmpty prepend=" AND " property="pEname">
PARENT_PRDT_CODE = #pEname#
</isNotEmpty>
ORDER BY CREATED_TIME DESC
</select>
<update id="updateTreeNodeLeaf">
UPDATE hpjx.t_hpsc002 SET LEAF = #leaf# WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
$(function () {
IPLATUI.EFTree = {
"materialTree": {
ROOT: "root:项目列表",
/**
* 选中树结点时触发的事件,注意点击树 折叠/展开 的图标不会触发此事件
*
* @param e
* e.sender kendoTree对象, tree01Tree(EFTree的id + "Tree")
* e.node 点击的节点DOM元素
*/
select: function (e) {
var nodeData = this.dataItem(e.node);
IPLATUI.EFTree.materialTree.selectTreeNode.nodeId = nodeData.nodeId;
IPLATUI.EFTree.materialTree.selectTreeNode.projCode = nodeData.projCode;
IPLATUI.EFTree.materialTree.selectTreeNode.projName = nodeData.projName;
// 重新查询EFGrid
resultGrid.dataSource.page(1);
},
selectTreeNode:{}
}
};
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid = {
result: {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 70, 100],
},
/**
* EFGrid新增行之前触发的事件,可以根据业务逻辑控制是否进行新增
* @param e 事件对象
* e.sender Grid对象
* e.preventDefault 阻止事件发生
*/
beforeAdd: function (e) {
var logic = Object.keys(IPLATUI.EFTree.materialTree.selectTreeNode).length === 0;
if (logic) { // 通过业务逻辑判断, 控制是否进行新增
IPLAT.alert({
message: '<b>请选择项目列表</b>',
okFn: function (e) {
},
title: '提示'
});
e.preventDefault();
}
},
/**
* EFGrid新增行时触发的事件,此时数据行tr元素还未渲染
* @param e 事件对象
* e.sender Grid对象
* e.preventDefault 不会触发dataBound,不渲染tr
* e.index 插入的行号
* e.items 将要插入的数据行数组([Model,Model, ...])
*/
onAdd: function (e) {
// 动态设置默认邮箱
let selectTreeNode = IPLATUI.EFTree.materialTree.selectTreeNode;
$.each(e.items, function(index, item){
item['projCode'] = selectTreeNode.projCode;
item['projName'] = selectTreeNode.projName;
item['parentPrdtCode'] = selectTreeNode.nodeId;
item['parentPrdtName'] = selectTreeNode.projName;
});
},
/**
* 点击Grid保存按钮时触发的事件
* @param e 事件对象
* e.sender Grid对象
*/
onSave: function (e) {
// 不向后台保存
var tree = $("#materialTree").data("kendoTreeView");
var inInfo = new EiInfo();
EiCommunicator.send("HPSC002", "queryTreeNode", inInfo, {//传入参数
onSuccess: function (inInfo) {
tree.reload("root");//更新树
}
});
},
/**
* 点击Grid删除按钮时触发的事件
* @param e 事件对象
* e.sender Grid对象
*/
onDelete: function (e) {
// 不向后台保存
var tree = $("#materialTree").data("kendoTreeView");
var inInfo = new EiInfo();
EiCommunicator.send("HPSC002", "queryTreeNode", inInfo, {//传入参数
onSuccess: function (inInfo) {
tree.reload("root");//更新树
}
});
},
toolbarConfig: {
hidden: false, // true时,不显示功能按钮,但保留setting导出按钮
// add: false, // 不显示新增按钮
// cancel: false, // 不显示取消按钮
// save: false, // 不显示保存按钮
delete: true, // 显示删除按钮
buttons: [ // 不允许覆盖默认的4个按钮,可以设置自定义的按钮
{
name: "test",
text: "测试",
front: "left",
layout: "1",
click: function () {
// 此处编写自定义功能
WindowUtil({
title: "定制",
content: "<div class='kendo-del-message'>测试</div>"
});
}
},
]
},
columns: [{
field: "filePath1",
headerTemplate: "设计图纸",
template: "<span style='display: flex;justify-content: center'><a class='i-btn-sm test' href=''>下载</a></span>",
}],
}
}
});
\ No newline at end of file
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
<%-- <link rel="stylesheet" href="${ctx}/css/simulatedOperation.css"/>--%>
</head>
<EF:EFPage title="物料清单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="custType" cname="客商类型:" row="0"/>
<EF:EFSelect cname="分类:" optionLabel="全部" blockId="inqu_status" ename="custClassify" row="0">
<EF:EFOption label="供应商" value="1"/>
<EF:EFOption label="客户" value="2"/>
</EF:EFSelect>
<EF:EFSelect cname="状态:" optionLabel="全部" blockId="inqu_status" ename="status" row="0">
<EF:EFOption label="启用" value="1"/>
<EF:EFOption label="停用" value="0"/>
</EF:EFSelect>
</div>
<EF:EFButton ename="QUERY" cname="查询" row="1" class="btn-align-right"></EF:EFButton>
</EF:EFRegion>
<div id="splitter" class="i-fit-height" style="display: inline">
<div id="left-pane" class="i-fit-height" style="width: 20%;float:left;">
<EF:EFRegion id="projTree" title="BOM结构图" fitHeight="true">
<EF:EFTree id="materialTree" valueField="label" textField="text" hasChildren="leaf"
serviceName="HPSC002" methodName="queryTreeNode">
</EF:EFTree>
</EF:EFRegion>
</div>
<div id="right-pane" class="i-fit-height" style="width: 80%;float: right">
<EF:EFRegion id="result" title="明细信息" >
<EF:EFGrid blockId="result" autoDraw="no" >
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn enable="false" ename="projCode" cname="项目编码"/>
<EF:EFColumn enable="false" ename="projName" cname="项目名称"/>
<EF:EFColumn ename="prdtCode" required="true" cname="产品编码"/>
<EF:EFColumn ename="prdtName" required="true" cname="产品名称"/>
<EF:EFColumn enable="false" ename="parentPrdtCode" hidden="true" cname="上级产品名称"/>
<EF:EFColumn enable="false" ename="parentPrdtName" cname="上级产品名称"/>
<EF:EFColumn ename="num" required="true" cname="数量"/>
<EF:EFColumn ename="unitWt" required="true" format="{0:N3}" cname="单重"/>
<EF:EFColumn enable="false" format="{0:N3}" ename="totalWt" cname="总重"/>
</EF:EFGrid>
</EF:EFRegion>
</div>
</div>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HP/SC/HPSC002.js"></script>
\ No newline at end of file
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