parent
070090b3a7
commit
e1743ced68
|
@ -5,6 +5,8 @@ import cn.hutool.crypto.SecureUtil;
|
|||
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
|
||||
import cn.hutool.crypto.symmetric.SymmetricCrypto;
|
||||
|
||||
import static cn.hutool.crypto.CipherMode.encrypt;
|
||||
|
||||
/**
|
||||
* @Description AES加密解密
|
||||
* @Author xiang2lin
|
||||
|
@ -77,4 +79,9 @@ public class AESUtil {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String data = "U8C241231";
|
||||
String encrypt1 = encrypt(data);
|
||||
System.out.println(encrypt1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.context.support.ApplicationObjectSupport;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author 郭军辉
|
||||
* <p>
|
||||
|
@ -26,7 +25,7 @@ public class DefaultController extends ApplicationObjectSupport {
|
|||
* @return
|
||||
*/
|
||||
public JsonResultEntity getFailureMessageEntity(String message) {
|
||||
return new JsonResultEntity(message, false);
|
||||
return new JsonResultEntity(message, false, "500");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +35,7 @@ public class DefaultController extends ApplicationObjectSupport {
|
|||
* @return
|
||||
*/
|
||||
public JsonResultEntity getFailureMessageEntity(String message, Object mo) {
|
||||
return new JsonResultEntity(message, false, mo);
|
||||
return new JsonResultEntity(message, false, "500", mo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,7 +46,7 @@ public class DefaultController extends ApplicationObjectSupport {
|
|||
* @return
|
||||
*/
|
||||
public JsonResultEntity getSuccessMessageEntity(String message, Object mo) {
|
||||
return new JsonResultEntity(message, true, mo);
|
||||
return new JsonResultEntity(message, true, "200", mo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,17 +56,10 @@ public class DefaultController extends ApplicationObjectSupport {
|
|||
* @return
|
||||
*/
|
||||
public JsonResultEntity getSuccessMessageEntity(String message) {
|
||||
return new JsonResultEntity(message, true);
|
||||
return new JsonResultEntity(message, true, "200");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* //绑定org_id
|
||||
*
|
||||
|
|
|
@ -26,8 +26,45 @@ public class MdmModuleEntity extends BaseEntity {
|
|||
private String createUser;
|
||||
//修改人
|
||||
private String modifyUser;
|
||||
/** 0:预制 1:手工 */
|
||||
private String tag;
|
||||
private String u8cDbPk;
|
||||
private String nccDbPk;
|
||||
private String ysDbPk;
|
||||
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String getU8cDbPk() {
|
||||
return u8cDbPk;
|
||||
}
|
||||
|
||||
public void setU8cDbPk(String u8cDbPk) {
|
||||
this.u8cDbPk = u8cDbPk;
|
||||
}
|
||||
|
||||
public String getNccDbPk() {
|
||||
return nccDbPk;
|
||||
}
|
||||
|
||||
public void setNccDbPk(String nccDbPk) {
|
||||
this.nccDbPk = nccDbPk;
|
||||
}
|
||||
|
||||
public String getYsDbPk() {
|
||||
return ysDbPk;
|
||||
}
|
||||
|
||||
public void setYsDbPk(String ysDbPk) {
|
||||
this.ysDbPk = ysDbPk;
|
||||
}
|
||||
|
||||
public String getMdmName() {
|
||||
return mdmName;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="tag" column="tag" jdbcType="VARCHAR"/>
|
||||
<result property="u8cDbPk" column="u8c_db_pk" jdbcType="VARCHAR"/>
|
||||
<result property="nccDbPk" column="ncc_db_pk" jdbcType="VARCHAR"/>
|
||||
<result property="ysDbPk" column="ys_db_pk" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
@ -39,6 +43,10 @@
|
|||
,sts
|
||||
,org_id
|
||||
,company_id
|
||||
,tag
|
||||
,u8c_db_pk
|
||||
,ncc_db_pk
|
||||
,ys_db_pk
|
||||
</sql>
|
||||
<!--通过ID获取数据 -->
|
||||
<select id="entity_get" resultMap="get-MdmModuleEntity-result">
|
||||
|
@ -67,6 +75,10 @@
|
|||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
||||
<if test="tag != null and tag != ''">and tag = #{tag}</if>
|
||||
<if test="u8cDbPk != null and u8cDbPk != ''">and u8c_db_pk = #{u8cDbPk}</if>
|
||||
<if test="nccDbPk != null and nccDbPk != ''">and ncc_db_pk = #{nccDbPk}</if>
|
||||
<if test="ysDbPk != null and ysDbPk != ''">and ys_db_pk = #{ysDbPk}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -91,6 +103,10 @@
|
|||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
||||
<if test="tag != null and tag != ''">and tag = #{tag}</if>
|
||||
<if test="u8cDbPk != null and u8cDbPk != ''">and u8c_db_pk = #{u8cDbPk}</if>
|
||||
<if test="nccDbPk != null and nccDbPk != ''">and ncc_db_pk = #{nccDbPk}</if>
|
||||
<if test="ysDbPk != null and ysDbPk != ''">and ys_db_pk = #{ysDbPk}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -122,6 +138,7 @@
|
|||
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
|
||||
<if test="companyId != null and companyId != ''">and company_id like concat('%',#{companyId},'%')</if>
|
||||
<if test="tag != null and tag != ''">and tag like concat('%',#{tag},'%')</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -149,6 +166,7 @@
|
|||
<if test="sts != null and sts != ''">or sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">or org_id = #{org_id}</if>
|
||||
<if test="companyId != null and companyId != ''">or company_id = #{companyId}</if>
|
||||
<if test="tag != null and tag != ''">or tag = #{tag}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -175,6 +193,10 @@
|
|||
<if test="org_id != null and org_id != ''">org_id ,</if>
|
||||
<if test="companyId != null and companyId != ''">company_id ,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
<if test="tag == null ">tag ,</if>
|
||||
<if test="u8cDbPk != null and u8cDbPk != ''">u8c_db_pk,</if>
|
||||
<if test="nccDbPk != null and nccDbPk != ''">ncc_db_pk,</if>
|
||||
<if test="ysDbPk != null and ysDbPk != ''">ys_db_pk,</if>
|
||||
</trim>
|
||||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
|
@ -194,6 +216,10 @@
|
|||
<if test="org_id != null and org_id != ''">#{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''">#{companyId} ,</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
<if test="tag == null ">'1',</if>
|
||||
<if test="u8cDbPk != null and u8cDbPk != ''">#{u8cDbPk},</if>
|
||||
<if test="nccDbPk != null and nccDbPk != ''">#{nccDbPk},</if>
|
||||
<if test="ysDbPk != null and ysDbPk != ''">#{ysDbPk},</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
|
@ -281,6 +307,9 @@ where id = #{id}
|
|||
<select id="queryMdm" resultMap="get-MdmModuleEntity-result"
|
||||
parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity">
|
||||
select
|
||||
a.u8c_db_pk as u8c_db_pk,
|
||||
a.ncc_db_pk as ncc_db_pk,
|
||||
a.ys_db_pk as ys_db_pk,
|
||||
a.id as id,
|
||||
a.mdm_name as mdm_name,
|
||||
a.mdm_logo as mdm_logo,
|
||||
|
@ -974,10 +1003,10 @@ where id = #{id}
|
|||
< #{item.filedVaule}
|
||||
</when>
|
||||
<when test="item.compareType == '5'.toString() ">
|
||||
like #{item.filedVaule}
|
||||
like concat('%',#{item.filedVaule},'%')
|
||||
</when>
|
||||
<when test="item.compareType == '6'.toString() ">
|
||||
not like #{item.filedVaule}
|
||||
not like concat('%',#{item.filedVaule},'%')
|
||||
</when>
|
||||
</choose>
|
||||
|
||||
|
|
|
@ -3,7 +3,14 @@ package com.hzya.frame.mdm.mdmModule.service;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.mdm.mdmModule.vo.ImportExcelVO;
|
||||
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主数据模版(MdmModule)表服务接口
|
||||
|
@ -397,4 +404,16 @@ public interface IMdmModuleService extends IBaseService<MdmModuleEntity, String>
|
|||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity queryMdmDistributeByMdmCode(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 下载导入模版
|
||||
* @return
|
||||
*/
|
||||
void generateExcelTemplate(HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 导入模版
|
||||
* @param file
|
||||
*/
|
||||
List<MdmModuleDbFiledsEntity> importTemplateFile(MultipartFile file, ImportExcelVO importExcelVO);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
package com.hzya.frame.mdm.mdmModule.service.impl;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hzya.frame.beanutil.BeanUtil;
|
||||
import com.hzya.frame.mdm.entity.MdmDbFiledVo;
|
||||
import com.hzya.frame.mdm.entity.MdmDto;
|
||||
import com.hzya.frame.mdm.entity.MdmModuleViewVo;
|
||||
|
@ -10,6 +19,8 @@ import com.hzya.frame.mdm.entity.MdmQuery;
|
|||
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
||||
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
||||
import com.hzya.frame.mdm.mdmModule.service.IMdmModuleService;
|
||||
import com.hzya.frame.mdm.mdmModule.vo.ExcelTemplateVO;
|
||||
import com.hzya.frame.mdm.mdmModule.vo.ImportExcelVO;
|
||||
import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao;
|
||||
import com.hzya.frame.mdm.mdmModuleDb.dao.impl.MdmModuleDbDaoImpl;
|
||||
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
|
||||
|
@ -50,17 +61,24 @@ import com.hzya.frame.web.entity.BaseResult;
|
|||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import com.hzya.frame.web.exception.BaseSystemException;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 主数据模版(MdmModule)表服务实现类
|
||||
|
@ -443,6 +461,22 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
|||
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
||||
if ("1".equals(mdmModuleDbEntities.get(i).getDbType()) || "2".equals(mdmModuleDbEntities.get(i).getDbType())) {
|
||||
dbEntities.add(mdmModuleDbEntities.get(i));
|
||||
//查询合并规则。add by zyd 20250707
|
||||
List<String> filedNames=new ArrayList<>();
|
||||
if (mdmModuleDbEntities.get(i).getMergeRules() != null && !"".equals(mdmModuleDbEntities.get(i).getMergeRules())) {
|
||||
String mergeRulesIds = mdmModuleDbEntities.get(i).getMergeRules();
|
||||
String[] split = mergeRulesIds.split(",");
|
||||
for (String filedId : split) {
|
||||
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
|
||||
mdmModuleDbFiledsEntity.setId(filedId);
|
||||
List<MdmModuleDbFiledsEntity> fileds = mdmModuleDbFiledsDao.query(mdmModuleDbFiledsEntity);
|
||||
if(fileds.size()!=0){
|
||||
filedNames.add(fileds.get(0).getChName());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
mdmModuleDbEntities.get(i).setMergeRulesStr(String.join(",",filedNames));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1403,7 +1437,8 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
|||
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
|
||||
mdmModuleDbFiledsEntity.setMdmId(entity.getMdmId());
|
||||
mdmModuleDbFiledsEntity.setSts("Y");
|
||||
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity);
|
||||
// List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity);
|
||||
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.query(mdmModuleDbFiledsEntity);
|
||||
if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) {
|
||||
for (int i = 0; i < mdmModuleDbFiledsEntityList.size(); i++) {
|
||||
if (entity.getDbId().equals(mdmModuleDbFiledsEntityList.get(i).getDbId()) && entity.getEnName().equals(mdmModuleDbFiledsEntityList.get(i).getEnName())) {
|
||||
|
@ -1411,6 +1446,42 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
|||
}
|
||||
}
|
||||
}
|
||||
//新增时:查询sysPk,sysCode,sysName段是否存在 add by zyd 2025-06-09
|
||||
boolean isSysPk = false;
|
||||
boolean isSysCode = false;
|
||||
boolean isSysName = false;
|
||||
boolean isSysDate = false;
|
||||
for (MdmModuleDbFiledsEntity dbFiledsEntity : mdmModuleDbFiledsEntityList) {
|
||||
if (entity.getDbId().equals(dbFiledsEntity.getDbId())) {
|
||||
if (entity.getDbId().equals(dbFiledsEntity.getDbId())) {
|
||||
if ("Y".equals(dbFiledsEntity.getIsSysPk())) {
|
||||
isSysPk = true;
|
||||
}
|
||||
if ("Y".equals(dbFiledsEntity.getIsSysCode())) {
|
||||
isSysCode = true;
|
||||
}
|
||||
if ("Y".equals(dbFiledsEntity.getIsSysName())) {
|
||||
isSysName = true;
|
||||
}
|
||||
if ("Y".equals(dbFiledsEntity.getIsSysDate())) {
|
||||
isSysDate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//判端该字段是不是sysPk,sysCode,sysName=true
|
||||
if ("Y".equals(entity.getIsSysPk()) && isSysPk) {
|
||||
return BaseResult.getFailureMessageEntity("系统主键字段已存在,请修改");
|
||||
}
|
||||
if ("Y".equals(entity.getIsSysCode()) && isSysCode) {
|
||||
return BaseResult.getFailureMessageEntity("系统code字段已存在,请修改");
|
||||
}
|
||||
if ("Y".equals(entity.getIsSysName()) && isSysName) {
|
||||
return BaseResult.getFailureMessageEntity("系统name字段已存在,请修改");
|
||||
}
|
||||
if ("Y".equals(entity.getIsSysDate()) && isSysDate) {
|
||||
return BaseResult.getFailureMessageEntity("系统date字段已存在,请修改");
|
||||
}
|
||||
entity.setCreate();
|
||||
if ("1".equals(entity.getDbType())) {
|
||||
entity.setAddType("1");
|
||||
|
@ -1488,6 +1559,49 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
|||
} catch (Exception e) {
|
||||
throw new BaseSystemException("表字段类型,修改失败,请联系管理员");
|
||||
}
|
||||
|
||||
//更新时:查询sysPk,sysCode,sysName段是否存在 add by zyd 2025-06-09
|
||||
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
|
||||
mdmModuleDbFiledsEntity.setDbId(entity.getDbId());
|
||||
mdmModuleDbFiledsEntity.setMdmId(entity.getMdmId());
|
||||
mdmModuleDbFiledsEntity.setSts("Y");
|
||||
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.query(mdmModuleDbFiledsEntity);
|
||||
boolean isSysPk = false;
|
||||
boolean isSysCode = false;
|
||||
boolean isSysName = false;
|
||||
boolean isSysDate = false;
|
||||
for (MdmModuleDbFiledsEntity dbFiledsEntity : mdmModuleDbFiledsEntityList) {
|
||||
if (entity.getDbId().equals(dbFiledsEntity.getDbId())) {
|
||||
if (entity.getDbId().equals(dbFiledsEntity.getDbId())) {
|
||||
if ("Y".equals(dbFiledsEntity.getIsSysPk())) {
|
||||
isSysPk = true;
|
||||
}
|
||||
if ("Y".equals(dbFiledsEntity.getIsSysCode())) {
|
||||
isSysCode = true;
|
||||
}
|
||||
if ("Y".equals(dbFiledsEntity.getIsSysName())) {
|
||||
isSysName = true;
|
||||
}
|
||||
if ("Y".equals(dbFiledsEntity.getIsSysDate())) {
|
||||
isSysDate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//判端该字段是不是sysPk,sysCode,sysName=true
|
||||
if ("Y".equals(entity.getIsSysPk()) && isSysPk) {
|
||||
return BaseResult.getFailureMessageEntity("系统主键字段已存在,请修改");
|
||||
}
|
||||
if ("Y".equals(entity.getIsSysCode()) && isSysCode) {
|
||||
return BaseResult.getFailureMessageEntity("系统code字段已存在,请修改");
|
||||
}
|
||||
if ("Y".equals(entity.getIsSysName()) && isSysName) {
|
||||
return BaseResult.getFailureMessageEntity("系统name字段已存在,请修改");
|
||||
}
|
||||
if ("Y".equals(entity.getIsSysDate()) && isSysDate) {
|
||||
return BaseResult.getFailureMessageEntity("系统date字段已存在,请修改");
|
||||
}
|
||||
|
||||
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = new ArrayList<>();
|
||||
mdmModuleDbFiledsEntities.add(entity);
|
||||
mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities);
|
||||
|
@ -1551,6 +1665,7 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
|||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
MdmModuleDbFiledsRuleEntity queryCount = new MdmModuleDbFiledsRuleEntity();
|
||||
queryCount.setMdmId(entity.getMdmId());
|
||||
queryCount.setDbId(entity.getDbId());
|
||||
queryCount.setRuleCode("label");
|
||||
queryCount.setRuleValue(entity.getEnName());
|
||||
|
@ -2864,4 +2979,290 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
|||
List<MdmModuleDistributeEntity> list = mdmModuleDistributeDao.queryBase(entity);
|
||||
return BaseResult.getSuccessMessageEntity("获取分发设置成功", list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成导入模版
|
||||
*/
|
||||
@Override
|
||||
public void generateExcelTemplate(HttpServletResponse response) throws IOException {
|
||||
// 设置响应内容类型
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 设置文件名,注意中文需要URLEncoder编码
|
||||
String fileName = URLEncoder.encode("表字段定义模版", "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
// 准备模板的示例数据
|
||||
List<ExcelTemplateVO> demoData = new ArrayList<>(); //createTemplateDemoData()
|
||||
// 使用EasyExcel直接写入响应输出流
|
||||
EasyExcel.write(response.getOutputStream(), ExcelTemplateVO.class)
|
||||
.sheet("表字段定义模版")
|
||||
.doWrite(demoData);
|
||||
}
|
||||
|
||||
/*private List<ExcelTemplateVO> createTemplateDemoData() {
|
||||
List<ExcelTemplateVO> demoData = new ArrayList<>();
|
||||
ExcelTemplateVO demo = new ExcelTemplateVO();
|
||||
demo.setChName("用户ID");
|
||||
demo.setEnName("userId");
|
||||
demo.setFiledType("1"); // 对应BIGINT类型
|
||||
demo.setFiledLength("20");
|
||||
demo.setIsSysPk("Y");
|
||||
demo.setIsSysCode("Y");
|
||||
demo.setIsSysName("N");
|
||||
demo.setIsSysDate("N");
|
||||
demo.setTitle("用户ID");
|
||||
demo.setRow("6");
|
||||
demo.setWidth("100");
|
||||
demo.setType("input");
|
||||
demo.setRequired("true");
|
||||
demo.setDisabled("true");
|
||||
|
||||
demoData.add(demo);
|
||||
return demoData;
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* 导入模版
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public List<MdmModuleDbFiledsEntity> importTemplateFile(MultipartFile file , ImportExcelVO importExcelVO) {
|
||||
// 校验文件合法性
|
||||
if (file == null || file.isEmpty()) {
|
||||
throw new IllegalArgumentException("导入文件不能为空");
|
||||
}
|
||||
// 校验文件格式
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (fileName == null || (!fileName.endsWith(".xlsx") && !fileName.endsWith(".xls"))) {
|
||||
throw new IllegalArgumentException("请上传Excel格式文件");
|
||||
}
|
||||
// 表头数据
|
||||
List<List<String>> headerList = new ArrayList<>();
|
||||
// 用于存储内容数据
|
||||
List<ExcelTemplateVO> dataList = new ArrayList<>();
|
||||
List<MdmModuleDbFiledsEntity> resultEntities = new ArrayList<>();
|
||||
try (InputStream inputStream = file.getInputStream()) {
|
||||
// 使用EasyExcel读取文件
|
||||
EasyExcel.read(inputStream)
|
||||
.head(ExcelTemplateVO.class) // 指定映射的实体类
|
||||
.sheet(0) // 指定第一个sheet页
|
||||
.headRowNumber(1) // 表头行数(从1开始)
|
||||
.autoTrim(true)
|
||||
.registerReadListener(new AnalysisEventListener<ExcelTemplateVO>() {
|
||||
/**
|
||||
* 获取表头行数据
|
||||
*/
|
||||
@Override
|
||||
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
|
||||
// 1. 转换表头为有序列表
|
||||
List<String> header = new ArrayList<>();
|
||||
// 获取最大列索引,确保顺序正确
|
||||
int maxColIndex = headMap.keySet().stream().mapToInt(Integer::intValue).max().orElse(-1);
|
||||
for (int i = 0; i <= maxColIndex; i++) {
|
||||
header.add(headMap.getOrDefault(i, "")); // 无数据的列填空
|
||||
}
|
||||
headerList.add(header);
|
||||
}
|
||||
/**
|
||||
* 每解析一行数据触发
|
||||
*/
|
||||
@Override
|
||||
public void invoke(ExcelTemplateVO data, AnalysisContext context) {
|
||||
// 空行直接跳过
|
||||
if (isRowEmpty(data)) {
|
||||
return;
|
||||
}
|
||||
// 数据校验
|
||||
validateData(data, context.readRowHolder().getRowIndex() + 1);
|
||||
dataList.add(data);
|
||||
}
|
||||
/**
|
||||
* 所有数据解析完成后触发
|
||||
*/
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
// 解析完成后的数据处理
|
||||
List<MdmModuleDbFiledsEntity> entities = processImportData(headerList, dataList, importExcelVO);
|
||||
if (entities != null) {
|
||||
resultEntities.addAll(entities);
|
||||
}
|
||||
}
|
||||
})
|
||||
.doRead(); // 执行读取操作
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("文件读取失败:" + e.getMessage(), e);
|
||||
}
|
||||
return resultEntities;
|
||||
}
|
||||
|
||||
private boolean isRowEmpty(ExcelTemplateVO data) {
|
||||
if(data == null) {
|
||||
return true;
|
||||
}
|
||||
return StringUtils.isEmpty(data.getChName() ) &&
|
||||
StringUtils.isEmpty(data.getFiledType()) &&
|
||||
StringUtils.isEmpty(data.getEnName()) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据,新增字段
|
||||
* @param headerList
|
||||
* @param dataList
|
||||
*/
|
||||
private List<MdmModuleDbFiledsEntity> processImportData(List<List<String>> headerList, List<ExcelTemplateVO> dataList,ImportExcelVO importExcelVO) {
|
||||
// 获取表头列名
|
||||
List<String> headers = headerList.get(0);
|
||||
// 数据库字段数据
|
||||
List<MdmModuleDbFiledsEntity> entities = new ArrayList<>();
|
||||
for (ExcelTemplateVO data : dataList) {
|
||||
MdmModuleDbFiledsEntity entity = new MdmModuleDbFiledsEntity();
|
||||
BeanUtils.copyProperties(data, entity);
|
||||
// 字段规则数据集合
|
||||
List<MdmModuleDbFiledsRuleEntity> rules = new ArrayList<>();
|
||||
for (String header : headers) {
|
||||
// 字段规则数据
|
||||
MdmModuleDbFiledsRuleEntity rule = new MdmModuleDbFiledsRuleEntity();
|
||||
rule.setRuleType("2");
|
||||
rule.setFormName("optionRuleForm");
|
||||
switch (header) {
|
||||
case "显示名":
|
||||
rule.setRuleName("显示名");
|
||||
rule.setRuleCode("title");
|
||||
rule.setRuleValue(data.getChName());
|
||||
break;
|
||||
case "宽度":
|
||||
rule.setRuleName("宽度");
|
||||
rule.setRuleCode("row");
|
||||
rule.setRuleValue(data.getRow());
|
||||
break;
|
||||
case "单元格宽度":
|
||||
rule.setRuleName("单元格宽度");
|
||||
rule.setRuleCode("width");
|
||||
rule.setRuleValue(data.getWidth());
|
||||
break;
|
||||
case "数据类型":
|
||||
rule.setRuleName("数据类型");
|
||||
rule.setRuleCode("type");
|
||||
rule.setRuleValue(data.getType());
|
||||
break;
|
||||
case "必填":
|
||||
rule.setRuleName("必填");
|
||||
rule.setRuleCode("required");
|
||||
rule.setRuleValue(data.getRequired() != null ? "true" : "false");
|
||||
break;
|
||||
case "禁止修改":
|
||||
rule.setRuleName("禁止修改");
|
||||
rule.setRuleCode("disabled");
|
||||
rule.setRuleValue(data.getDisabled() != null ? "true" : "false");
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
rules.add(rule);
|
||||
}
|
||||
entity.setMdmModuleDbFiledsRules(rules);
|
||||
entity.setDbName(importExcelVO.getDbName());
|
||||
entity.setDbId(importExcelVO.getDbId());
|
||||
entity.setDbType(importExcelVO.getDbType());
|
||||
entity.setMdmId(importExcelVO.getMdmId());
|
||||
entities.add(entity);
|
||||
}
|
||||
return entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据校验方法,验证Excel导入的数据合法性
|
||||
* @param data 导入的Excel数据对象
|
||||
* @param rowNum 行号
|
||||
*/
|
||||
private void validateData(ExcelTemplateVO data, int rowNum) {
|
||||
List<String> errors = new ArrayList<>();
|
||||
|
||||
// 1. 校验中文名称必填
|
||||
if (StringUtils.isBlank(data.getChName())) {
|
||||
errors.add("第" + rowNum + "行:中文名称不能为空");
|
||||
}
|
||||
|
||||
// 2. 校验字段类型合法性
|
||||
if (StringUtils.isBlank(data.getFiledType())) {
|
||||
errors.add("第" + rowNum + "行:字段类型不能为空");
|
||||
} else {
|
||||
Set<String> validTypes = new HashSet<>(Arrays.asList("1", "2", "3", "4"));
|
||||
if (!validTypes.contains(data.getFiledType())) {
|
||||
errors.add("第" + rowNum + "行:字段类型无效,允许值为1(BIGINT)、2(DECIMAL)、3(VARCHAR)、4(DATETIME)");
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 校验长度(数字类型且当字段类型为1、2、3时必填)
|
||||
if (StringUtils.isNotBlank(data.getFiledType()) &&
|
||||
(data.getFiledType().equals("1") || data.getFiledType().equals("2") || data.getFiledType().equals("3"))) {
|
||||
|
||||
if (StringUtils.isBlank(data.getFiledLength())) {
|
||||
errors.add("第" + rowNum + "行:字段长度不能为空");
|
||||
} else if (!StringUtils.isNumeric(data.getFiledLength())) {
|
||||
errors.add("第" + rowNum + "行:字段长度必须为数字");
|
||||
} else {
|
||||
int length = Integer.parseInt(data.getFiledLength());
|
||||
if (length <= 0) {
|
||||
errors.add("第" + rowNum + "行:字段长度必须大于0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 校验系统主键标识合法性
|
||||
if (StringUtils.isNotBlank(data.getIsSysPk()) &&
|
||||
!"Y".equals(data.getIsSysPk()) && !"N".equals(data.getIsSysPk())) {
|
||||
errors.add("第" + rowNum + "行:是否系统主键只能为Y或N");
|
||||
}
|
||||
|
||||
// 5. 校验系统数据编码标识合法性
|
||||
if (StringUtils.isNotBlank(data.getIsSysCode()) &&
|
||||
!"Y".equals(data.getIsSysCode()) && !"N".equals(data.getIsSysCode())) {
|
||||
errors.add("第" + rowNum + "行:是否系统数据编码只能为Y或N");
|
||||
}
|
||||
|
||||
// 6. 校验系统数据名称标识合法性
|
||||
if (StringUtils.isNotBlank(data.getIsSysName()) &&
|
||||
!"Y".equals(data.getIsSysName()) && !"N".equals(data.getIsSysName())) {
|
||||
errors.add("第" + rowNum + "行:是否系统数据名称只能为Y或N");
|
||||
}
|
||||
|
||||
// 7. 校验系统日期标识合法性
|
||||
if (StringUtils.isNotBlank(data.getIsSysDate()) &&
|
||||
!"Y".equals(data.getIsSysDate()) && !"N".equals(data.getIsSysDate())) {
|
||||
errors.add("第" + rowNum + "行:是否系统日期只能为Y或N");
|
||||
}
|
||||
|
||||
// 8. 校验是否必填标识合法性
|
||||
if (data.getRequired() != null && !data.getRequired().trim().isEmpty()) {
|
||||
String required = data.getRequired().trim();
|
||||
if (!"TRUE".equalsIgnoreCase(required) && !"FALSE".equalsIgnoreCase(required)) {
|
||||
errors.add("第" + rowNum + "行:是否必填只能为true或false");
|
||||
}
|
||||
}
|
||||
|
||||
// 9. 校验禁止修改标识合法性
|
||||
if (data.getDisabled() != null && !data.getDisabled().trim().isEmpty()) {
|
||||
String disabled = data.getDisabled().trim();
|
||||
if (!"TRUE".equalsIgnoreCase(disabled) && !"FALSE".equalsIgnoreCase(disabled)) {
|
||||
errors.add("第" + rowNum + "行:禁止修改只能为true或false");
|
||||
}
|
||||
}
|
||||
|
||||
// 如果有错误,抛出异常中断导入
|
||||
if (!errors.isEmpty()) {
|
||||
throw new ExcelDataValidateException(String.join(";", errors));
|
||||
}
|
||||
}
|
||||
|
||||
// 自定义异常类
|
||||
public class ExcelDataValidateException extends RuntimeException {
|
||||
public ExcelDataValidateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,25 @@ public class MdmModuleDbEntity extends BaseEntity {
|
|||
/** 数据类型 1、新增 2、修改 */
|
||||
private String dataType;
|
||||
private List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds;
|
||||
/** 合并规则,字段id使用逗号隔开 */
|
||||
private String mergeRules;
|
||||
private String mergeRulesStr;
|
||||
|
||||
public String getMergeRules() {
|
||||
return mergeRules;
|
||||
}
|
||||
|
||||
public void setMergeRules(String mergeRules) {
|
||||
this.mergeRules = mergeRules;
|
||||
}
|
||||
|
||||
public String getMergeRulesStr() {
|
||||
return mergeRulesStr;
|
||||
}
|
||||
|
||||
public void setMergeRulesStr(String mergeRulesStr) {
|
||||
this.mergeRulesStr = mergeRulesStr;
|
||||
}
|
||||
|
||||
public String getMdmId() {
|
||||
return mdmId;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="mergeRules" column="merge_rules" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id="MdmModuleDbEntity_Base_Column_List">
|
||||
|
@ -32,6 +33,7 @@
|
|||
,sts
|
||||
,org_id
|
||||
,company_id
|
||||
,merge_rules
|
||||
</sql>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-MdmModuleDbEntity-result"
|
||||
|
@ -53,6 +55,7 @@
|
|||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
||||
<if test="mergeRules != null and mergeRules != ''">and merge_rules = #{mergeRules}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -77,6 +80,7 @@
|
|||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
||||
<if test="mergeRules != null and mergeRules != ''">and merge_rules = #{mergeRules}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -107,6 +111,7 @@
|
|||
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
|
||||
<if test="companyId != null and companyId != ''">and company_id like concat('%',#{companyId},'%')</if>
|
||||
<if test="mergeRules != null and mergeRules != ''">and merge_rules like concat('%',#{mergeRules},'%')</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -133,6 +138,7 @@
|
|||
<if test="sts != null and sts != ''">or sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">or org_id = #{org_id}</if>
|
||||
<if test="companyId != null and companyId != ''">or company_id = #{companyId}</if>
|
||||
<if test="mergeRules != null and mergeRules != ''">or merge_rules = #{mergeRules}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -156,6 +162,7 @@
|
|||
<if test="sts != null and sts != ''">sts ,</if>
|
||||
<if test="org_id != null and org_id != ''">org_id ,</if>
|
||||
<if test="companyId != null and companyId != ''">company_id ,</if>
|
||||
<if test="mergeRules != null and mergeRules != ''">merge_rules ,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
|
@ -173,6 +180,7 @@
|
|||
<if test="sts != null and sts != ''">#{sts} ,</if>
|
||||
<if test="org_id != null and org_id != ''">#{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''">#{companyId} ,</if>
|
||||
<if test="mergeRules != null and mergeRules != ''">#{mergeRules} ,</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
|
@ -180,10 +188,10 @@
|
|||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch">
|
||||
insert into mdm_module_db(mdm_id, db_name, db_type, remark, create_user_id, create_time, modify_user_id,
|
||||
modify_time, sts, org_id, company_id, sts)
|
||||
modify_time, sts, org_id, company_id, merge_rules, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},
|
||||
(#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.mergeRules},
|
||||
'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
|
@ -223,6 +231,7 @@
|
|||
<if test="sts != null and sts != ''">sts = #{sts},</if>
|
||||
<if test="org_id != null and org_id != ''">org_id = #{org_id},</if>
|
||||
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
|
||||
<if test="mergeRules != null and mergeRules != ''">merge_rules = #{mergeRules},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
@ -244,6 +253,7 @@ where id = #{id}
|
|||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
||||
<if test="mergeRules != null and mergeRules != ''">and merge_rules = #{mergeRules}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</update>
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.hzya.frame.mdm.mdmModuleDbFileds.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
|
||||
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
|
@ -20,10 +23,13 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
|
|||
/** 模版数据库id */
|
||||
private String dbId;
|
||||
/** 中文名 */
|
||||
@ExcelProperty(value = "中文名称", index = 0)
|
||||
private String chName;
|
||||
/** 英文名 */
|
||||
@ExcelProperty(value = "英文名称", index = 1)
|
||||
private String enName;
|
||||
/** 字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME */
|
||||
@ExcelProperty(value = "字段类型", index = 2)
|
||||
private String filedType;
|
||||
/** 显示类型:新增 */
|
||||
private String addType;
|
||||
|
@ -33,11 +39,13 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
|
|||
private String showType;
|
||||
/** 显示类型:查询 */
|
||||
private String queryType;
|
||||
|
||||
/** 显示类型:列表 */
|
||||
private String listType;
|
||||
/** 显示类型:显示 */
|
||||
private String viewType;
|
||||
/** 长度 */
|
||||
@ExcelProperty(value = "长度", index = 3)
|
||||
private String filedLength;
|
||||
/** 公司id */
|
||||
private String companyId;
|
||||
|
@ -57,6 +65,26 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
|
|||
|
||||
//1、查询2、列表3、新增4、修改 5、查看
|
||||
private String fieldType;
|
||||
/**
|
||||
* 是否sys主键 系统主键(三方系统主键,同步中台之后,该字段作为主键)Y/N
|
||||
*/
|
||||
@ExcelProperty(value = "是否系统主键", index = 4)
|
||||
private String isSysPk;
|
||||
/**
|
||||
* 是否sys编码 系统code(三方系统code,同步中台之后,该字段作为code)Y/N
|
||||
*/
|
||||
@ExcelProperty(value = "是否系统数据编码", index = 5)
|
||||
private String isSysCode;
|
||||
/**
|
||||
* 是否sys名称 系统name(三方系统name,同步中台之后,该字段作为name)Y/N
|
||||
*/
|
||||
@ExcelProperty(value = "是否系统数据名称", index = 6)
|
||||
private String isSysName;
|
||||
/**
|
||||
* 是否sys日期 系统date(三方系统name,同步中台之后,该字段作为name)Y/N
|
||||
*/
|
||||
@ExcelProperty(value = "是否系统日期", index = 7)
|
||||
private String isSysDate;
|
||||
public String getMdmId() {
|
||||
return mdmId;
|
||||
}
|
||||
|
@ -216,5 +244,67 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
|
|||
public void setDbType(String dbType) {
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getIsSysPk() {
|
||||
return isSysPk;
|
||||
}
|
||||
|
||||
public void setIsSysPk(String isSysPk) {
|
||||
this.isSysPk = isSysPk;
|
||||
}
|
||||
|
||||
public String getIsSysCode() {
|
||||
return isSysCode;
|
||||
}
|
||||
|
||||
public void setIsSysCode(String isSysCode) {
|
||||
this.isSysCode = isSysCode;
|
||||
}
|
||||
|
||||
public String getIsSysName() {
|
||||
return isSysName;
|
||||
}
|
||||
|
||||
public void setIsSysName(String isSysName) {
|
||||
this.isSysName = isSysName;
|
||||
}
|
||||
|
||||
public String getIsSysDate() {
|
||||
return isSysDate;
|
||||
}
|
||||
|
||||
public void setIsSysDate(String isSysDate) {
|
||||
this.isSysDate = isSysDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联的表
|
||||
*/
|
||||
private MdmModuleDbEntity mdmModuleDbEntity;
|
||||
|
||||
public MdmModuleDbEntity getMdmModuleDbEntity() {
|
||||
return mdmModuleDbEntity;
|
||||
}
|
||||
|
||||
public void setMdmModuleDbEntity(MdmModuleDbEntity mdmModuleDbEntity) {
|
||||
this.mdmModuleDbEntity = mdmModuleDbEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联字段
|
||||
*/
|
||||
private List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds;
|
||||
|
||||
public List<MdmModuleDbFiledsEntity> getSublistMdmModuleDbFileds() {
|
||||
return sublistMdmModuleDbFileds;
|
||||
}
|
||||
|
||||
public void setSublistMdmModuleDbFileds(List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds) {
|
||||
this.sublistMdmModuleDbFileds = sublistMdmModuleDbFileds;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.mdm.mdmModuleDbFileds.dao.impl.MdmModuleDbFiledsDaoImpl">
|
||||
|
||||
<resultMap id="get-MdmModuleDbFiledsEntity-result" type="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity" >
|
||||
<resultMap id="get-MdmModuleDbFiledsEntity-result"
|
||||
type="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/>
|
||||
<result property="dbId" column="db_id" jdbcType="VARCHAR"/>
|
||||
|
@ -24,6 +25,10 @@
|
|||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="isSysPk" column="sys_pk" jdbcType="VARCHAR"/>
|
||||
<result property="isSysCode" column="sys_code" jdbcType="VARCHAR"/>
|
||||
<result property="isSysName" column="sys_name" jdbcType="VARCHAR"/>
|
||||
<result property="isSysDate" column="sys_date" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id="MdmModuleDbFiledsEntity_Base_Column_List">
|
||||
|
@ -48,9 +53,14 @@
|
|||
,sts
|
||||
,org_id
|
||||
,company_id
|
||||
,sys_pk
|
||||
,sys_code
|
||||
,sys_name
|
||||
,sys_date
|
||||
</sql>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-MdmModuleDbFiledsEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
<select id="entity_list_base" resultMap="get-MdmModuleDbFiledsEntity-result"
|
||||
parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
select
|
||||
<include refid="MdmModuleDbFiledsEntity_Base_Column_List"/>
|
||||
from mdm_module_db_fileds
|
||||
|
@ -76,6 +86,10 @@
|
|||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
||||
<if test="isSysPk != null and isSysPk != ''">and sys_pk = #{isSysPk}</if>
|
||||
<if test="isSysCode != null and isSysCode != ''">and sys_code = #{isSysCode}</if>
|
||||
<if test="isSysName != null and isSysName != ''">and sys_name = #{isSysName}</if>
|
||||
<if test="isSysDate != null and isSysDate != ''">and sys_date = #{isSysDate}</if>
|
||||
<if test="roletype != null and roletype != ''">
|
||||
and id in (
|
||||
select
|
||||
|
@ -91,7 +105,8 @@
|
|||
</select>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
<select id="entity_count" resultType="Integer"
|
||||
parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
select count(1) from mdm_module_db_fileds
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id = #{id}</if>
|
||||
|
@ -115,6 +130,10 @@
|
|||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
||||
<if test="isSysPk != null and isSysPk != ''">and sys_pk = #{isSysPk}</if>
|
||||
<if test="isSysCode != null and isSysCode != ''">and sys_code = #{isSysCode}</if>
|
||||
<if test="isSysName != null and isSysName != ''">and sys_name = #{isSysName}</if>
|
||||
<if test="isSysDate != null and isSysDate != ''">and sys_date = #{isSysDate}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -122,7 +141,8 @@
|
|||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-MdmModuleDbFiledsEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
<select id="entity_list_like" resultMap="get-MdmModuleDbFiledsEntity-result"
|
||||
parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
select
|
||||
<include refid="MdmModuleDbFiledsEntity_Base_Column_List"/>
|
||||
from mdm_module_db_fileds
|
||||
|
@ -139,15 +159,25 @@
|
|||
<if test="queryType != null and queryType != ''">and query_type like concat('%',#{queryType},'%')</if>
|
||||
<if test="listType != null and listType != ''">and list_type like concat('%',#{listType},'%')</if>
|
||||
<if test="viewType != null and viewType != ''">and view_type like concat('%',#{viewType},'%')</if>
|
||||
<if test="filedLength != null and filedLength != ''"> and filed_length like concat('%',#{filedLength},'%') </if>
|
||||
<if test="filedLength != null and filedLength != ''">and filed_length like concat('%',#{filedLength},'%')
|
||||
</if>
|
||||
<if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id like
|
||||
concat('%',#{create_user_id},'%')
|
||||
</if>
|
||||
<if test="create_time != null">and create_time like concat('%',#{create_time},'%')</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id like
|
||||
concat('%',#{modify_user_id},'%')
|
||||
</if>
|
||||
<if test="modify_time != null">and modify_time like concat('%',#{modify_time},'%')</if>
|
||||
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
|
||||
<if test="companyId != null and companyId != ''">and company_id like concat('%',#{companyId},'%')</if>
|
||||
|
||||
<if test="isSysPk != null and isSysPk != ''">and sys_pk like concat('%',#{isSysPk},'%')</if>
|
||||
<if test="isSysCode != null and isSysCode != ''">and sys_code like concat('%',#{isSysCode},'%')</if>
|
||||
<if test="isSysName != null and isSysName != ''">and sys_name like concat('%',#{isSysName},'%')</if>
|
||||
<if test="isSysDate != null and isSysDate != ''">and sys_date like concat('%',#{isSysDate},'%')</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -155,7 +185,8 @@
|
|||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="MdmModuleDbFiledsentity_list_or" resultMap="get-MdmModuleDbFiledsEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
<select id="MdmModuleDbFiledsentity_list_or" resultMap="get-MdmModuleDbFiledsEntity-result"
|
||||
parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
select
|
||||
<include refid="MdmModuleDbFiledsEntity_Base_Column_List"/>
|
||||
from mdm_module_db_fileds
|
||||
|
@ -181,6 +212,12 @@
|
|||
<if test="sts != null and sts != ''">or sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">or org_id = #{org_id}</if>
|
||||
<if test="companyId != null and companyId != ''">or company_id = #{companyId}</if>
|
||||
|
||||
<if test="isSysPk != null and isSysPk != ''">or sys_pk = #{isSysPk}</if>
|
||||
<if test="isSysCode != null and isSysCode != ''">or sys_code = #{isSysCode}</if>
|
||||
<if test="isSysName != null and isSysName != ''">or sys_name = #{isSysName}</if>
|
||||
<if test="isSysDate != null and isSysDate != ''">or sys_date = #{isSysDate}</if>
|
||||
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
|
@ -212,6 +249,10 @@
|
|||
<if test="sts != null and sts != ''">sts ,</if>
|
||||
<if test="org_id != null and org_id != ''">org_id ,</if>
|
||||
<if test="companyId != null and companyId != ''">company_id ,</if>
|
||||
<if test="isSysPk != null and isSysPk != ''">sys_pk ,</if>
|
||||
<if test="isSysCode != null and isSysCode != ''">sys_code ,</if>
|
||||
<if test="isSysName != null and isSysName != ''">sys_name ,</if>
|
||||
<if test="isSysDate != null and isSysDate != ''">sys_date ,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
|
@ -237,21 +278,30 @@
|
|||
<if test="sts != null and sts != ''">#{sts} ,</if>
|
||||
<if test="org_id != null and org_id != ''">#{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''">#{companyId} ,</if>
|
||||
<if test="isSysPk != null and isSysPk != ''">#{isSysPk} ,</if>
|
||||
<if test="isSysCode != null and isSysCode != ''">#{isSysCode} ,</if>
|
||||
<if test="isSysName != null and isSysName != ''">#{isSysName} ,</if>
|
||||
<if test="isSysDate != null and isSysDate != ''">#{isSysDate} ,</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch">
|
||||
insert into mdm_module_db_fileds(mdm_id, db_id, ch_name, en_name, filed_type, add_type, update_type, show_type, query_type, list_type, view_type, filed_length, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
|
||||
insert into mdm_module_db_fileds(mdm_id, db_id, ch_name, en_name, filed_type, add_type, update_type, show_type,
|
||||
query_type, list_type, view_type, filed_length, create_user_id, create_time, modify_user_id, modify_time, sts,
|
||||
org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.mdmId},#{entity.dbId},#{entity.chName},#{entity.enName},#{entity.filedType},#{entity.addType},#{entity.updateType},#{entity.showType},#{entity.queryType},#{entity.listType},#{entity.viewType},#{entity.filedLength},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
|
||||
(#{entity.mdmId},#{entity.dbId},#{entity.chName},#{entity.enName},#{entity.filedType},#{entity.addType},#{entity.updateType},#{entity.showType},#{entity.queryType},#{entity.listType},#{entity.viewType},#{entity.filedLength},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},
|
||||
'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch">
|
||||
insert into mdm_module_db_fileds(mdm_id, db_id, ch_name, en_name, filed_type, add_type, update_type, show_type, query_type, list_type, view_type, filed_length, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
|
||||
insert into mdm_module_db_fileds(mdm_id, db_id, ch_name, en_name, filed_type, add_type, update_type, show_type,
|
||||
query_type, list_type, view_type, filed_length, create_user_id, create_time, modify_user_id, modify_time, sts,
|
||||
org_id, company_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.mdmId},#{entity.dbId},#{entity.chName},#{entity.enName},#{entity.filedType},#{entity.addType},#{entity.updateType},#{entity.showType},#{entity.queryType},#{entity.listType},#{entity.viewType},#{entity.filedLength},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
|
||||
|
@ -275,7 +325,8 @@
|
|||
modify_time = values(modify_time),
|
||||
sts = values(sts),
|
||||
org_id = values(org_id),
|
||||
company_id = values(company_id)</insert>
|
||||
company_id = values(company_id)
|
||||
</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
update mdm_module_db_fileds set
|
||||
|
@ -299,16 +350,28 @@ update mdm_module_db_fileds set
|
|||
<if test="sts != null and sts != ''">sts = #{sts},</if>
|
||||
<if test="org_id != null and org_id != ''">org_id = #{org_id},</if>
|
||||
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
|
||||
<if test="isSysPk != null and isSysPk != ''">sys_pk = #{isSysPk},</if>
|
||||
<if test="isSysPk == null ">sys_pk = null,</if>
|
||||
<if test="isSysCode != null and isSysCode != ''">sys_code = #{isSysCode},</if>
|
||||
<if test="isSysCode == null ">sys_code = null,</if>
|
||||
<if test="isSysName != null and isSysName != ''">sys_name = #{isSysName},</if>
|
||||
<if test="isSysName == null ">sys_name = null,</if>
|
||||
<if test="isSysDate != null and isSysDate != ''">sys_date = #{isSysDate},</if>
|
||||
<if test="isSysDate == null ">sys_date = null,</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<!-- 逻辑删除 -->
|
||||
<update id="entity_logicDelete" parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
update mdm_module_db_fileds set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
update mdm_module_db_fileds
|
||||
set sts= 'N',
|
||||
modify_time = #{modify_time},
|
||||
modify_user_id = #{modify_user_id}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<!-- 多条件逻辑删除 -->
|
||||
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity" >
|
||||
<update id="entity_logicDelete_Multi_Condition"
|
||||
parameterType="com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity">
|
||||
update mdm_module_db_fileds set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id = #{id}</if>
|
||||
|
@ -332,11 +395,15 @@ update mdm_module_db_fileds set sts= 'N' ,modify_time = #{modify_time},modify_u
|
|||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from mdm_module_db_fileds where id = #{id}
|
||||
delete
|
||||
from mdm_module_db_fileds
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<!--通过mdmCode删除-->
|
||||
<delete id="deleteMdmModuleDbFileds" parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity">
|
||||
delete from mdm_module_db_fileds where mdm_id = #{mdmId}
|
||||
delete
|
||||
from mdm_module_db_fileds
|
||||
where mdm_id = #{mdmId}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.hzya.frame.mdm.mdmModuleDbFileds.service.impl;
|
|||
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
|
||||
import com.hzya.frame.mdm.mdmModuleDbFileds.dao.IMdmModuleDbFiledsDao;
|
||||
import com.hzya.frame.mdm.mdmModuleDbFileds.service.IMdmModuleDbFiledsService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.annotation.Resource;
|
||||
|
|
|
@ -310,7 +310,12 @@
|
|||
parameterType="com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
|
||||
select count(1) from mdm_module_db_fileds_rule
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="mdmId != null and mdmId != ''">and mdm_id != #{mdmId}</if>
|
||||
<!-- <if test="mdmId != null and mdmId != ''">and mdm_id != #{mdmId}</if>-->
|
||||
<!-- <if test="ruleCode != null and ruleCode != ''">and rule_code = #{ruleCode}</if>-->
|
||||
<!-- <if test="ruleValue != null and ruleValue != ''">and rule_value = #{ruleValue}</if>-->
|
||||
|
||||
<if test="mdmId != null and mdmId != ''">and mdm_id = #{mdmId}</if>
|
||||
<if test="dbId != null and dbId != ''">and db_id = #{dbId}</if>
|
||||
<if test="ruleCode != null and ruleCode != ''">and rule_code = #{ruleCode}</if>
|
||||
<if test="ruleValue != null and ruleValue != ''">and rule_value = #{ruleValue}</if>
|
||||
and sts='Y'
|
||||
|
|
Loading…
Reference in New Issue