Commit d039fe9c by 宋祥

1.查询视图动态列功能

parent ae8d157a
......@@ -2,6 +2,7 @@ package com.baosight.hggp.common;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.enums.ValidFlagEnum;
import java.util.HashMap;
import java.util.Map;
......@@ -21,7 +22,16 @@ import java.util.Map;
*/
public enum DdynamicEnum {
//------------------------------------配置管理-----------------------------------
/**
/**
* 模块:租户管理
* 用途:租户下拉框
*/
ACCOUNT_BLOCK_ID("account_block_id", "accountCode", "accountName", "HGPZ009.query",
new HashMap<String, Object>() {{
put("exValidFlag", ValidFlagEnum.VIRTUALLY.getCode());
}}),
/**
* 模块:项目性质
* 用途:项目性质下拉框
* 编写:wwl
......
......@@ -57,13 +57,16 @@ public class DocController extends WebDispatchController {
}
Map<String, Object> params = this.convertParam(paramMaps);
String id = request.getParameter("id");
DocRouteEnum docRouteEnum = DocRouteEnum.getById(id);
if (MapUtils.getString(params, "fileName").contains("HGSC004A")) {
DocRouteEnum docRouteEnum = null;
String fileName = MapUtils.getString(params, "fileName");
if (fileName != null && fileName.contains("HGSC004A")) {
docRouteEnum = DocRouteEnum.getById("route_001");
} else if (params.get("fileName").toString().contains("HGSC009A")) {
} else if (fileName != null && fileName.contains("HGSC009A")) {
docRouteEnum = DocRouteEnum.getById("route_002");
} else if (params.get("fileName").toString().contains("HGPZ005")) {
} else if (fileName != null && fileName.contains("HGPZ005")) {
docRouteEnum = DocRouteEnum.getById("route_003");
} else {
docRouteEnum = DocRouteEnum.getById(id);
}
if (docRouteEnum == null) {
outInfo.setMsg("导入标识ID不存在");
......
......@@ -7,6 +7,18 @@ package com.baosight.hggp.core.constant;
public class CodesetConstant {
/**
* 动态表
*
* @author:songx
* @date:2024/3/1,17:36
*/
public static class HgPz {
// 动态表
public static final String DYNAMIC_TABLE = "app.pz.dynamicTable";
}
/**
* 组织机构
*
* @author:songx
......
......@@ -71,6 +71,21 @@ public class CommonConstant {
}
/**
* 权限过滤
*
* @author:songx
* @date:2024/1/20,15:04
*/
public static class AuthFilter {
// 企业权限
public static final String[] ACCOUNT = {"HGXSUser", "HGPZ009", "HGPZ020", "HGPZ020A"};
// 数据权限
public static final String[] DATA = {"HGXSUser", "HGXSOrg", "HGXSUserGroup", "HGPZ009", "HGPZ020",
"HGPZ010.query"};
}
/**
* 设备计划状态
*
* @author:songx
......@@ -115,6 +130,8 @@ public class CommonConstant {
// Main
public static final String MAIN = "main";
public static final String ENAME = "ename";
// 动态列
public static final String DYNAMIC_COLUMN = "dynamicColumn";
}
/**
......
......@@ -3,7 +3,6 @@ package com.baosight.hggp.core.dao;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -38,21 +37,32 @@ public class DaoUtils {
List<Integer> countMaps = DaoBase.getInstance().query(sqlName, paramMap);
return CollectionUtils.isEmpty(countMaps) ? 0 : countMaps.get(0).intValue();
}
/**
* insert method.
*
* @param sql
* @param obj
* @throws PlatException
*/
public static void insert(String sql, Object obj) throws PlatException {
insert(sql, obj, true);
}
/**
* insert method.
*
* @param sql
* @param obj
*/
public static void insert(String sql, Object obj, boolean setAuth) throws PlatException {
if (obj instanceof DaoEPBase) {
setCreator((DaoEPBase) obj);
setCreator((DaoEPBase) obj, setAuth);
} else if (obj instanceof Map) {
setCreator((Map) obj);
setCreator((Map) obj, setAuth);
} else if (obj instanceof List) {
for (Object o : ((List) obj)) {
insert(sql, o);
insert(sql, o, setAuth);
}
return;
}
......@@ -66,6 +76,17 @@ public class DaoUtils {
* @param rows
*/
public static void batchInsert(String sql, List rows) {
batchInsert(sql, rows, true);
}
/**
* insertBatch method.
*
* @param sql
* @param rows
* @param setAuth
*/
public static void batchInsert(String sql, List rows, boolean setAuth) {
// 创建人部门
String depCode = "";
if (StringUtils.isBlank(depCode) && !"admin".equals(UserSessionUtils.getLoginName())) {
......@@ -81,11 +102,11 @@ public class DaoUtils {
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
}
setCreator(daoEPBase);
setCreator(daoEPBase, setAuth);
} else if (row instanceof Map) {
Map map = (Map) row;
map.put("depCode", depCode);
setCreator(map);
setCreator(map, setAuth);
}
}
Map paramMap = new HashMap();
......@@ -124,7 +145,7 @@ public class DaoUtils {
});
return DaoBase.getInstance().updateBatch(sql, parameters);
}
/**
* insertBatch method.
*
......@@ -132,11 +153,22 @@ public class DaoUtils {
* @param parameters
*/
public static int insertBatch(String sql, Collection parameters) {
parameters.forEach(obj->{
return insertBatch(sql, parameters, true);
}
/**
* insertBatch method.
*
* @param sql
* @param parameters
* @param setAuth
*/
public static int insertBatch(String sql, Collection parameters, boolean setAuth) {
parameters.forEach(obj -> {
if (obj instanceof DaoEPBase) {
setCreator((DaoEPBase) obj);
setCreator((DaoEPBase) obj, setAuth);
} else if (obj instanceof Map) {
setCreator((Map) obj);
setCreator((Map) obj, setAuth);
}
});
return DaoBase.getInstance().insertBatch(sql, parameters);
......@@ -146,8 +178,9 @@ public class DaoUtils {
* 创建人工号 创建人姓名 创建人岗号 创建时刻
*
* @param bean
* @param setAuth 设置权限
*/
private static void setCreator(DaoEPBase bean) {
private static void setCreator(DaoEPBase bean, boolean setAuth) {
// 创建人ID
String userId;
try {
......@@ -178,28 +211,6 @@ public class DaoUtils {
} catch (Exception e) {
log.warn("写入创建人姓名失败", e);
}
// 创建人企业编码
String accountCode = UserSessionUtils.getAccountCode();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
}
try {
BeanUtils.setProperty(bean, "accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人组织机构
List<String> orgIds = UserSessionUtils.getOrgId();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
}
try {
// 此处应该不支持自定义部门,否则写入的部门信息不准确
String depCode = CollectionUtils.isEmpty(orgIds) ? "" : orgIds.get(0);
BeanUtils.setProperty(bean, "depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
}
// 创建时刻
try {
String dateTime = DateUtils.shortDateTime();
......@@ -214,14 +225,39 @@ public class DaoUtils {
} catch (Exception e) {
log.warn("error", e);
}
// 创建人企业编码
if (setAuth) {
String accountCode = UserSessionUtils.getAccountCode();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
}
try {
BeanUtils.setProperty(bean, "accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人组织机构
List<String> orgIds = UserSessionUtils.getOrgId();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
}
try {
// 此处应该不支持自定义部门,否则写入的部门信息不准确
String depCode = CollectionUtils.isEmpty(orgIds) ? "" : orgIds.get(0);
BeanUtils.setProperty(bean, "depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
}
}
}
/**
* 创建人工号 创建人姓名 创建时刻.
*
* @param map
* @param setAuth
*/
public static void setCreator(Map map) {
public static void setCreator(Map map, boolean setAuth) {
// 创建人工号
String userId = MapUtils.getString(map, "createdBy");
try {
......@@ -245,27 +281,6 @@ public class DaoUtils {
}
map.put("createdName", userName);
map.put("updatedName", "");
// 创建人企业编码
String accountCode = UserSessionUtils.getAccountCode();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
}
try {
map.put("accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人部门编码
List<String> orgIds = UserSessionUtils.getOrgId();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
}
try {
String depCode = CollectionUtils.isEmpty(orgIds) ? "" : orgIds.get(0);
map.put("depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建时刻
try {
map.put("createdTime", DateUtils.shortDateTime());
......@@ -279,6 +294,29 @@ public class DaoUtils {
} catch (PlatException e) {
log.warn("error", e);
}
if (setAuth) {
// 创建人企业编码
String accountCode = UserSessionUtils.getAccountCode();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
}
try {
map.put("accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人部门编码
List<String> orgIds = UserSessionUtils.getOrgId();
if (!"admin".equals(userId)) {
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
}
try {
String depCode = CollectionUtils.isEmpty(orgIds) ? "" : orgIds.get(0);
map.put("depCode", depCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
}
}
/**
......
......@@ -2,6 +2,7 @@ package com.baosight.hggp.core.enums;
import com.baosight.hggp.hg.cw.domain.HGCW003;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.sj.domain.HGSJ003;
......@@ -17,6 +18,7 @@ public enum DocRouteEnum {
HGPZ005("route_003", "", 1, "HGPZ005", "importData", HGPZ005.class),
HGCW003("route_004", "", 1, "HGCW003", "importData", HGCW003.class),
HGSJ003("route_005", "", 1, "HGSJ003", "importData", HGSJ003.class),
HGPZ021("HGPZ021", "/file/template/hgpz021.xls", 1, "HGPZ021", "importData", HGPZ021.class),
;
......
......@@ -527,6 +527,7 @@ public class HGConstant {
// 已提交
public static final Integer S1 = 1;
}
// 报工状态
public static class BGStatus {
......
......@@ -18,4 +18,19 @@ public class HgPzSqlConstant {
public static final String UPDATE_COMPOSING_COEFF = MODULE + "updateComposingCoeff";
}
/**
*
* @author songx
* @date 2024/11/6,14:21
*/
public class HgPz020 {
// 模块名称
public static final String MODULE = "HGPZ020.";
// 修改排产系数
public static final String UPDATE_SORT = MODULE + "updateSort";
// 删除字段
public static final String DELETE_BY_FIELD = MODULE + "deleteByField";
}
}
package com.baosight.hggp.hg.pz.enums;
/**
* 动态表
*
* @author songx
* @date 2024/3/1,17:29
*/
public enum DynamicTableEnum {
HGCW002("HGCW002", "合同管理"),
HGSC001("HGSC001", "项目立项"),
;
/**
* 编码
*/
private String code;
/**
* 名称
*/
private String name;
DynamicTableEnum(String code, String name) {
this.code = code;
this.name = name;
}
/**
* code 是否存在
*
* @param code
* @return
*/
public static boolean contains(String code) {
for (DynamicTableEnum value : values()) {
if (value.getCode().equals(code)) {
return true;
}
}
return false;
}
/**
* 根据名称查询
*
* @param name
* @return
*/
public static DynamicTableEnum getByName(String name) {
for (DynamicTableEnum value : values()) {
if (value.getName().equals(name)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
......@@ -13,8 +13,6 @@ import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......
......@@ -7,13 +7,11 @@ import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ015;
import com.baosight.hggp.hg.pz.domain.HGPZ015A;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.pz.constant.HgPzSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ020;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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 java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 表字段配置
*
* @author:songx
* @date:2024/1/15,11:20
*/
public class ServiceHGPZ020 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.ACCOUNT_BLOCK_ID), null, true);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGPZ020().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGPZ020.QUERY, new HGPZ020());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
List<HGPZ020> fPz020s = MapUtils.toDaoEPBases(inInfo, HGPZ020.class);
for (HGPZ020 fPz020 : fPz020s) {
DaoUtils.update(HGPZ020.DELETE, fPz020);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + fPz020s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 修改排序
*
* @param inInfo
* @return
*/
public EiInfo updateSort(EiInfo inInfo) {
try {
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap : resultMaps) {
DaoUtils.update(HgPzSqlConstant.HgPz020.UPDATE_SORT, resultMap);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + resultMaps.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.domain.HGPZ020;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 选择字段
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHGPZ020A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.ACCOUNT_BLOCK_ID), null, true);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGPZ021().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, "HGPZ020A.query", new HGPZ021());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 确认操作.
*
* @param inInfo
* @return
*/
public EiInfo confirm(EiInfo inInfo) {
try {
// 租户信息
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String accountCode = MapUtils.getString(queryMap, HGPZ020.FIELD_ACCOUNT_CODE);
AssertUtils.isEmpty(accountCode, "请选择租户");
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode);
AssertUtils.isNull(dbPz009, "租户信息不存在");
List<HGPZ020> fPz020s = MapUtils.toDaoEPBases(inInfo, HGPZ020.class);
for (HGPZ020 fPz020 : fPz020s) {
fPz020.setAccountCode(accountCode);
fPz020.setAccountName(dbPz009.getAccountName());
DaoUtils.insert(HGPZ020.INSERT, fPz020, false);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + fPz020s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.core.constant.CodesetConstant;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.tools.CodeValueTools;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.constant.HgPzSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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 java.util.List;
import java.util.Map;
/**
* 表字段配置
*
* @author:songx
* @date:2024/1/15,11:20
*/
public class ServiceHGPZ021 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGPZ021().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGPZ021.QUERY, new HGPZ021());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo remove(EiInfo inInfo) {
try {
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap : resultMaps) {
DaoUtils.update(HGPZ021.DELETE, resultMap);
// 同步删除已配置的信息
DaoUtils.update(HgPzSqlConstant.HgPz020.DELETE_BY_FIELD, resultMap);
}
inInfo = this.query(inInfo);
inInfo.setMsg("操作成功!本次对[" + resultMaps.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据导入
*
* @param inInfo
* @return
*/
public EiInfo importData(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
try {
List<HGPZ021> fPz021s = (List<HGPZ021>) inInfo.get("dataList");
// 数据校验
this.checkImportData(fPz021s);
// 插入新的数据
this.saveImportData(fPz021s);
outInfo.setMsg("导入成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(outInfo, e, "数据导入失败");
}
return outInfo;
}
/**
* 检查导入的数据
*
* @param fPz021s
*/
private void checkImportData(List<HGPZ021> fPz021s) {
// 表名称小代码
List<Map> dynamicTables = CodeValueTools.getCodeValues(CodesetConstant.HgPz.DYNAMIC_TABLE);
for (HGPZ021 fPz021 : fPz021s) {
AssertUtils.isEmpty(fPz021.getTableCode(), String.format("序号[%s]表英文名不能为空", fPz021.getId()));
for (Map dynamicTableMap : dynamicTables) {
String value = MapUtils.getString(dynamicTableMap, "value");
if (value.equals(fPz021.getTableCode())) {
fPz021.setTableName(MapUtils.getString(dynamicTableMap, "label"));
}
}
AssertUtils.isEmpty(fPz021.getTableName(), String.format("序号[%s]表名称非法", fPz021.getId()));
AssertUtils.isEmpty(fPz021.getFieldCode(), String.format("序号[%s]字段英文名不能为空", fPz021.getId()));
AssertUtils.isEmpty(fPz021.getFieldName(), String.format("序号[%s]字段中文名不能为空", fPz021.getId()));
}
}
/**
* 数据写入
*
* @param fPz021s
*/
private void saveImportData(List<HGPZ021> fPz021s) {
for (HGPZ021 fPz021 : fPz021s) {
fPz021.setStatus(HGConstant.EnablingStatus.QY);
fPz021.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HGPZ021.INSERT, fPz021);
}
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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.service.impl.ServiceEPBase;
import java.util.Map;
/**
* 新增修改
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHGPZ021A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
this.setBaseInfo(inInfo);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
public EiInfo save(EiInfo inInfo) {
try {
HGPZ021 fPz021 = MapUtils.toDaoEPBase(inInfo, HGPZ021.class);
if (fPz021.getId() == null || fPz021.getId() == 0) {
this.add(fPz021);
} else {
this.modify(fPz021);
}
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增
*
* @param fPz021
*/
private void add(HGPZ021 fPz021) {
fPz021.setStatus(HGConstant.EnablingStatus.QY);
fPz021.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HGPZ021.INSERT, fPz021);
}
/**
* 修改数据
*
* @param fPz021
*/
private void modify(HGPZ021 fPz021) {
DaoUtils.update(HGPZ021.UPDATE, fPz021);
}
/**
* 设置信息
*
* @param inInfo
*/
public void setBaseInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
Long id = MapUtils.getLong(queryRow, HGPZ021.FIELD_ID);
if (id == null) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HGPZTools.HgPz021.get(id));
resultBlock.addBlockMeta(new HGPZ021().eiMetadata);
inInfo.setBlock(resultBlock);
}
}
<?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">
<sqlMap namespace="HGPZ020">
<sql id="column">
ID as "id", <!-- -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
ACCOUNT_CODE as "accountCode", <!-- 租户编码 -->
ACCOUNT_NAME as "accountName", <!-- 租户名称 -->
TABLE_CODE as "tableCode", <!-- 表英文名 -->
TABLE_NAME as "tableName", <!-- 表中文名 -->
FIELD_CODE as "fieldCode", <!-- 字段英文名 -->
FIELD_NAME as "fieldName", <!-- 字段中文名 -->
VIEW_SQL as "viewSql", <!-- 视图SQL -->
SORT_NUM as "sortNum" <!-- 排序 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableCode">
TABLE_CODE = #tableCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableName">
TABLE_NAME LIKE CONCAT('%', #tableName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldCode">
FIELD_CODE LIKE CONCAT('%', #fieldCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldName">
FIELD_NAME LIKE CONCAT('%', #fieldName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="sortNum">
SORT_NUM = #sortNum#
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.pz.domain.HGPZ020">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGPZ020 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGPZ020 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGPZ020 (
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
ACCOUNT_CODE, <!-- 租户编码 -->
ACCOUNT_NAME, <!-- 租户名称 -->
TABLE_CODE, <!-- 表英文名 -->
TABLE_NAME, <!-- 表中文名 -->
FIELD_CODE, <!-- 字段英文名 -->
FIELD_NAME, <!-- 字段中文名 -->
VIEW_SQL, <!-- 视图SQL -->
SORT_NUM <!-- 排序 -->
) VALUES (
#createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#,
#accountCode#, #accountName#, #tableCode#, #tableName#, #fieldCode#, #fieldName#, #viewSql#,
#sortNum#
)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGPZ020 WHERE ID = #id#
</delete>
<!-- 根据字段删除 -->
<delete id="deleteByField">
DELETE FROM ${hggpSchema}.HGPZ020 WHERE TABLE_CODE = #tableCode# AND FIELD_CODE = #fieldCode#
</delete>
<!-- 修改排序 -->
<update id="updateSort">
UPDATE ${hggpSchema}.HGPZ020
SET
SORT_NUM = #sortNum#, <!-- 排序 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
<?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">
<sqlMap namespace="HGPZ020A">
<sql id="column">
ID as "id", <!-- -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
STATUS as "status", <!-- 0-未启用,1-已启用 -->
TABLE_CODE as "tableCode", <!-- 表英文名 -->
TABLE_NAME as "tableName", <!-- 表中文名 -->
FIELD_CODE as "fieldCode", <!-- 字段英文名 -->
FIELD_NAME as "fieldName", <!-- 字段中文名 -->
VIEW_SQL as "viewSql", <!-- -->
SORT_NUM as "sortNum" <!-- 排序 -->
</sql>
<sql id="condition">
<!-- 过滤已经添加的字段 -->
AND NOT EXISTS (SELECT * FROM ${hggpSchema}.HGPZ020 A WHERE A.TABLE_CODE = T.TABLE_CODE
AND A.FIELD_CODE = T.FIELD_CODE AND A.ACCOUNT_CODE = #accountCode#
)
<isNotEmpty prepend=" AND " property="tableCode">
TABLE_CODE LIKE CONCAT('%', #tableCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableName">
TABLE_NAME LIKE CONCAT('%', #tableName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldCode">
FIELD_CODE LIKE CONCAT('%', #fieldCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldName">
FIELD_NAME LIKE CONCAT('%', #fieldName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.pz.domain.HGPZ021">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGPZ021 T WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGPZ021 T WHERE 1=1
<include refid="condition"/>
</select>
</sqlMap>
\ No newline at end of file
<?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">
<sqlMap namespace="HGPZ021">
<sql id="column">
ID as "id", <!-- -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
STATUS as "status", <!-- 0-未启用,1-已启用 -->
TABLE_CODE as "tableCode", <!-- 表英文名 -->
TABLE_NAME as "tableName", <!-- 表中文名 -->
FIELD_CODE as "fieldCode", <!-- 字段英文名 -->
FIELD_NAME as "fieldName", <!-- 字段中文名 -->
VIEW_SQL as "viewSql", <!-- -->
SORT_NUM as "sortNum", <!-- 排序 -->
IS_DEFAULT as "isDefault" <!-- 是否默认 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableCode">
TABLE_CODE = #tableCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="tableName">
TABLE_NAME LIKE CONCAT('%', #tableName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldCode">
FIELD_CODE LIKE CONCAT('%', #fieldCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fieldName">
FIELD_NAME LIKE CONCAT('%', #fieldName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="isDefault">
IS_DEFAULT = #isDefault#
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.pz.domain.HGPZ021">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGPZ021 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGPZ021 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGPZ021 (
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
STATUS, <!-- 0-未启用,1-已启用 -->
TABLE_CODE, <!-- 表英文名 -->
TABLE_NAME, <!-- 表中文名 -->
FIELD_CODE, <!-- 字段英文名 -->
FIELD_NAME, <!-- 字段中文名 -->
VIEW_SQL, <!-- 视图 -->
SORT_NUM, <!-- 排序 -->
IS_DEFAULT <!-- 是否默认 -->
) VALUES (
#createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#,
#deleteFlag#, #status#, #tableCode#, #tableName#, #fieldCode#, #fieldName#, #viewSql#,
#sortNum#, #isDefault#
)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGPZ021 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGPZ021
SET
TABLE_CODE = #tableCode#, <!-- 表英文名 -->
TABLE_NAME = #tableName#, <!-- 表中文名 -->
FIELD_CODE = #fieldCode#, <!-- 字段英文名 -->
FIELD_NAME = #fieldName#, <!-- 字段中文名 -->
VIEW_SQL = #viewSql#, <!-- 视图 -->
SORT_NUM = #sortNum#, <!-- 排序 -->
IS_DEFAULT = #isDefault#, <!-- 是否默认 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
<!-- 修改排序 -->
<update id="updateSort">
UPDATE ${hggpSchema}.HGPZ021
SET
SORT_NUM = #sortNum#, <!-- 排序 -->
IS_DEFAULT = #isDefault#, <!-- 是否默认 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
package com.baosight.hggp.hg.pz.tools;
import com.baosight.hggp.common.InventTypeEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.ValidFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.*;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.pz.domain.HGPZ002;
import com.baosight.hggp.hg.pz.domain.HGPZ003;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.pz.domain.HGPZ006;
import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.domain.HGPZ015A;
import com.baosight.hggp.hg.pz.domain.HGPZ016;
import com.baosight.hggp.hg.pz.domain.HGPZ017;
import com.baosight.hggp.hg.pz.domain.HGPZ018;
import com.baosight.hggp.hg.pz.domain.HGPZ020;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
......@@ -996,6 +1010,65 @@ public class HGPZTools {
}
}
}
/**
* HGPZ020 定义
*
* @author songx
* @date 2024/11/5,14:28
*/
public static class HgPz020 {
/**
* 查询
*
* @param tableCode
* @return
*/
public static List<HGPZ020> listByTable(String tableCode) {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HGPZ020.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
queryMap.put(HGPZ020.FIELD_TABLE_CODE, tableCode);
queryMap.put(EiConstant.orderByStr, " SORT_NUM ASC");
return DaoBase.getInstance().query(HGPZ020.QUERY, queryMap);
}
}
/**
* HGPZ021 定义
*
* @author songx
* @date 2024/11/5,14:28
*/
public static class HgPz021 {
/**
* 查询
*
* @param id
* @return
*/
public static HGPZ021 get(Long id) {
AssertUtils.isNull(id, "节点ID不能为空");
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HGPZ021.FIELD_ID, id);
List<HGPZ021> results = DaoBase.getInstance().query(HGPZ021.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param tableCode
* @return
*/
public static List<HGPZ021> listDefaultByTable(String tableCode) {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put(HGPZ021.FIELD_IS_DEFAULT, CommonConstant.YesNo.YES_1);
queryMap.put(HGPZ021.FIELD_TABLE_CODE, tableCode);
queryMap.put(EiConstant.orderByStr, " SORT_NUM ASC");
return DaoBase.getInstance().query(HGPZ021.QUERY, queryMap);
}
}
}
package com.baosight.hggp.hg.pz.utils;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ020;
import com.baosight.hggp.hg.pz.domain.HGPZ021;
import com.baosight.hggp.hg.pz.enums.DynamicTableEnum;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.collections.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author songx
* @date 2024/11/6,15:48
*/
public class HGPZUtils {
/**
* HGPZ020 定义
*
* @author songx
* @date 2024/11/6,15:48
*/
public static class HgPz020 {
/**
* 设置动态列
*
* @param inInfo
* @param dynamicTableEnum
* @return
*/
public static void buildDynamicColumn(EiInfo inInfo, DynamicTableEnum dynamicTableEnum) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
buildDynamicColumn(queryMap, dynamicTableEnum);
}
/**
* 设置动态列
*
* @param queryMap
* @param dynamicTableEnum
* @return
*/
public static void buildDynamicColumn(Map queryMap, DynamicTableEnum dynamicTableEnum) {
queryMap.put(CommonConstant.Field.DYNAMIC_COLUMN, buildDynamicColumn(dynamicTableEnum));
}
/**
* 设置动态列
*
* @param dynamicTableEnum 动态表
*/
public static String buildDynamicColumn(DynamicTableEnum dynamicTableEnum) {
// 查询企业配置的字段,如果未配置使用默认字段
List<HGPZ020> dbPz020s = HGPZTools.HgPz020.listByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz020s)) {
return dbPz020s.stream().map(item -> {
if (StringUtils.isEmpty(item.getViewSql())) {
return item.getFieldCode();
} else {
return item.getViewSql() + " as " + item.getFieldCode();
}
}).collect(Collectors.joining(","));
}
List<HGPZ021> dbPz021s = HGPZTools.HgPz021.listDefaultByTable(dynamicTableEnum.getCode());
if (CollectionUtils.isNotEmpty(dbPz021s)) {
return dbPz021s.stream().map(item -> {
if (StringUtils.isEmpty(item.getViewSql())) {
return item.getFieldCode();
} else {
return item.getViewSql() + " as " + item.getFieldCode();
}
}).collect(Collectors.joining(","));
}
return null;
}
/**
* 填充EiMetadata
*
* @param inInfo
* @param clazz
*/
public static void buildEiMetadata(EiInfo inInfo, Class clazz) {
EiBlock resultBlock = inInfo.getBlock(EiConstant.resultBlock);
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 动态列
String dynamicColumn = MapUtils.getString(queryMap, CommonConstant.Field.DYNAMIC_COLUMN);
if (StringUtils.isBlank(dynamicColumn)) {
return;
}
// 取实体类的Meta列信息
Map<String, EiColumn> originMetas = ((DaoEPBase) clazz.newInstance()).eiMetadata.getMetas();
for (String itemColumn : dynamicColumn.split(",")) {
// 需要去除字段前面的表别名
EiColumn eiColumn = originMetas.get(itemColumn);
if (eiColumn != null) {
resultBlock.addMeta(eiColumn);
}
}
} catch (Exception e) {
throw new PlatException("加载EiMetadata失败");
}
}
}
}
......@@ -14,6 +14,8 @@ public class HgScSqlConstant {
*/
public static class HgSc001 {
// 动态查询
public static final String DYNAMIC_QUERY = "HGSC001.dynamicQuery";
// 获取
public static final String GET_BY_CODE = "HGSC001.get";
// 德诚修改
......
......@@ -7,7 +7,8 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ001;
import com.baosight.hggp.hg.pz.domain.HGPZ002;
import com.baosight.hggp.hg.pz.enums.DynamicTableEnum;
import com.baosight.hggp.hg.pz.utils.HGPZUtils;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
......@@ -16,17 +17,25 @@ import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
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 java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @Author wwl
* @Date 2024/5/6 19:48
......@@ -45,20 +54,26 @@ public class ServiceHGSC001 extends ServiceBase {
}
return inInfo;
}
@OperationLogAnnotation(operModul = "项目立项", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001());
Map map = new HashMap();
map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "项目立项", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
// 设置动态列
HGPZUtils.HgPz020.buildDynamicColumn(inInfo, DynamicTableEnum.HGSC001);
inInfo = super.query(inInfo, HgScSqlConstant.HgSc001.DYNAMIC_QUERY, new HGSC001());
// 根据结果集填充eiMetadata
HGPZUtils.HgPz020.buildEiMetadata(inInfo, HGSC001.class);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@Override
@OperationLogAnnotation(operModul = "项目立项", operType = "删除", operDesc = "删除")
......
......@@ -136,6 +136,17 @@
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id desc
</isEmpty>
</dynamic>
</sql>
<select id="get" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT
<include refid="column"/>
......@@ -148,14 +159,7 @@
<include refid="column"/>
FROM ${hggpSchema}.HGSC001 WHERE 1=1
<include refid="customCondition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id desc
</isEmpty>
</dynamic>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
......@@ -163,6 +167,20 @@
<include refid="customCondition"/>
</select>
<select id="dynamicQuery" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT
<isEmpty property="dynamicColumn">ID as "id"</isEmpty>
<isNotEmpty property="dynamicColumn">$dynamicColumn$</isNotEmpty>
FROM ${hggpSchema}.HGSC001 WHERE 1=1
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
<select id="dynamicCount" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC001 WHERE 1=1
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC001 (id,
company_code, <!-- 公司编码 -->
......
......@@ -2,7 +2,6 @@ package com.baosight.hggp.util;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.HGConstants;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -16,7 +15,13 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -70,7 +75,7 @@ public class CommonMethod {
if (selectParams == null) {
selectParams = new HashMap<>();
}
selectParams.put("accountCode", UserSessionUtils.getAccountCode());
// selectParams.put("accountCode", UserSessionUtils.getAccountCode());
/* 遍历每个数据源 */
for (DdynamicEnum tableParam : tableParams) {
/* 编辑块名称 */
......
......@@ -124,6 +124,8 @@ public class DocExcelUtils {
f.set(obj, Integer.parseInt(cellValue));
} else if (f.getType() == Double.class || f.getType() == double.class) {
f.set(obj, Double.parseDouble(cellValue));
} else if (f.getType() == Long.class || f.getType() == long.class) {
f.set(obj, Long.parseLong(cellValue));
} else if (f.getType() == BigDecimal.class) {
f.set(obj, new BigDecimal(cellValue));
} else {
......
......@@ -192,8 +192,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
*/
private void setAccountCode(String name, Map parameters) {
// 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HGXSUser", "HGPZ009"};
if (StringUtils.startsWithAny(name, serviceFilter)) {
if (StringUtils.startsWithAny(name, CommonConstant.AuthFilter.ACCOUNT)) {
return;
}
// 本来是BUG,避免业务代码改动依然保持原逻辑ADMIN时依然置空
......@@ -221,8 +220,8 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
}
// 需要过滤部分sql name,否则会形成死循环;admin账户不需要校验
String loginName = UserSessionUtils.getLoginName();
String[] serviceFilter = {"HGXSUser", "HGXSOrg", "HGXSUserGroup", "HGPZ009", "HGPZ010.query"};
if (StringUtils.startsWithAny(name, serviceFilter) || "admin".equalsIgnoreCase(loginName)) {
if (StringUtils.startsWithAny(name, CommonConstant.AuthFilter.DATA)
|| "admin".equalsIgnoreCase(loginName)) {
return;
}
// 是否启用数据权限
......
......@@ -120,6 +120,8 @@
<!--配置-->
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005.xml"/>
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ020.xml"/>
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ021.xml"/>
<!--销售-->
<sqlMap resource="com/baosight/hggp/hg/yx/sql/HGYX001.xml"/>
......
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100]
},
columns: []
}
// 查询
$("#QUERY").on("click", query);
// 选择
$("#SELECT").on("click", select);
// 删除
$("#REMOVE").on("click", remove);
// 修改排序
$("#UPDATE_SORT").on("click", updateSort);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
};
/**
* 选择
*/
let select = function () {
JSColorbox.open({
href: "HGPZ020A",
title: "<div style='text-align: center;'>字段查询</div>",
width: "95%",
height: "95%",
callbackName: selectCallback
});
}
/**
* 选择回调
*/
let selectCallback = function () {
// 刷新页面
query();
}
/**
* 删除
*/
function remove() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HGPZ020", "remove", true);
}
})
}
/**
* 修改排序
*/
function updateSort() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.submitGridsData("result", "HGPZ020", "updateSort", true);
}
\ 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}"/>
<EF:EFPage title="表字段配置">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect ename="accountCode" cname="租户" blockId="inqu_status" row="0" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="account_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="tableCode" cname="表名称" blockId="result" row="0" colWidth="3" filter="contains"
required="true" optionLabel="全部" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
</EF:EFSelect>
<EF:EFInput ename="fieldCode" cname="字段英文名" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="fieldName" cname="字段中文名" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true" sort="single">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="租户编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="accountName" cname="租户名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="tableCode" cname="表英文名" enable="false" width="120" align="left"/>
<EF:EFColumn ename="tableName" cname="表中文名" enable="false" width="160" align="left"/>
<EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="160" align="left"/>
<EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left"/>
<EF:EFColumn ename="viewSql" cname="视图语句" enable="false" width="200" align="left" sort="false"/>
<EF:EFColumn ename="sortNum" cname="排序" width="100" align="center" required="true"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="updatedName" cname="修改人" enable="false" align="center"/>
<EF:EFColumn ename="updatedTime" cname="修改时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFSelect = {
"inqu_status-0-accountCode": {
change: function (e) { //获取勾选值
query();
}
}
}
IPLATUI.EFGrid = {
"result": {
exportGrid: false,
columns: []
}
}
// 查询
$("#QUERY").on("click", query);
// 确认
$("#CONFIRM").on("click", confirm);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 选择
*/
let confirm = function () {
let accountCode = $("#inqu_status-0-accountCode").val();
if (CommonUtils.isBlank(accountCode)) {
message("请选择租户");
return;
}
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
JSUtils.submitGridsData("result", "HGPZ020A", "confirm",
true, function (res) {
message(res.msg);
if (res.status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
}
<!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="查询区域" type="query">
<div class="row">
<EF:EFSelect ename="accountCode" cname="租户" blockId="inqu_status" row="0" colWidth="3" filter="contains"
required="true">
<EF:EFOptions blockId="account_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="tableCode" cname="表名称" blockId="result" row="0" colWidth="3" filter="contains"
required="true" optionLabel="全部" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
</EF:EFSelect>
<EF:EFInput ename="fieldCode" cname="字段英文名" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="fieldName" cname="字段中文名" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row" height="60vh">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="tableCode" cname="表英文名" enable="false" width="120" align="center"/>
<EF:EFColumn ename="tableName" cname="表中文名" enable="false" width="160" align="left"/>
<EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="160" align="center"/>
<EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left"/>
<EF:EFColumn ename="viewSql" cname="视图语句" enable="false" width="200" align="left" sort="false"/>
<EF:EFColumn ename="sortNum" cname="排序" enable="false" width="80" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20, pageSizes: [20, 50, 70, 100]
}, columns: [{
field: "operator", template: function (item) {
let template = '';
if (!CommonUtils.isBlank(item.id)) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="modify(' + item.id + ')">修改</a>';
}
return template
}
}]
}
// 查询
$("#QUERY").on("click", query);
// 新增
$("#ADD").on("click", add);
// 删除
$("#REMOVE").on("click", remove);
// 导入
$("#IMPORT").on("click", importData);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
};
/**
* 新增
*/
let add = function () {
addOrUpdate("");
}
/**
* 修改
*/
let modify = function (id) {
let params = "inqu_status-0-id=" + id;
addOrUpdate(params);
}
/**
* 新增
*/
let addOrUpdate = function (params) {
JSColorbox.open({
href: "HGPZ021A?" + params,
title: "<div style='text-align: center;'>" + (isBlank(params) ? "新增表字段" : "修改表字段")
+ "</div>",
width: "60%",
height: "70%",
callbackName: addOrUpdateCallback
});
}
/**
* 新增成功后回调
*/
let addOrUpdateCallback = function (res) {
// 刷新列表
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 删除
*/
function remove() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HGPZ021", "remove", true);
}
})
}
/**
* 导入
*/
let importData = function () {
CommonUtils.importData("HGPZ021", "表字段导入", importDataCallback);
}
/**
* 导入回调
*/
let importDataCallback = function () {
query();
}
\ 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}"/>
<EF:EFPage title="表字段管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect ename="tableCode" cname="表名称" blockId="result" row="0" colWidth="3" filter="contains"
required="true" optionLabel="全部" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
</EF:EFSelect>
<EF:EFInput ename="fieldCode" cname="字段英文名" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="fieldName" cname="字段中文名" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true" sort="single">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"
sort="false"/>
<EF:EFColumn ename="tableCode" cname="表英文名" enable="false" width="120" align="center"/>
<EF:EFColumn ename="tableName" cname="表中文名" enable="false" width="160" align="left"/>
<EF:EFColumn ename="fieldCode" cname="字段英文名" enable="false" width="160" align="left"/>
<EF:EFColumn ename="fieldName" cname="字段中文名" enable="false" width="180" align="left"/>
<EF:EFColumn ename="viewSql" cname="视图SQL" enable="false" width="200" align="left" sort="false"/>
<EF:EFColumn ename="sortNum" cname="排序" enable="false" width="80" align="center"/>
<EF:EFComboColumn ename="isDefault" cname="是否默认" enable="false" width="90" align="center">
<EF:EFCodeOption codeName="hggp.common.yesNo"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="updatedName" cname="修改人" enable="false" align="center"/>
<EF:EFColumn ename="updatedTime" cname="修改时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFSelect = {
"result-0-tableCode": {
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
var textField = dataItem['textField'];
if (!CommonUtils.isBlank(valueField)) {
textField = textField.indexOf("-") > -1 ? textField.split("-")[1] : textField;
$("#result-0-tableName").val(textField);
} else {
$("#result-0-tableName").val("");
}
}
}
}
IPLATUI.EFGrid = {
"result": {
pageable: false,
exportGrid: false,
toolbarConfig: {
hidden: false,
},
columns: []
}
};
// 确认
$('#SAVE').on('click', save);
// 键盘按键
downKeyUp();
})
/**
* 保存
*/
let save = function () {
let tableCode = $("#result-0-tableCode").val();
if (isBlank(tableCode)) {
message("表名称不能为空");
return;
}
let fieldCode = $("#result-0-fieldCode").val();
if (isBlank(fieldCode)) {
message("字段英文名不能为空");
return;
}
let fieldName = $("#result-0-fieldName").val();
if (isBlank(fieldName)) {
message("字段中文名不能为空");
return;
}
JSUtils.submitGridsData("", "HGPZ021A", "save", false,
function (res) {
if (res.status > -1) {
parent.JSColorbox.setValueCallback(res);
} else {
message(res.msg);
}
}
);
}
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="动态表详情">
<EF:EFRegion id="result" title="数据区域">
<EF:EFInput cname="ID" blockId="result" ename="id" row="0" type="hidden"/>
<div class="row">
<EF:EFSelect ename="tableCode" cname="表名称" blockId="result" row="0" colWidth="6" ratio="2:10"
filter="contains" required="true" optionLabel="请选择" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="app.pz.dynamicTable"/>
</EF:EFSelect>
<EF:EFInput ename="tableName" cname="表中文名" blockId="result" row="0" type="hidden"/>
</div>
<div class="row">
<EF:EFInput ename="fieldCode" cname="字段英文名" blockId="result" row="0" colWidth="6" ratio="2:10"
required="true"/>
</div>
<div class="row">
<EF:EFInput ename="fieldName" cname="字段中文名" blockId="result" row="0" colWidth="6" ratio="2:10"
required="true"/>
</div>
<div class="row">
<EF:EFInput ename="viewSql" cname="视图语句" blockId="result" row="0" colWidth="6" ratio="2:10"/>
</div>
<div class="row">
<EF:EFInput ename="sortNum" cname="排序" blockId="result" row="0" colWidth="6" ratio="2:10"/>
</div>
<div class="row">
<EF:EFSelect ename="isDefault" cname="是否默认" blockId="result" row="0" colWidth="6" ratio="2:10"
required="true">
<EF:EFCodeOption codeName="hggp.common.yesNo"/>
</EF:EFSelect>
</div>
<br/>
</EF:EFRegion>
</EF:EFPage>
......@@ -8,8 +8,6 @@
<script>
var ctx = "${ctx}";
</script>
<head>
</head>
<EF:EFPage title="项目立项">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
......@@ -32,7 +30,7 @@
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" copyToAdd="false">
<EF:EFGrid blockId="result" autoDraw="dynamic" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="center"/>
......
......@@ -770,6 +770,23 @@ function loadChange(grid,e,field) {
}
}
/**
* 导入
*
* @param id 路由ID
* @param title 标题
* @param callback 回调函数
*/
let importData = function (id, title, callback) {
JSColorbox.open({
href: "HGDM91?inqu_status-0-id=" + id,
title: "<div style='text-align: center;'>" + title + "</div>",
width: "600px",
height: "250px",
callbackName: callback
});
}
// export 到全局作用域 window对象
$.extend(window, {
CommonUtils: {
......@@ -778,7 +795,8 @@ function loadChange(grid,e,field) {
previewFile: previewFile,
isBlank: isBlank,
hideButton: hideButton,
showButton: showButton
showButton: showButton,
importData: importData
}
});
})(window.jQuery);
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