'feat():新增DEMO样例'

parent 11a68065
/**
* Generate time : 2024-01-08 18:33:20
* Version : 1.0
*/
package com.baosight.iplat4j.demo.domain;
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;
/**
* Tveci002
*
*/
public class Tveci002 extends DaoEPBase {
private String resId = " "; /* 资源ID*/
private String resClass = " "; /* 资源类型*/
private String htmlCode = " "; /* html代码*/
private String cssCode = " "; /* 样式代码*/
private String javascriptCode = " "; /* js代码*/
private String recCreator = " "; /* 创建人员*/
private String recCreateTime = " "; /* 创建时间*/
private String recRevisor = " "; /* 更新人员*/
private String recReviseTime = " "; /* 更新时间*/
private String dependencies = " "; /* js依赖*/
/**
* initialize the metadata
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn("resId");
eiColumn.setPrimaryKey(true);
eiColumn.setDescName("资源ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("resClass");
eiColumn.setPrimaryKey(true);
eiColumn.setDescName("资源类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("htmlCode");
eiColumn.setDescName("html代码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("cssCode");
eiColumn.setDescName("样式代码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("javascriptCode");
eiColumn.setDescName("js代码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("recCreator");
eiColumn.setDescName("创建人员");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("recCreateTime");
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("recRevisor");
eiColumn.setDescName("更新人员");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("recReviseTime");
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("dependencies");
eiColumn.setDescName("js依赖");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor
*/
public Tveci002() {
initMetaData();
}
/**
* get the resId - 资源ID
* @return the resId
*/
public String getResId() {
return this.resId;
}
/**
* set the resId - 资源ID
*/
public void setResId(String resId) {
this.resId = resId;
}
/**
* get the resClass - 资源类型
* @return the resClass
*/
public String getResClass() {
return this.resClass;
}
/**
* set the resClass - 资源类型
*/
public void setResClass(String resClass) {
this.resClass = resClass;
}
/**
* get the htmlCode - html代码
* @return the htmlCode
*/
public String getHtmlCode() {
return this.htmlCode;
}
/**
* set the htmlCode - html代码
*/
public void setHtmlCode(String htmlCode) {
this.htmlCode = htmlCode;
}
/**
* get the cssCode - 样式代码
* @return the cssCode
*/
public String getCssCode() {
return this.cssCode;
}
/**
* set the cssCode - 样式代码
*/
public void setCssCode(String cssCode) {
this.cssCode = cssCode;
}
/**
* get the javascriptCode - js代码
* @return the javascriptCode
*/
public String getJavascriptCode() {
return this.javascriptCode;
}
/**
* set the javascriptCode - js代码
*/
public void setJavascriptCode(String javascriptCode) {
this.javascriptCode = javascriptCode;
}
/**
* get the recCreator - 创建人员
* @return the recCreator
*/
public String getRecCreator() {
return this.recCreator;
}
/**
* set the recCreator - 创建人员
*/
public void setRecCreator(String recCreator) {
this.recCreator = recCreator;
}
/**
* get the recCreateTime - 创建时间
* @return the recCreateTime
*/
public String getRecCreateTime() {
return this.recCreateTime;
}
/**
* set the recCreateTime - 创建时间
*/
public void setRecCreateTime(String recCreateTime) {
this.recCreateTime = recCreateTime;
}
/**
* get the recRevisor - 更新人员
* @return the recRevisor
*/
public String getRecRevisor() {
return this.recRevisor;
}
/**
* set the recRevisor - 更新人员
*/
public void setRecRevisor(String recRevisor) {
this.recRevisor = recRevisor;
}
/**
* get the recReviseTime - 更新时间
* @return the recReviseTime
*/
public String getRecReviseTime() {
return this.recReviseTime;
}
/**
* set the recReviseTime - 更新时间
*/
public void setRecReviseTime(String recReviseTime) {
this.recReviseTime = recReviseTime;
}
/**
* get the dependencies - js依赖
* @return the dependencies
*/
public String getDependencies() {
return this.dependencies;
}
/**
* set the dependencies - js依赖
*/
public void setDependencies(String dependencies) {
this.dependencies = dependencies;
}
/**
* get the value from Map
*/
public void fromMap(Map map) {
setResId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("resId")), resId));
setResClass(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("resClass")), resClass));
setHtmlCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("htmlCode")), htmlCode));
setCssCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("cssCode")), cssCode));
setJavascriptCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("javascriptCode")), javascriptCode));
setRecCreator(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("recCreator")), recCreator));
setRecCreateTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("recCreateTime")), recCreateTime));
setRecRevisor(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("recRevisor")), recRevisor));
setRecReviseTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("recReviseTime")), recReviseTime));
setDependencies(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("dependencies")), dependencies));
}
/**
* set the value to Map
*/
public Map toMap() {
Map map = new HashMap();
map.put("resId",StringUtils.toString(resId, eiMetadata.getMeta("resId")));
map.put("resClass",StringUtils.toString(resClass, eiMetadata.getMeta("resClass")));
map.put("htmlCode",StringUtils.toString(htmlCode, eiMetadata.getMeta("htmlCode")));
map.put("cssCode",StringUtils.toString(cssCode, eiMetadata.getMeta("cssCode")));
map.put("javascriptCode",StringUtils.toString(javascriptCode, eiMetadata.getMeta("javascriptCode")));
map.put("recCreator",StringUtils.toString(recCreator, eiMetadata.getMeta("recCreator")));
map.put("recCreateTime",StringUtils.toString(recCreateTime, eiMetadata.getMeta("recCreateTime")));
map.put("recRevisor",StringUtils.toString(recRevisor, eiMetadata.getMeta("recRevisor")));
map.put("recReviseTime",StringUtils.toString(recReviseTime, eiMetadata.getMeta("recReviseTime")));
map.put("dependencies",StringUtils.toString(dependencies, eiMetadata.getMeta("dependencies")));
return map;
}
}
\ No newline at end of file
package com.baosight.iplat4j.demo.service;
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.demo.domain.Tveci002;
import java.util.Map;
/**
* @author xuao
* @date 2024年01月08日 18:29
*/
public class ServiceEEDM02 extends ServiceBase {
public static final String INQU_STATUS_BLOCK = "inqu_status";
public static final String RESULT_BLOCK = "result";
/**
* 画面初始化.
*/
public EiInfo initLoad(EiInfo inInfo) {
Tveci002 tveci002 = new Tveci002();
EiInfo outInfo = super.initLoad(inInfo, tveci002);
outInfo.addBlock(RESULT_BLOCK).addBlockMeta(tveci002.eiMetadata);
return inInfo;
}
/**
* 查询操作.
*/
@Override
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/
EiInfo outInfo = super.query(inInfo, "tveci002.query", new Tveci002());
return outInfo;
}
/**
* 新增操作.
*/
@Override
public EiInfo insert(EiInfo inInfo) {
try {
Tveci002 tveci002 = new Tveci002();
EiBlock eiBlock = inInfo.getBlock(RESULT_BLOCK);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
tveci002.fromMap(map);
this.dao.insert("tveci002.insert", tveci002.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 {
Tveci002 tveci002 = new Tveci002();
EiBlock eiBlock = inInfo.getBlock(RESULT_BLOCK);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
tveci002.fromMap(map);
this.dao.update("tveci002.update", tveci002.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) {
Tveci002 tveci002 = new Tveci002();
EiBlock eiBlock = eiInfo.getBlock(RESULT_BLOCK);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
tveci002.fromMap(map);
this.dao.delete("tveci002.delete", tveci002.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-08 18:33:20
Version : 1.0
tableName :eplat.tveci002
RES_ID VARCHAR NOT NULL primarykey,
RES_CLASS VARCHAR NOT NULL primarykey,
HTML_CODE VARCHAR,
CSS_CODE VARCHAR,
JAVASCRIPT_CODE VARCHAR,
REC_CREATOR VARCHAR,
REC_CREATE_TIME VARCHAR,
REC_REVISOR VARCHAR,
REC_REVISE_TIME VARCHAR,
DEPENDENCIES VARCHAR
-->
<sqlMap namespace="tveci002">
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.iplat4j.ee.dm.domain.Tveci002">
SELECT
RES_ID as "resId", <!-- 资源ID -->
RES_CLASS as "resClass", <!-- 资源类型 -->
HTML_CODE as "htmlCode", <!-- html代码 -->
CSS_CODE as "cssCode", <!-- 样式代码 -->
JAVASCRIPT_CODE as "javascriptCode", <!-- js代码 -->
REC_CREATOR as "recCreator", <!-- 创建人员 -->
REC_CREATE_TIME as "recCreateTime", <!-- 创建时间 -->
REC_REVISOR as "recRevisor", <!-- 更新人员 -->
REC_REVISE_TIME as "recReviseTime", <!-- 更新时间 -->
DEPENDENCIES as "dependencies" <!-- js依赖 -->
FROM eplat.tveci002 WHERE 1=1
<isNotEmpty prepend=" AND " property="resId">
RES_ID = #resId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="resClass">
RES_CLASS = #resClass#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
RES_ID asc,
RES_CLASS asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM eplat.tveci002 WHERE 1=1
<isNotEmpty prepend=" AND " property="resId">
RES_ID = #resId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="resClass">
RES_CLASS = #resClass#
</isNotEmpty>
</select>
<!--
<isNotEmpty prepend=" AND " property="resId">
RES_ID = #resId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="resClass">
RES_CLASS = #resClass#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="htmlCode">
HTML_CODE = #htmlCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="cssCode">
CSS_CODE = #cssCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="javascriptCode">
JAVASCRIPT_CODE = #javascriptCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="recCreator">
REC_CREATOR = #recCreator#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="recCreateTime">
REC_CREATE_TIME = #recCreateTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="recRevisor">
REC_REVISOR = #recRevisor#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="recReviseTime">
REC_REVISE_TIME = #recReviseTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dependencies">
DEPENDENCIES = #dependencies#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO eplat.tveci002 (RES_ID, <!-- 资源ID -->
RES_CLASS, <!-- 资源类型 -->
HTML_CODE, <!-- html代码 -->
CSS_CODE, <!-- 样式代码 -->
JAVASCRIPT_CODE, <!-- js代码 -->
REC_CREATOR, <!-- 创建人员 -->
REC_CREATE_TIME, <!-- 创建时间 -->
REC_REVISOR, <!-- 更新人员 -->
REC_REVISE_TIME, <!-- 更新时间 -->
DEPENDENCIES <!-- js依赖 -->
)
VALUES (#resId#, #resClass#, #htmlCode#, #cssCode#, #javascriptCode#, #recCreator#, #recCreateTime#, #recRevisor#, #recReviseTime#, #dependencies#)
</insert>
<delete id="delete">
DELETE FROM eplat.tveci002 WHERE
RES_ID = #resId# AND
RES_CLASS = #resClass#
</delete>
<update id="update">
UPDATE eplat.tveci002
SET
HTML_CODE = #htmlCode#, <!-- html代码 -->
CSS_CODE = #cssCode#, <!-- 样式代码 -->
JAVASCRIPT_CODE = #javascriptCode#, <!-- js代码 -->
REC_CREATOR = #recCreator#, <!-- 创建人员 -->
REC_CREATE_TIME = #recCreateTime#, <!-- 创建时间 -->
REC_REVISOR = #recRevisor#, <!-- 更新人员 -->
REC_REVISE_TIME = #recReviseTime#, <!-- 更新时间 -->
DEPENDENCIES = #dependencies# <!-- js依赖 -->
WHERE
RES_ID = #resId# AND
RES_CLASS = #resClass#
</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_SAVE").on("click", function () {
var btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
IPLAT.submitNode($("#EEDM02"), "EEDM02", "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($("#EEDM02"), "EEDM02", "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);
}
});
});
//删除
$("#BTN_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($("#EEDM02"), "EEDM02", "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 prefix="bm2c" title="测试">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="inqu_status-0-templateCode" cname="模板号" colWidth="4"/>
<EF:EFCascadeSelect ename="inqu_status-0-companyTypeCode"
valueTemplate="#=companyTypeCode#-#=companyTypeCodeName#"
template="#=companyTypeCode#-#=companyTypeCodeName#"
defaultValue="Europe" serviceName="QKHB01" methodName="getCompanyTypeCodeBySelect"
resultId="result" cname="公司别" textField="companyTypeCodeName"
valueField="companyTypeCode" colWidth="4" readonly="true">
</EF:EFCascadeSelect>
<EF:EFCascadeSelect ename="inqu_status-0-companyCode" valueTemplate="#=companyCode#-#=companyCodeName#"
template="#=companyCode#-#=companyCodeName#"
serviceName="QKHB01" methodName="getCompanyCodeBySelect" cname="账套" resultId="result"
cascadeFrom="inqu_status-0-companyTypeCode"
textField="companyCodeName" valueField="companyCode" colWidth="4" readonly="false">
</EF:EFCascadeSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="评价信息">
<EF:EFGrid blockId="result" autoDraw="false" isFloat="true" autoFit="true">
<EF:EFColumn ename="internalCode" cname="内码" hidden="true"/>
<EF:EFColumn ename="templateCode" cname="模板号" width="100" readonly="true" disabled="true"/>
<EF:EFColumn ename="templateName" 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:EFCodeOption codeName="eqms.qg.status"/>
</EF:EFComboColumn>
</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