Commit bc2ce2f8 by 徐澳

feat():完成HPPZ002

parent aaee51b2
/**
* Generate time : 2024-01-09 14:40:53
* Version : 1.0
*/
package com.baosight.iplat4j.hp.pz.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
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;
/**
* THppz002
*
*/
public class THppz002 extends DaoEPBase {
private Long id = 0L;
private String companyCode = " "; /* 企业编码 预留*/
private Integer custType = 0; /* 供应商类型 1 国企 : 2 民营*/
private String custCode = " "; /* 供应商编码*/
private String custName = " "; /* 供应商名称*/
private String address = " "; /* 地址*/
private Boolean status; /* 状态 0禁用 1启用*/
private String createdBy = " "; /* 创建人*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedTime = " "; /* 更新时间*/
/**
* 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("custType");
eiColumn.setDescName("供应商类型 1 国企 : 2 民营");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custCode");
eiColumn.setDescName("供应商编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custName");
eiColumn.setDescName("供应商名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("address");
eiColumn.setDescName("地址");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("status");
eiColumn.setDescName("状态 0禁用 1启用");
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);
}
/**
* the constructor
*/
public THppz002() {
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 custType - 供应商类型 1 国企 : 2 民营
* @return the custType
*/
public Integer getCustType() {
return this.custType;
}
/**
* set the custType - 供应商类型 1 国企 : 2 民营
*/
public void setCustType(Integer custType) {
this.custType = custType;
}
/**
* get the custCode - 供应商编码
* @return the custCode
*/
public String getCustCode() {
return this.custCode;
}
/**
* set the custCode - 供应商编码
*/
public void setCustCode(String custCode) {
this.custCode = custCode;
}
/**
* get the custName - 供应商名称
* @return the custName
*/
public String getCustName() {
return this.custName;
}
/**
* set the custName - 供应商名称
*/
public void setCustName(String custName) {
this.custName = custName;
}
/**
* get the address - 地址
* @return the address
*/
public String getAddress() {
return this.address;
}
/**
* set the address - 地址
*/
public void setAddress(String address) {
this.address = address;
}
/**
* get the status - 状态 0禁用 1启用
* @return the status
*/
public Boolean getStatus() {
return this.status;
}
/**
* set the status - 状态 0禁用 1启用
*/
public void setStatus(Boolean status) {
this.status = status;
}
/**
* 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 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));
setCustType(NumberUtils.toInteger(StringUtils.toString(map.get("custType")), custType));
setCustCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("custCode")), custCode));
setCustName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("custName")), custName));
setAddress(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("address")), address));
setStatus(NumberUtils.toBoolean(StringUtils.toString(map.get("status")), status));
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));
}
/**
* 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("custType",StringUtils.toString(custType, eiMetadata.getMeta("custType")));
map.put("custCode",StringUtils.toString(custCode, eiMetadata.getMeta("custCode")));
map.put("custName",StringUtils.toString(custName, eiMetadata.getMeta("custName")));
map.put("address",StringUtils.toString(address, eiMetadata.getMeta("address")));
map.put("status",StringUtils.toString(status, eiMetadata.getMeta("status")));
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")));
return map;
}
}
\ No newline at end of file
package com.baosight.iplat4j.hp.pz.service;
import com.baosight.iplat4j.common.CompanyTypeEnum;
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.hp.pz.domain.THppz002;
import com.baosight.iplat4j.util.CommonMethod;
import java.util.Map;
/**
* @author xuao
* @date 2024年01月09日 10:18
*/
public class ServiceHPPZ002 extends ServiceBase {
/**
* 画面初始化.
*/
public EiInfo initLoad(EiInfo inInfo) {
THppz002 HPPZ002 = new THppz002();
EiInfo outInfo = super.initLoad(inInfo, HPPZ002);
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(HPPZ002.eiMetadata);
outInfo.setBlock(CompanyTypeEnum.generatorEiBlock());
return outInfo;
}
/**
* 查询操作.
*/
@Override
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/
EiInfo outInfo = super.query(inInfo, "HPPZ002.query", new THppz002());
return outInfo;
}
/**
* 新增操作.
*/
@Override
public EiInfo insert(EiInfo inInfo) {
try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock);
super.insert(inInfo,"HPPZ002.insert");
// THppz002 hppz002 = new THppz002();
// EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
// for (int i = 0; i < eiBlock.getRowCount(); i++) {
// Map<?, ?> map = eiBlock.getRow(i);
// hppz002.fromMap(map);
// this.dao.insertBatch()//insert("HPPZ002.insert", hppz002.toMap());
// }
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 inInfo;
}
/**
* 修改操作.
*/
public EiInfo update(EiInfo inInfo) {
try {
THppz002 HPPZ002 = new THppz002();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPPZ002.fromMap(map);
this.dao.update("HPPZ002.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) {
THppz002 HPPZ002 = new THppz002();
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("HPPZ002.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;
}
}
<?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-09 14:40:53
Version : 1.0
tableName :hpjx.t_hppz002
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
CUST_TYPE TINYINT NOT NULL,
CUST_CODE VARCHAR NOT NULL,
CUST_NAME VARCHAR NOT NULL,
ADDRESS VARCHAR NOT NULL,
STATUS TINYINT NOT NULL,
CREATED_BY VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR
-->
<sqlMap namespace="HPPZ002">
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.iplat4j.hp.pz.domain.THppz002">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
CUST_TYPE as "custType", <!-- 供应商类型 1 国企 : 2 民营 -->
CUST_CODE as "custCode", <!-- 供应商编码 -->
CUST_NAME as "custName", <!-- 供应商名称 -->
ADDRESS as "address", <!-- 地址 -->
STATUS as "status", <!-- 状态 0禁用 1启用 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz002 WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz002 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="custType">
CUST_TYPE = #custType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custCode">
CUST_CODE = #custCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custName">
CUST_NAME = #custName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="address">
ADDRESS = #address#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</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>
-->
<insert id="insert">
INSERT INTO hpjx.t_hppz002 (
COMPANY_CODE, <!-- 企业编码 预留 -->
CUST_TYPE, <!-- 供应商类型 1 国企 : 2 民营 -->
CUST_CODE, <!-- 供应商编码 -->
CUST_NAME, <!-- 供应商名称 -->
ADDRESS, <!-- 地址 -->
STATUS, <!-- 状态 0禁用 1启用 -->
CREATED_BY, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_TIME <!-- 更新时间 -->
)
VALUES (#companyCode#, #custType#, #custCode#, #custName#, #address#, #status#, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#)
</insert>
<delete id="delete">
DELETE FROM hpjx.t_hppz002 WHERE
ID = #id#
</delete>
<update id="update">
UPDATE hpjx.t_hppz002
SET
CUST_TYPE = #custType#, <!-- 供应商类型 1 国企 : 2 民营 -->
CUST_CODE = #custCode#, <!-- 供应商编码 -->
CUST_NAME = #custName#, <!-- 供应商名称 -->
ADDRESS = #address#, <!-- 地址 -->
STATUS = #status#, <!-- 状态 0禁用 1启用 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE
ID = #id#
</update>
</sqlMap>
\ No newline at end of file
$(function() {
// 查询
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
});
IPLATUI.EFGrid = {
"result": {
loadComplete: function (grid) {
// 新增
$("#BTN_INSERT").on("click", function () {
var btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
IPLAT.submitNode($("#HPPZ002"), "HPPZ002", "insert", {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
// 绑定grid
resultGrid.setEiInfo(ei);
NotificationUtil({
msg: '新增成功'
});
}
//释放禁用按钮
btnNode.attr("disabled", false);
resultGrid.dataSource.page(1);
},
onFail: function (ei) { // onFail 表示失败回调函数
// 发生异常
console.log(ei);
//释放禁用按钮
btnNode.attr("disabled", false);
}
});
});
// 修改
$("#UPDATE").on("click", function () {
var rowCount = resultGrid.getCheckedRows();
// 检验是否选中数据
if (rowCount == null || rowCount == "") {
NotificationUtil({
msg : '请选择一条或多条数据'
}, "warning");
return false;
}
var btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
IPLAT.submitNode($("#HPPZ002"), "HPPZ002", "update", {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: '修改成功'
});
// 绑定grid
resultGrid.setEiInfo(ei);
}
//释放禁用按钮
btnNode.attr("disabled", false);
},
onFail: function (ei) { // onFail 表示失败回调函数
// 发生异常
console.log(ei);
//释放禁用按钮
btnNode.attr("disabled", false);
}
});
});
//删除
$("#DELETE").on("click", function () {
var btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
var dataItems = resultGrid.getCheckedRows();
if (dataItems == null || dataItems == "") {
NotificationUtil({
msg: '选择要删除的数据'
}, "warning");
//释放禁用按钮
btnNode.attr("disabled", false);
return false;
}
IPLAT.submitNode($("#HPPZ002"), "HPPZ002", "delete", {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: '删除成功'
});
// 绑定grid
resultGrid.setEiInfo(ei);
}
//释放禁用按钮
btnNode.attr("disabled", false);
},
onFail: function (ei) {// onFail
// 表示失败回调函数
// 发生异常
console.log(ei);
//释放禁用按钮
btnNode.attr("disabled", false);
}
});
});
}
},
};
});
<!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}"/>
<EF:EFPage title="供应商档案">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="inqu_status-0-custName" cname="供应商名称" colWidth="4" readonly="false"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="false" isFloat="true" autoFit="true">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="custType" cname="供应商类型" align="center"
blockName="company_type_block_id"
columnTemplate="#=textField#-#=valueField#" optionLabel=" "
itemTemplate="#=textField#-#=valueField#" textField="textField"
valueField="valueField" width="100">
</EF:EFComboColumn>
<EF:EFColumn ename="custCode" cname="供应商编码" width="100" readonly="true" disabled="true"/>
<EF:EFColumn ename="custName" cname="供应商名称" width="100" readonly="false"/>
<EF:EFColumn ename="address" cname="地址" width="100" readonly="false"/>
<EF:EFComboColumn ename="status" cname="状态" align="center"
columnTemplate="#=valueField#-#=textField#" optionLabel=" "
itemTemplate="#=valueField#-#=textField#" textField="textField"
valueField="valueField" width="100">
<EF:EFOption label="--请选择--" value=""></EF:EFOption>
<EF:EFOption label="启用" value="1"></EF:EFOption>
<EF:EFOption label="禁用" value="0"></EF:EFOption>
</EF:EFComboColumn>
<EF:EFColumn ename="createdTime" cname="创建时间" width="100" readonly="true" disabled="true"/>
<EF:EFColumn ename="createdBy" cname="创建人" width="100" readonly="false"/>
<EF:EFColumn ename="updatedTime" cname="更新时间" width="100" readonly="true" disabled="true"/>
<EF:EFColumn ename="updatedBy" cname="更新人" width="100" readonly="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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