diff --git a/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java b/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java index a999a9fa..1b9d09b3 100644 --- a/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java +++ b/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java @@ -73,7 +73,6 @@ public interface IBaseDao<E extends Serializable, PK extends Serializable> { * @return */ int delete(String paramString, Object paramObject); - /** * 修改 * @param paramString sqlMapperID @@ -178,6 +177,8 @@ public interface IBaseDao<E extends Serializable, PK extends Serializable> { */ Integer getCount(E paramE); + Integer getCount(String statement,Object baseEntity); + /** * 分页查询 * @param paramString mapperID diff --git a/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java b/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java index c578b60e..95e43393 100644 --- a/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java +++ b/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java @@ -276,6 +276,11 @@ public abstract class MybatisGenericDao<E extends Serializable, PK extends Seria return list; } + @Override + public Integer getCount(String statement,Object baseEntity) { + Integer totalCount = this.sqlSession.selectOne(statement, baseEntity); + return totalCount; + } public List<E> query(Object baseEntity) { Assert.notNull(baseEntity, "query baseEntity :不能为NULL"); diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java index ae393466..93774e10 100644 --- a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java @@ -2,6 +2,7 @@ package com.hzya.frame.mdm.entity; import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; import java.util.List; @@ -12,6 +13,8 @@ public class MdmDto { private Long mdmCode; //单据编码规则 private List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntityList; + //字段规则 + private List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities; //主数据主表 private MdmModuleDbEntity mainMdmModuleDb; //主数据子表 @@ -20,6 +23,10 @@ public class MdmDto { //id private String id; + //id + private String fieldId; + //id + private String dbId; //3、新增4、修改 5、查看 private String showType; //分页 @@ -201,5 +208,29 @@ public class MdmDto { public void setUpId(String upId) { this.upId = upId; } + + public List<MdmModuleDbFiledsRuleEntity> getMdmModuleDbFiledsRuleEntities() { + return mdmModuleDbFiledsRuleEntities; + } + + public void setMdmModuleDbFiledsRuleEntities(List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities) { + this.mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleEntities; + } + + public String getFieldId() { + return fieldId; + } + + public void setFieldId(String fieldId) { + this.fieldId = fieldId; + } + + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewVo.java index 67429ac6..44719c62 100644 --- a/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewVo.java +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewVo.java @@ -9,6 +9,10 @@ import java.util.List; public class MdmModuleViewVo { + /** 主数据模版ID */ + private String mdmId; + /** 类型1、查询2、列表3、新增4、修改 5、查看 */ + private String viewType; //模版 private MdmModuleViewEntity mdmModuleViewEntity; //新增 @@ -131,6 +135,20 @@ public class MdmModuleViewVo { this.dbButtonFiled = dbButtonFiled; } + public String getMdmId() { + return mdmId; + } + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getViewType() { + return viewType; + } + + public void setViewType(String viewType) { + this.viewType = viewType; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java index 8854d3e8..5a2b602f 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java @@ -5,6 +5,7 @@ import com.hzya.frame.mdm.entity.MdmDto; import com.hzya.frame.mdm.entity.MdmQuery; import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; import com.hzya.frame.sys.entity.FormmainDeleteDto; import java.util.HashMap; @@ -26,6 +27,7 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> { Integer checkTable(Map<String, String> maps); Integer createTable(Map<String, Object> maps); Integer alterTable(Map<String, Object> maps); + Integer alterTableField(MdmModuleDbFiledsEntity entity); Integer alterTableName(Map<String, String> maps); List<HashMap<String, Object>> queryMdmShowData(MdmQuery entity); List<HashMap<String, Object>> queryTemplateDataMore(MdmDto entity); @@ -39,5 +41,11 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> { List<HashMap<String, Object>> queryDataAll(MdmDto entity); + Integer deleteMdmModuleEntity(MdmModuleEntity entity); + + Integer queryMainCount(MdmQuery mdmQuery); + + Integer deleteTable(Map<String, Object> maps); + } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java index 40cd1bab..c7435918 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java @@ -5,6 +5,7 @@ import com.hzya.frame.mdm.entity.MdmDto; 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.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; import com.hzya.frame.sys.entity.FormmainDeleteDto; import org.springframework.stereotype.Repository; import com.hzya.frame.basedao.dao.MybatisGenericDao; @@ -45,6 +46,19 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String> List<HashMap<String, Object>> o = (List<HashMap<String, Object>>) super.selectList(getSqlIdPrifx() + "queryDataAll", entity); return o; } + + @Override + public Integer deleteMdmModuleEntity(MdmModuleEntity entity) { + Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteMdmModuleEntity", entity); + return o; + } + + @Override + public Integer queryMainCount(MdmQuery entity) { + Integer o = (Integer) super.getCount(getSqlIdPrifx() + "queryMainCount", entity); + return o; + } + @Override public Integer checkData(Map<String, String> maps) { Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "checkData", maps); @@ -105,11 +119,22 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String> Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "createTable", maps); return o; } + + @Override + public Integer deleteTable(Map<String, Object> maps) { + Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteTable", maps); + return o; + } @Override public Integer alterTable(Map<String, Object> maps) { Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTable", maps); return o; } + @Override + public Integer alterTableField(MdmModuleDbFiledsEntity entity) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTableField", entity); + return o; + } @Override public Integer alterTableName(Map<String, String> maps) { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml index 4e94d665..7dbd9244 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -2,26 +2,26 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.hzya.frame.mdm.mdmModule.dao.impl.MdmModuleDaoImpl"> - <resultMap id="get-MdmModuleEntity-result" type="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity" > - <result property="id" column="id" jdbcType="VARCHAR"/> - <result property="mdmName" column="mdm_name" jdbcType="VARCHAR"/> - <result property="mdmLogo" column="mdm_logo" jdbcType="VARCHAR"/> - <result property="mdmCode" column="mdm_code" jdbcType="INTEGER"/> - <result property="mdmType" column="mdm_type" jdbcType="VARCHAR"/> - <result property="remark" column="remark" jdbcType="VARCHAR"/> - <result property="createUser" column="createUser" jdbcType="VARCHAR"/> - <result property="modifyUser" column="modifyUser" jdbcType="VARCHAR"/> - <result property="sorts" column="sorts" jdbcType="INTEGER"/> - <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/> - <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/> - <result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/> - <result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/> - <result property="sts" column="sts" jdbcType="VARCHAR"/> - <result property="org_id" column="org_id" jdbcType="VARCHAR"/> - <result property="companyId" column="company_id" jdbcType="VARCHAR"/> - </resultMap> + <resultMap id="get-MdmModuleEntity-result" type="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> + <result property="id" column="id" jdbcType="VARCHAR"/> + <result property="mdmName" column="mdm_name" jdbcType="VARCHAR"/> + <result property="mdmLogo" column="mdm_logo" jdbcType="VARCHAR"/> + <result property="mdmCode" column="mdm_code" jdbcType="INTEGER"/> + <result property="mdmType" column="mdm_type" jdbcType="VARCHAR"/> + <result property="remark" column="remark" jdbcType="VARCHAR"/> + <result property="createUser" column="createUser" jdbcType="VARCHAR"/> + <result property="modifyUser" column="modifyUser" jdbcType="VARCHAR"/> + <result property="sorts" column="sorts" jdbcType="INTEGER"/> + <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/> + <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/> + <result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/> + <result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/> + <result property="sts" column="sts" jdbcType="VARCHAR"/> + <result property="org_id" column="org_id" jdbcType="VARCHAR"/> + <result property="companyId" column="company_id" jdbcType="VARCHAR"/> + </resultMap> <!-- 查询的字段--> - <sql id = "MdmModuleEntity_Base_Column_List"> + <sql id="MdmModuleEntity_Base_Column_List"> id ,mdm_name ,mdm_logo @@ -40,227 +40,243 @@ <!--通过ID获取数据 --> <select id="entity_get" resultMap="get-MdmModuleEntity-result"> select - <include refid="MdmModuleEntity_Base_Column_List" /> + <include refid="MdmModuleEntity_Base_Column_List"/> from mdm_module where id = #{ id } and sts='Y' </select> - <!-- 查询 采用==查询 --> - <select id="entity_list_base" resultMap="get-MdmModuleEntity-result" parameterType = "com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> - select - <include refid="MdmModuleEntity_Base_Column_List" /> - from mdm_module - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''"> and id = #{id} </if> - <if test="mdmName != null and mdmName != ''"> and mdm_name = #{mdmName} </if> - <if test="mdmLogo != null and mdmLogo != ''"> and mdm_logo = #{mdmLogo} </if> - <if test="mdmCode != null"> and mdm_code = #{mdmCode} </if> - <if test="mdmType != null and mdmType != ''"> and mdm_type = #{mdmType} </if> - <if test="remark != null and remark != ''"> and remark = #{remark} </if> - <if test="sorts != null"> and sorts = #{sorts} </if> - <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> - <if test="create_time != null"> and create_time = #{create_time} </if> - <if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if> - <if test="modify_time != null"> and modify_time = #{modify_time} </if> - <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> + <!-- 查询 采用==查询 --> + <select id="entity_list_base" resultMap="get-MdmModuleEntity-result" + parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> + select + <include refid="MdmModuleEntity_Base_Column_List"/> + from mdm_module + <trim prefix="where" prefixOverrides="and"> + <if test="id != null and id != ''">and id = #{id}</if> + <if test="mdmName != null and mdmName != ''">and mdm_name = #{mdmName}</if> + <if test="mdmLogo != null and mdmLogo != ''">and mdm_logo = #{mdmLogo}</if> + <if test="mdmCode != null">and mdm_code = #{mdmCode}</if> + <if test="mdmType != null and mdmType != ''">and mdm_type = #{mdmType}</if> + <if test="remark != null and remark != ''">and remark = #{remark}</if> + <if test="sorts != null">and sorts = #{sorts}</if> + <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if> + <if test="create_time != null">and create_time = #{create_time}</if> + <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if> + <if test="modify_time != null">and modify_time = #{modify_time}</if> + <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> and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> -</select> - -<!-- 查询符合条件的数量 --> -<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> - select count(1) from mdm_module - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''"> and id = #{id} </if> - <if test="mdmName != null and mdmName != ''"> and mdm_name = #{mdmName} </if> - <if test="mdmLogo != null and mdmLogo != ''"> and mdm_logo = #{mdmLogo} </if> - <if test="mdmCode != null"> and mdm_code = #{mdmCode} </if> - <if test="mdmType != null and mdmType != ''"> and mdm_type = #{mdmType} </if> - <if test="remark != null and remark != ''"> and remark = #{remark} </if> - <if test="sorts != null"> and sorts = #{sorts} </if> - <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> - <if test="create_time != null"> and create_time = #{create_time} </if> - <if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if> - <if test="modify_time != null"> and modify_time = #{modify_time} </if> - <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> + </trim> + <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> + <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> + </select> + + <!-- 查询符合条件的数量 --> + <select id="entity_count" resultType="Integer" parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> + select count(1) from mdm_module + <trim prefix="where" prefixOverrides="and"> + <if test="id != null and id != ''">and id = #{id}</if> + <if test="mdmName != null and mdmName != ''">and mdm_name = #{mdmName}</if> + <if test="mdmLogo != null and mdmLogo != ''">and mdm_logo = #{mdmLogo}</if> + <if test="mdmCode != null">and mdm_code = #{mdmCode}</if> + <if test="mdmType != null and mdmType != ''">and mdm_type = #{mdmType}</if> + <if test="remark != null and remark != ''">and remark = #{remark}</if> + <if test="sorts != null">and sorts = #{sorts}</if> + <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if> + <if test="create_time != null">and create_time = #{create_time}</if> + <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if> + <if test="modify_time != null">and modify_time = #{modify_time}</if> + <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> and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if> + </trim> + <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> + <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> </select> <!-- 分页查询列表 采用like格式 --> -<select id="entity_list_like" resultMap="get-MdmModuleEntity-result" parameterType = "com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> - select - <include refid="MdmModuleEntity_Base_Column_List" /> - from mdm_module - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if> - <if test="mdmName != null and mdmName != ''"> and mdm_name like concat('%',#{mdmName},'%') </if> - <if test="mdmLogo != null and mdmLogo != ''"> and mdm_logo like concat('%',#{mdmLogo},'%') </if> - <if test="mdmCode != null"> and mdm_code like concat('%',#{mdmCode},'%') </if> - <if test="mdmType != null and mdmType != ''"> and mdm_type like concat('%',#{mdmType},'%') </if> - <if test="remark != null and remark != ''"> and remark like concat('%',#{remark},'%') </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_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_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> + <select id="entity_list_like" resultMap="get-MdmModuleEntity-result" + parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> + select + <include refid="MdmModuleEntity_Base_Column_List"/> + from mdm_module + <trim prefix="where" prefixOverrides="and"> + <if test="id != null and id != ''">and id like concat('%',#{id},'%')</if> + <if test="mdmName != null and mdmName != ''">and mdm_name like concat('%',#{mdmName},'%')</if> + <if test="mdmLogo != null and mdmLogo != ''">and mdm_logo like concat('%',#{mdmLogo},'%')</if> + <if test="mdmCode != null">and mdm_code like concat('%',#{mdmCode},'%')</if> + <if test="mdmType != null and mdmType != ''">and mdm_type like concat('%',#{mdmType},'%')</if> + <if test="remark != null and remark != ''">and remark like concat('%',#{remark},'%')</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_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_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> and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> -</select> + </trim> + <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> + <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> + </select> -<!-- 查询列表 字段采用or格式 --> -<select id="MdmModuleentity_list_or" resultMap="get-MdmModuleEntity-result" parameterType = "com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> - select - <include refid="MdmModuleEntity_Base_Column_List" /> - from mdm_module - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''"> or id = #{id} </if> - <if test="mdmName != null and mdmName != ''"> or mdm_name = #{mdmName} </if> - <if test="mdmLogo != null and mdmLogo != ''"> or mdm_logo = #{mdmLogo} </if> - <if test="mdmCode != null"> or mdm_code = #{mdmCode} </if> - <if test="mdmType != null and mdmType != ''"> or mdm_type = #{mdmType} </if> - <if test="remark != null and remark != ''"> or remark = #{remark} </if> - <if test="sorts != null"> or sorts = #{sorts} </if> - <if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if> - <if test="create_time != null"> or create_time = #{create_time} </if> - <if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if> - <if test="modify_time != null"> or modify_time = #{modify_time} </if> - <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> + <!-- 查询列表 字段采用or格式 --> + <select id="MdmModuleentity_list_or" resultMap="get-MdmModuleEntity-result" + parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> + select + <include refid="MdmModuleEntity_Base_Column_List"/> + from mdm_module + <trim prefix="where" prefixOverrides="and"> + <if test="id != null and id != ''">or id = #{id}</if> + <if test="mdmName != null and mdmName != ''">or mdm_name = #{mdmName}</if> + <if test="mdmLogo != null and mdmLogo != ''">or mdm_logo = #{mdmLogo}</if> + <if test="mdmCode != null">or mdm_code = #{mdmCode}</if> + <if test="mdmType != null and mdmType != ''">or mdm_type = #{mdmType}</if> + <if test="remark != null and remark != ''">or remark = #{remark}</if> + <if test="sorts != null">or sorts = #{sorts}</if> + <if test="create_user_id != null and create_user_id != ''">or create_user_id = #{create_user_id}</if> + <if test="create_time != null">or create_time = #{create_time}</if> + <if test="modify_user_id != null and modify_user_id != ''">or modify_user_id = #{modify_user_id}</if> + <if test="modify_time != null">or modify_time = #{modify_time}</if> + <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> and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> -</select> + </trim> + <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> + <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> + </select> -<!--新增所有列--> -<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity" > - insert into mdm_module( - <trim suffix="" suffixOverrides=","> - <if test="id != null and id != ''"> id , </if> - <if test="mdmName != null and mdmName != ''"> mdm_name , </if> - <if test="mdmLogo != null and mdmLogo != ''"> mdm_logo , </if> - <if test="mdmCode != null"> mdm_code , </if> - <if test="mdmCode == null"> mdm_code , </if> - <if test="mdmType != null and mdmType != ''"> mdm_type , </if> - <if test="remark != null and remark != ''"> remark , </if> - <if test="sorts != null"> sorts , </if> - <if test="create_user_id != null and create_user_id != ''"> create_user_id , </if> - <if test="create_time != null"> create_time , </if> - <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if> - <if test="modify_time != null"> modify_time , </if> - <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="sts == null ">sts,</if> - </trim> - )values( - <trim suffix="" suffixOverrides=","> - <if test="id != null and id != ''"> #{id} ,</if> - <if test="mdmName != null and mdmName != ''"> #{mdmName} ,</if> - <if test="mdmLogo != null and mdmLogo != ''"> #{mdmLogo} ,</if> - <if test="mdmCode != null"> #{mdmCode} ,</if> + <!--新增所有列--> + <insert id="entity_insert" parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> + insert into mdm_module( + <trim suffix="" suffixOverrides=","> + <if test="id != null and id != ''">id ,</if> + <if test="mdmName != null and mdmName != ''">mdm_name ,</if> + <if test="mdmLogo != null and mdmLogo != ''">mdm_logo ,</if> + <if test="mdmCode != null">mdm_code ,</if> + <if test="mdmCode == null">mdm_code ,</if> + <if test="mdmType != null and mdmType != ''">mdm_type ,</if> + <if test="remark != null and remark != ''">remark ,</if> + <if test="sorts != null">sorts ,</if> + <if test="create_user_id != null and create_user_id != ''">create_user_id ,</if> + <if test="create_time != null">create_time ,</if> + <if test="modify_user_id != null and modify_user_id != ''">modify_user_id ,</if> + <if test="modify_time != null">modify_time ,</if> + <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="sts == null ">sts,</if> + </trim> + )values( + <trim suffix="" suffixOverrides=","> + <if test="id != null and id != ''">#{id} ,</if> + <if test="mdmName != null and mdmName != ''">#{mdmName} ,</if> + <if test="mdmLogo != null and mdmLogo != ''">#{mdmLogo} ,</if> + <if test="mdmCode != null">#{mdmCode} ,</if> <if test="mdmCode == null ">(SELECT IFNULL(MAX(b.mdm_code)+1,10001) AS mdmCode FROM mdm_module b ),</if> - <if test="mdmType != null and mdmType != ''"> #{mdmType} ,</if> - <if test="remark != null and remark != ''"> #{remark} ,</if> - <if test="sorts != null"> #{sorts} ,</if> - <if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if> - <if test="create_time != null"> #{create_time} ,</if> - <if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if> - <if test="modify_time != null"> #{modify_time} ,</if> - <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="sts == null ">'Y',</if> - </trim> - ) -</insert> -<!-- 批量新增 --> -<insert id="entityInsertBatch" > - insert into mdm_module(mdm_name, mdm_logo, mdm_code, mdm_type, remark, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) - values - <foreach collection="entities" item="entity" separator=","> - (#{entity.mdmName},#{entity.mdmLogo},#{entity.mdmCode},#{entity.mdmType},#{entity.remark},#{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(mdm_name, mdm_logo, mdm_code, mdm_type, remark, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) - values - <foreach collection="entities" item="entity" separator=","> - (#{entity.mdmName},#{entity.mdmLogo},#{entity.mdmCode},#{entity.mdmType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) - </foreach> - on duplicate key update - mdm_name = values(mdm_name), - mdm_logo = values(mdm_logo), - mdm_code = values(mdm_code), - mdm_type = values(mdm_type), - remark = values(remark), - create_user_id = values(create_user_id), - create_time = values(create_time), - modify_user_id = values(modify_user_id), - modify_time = values(modify_time), - sts = values(sts), - org_id = values(org_id), - company_id = values(company_id)</insert> -<!--通过主键修改方法--> -<update id="entity_update" parameterType = "com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity" > -update mdm_module set -<trim suffix="" suffixOverrides=","> - <if test="mdmName != null and mdmName != ''"> mdm_name = #{mdmName},</if> - <if test="mdmLogo != null and mdmLogo != ''"> mdm_logo = #{mdmLogo},</if> - <if test="mdmCode != null"> mdm_code = #{mdmCode},</if> - <if test="mdmType != null and mdmType != ''"> mdm_type = #{mdmType},</if> - <if test="remark != null and remark != ''"> remark = #{remark},</if> - <if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if> - <if test="create_time != null"> create_time = #{create_time},</if> - <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if> - <if test="modify_time != null"> modify_time = #{modify_time},</if> - <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> -</trim> -where id = #{id} -</update> -<!-- 逻辑删除 --> -<update id="entity_logicDelete" parameterType = "com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity" > + <if test="mdmType != null and mdmType != ''">#{mdmType} ,</if> + <if test="remark != null and remark != ''">#{remark} ,</if> + <if test="sorts != null">#{sorts} ,</if> + <if test="create_user_id != null and create_user_id != ''">#{create_user_id} ,</if> + <if test="create_time != null">#{create_time} ,</if> + <if test="modify_user_id != null and modify_user_id != ''">#{modify_user_id} ,</if> + <if test="modify_time != null">#{modify_time} ,</if> + <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="sts == null ">'Y',</if> + </trim> + ) + </insert> + <!-- 批量新增 --> + <insert id="entityInsertBatch"> + insert into mdm_module(mdm_name, mdm_logo, mdm_code, mdm_type, remark, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, company_id, sts) + values + <foreach collection="entities" item="entity" separator=","> + (#{entity.mdmName},#{entity.mdmLogo},#{entity.mdmCode},#{entity.mdmType},#{entity.remark},#{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(mdm_name, mdm_logo, mdm_code, mdm_type, remark, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, company_id) + values + <foreach collection="entities" item="entity" separator=","> + (#{entity.mdmName},#{entity.mdmLogo},#{entity.mdmCode},#{entity.mdmType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + </foreach> + on duplicate key update + mdm_name = values(mdm_name), + mdm_logo = values(mdm_logo), + mdm_code = values(mdm_code), + mdm_type = values(mdm_type), + remark = values(remark), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + </insert> + <!--通过主键修改方法--> + <update id="entity_update" parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> + update mdm_module set + <trim suffix="" suffixOverrides=","> + <if test="mdmName != null and mdmName != ''">mdm_name = #{mdmName},</if> + <if test="mdmLogo != null and mdmLogo != ''">mdm_logo = #{mdmLogo},</if> + <if test="mdmCode != null">mdm_code = #{mdmCode},</if> + <if test="mdmType != null and mdmType != ''">mdm_type = #{mdmType},</if> + <if test="remark != null and remark != ''">remark = #{remark},</if> + <if test="create_user_id != null and create_user_id != ''">create_user_id = #{create_user_id},</if> + <if test="create_time != null">create_time = #{create_time},</if> + <if test="modify_user_id != null and modify_user_id != ''">modify_user_id = #{modify_user_id},</if> + <if test="modify_time != null">modify_time = #{modify_time},</if> + <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> + </trim> + where id = #{id} + </update> + <!-- 逻辑删除 --> + <update id="entity_logicDelete" parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> update mdm_module 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.mdmModule.entity.MdmModuleEntity" > -update mdm_module 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> - <if test="mdmName != null and mdmName != ''"> and mdm_name = #{mdmName} </if> - <if test="mdmLogo != null and mdmLogo != ''"> and mdm_logo = #{mdmLogo} </if> - <if test="mdmCode != null"> and mdm_code = #{mdmCode} </if> - <if test="mdmType != null and mdmType != ''"> and mdm_type = #{mdmType} </if> - <if test="remark != null and remark != ''"> and remark = #{remark} </if> - <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> + <!-- 多条件逻辑删除 --> + <update id="entity_logicDelete_Multi_Condition" parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> + update mdm_module 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> + <if test="mdmName != null and mdmName != ''">and mdm_name = #{mdmName}</if> + <if test="mdmLogo != null and mdmLogo != ''">and mdm_logo = #{mdmLogo}</if> + <if test="mdmCode != null">and mdm_code = #{mdmCode}</if> + <if test="mdmType != null and mdmType != ''">and mdm_type = #{mdmType}</if> + <if test="remark != null and remark != ''">and remark = #{remark}</if> + <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> and sts='Y' - </trim> -</update> -<!--通过主键删除--> -<delete id="entity_delete"> + </trim> + </update> + <!--通过主键删除--> + <delete id="entity_delete"> delete from mdm_module where id = #{id} </delete> + + <delete id="deleteTable" > + DROP TABLE ${tableName} + </delete> <!-- 分页查询列表 采用like格式 --> - <select id="queryMdm" resultMap="get-MdmModuleEntity-result" parameterType = "com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> + <select id="queryMdm" resultMap="get-MdmModuleEntity-result" + parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> select a.id as id, a.mdm_name as mdm_name, @@ -292,7 +308,7 @@ update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = # <!--通过ID获取数据 --> <select id="getByMdmCode" resultMap="get-MdmModuleEntity-result"> select - <include refid="MdmModuleEntity_Base_Column_List" /> + <include refid="MdmModuleEntity_Base_Column_List"/> from mdm_module where mdm_code = #{ mdmCode } and sts='Y' </select> <!--通过ID获取数据 --> @@ -307,42 +323,80 @@ update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = # </select> - <select id="createTable" resultType="java.lang.Integer"> CREATE TABLE ${tableName} ( - <foreach collection="databaseFields" item="item" index="index"> - <choose> - <when test="item.enName == 'id'.toString()"> - `id` varchar(50) NOT NULL COMMENT '唯一标识码', - </when> - <when test="item.enName == 'sorts'.toString()"> - `sorts` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '排序', - </when> - <otherwise > - <choose> - <when test="item.filedType == '1'.toString()"> - ${item.enName} bigint(${item.filedLength}) DEFAULT NULL COMMENT #{item.chName}, - </when> - <when test="item.filedType == '2'.toString()"> - ${item.enName} decimal(${item.filedLength}) DEFAULT NULL COMMENT #{item.chName}, - </when> - <when test="item.filedType == '3'.toString()"> - ${item.enName} varchar(${item.filedLength}) DEFAULT NULL COMMENT #{item.chName}, - </when> - <when test="item.filedType == '4'.toString()"> - ${item.enName} datetime DEFAULT NULL COMMENT #{item.chName}, - </when> - </choose> - </otherwise> - </choose> - </foreach> + <choose> + <when test="tableType == '1'.toString()"> + `id` varchar(50) NOT NULL COMMENT '唯一标识码', + `document_rule` varchar(50) DEFAULT NULL COMMENT '单据规则', + `document_rule_num` bigint DEFAULT NULL COMMENT '单据规则流水号', + `data_status` varchar(1) DEFAULT NULL COMMENT '数据状态 Y正常 N删除 F修改', + `add_status` varchar(1) DEFAULT NULL COMMENT '新增数据状态 0待下发 1已下发', + `update_status` varchar(1) DEFAULT NULL COMMENT '修改数据状态 0待下发 1已下发', + `delete_status` varchar(1) DEFAULT NULL COMMENT '删除数据状态 0待下发 1已下发', + `sorts` bigint NOT NULL AUTO_INCREMENT COMMENT '排序', + `create_user_id` varchar(50) DEFAULT NULL COMMENT '创建人id', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `modify_user_id` varchar(50) DEFAULT NULL COMMENT '修改人id', + `modify_time` datetime DEFAULT NULL COMMENT '修改时间', + `sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)', + `org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID', + `company_id` varchar(50) DEFAULT NULL COMMENT '公司id', + </when> + <when test="tableType == '2'.toString()"> + `id` varchar(50) NOT NULL COMMENT '唯一标识码', + `formmain_id` varchar(50) DEFAULT NULL COMMENT 'formmain_id', + `data_status` varchar(1) DEFAULT NULL COMMENT '数据状态 Y正常 N删除 F修改', + `sorts` bigint NOT NULL AUTO_INCREMENT COMMENT '排序', + `create_user_id` varchar(50) DEFAULT NULL COMMENT '创建人id', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `modify_user_id` varchar(50) DEFAULT NULL COMMENT '修改人id', + `modify_time` datetime DEFAULT NULL COMMENT '修改时间', + `sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)', + `org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID', + `company_id` varchar(50) DEFAULT NULL COMMENT '公司id', + </when> + <when test="tableType == '3'.toString()"> + `id` varchar(50) NOT NULL COMMENT '唯一标识码', + `formmain_id` varchar(50) DEFAULT NULL COMMENT 'formmain_id', + `source_name` varchar(255) DEFAULT NULL COMMENT '来源名称', + `code` varchar(255) DEFAULT NULL COMMENT '编码', + `source_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '源数据', + `option_type` varchar(255) DEFAULT NULL COMMENT '操作类型', + `option_name` varchar(255) DEFAULT NULL COMMENT '操作人', + `sorts` bigint NOT NULL AUTO_INCREMENT COMMENT '排序', + `create_user_id` varchar(50) DEFAULT NULL COMMENT '创建人id', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `modify_user_id` varchar(50) DEFAULT NULL COMMENT '修改人id', + `modify_time` datetime DEFAULT NULL COMMENT '修改时间', + `sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)', + `org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID', + `company_id` varchar(50) DEFAULT NULL COMMENT '公司id', + </when> + <when test="tableType == '4'.toString()"> + `id` varchar(50) NOT NULL COMMENT '唯一标识码', + `formmain_id` varchar(50) DEFAULT NULL COMMENT 'formmain_id', + `target_app` varchar(255) DEFAULT NULL COMMENT '目标应用', + `target_api` varchar(255) DEFAULT NULL COMMENT '目标api', + `source_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '源数据', + `option_type` varchar(255) DEFAULT NULL COMMENT '操作类型', + `sorts` bigint NOT NULL AUTO_INCREMENT COMMENT '排序', + `create_user_id` varchar(50) DEFAULT NULL COMMENT '创建人id', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `modify_user_id` varchar(50) DEFAULT NULL COMMENT '修改人id', + `modify_time` datetime DEFAULT NULL COMMENT '修改时间', + `sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)', + `org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID', + `company_id` varchar(50) DEFAULT NULL COMMENT '公司id', + </when> + </choose> PRIMARY KEY (`sorts`,`id`) USING BTREE - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = #{tableRemark} + ) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 + <if test="tableRemark != null and tableRemark != ''"> COMMENT = #{tableRemark} </if> </select> - <!--通过ID获取数据 --> <select id="alterTable" resultType="java.lang.Integer"> ALTER TABLE ${tableName} @@ -400,6 +454,77 @@ update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = # </trim> </select> + + <select id="alterTableField" resultType="java.lang.Integer"> + + ALTER TABLE ${dbName} + <choose> + <when test="filedType == '1'.toString()"> + <choose> + <when test="dataType == '1'.toString()"> + add COLUMN ${enName} bigint(${filedLength}) DEFAULT NULL COMMENT + #{chName} + </when> + <when test="dataType == '3'.toString()"> + drop COLUMN ${enName} + </when> + <otherwise> + MODIFY COLUMN ${enName} bigint(${filedLength}) DEFAULT NULL COMMENT + #{chName} + </otherwise> + </choose> + </when> + <when test="filedType == '3'.toString()"> + <choose> + <when test="dataType == '1'.toString()"> + add COLUMN ${enName} varchar(${filedLength}) DEFAULT NULL + COMMENT #{chName} + </when> + <when test="dataType == '3'.toString()"> + drop COLUMN ${enName} + </when> + <otherwise> + MODIFY COLUMN ${enName} varchar(${filedLength}) DEFAULT NULL COMMENT + #{chName} + </otherwise> + </choose> + </when> + + <when test="filedType == '2'.toString()"> + <choose> + <when test="dataType == '1'.toString()"> + add COLUMN ${enName} decimal(${filedLength}) DEFAULT NULL COMMENT + #{chName} + </when> + <when test="dataType == '3'.toString()"> + drop COLUMN ${enName} + </when> + <otherwise> + MODIFY COLUMN ${enName} decimal(${filedLength}) DEFAULT NULL COMMENT + #{chName} + </otherwise> + </choose> + </when> + <when test="filedType == '4'.toString()"> + <choose> + <when test="dataType == '1'.toString()"> + add COLUMN ${enName} datetime DEFAULT NULL COMMENT #{chName} + </when> + <when test="dataType == '3'.toString()"> + drop COLUMN ${enName} + </when> + <otherwise> + MODIFY COLUMN ${enName} datetime DEFAULT NULL COMMENT #{chName} + </otherwise> + </choose> + </when> + </choose> + </select> + + + + + <!--通过ID获取数据 --> <select id="alterTableName" resultType="java.lang.Integer"> ALTER TABLE ${tableName} COMMENT = #{tableRemark} @@ -496,7 +621,7 @@ update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = # order by sorts asc </select> <!-- 查询符合条件的数量 --> - <select id="checkData" resultType="Integer" > + <select id="checkData" resultType="Integer"> SELECT count(*) from @@ -657,5 +782,15 @@ update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = # order by sorts asc </select> + <!--通过mdmCode删除--> + <delete id="deleteMdmModuleEntity" parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity"> + delete from mdm_module where mdm_code = #{mdmCode} +</delete> + + + <!-- 查询符合条件的数量 --> + <select id="queryMainCount" resultType="Integer" parameterType="com.hzya.frame.mdm.entity.MdmQuery"> + select count(1) from ${tableName} where sts='Y' + </select> </mapper> diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java index 02372e74..5d45e907 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java @@ -1,7 +1,10 @@ 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.web.entity.JsonResultEntity; + /** * 主数据模版(MdmModule)表服务接口 * @@ -9,4 +12,380 @@ import com.hzya.frame.basedao.service.IBaseService; * @since 2024-06-03 08:46:29 */ public interface IMdmModuleService extends IBaseService<MdmModuleEntity, String>{ + + /** + * @Author lvleigang + * @Description 查询所有主数据 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdm(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 删除主数据 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity deleteMdm(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-基本信息获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity getMdm(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-基本信息新增 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdm(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-基本信息修改(同步修改菜单名称) + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdm(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-数据源-单据规则获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity getMdmTableCodeRule(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-单据规则新增或修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveOrUpdateMdmTableCodeRule(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDb(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表新增 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdmDb(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmDb(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表删除 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity deleteMdmDb(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDbField(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段明细 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDbFieldDetail(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段新增 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdmDbField(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmDbField(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段删除 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity deleteMdmDbField(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段规则获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDbFieldRule(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段规则修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmDbFieldRule(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示类型获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmView(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示类型保存 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdmView(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示类型修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmView(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示字段获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmViewField(JSONObject jsonObject); + + + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示字段设置保存 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveOrUpdateMdmViewField(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示按钮获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmViewButton(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示按钮保存 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveOrUpdateMdmViewButton(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-数据来源-列表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmSource(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据来源保存 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdmSource(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据来源获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity getMdmSource(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据来源修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmSource(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 主数据-数据来源删除 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity deleteMdmSource(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置-列表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDistribute(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置保存 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdmDistribute(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity getMdmDistribute(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmDistribute(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置删除 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity deleteMdmDistribute(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-写入日志-列表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmOptionLogPage(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-下发日志-列表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDistributeLogPage(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-数据源-服务获取(只获取主表) + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmService(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-服务字段获取(只获取主表) + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmServiceField(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-分发-只获取主表 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmMainDB(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-只获取主表字段 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmMainDBField(JSONObject jsonObject); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java index a47b3505..677329b2 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java @@ -1,12 +1,66 @@ package com.hzya.frame.mdm.mdmModule.service.impl; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.mdm.entity.MdmDbFiledVo; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.entity.MdmModuleViewVo; +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 org.springframework.stereotype.Service; +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; +import com.hzya.frame.mdm.mdmModuleDbFileds.dao.IMdmModuleDbFiledsDao; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.IMdmModuleDistributeDetailDao; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; +import com.hzya.frame.mdm.mdmModuleOptionLog.dao.IMdmModuleOptionLogDao; +import com.hzya.frame.mdm.mdmModuleOptionLog.entity.MdmModuleOptionLogEntity; +import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao; +import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity; +import com.hzya.frame.mdm.mdmModuleSource.dao.IMdmModuleSourceDao; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; +import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.mdm.mdmModuleViewButton.dao.IMdmModuleViewButtonDao; +import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity; +import com.hzya.frame.mdm.mdmModuleViewDetail.dao.IMdmModuleViewDetailDao; +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; +import com.hzya.frame.mdm.mdmTableCodeRule.dao.IMdmTableCodeRuleDao; +import com.hzya.frame.mdm.mdmTableCodeRule.dao.impl.MdmTableCodeRuleDaoImpl; +import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; +import com.hzya.frame.mdm.service.IMdmServiceCache; +import com.hzya.frame.mdm.service.impl.MdmServiceCache; +import com.hzya.frame.sysnew.buttonConfig.dao.ISysButtonConfigDao; +import com.hzya.frame.sysnew.buttonConfig.entity.SysButtonConfigEntity; +import com.hzya.frame.sysnew.menuConfig.dao.ISysMenuConfigDao; +import com.hzya.frame.sysnew.menuConfig.entity.SysMenuConfigEntity; +import com.hzya.frame.sysnew.popedomMenu.dao.ISysPopedomMenuDao; +import com.hzya.frame.sysnew.popedomMenu.entity.SysPopedomMenuEntity; +import com.hzya.frame.sysnew.popedomOperate.dao.ISysPopedomOperateDao; +import com.hzya.frame.sysnew.popedomOperate.entity.SysPopedomOperateEntity; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.checkerframework.checker.units.qual.A; +import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; + import javax.annotation.Resource; + import com.hzya.frame.basedao.service.impl.BaseService; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 主数据模版(MdmModule)表服务实现类 * @@ -15,12 +69,2502 @@ import com.hzya.frame.basedao.service.impl.BaseService; */ @Service(value = "mdmModuleService") public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> implements IMdmModuleService { - + private IMdmModuleDao mdmModuleDao; - + @Resource + private ISysPopedomMenuDao sysPopedomMenuDao; + @Resource + private ISysPopedomOperateDao sysPopedomOperateDao; + @Resource + private ISysButtonConfigDao sysButtonConfigDao; + @Resource + private ISysMenuConfigDao sysMenuConfigDao; + + @Resource + private IMdmModuleSendLogDao mdmModuleSendLogDao; + @Resource + private IMdmModuleOptionLogDao mdmModuleOptionLogDao; + @Resource + private IMdmServiceCache mdmServiceCache; + @Resource + private IMdmModuleDbDao mdmModuleDbDao; + @Resource + private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao; + @Resource + private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao; + @Resource + private IMdmModuleDistributeDao mdmModuleDistributeDao; + @Resource + private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao; + @Resource + private IMdmModuleViewDao mdmModuleViewDao; + + @Resource + private IMdmModuleSourceDao mdmModuleSourceDao; + @Resource + private IMdmModuleViewButtonDao mdmModuleViewButtonDao; + @Resource + private IMdmModuleViewDetailDao mdmModuleViewDetailDao; + @Resource + private IMdmTableCodeRuleDao mdmTableCodeRuleDao; + @Autowired - public void setMdmModuleDao(IMdmModuleDao dao) { - this.mdmModuleDao = dao; - this.dao = dao; - } + public void setMdmModuleDao(IMdmModuleDao dao) { + this.mdmModuleDao = dao; + this.dao = dao; + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询所有主数据 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdm(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + List<MdmModuleEntity> mdmModuleEntities = mdmModuleDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询所有主数据", mdmModuleEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 删除主数据 校验主表是不是有数据,有数据不允许删除 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity deleteMdm(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmModuleDao.get(entity.getId()); + if (mdmModuleEntity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表 + MdmModuleDbEntity queryDb = new MdmModuleDbEntity(); + queryDb.setMdmId(mdmModuleEntity.getId()); + queryDb.setSts("Y"); + queryDb.setDbType("1");//主表 + List<MdmModuleDbEntity> mdmModuleDbEntities = mdmModuleDbDao.queryBase(queryDb); + if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() == 1) { + MdmQuery mdmQuery = new MdmQuery(); + mdmQuery.setTableName(mdmModuleDbEntities.get(0).getDbName()); + Integer count = mdmModuleDao.queryMainCount(mdmQuery); + if (count > 0) { + return BaseResult.getFailureMessageEntity(mdmModuleEntity.getMdmName() + "存在数据,不允许删除"); + } + MdmModuleDbFiledsRuleEntity queryCount = new MdmModuleDbFiledsRuleEntity(); + queryCount.setMdmId(entity.getId()); + queryCount.setRuleCode("service"); + queryCount.setRuleValue(mdmModuleDbEntities.get(0).getDbName()); + Integer counts = mdmModuleDbFiledsRuleDao.queryUserMdm(queryCount); + if (counts > 0) { + return BaseResult.getFailureMessageEntity(mdmModuleEntity.getMdmName() + "已被引用,不允许删除"); + } + } + + + + //删除单据规则 + MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); + mdmTableCodeRuleEntity.setUpdate(); + mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); + mdmTableCodeRuleDao.logicRemoveMultiCondition(mdmTableCodeRuleEntity); + + //删除视图设置的字段 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + + //删除设置按钮 + MdmModuleViewButtonEntity mdmModuleViewButtonEntity = new MdmModuleViewButtonEntity(); + mdmModuleViewButtonEntity.setUpdate(); + mdmModuleViewButtonEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewButtonDao.logicRemoveMultiCondition(mdmModuleViewButtonEntity); + + //删除显示信息 + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setUpdate(); + mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewDao.logicRemoveMultiCondition(mdmModuleViewEntity); + //删除数据来源配置 + MdmModuleSourceEntity mdmModuleSourceEntity = new MdmModuleSourceEntity(); + mdmModuleSourceEntity.setUpdate(); + mdmModuleSourceEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleSourceDao.logicRemoveMultiCondition(mdmModuleSourceEntity); + //删除下发配置,以及下发配置的数据权限 + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setUpdate(); + mdmModuleDistributeDetailEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDistributeDetailDao.logicRemoveMultiCondition(mdmModuleDistributeDetailEntity); + + MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + mdmModuleDistributeEntity.setUpdate(); + mdmModuleDistributeEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDistributeDao.logicRemoveMultiCondition(mdmModuleDistributeEntity); + //删除字段规则表 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + //删除字段表 + mdmServiceCache.deleteMdmModuleDbFileds(mdmModuleEntity.getId(), null); + //删除设置的db,以及实体表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + List<MdmModuleDbEntity> mdmModuleDbEntities1 = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntities1 != null && mdmModuleDbEntities1.size() > 0) { + for (int i = 0; i < mdmModuleDbEntities1.size(); i++) { + Map<String, Object> maps = new HashMap<>(); + maps.put("tableName", mdmModuleDbEntities1.get(i).getDbName()); + mdmModuleDao.deleteTable(maps); + } + } + mdmServiceCache.deleteMdmModuleDb(mdmModuleEntity.getId(), null); + + //删除菜单和按钮,以及权限分配(用户权限和角色权限) + SysMenuConfigEntity sysMenuConfigEntity = new SysMenuConfigEntity(); + sysMenuConfigEntity.setFormId(mdmModuleEntity.getId()); + sysMenuConfigEntity.setSts("Y"); + List<SysMenuConfigEntity> sysMenuConfigEntities = sysMenuConfigDao.queryBase(sysMenuConfigEntity); + if (sysMenuConfigEntities != null && sysMenuConfigEntities.size() > 0) { + for (int i = 0; i < sysMenuConfigEntities.size(); i++) { + SysButtonConfigEntity sysButtonConfigEntity = new SysButtonConfigEntity(); + sysButtonConfigEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysButtonConfigEntity.setSts("Y"); + sysButtonConfigEntity.setUpdate(); + sysButtonConfigDao.logicRemoveMultiCondition(sysButtonConfigEntity); + + SysPopedomOperateEntity sysPopedomOperateEntity = new SysPopedomOperateEntity(); + sysPopedomOperateEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysPopedomOperateEntity.setSts("Y"); + sysPopedomOperateEntity.setUpdate(); + sysPopedomOperateDao.logicRemoveMultiCondition(sysPopedomOperateEntity); + + SysPopedomMenuEntity sysPopedomMenuEntity = new SysPopedomMenuEntity(); + sysPopedomMenuEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysPopedomMenuEntity.setSts("Y"); + sysPopedomMenuEntity.setUpdate(); + sysPopedomMenuDao.logicRemoveMultiCondition(sysPopedomMenuEntity); + sysMenuConfigEntities.get(i).setUpdate(); + sysMenuConfigDao.logicRemoveMultiCondition(sysMenuConfigEntities.get(i)); + } + } + + + //删除主数据 + mdmServiceCache.deleteMdmModuleEntity(mdmModuleEntity); + + return BaseResult.getSuccessMessageEntity("删除成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-基本信息获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity getMdm(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmModuleDao.get(entity.getId()); + if (mdmModuleEntity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + return BaseResult.getSuccessMessageEntity("获取成功", mdmModuleEntity); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-基本信息新增 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveMdm(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmName() == null || "".equals(entity.getMdmName())) { + return BaseResult.getFailureMessageEntity("请先输入主数据名称"); + } + if (entity.getMdmType() == null || "".equals(entity.getMdmType())) { + return BaseResult.getFailureMessageEntity("请先输入主数据类型"); + } + entity.setCreate(); + mdmModuleDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存成功",entity); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-基本信息修改(同步修改菜单名称) + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdm(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + mdmServiceCache.updateMdmModuleEntity(entity); + + //修改菜单的显示信息 + SysMenuConfigEntity sysMenuConfigEntity = new SysMenuConfigEntity(); + sysMenuConfigEntity.setFormId(entity.getId()); + sysMenuConfigEntity.setSts("Y"); + List<SysMenuConfigEntity> sysMenuConfigEntities = sysMenuConfigDao.queryBase(sysMenuConfigEntity); + if (sysMenuConfigEntities != null && sysMenuConfigEntities.size() > 0) { + for (int i = 0; i < sysMenuConfigEntities.size(); i++) { + + sysMenuConfigEntities.get(i).setUpdate(); + if ("1".equals(entity.getMdmType())) { + //1、档案 + sysMenuConfigEntities.get(i).setParentMenuId("ea22757e99c144fb9ef381dd322e233c"); + } else { + //2、单据 + sysMenuConfigEntities.get(i).setParentMenuId("58714ddb7ec94f5da91df74efada042f"); + } + sysMenuConfigEntities.get(i).setMenuName(entity.getMdmName()); + sysMenuConfigEntities.get(i).setMenuEnglishName("integrationOptionAdmin" + entity.getMdmCode()); + JSONObject object1 = JSONObject.parseObject(sysMenuConfigEntities.get(i).getOptions()); + object1.put("mdmId", entity.getId());//主数据id + object1.put("mdmCode", entity.getMdmCode());//主数据编码 + sysMenuConfigEntities.get(i).setOptions(object1.toString());//菜单mate参数 + sysMenuConfigDao.update(sysMenuConfigEntities.get(i)); + } + } + return BaseResult.getSuccessMessageEntity("修改成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-单据规则获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity getMdmTableCodeRule(JSONObject object) { + MdmTableCodeRuleEntity entity = getData("jsonStr", object, MdmTableCodeRuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntities = mdmTableCodeRuleDao.queryBase(entity); + return BaseResult.getSuccessMessageEntity("获取单据规则成功", mdmTableCodeRuleEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-单据规则新增或修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveOrUpdateMdmTableCodeRule(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmTableCodeRuleEntityList() == null || entity.getMdmTableCodeRuleEntityList().size() == 0) { + return BaseResult.getFailureMessageEntity("请先设置单据规则"); + } + + MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); + mdmTableCodeRuleEntity.setMdmId(entity.getId()); + mdmTableCodeRuleEntity.setSts("Y"); + mdmTableCodeRuleEntity.setUpdate(); + mdmTableCodeRuleDao.logicRemoveMultiCondition(mdmTableCodeRuleEntity); + if (entity.getMdmTableCodeRuleEntityList() != null && entity.getMdmTableCodeRuleEntityList().size() > 0) { + for (int i = 0; i < entity.getMdmTableCodeRuleEntityList().size(); i++) { + entity.getMdmTableCodeRuleEntityList().get(i).setMdmId(entity.getId()); + entity.getMdmTableCodeRuleEntityList().get(i).setCreate(); + mdmTableCodeRuleDao.save(entity.getMdmTableCodeRuleEntityList().get(i)); + } + } + + return BaseResult.getSuccessMessageEntity("保存单据规则成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDb(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(entity); + List<MdmModuleDbEntity> dbEntities = new ArrayList<>(); + if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0) { + 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)); + } + } + } + return BaseResult.getSuccessMessageEntity("获取数据源表成功", dbEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表新增 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveMdmDb(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List<MdmModuleDbEntity> mdmModuleDbEntities = new ArrayList<>(); + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = new ArrayList<>(); + entity.setDataType("1"); + //保存数据表,新建默认字段 + entity.setCreate(); + mdmModuleDbEntities.add(entity); + setMdmField(entity, mdmModuleDbFiledsEntities); + //如果是主表,同步新建 两张日志表,添加日志表字段 + if ("1".equals(entity.getDbType())) { + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(entity.getMdmId()); + mdmModuleDbEntity.setDbName(entity.getDbName() + "_option_log"); + mdmModuleDbEntity.setDbType("3"); + mdmModuleDbEntity.setRemark(entity.getRemark()+"操作日志"); + mdmModuleDbEntity.setCreate(); + mdmModuleDbEntity.setDataType("1"); + mdmModuleDbEntities.add(mdmModuleDbEntity); + //新增 设置日志表 + setMdmField(mdmModuleDbEntity, mdmModuleDbFiledsEntities); + + MdmModuleDbEntity mdmModuleDbEntity1 = new MdmModuleDbEntity(); + mdmModuleDbEntity1.setMdmId(entity.getMdmId()); + mdmModuleDbEntity1.setDbName(entity.getDbName() + "_send_log"); + mdmModuleDbEntity1.setDbType("4"); + mdmModuleDbEntity1.setRemark(entity.getRemark()+"下发日志"); + mdmModuleDbEntity1.setCreate(); + mdmModuleDbEntity1.setDataType("1"); + mdmModuleDbEntities.add(mdmModuleDbEntity1); + //新增 设置日志表 + setMdmField(mdmModuleDbEntity1, mdmModuleDbFiledsEntities); + } + mdmServiceCache.saveOrUpdateMdmModuleDb(entity.getMdmId(), mdmModuleDbEntities); + mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities); + + //新建表 + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + Map<String, Object> maps = new HashMap<>(); + maps.put("tableName", mdmModuleDbEntities.get(i).getDbName());//表名 + maps.put("tableRemark", mdmModuleDbEntities.get(i).getRemark());//表备注 + maps.put("tableType", mdmModuleDbEntities.get(i).getDbType());//表备注 + mdmModuleDao.createTable(maps); + } + return BaseResult.getSuccessMessageEntity("保存表成功"); + } + + /** + * @param entity + * @param mdmModuleDbFiledsEntities + * @return void + * @Author lvleigang + * @Description 设置默认字段 + * @Date 10:47 上午 2024/6/12 + **/ + private void setMdmField(MdmModuleDbEntity entity, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) { + + MdmModuleDbFiledsEntity id = new MdmModuleDbFiledsEntity(); + id.setMdmId(entity.getMdmId()); + id.setDbId(entity.getId()); + id.setChName("id"); + id.setEnName("id"); + id.setFiledType("3"); + id.setAddType("2"); + id.setUpdateType("2"); + id.setShowType("2"); + id.setQueryType("2"); + id.setListType("2"); + id.setViewType("2"); + id.setFiledLength("50"); + id.setCreate(); + id.setDataType("1"); + mdmModuleDbFiledsEntities.add(id); + + if ("1".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity documentRule = new MdmModuleDbFiledsEntity(); + documentRule.setMdmId(entity.getMdmId()); + documentRule.setDbId(entity.getId()); + documentRule.setEnName("document_rule"); + documentRule.setChName("单据规则"); + documentRule.setFiledType("3"); + documentRule.setAddType("2"); + documentRule.setUpdateType("1"); + documentRule.setShowType("1"); + documentRule.setQueryType("1"); + documentRule.setListType("1"); + documentRule.setViewType("2"); + documentRule.setFiledLength("50"); + documentRule.setCreate(); + documentRule.setDataType("1"); + + mdmModuleDbFiledsEntities.add(documentRule); + + MdmModuleDbFiledsEntity document_rule_num = new MdmModuleDbFiledsEntity(); + document_rule_num.setMdmId(entity.getMdmId()); + document_rule_num.setDbId(entity.getId()); + document_rule_num.setEnName("document_rule_num"); + document_rule_num.setChName("单据规则流水号"); + document_rule_num.setFiledType("1"); + document_rule_num.setAddType("2"); + document_rule_num.setUpdateType("2"); + document_rule_num.setShowType("2"); + document_rule_num.setQueryType("2"); + document_rule_num.setListType("2"); + document_rule_num.setViewType("2"); + document_rule_num.setFiledLength("50"); + document_rule_num.setCreate(); + document_rule_num.setDataType("1"); + mdmModuleDbFiledsEntities.add(document_rule_num); + } + if ("2".equals(entity.getDbType()) || "3".equals(entity.getDbType()) || "4".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity formmain_id = new MdmModuleDbFiledsEntity(); + formmain_id.setMdmId(entity.getMdmId()); + formmain_id.setDbId(entity.getId()); + formmain_id.setEnName("formmain_id"); + formmain_id.setChName("主表id"); + formmain_id.setFiledType("3"); + formmain_id.setAddType("2"); + formmain_id.setUpdateType("2"); + formmain_id.setShowType("2"); + formmain_id.setQueryType("2"); + formmain_id.setListType("2"); + formmain_id.setViewType("2"); + formmain_id.setFiledLength("50"); + formmain_id.setCreate(); + formmain_id.setDataType("1"); + mdmModuleDbFiledsEntities.add(formmain_id); + } + //写入日志字段:操作人 + if ("3".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity source_name = new MdmModuleDbFiledsEntity(); + source_name.setMdmId(entity.getMdmId()); + source_name.setDbId(entity.getId()); + source_name.setEnName("source_name"); + source_name.setChName("来源名称"); + source_name.setFiledType("3"); + source_name.setAddType("2"); + source_name.setUpdateType("2"); + source_name.setShowType("2"); + source_name.setQueryType("2"); + source_name.setListType("2"); + source_name.setViewType("2"); + source_name.setFiledLength("255"); + source_name.setCreate(); + source_name.setDataType("1"); + mdmModuleDbFiledsEntities.add(source_name); + + MdmModuleDbFiledsEntity code = new MdmModuleDbFiledsEntity(); + code.setMdmId(entity.getMdmId()); + code.setDbId(entity.getId()); + code.setEnName("code"); + code.setChName("编码"); + code.setFiledType("3"); + code.setAddType("1"); + code.setUpdateType("1"); + code.setShowType("1"); + code.setQueryType("1"); + code.setListType("1"); + code.setViewType("1"); + code.setFiledLength("255"); + code.setCreate(); + code.setDataType("1"); + mdmModuleDbFiledsEntities.add(code); + + MdmModuleDbFiledsEntity source_data = new MdmModuleDbFiledsEntity(); + source_data.setMdmId(entity.getMdmId()); + source_data.setDbId(entity.getId()); + source_data.setEnName("source_data"); + source_data.setChName("源数据"); + source_data.setFiledType("3"); + source_data.setAddType("1"); + source_data.setUpdateType("1"); + source_data.setShowType("1"); + source_data.setQueryType("1"); + source_data.setListType("1"); + source_data.setViewType("1"); + source_data.setFiledLength("255"); + source_data.setCreate(); + source_data.setDataType("1"); + mdmModuleDbFiledsEntities.add(source_data); + + MdmModuleDbFiledsEntity option_type = new MdmModuleDbFiledsEntity(); + option_type.setMdmId(entity.getMdmId()); + option_type.setDbId(entity.getId()); + option_type.setEnName("option_type"); + option_type.setChName("操作类型"); + option_type.setFiledType("3"); + option_type.setAddType("1"); + option_type.setUpdateType("1"); + option_type.setShowType("1"); + option_type.setQueryType("1"); + option_type.setListType("1"); + option_type.setViewType("1"); + option_type.setFiledLength("255"); + option_type.setCreate(); + option_type.setDataType("1"); + mdmModuleDbFiledsEntities.add(option_type); + + MdmModuleDbFiledsEntity option_Name = new MdmModuleDbFiledsEntity(); + option_Name.setMdmId(entity.getMdmId()); + option_Name.setDbId(entity.getId()); + option_Name.setEnName("option_name"); + option_Name.setChName("操作人"); + option_Name.setFiledType("3"); + option_Name.setAddType("1"); + option_Name.setUpdateType("1"); + option_Name.setShowType("1"); + option_Name.setQueryType("1"); + option_Name.setListType("1"); + option_Name.setViewType("1"); + option_Name.setFiledLength("255"); + option_Name.setCreate(); + option_Name.setDataType("1"); + mdmModuleDbFiledsEntities.add(option_Name); + } + + //目标应用、目标api、 + if ("4".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity target_app = new MdmModuleDbFiledsEntity(); + target_app.setMdmId(entity.getMdmId()); + target_app.setDbId(entity.getId()); + target_app.setEnName("target_app"); + target_app.setChName("目标应用"); + target_app.setFiledType("3"); + target_app.setAddType("1"); + target_app.setUpdateType("1"); + target_app.setShowType("1"); + target_app.setQueryType("1"); + target_app.setListType("1"); + target_app.setViewType("1"); + target_app.setFiledLength("255"); + target_app.setCreate(); + target_app.setDataType("1"); + mdmModuleDbFiledsEntities.add(target_app); + + MdmModuleDbFiledsEntity target_api = new MdmModuleDbFiledsEntity(); + target_api.setMdmId(entity.getMdmId()); + target_api.setDbId(entity.getId()); + target_api.setEnName("target_api"); + target_api.setChName("目标api"); + target_api.setFiledType("3"); + target_api.setAddType("1"); + target_api.setUpdateType("1"); + target_api.setShowType("1"); + target_api.setQueryType("1"); + target_api.setListType("1"); + target_api.setViewType("1"); + target_api.setFiledLength("255"); + target_api.setCreate(); + target_api.setDataType("1"); + mdmModuleDbFiledsEntities.add(target_api); + + MdmModuleDbFiledsEntity source_data = new MdmModuleDbFiledsEntity(); + source_data.setMdmId(entity.getMdmId()); + source_data.setDbId(entity.getId()); + source_data.setEnName("source_data"); + source_data.setChName("源数据"); + source_data.setFiledType("3"); + source_data.setAddType("1"); + source_data.setUpdateType("1"); + source_data.setShowType("1"); + source_data.setQueryType("1"); + source_data.setListType("1"); + source_data.setViewType("1"); + source_data.setFiledLength("255"); + source_data.setCreate(); + source_data.setDataType("1"); + mdmModuleDbFiledsEntities.add(source_data); + + MdmModuleDbFiledsEntity option_type = new MdmModuleDbFiledsEntity(); + option_type.setMdmId(entity.getMdmId()); + option_type.setDbId(entity.getId()); + option_type.setEnName("option_type"); + option_type.setChName("操作类型"); + option_type.setFiledType("3"); + option_type.setAddType("1"); + option_type.setUpdateType("1"); + option_type.setShowType("1"); + option_type.setQueryType("1"); + option_type.setListType("1"); + option_type.setViewType("1"); + option_type.setFiledLength("255"); + option_type.setCreate(); + option_type.setDataType("1"); + mdmModuleDbFiledsEntities.add(option_type); + } + if ("2".equals(entity.getDbType()) || "1".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity data_status = new MdmModuleDbFiledsEntity(); + data_status.setMdmId(entity.getMdmId()); + data_status.setDbId(entity.getId()); + data_status.setEnName("data_status"); + data_status.setChName("数据状态 Y正常 N删除 F修改"); + data_status.setFiledType("3"); + data_status.setAddType("2"); + data_status.setUpdateType("2"); + data_status.setShowType("2"); + data_status.setQueryType("2"); + data_status.setListType("2"); + data_status.setViewType("2"); + data_status.setFiledLength("1"); + data_status.setCreate(); + data_status.setDataType("1"); + mdmModuleDbFiledsEntities.add(data_status); + } + if ("1".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity add_status = new MdmModuleDbFiledsEntity(); + add_status.setMdmId(entity.getMdmId()); + add_status.setDbId(entity.getId()); + add_status.setEnName("add_status"); + add_status.setChName("新增数据状态 0待下发 1已下发"); + add_status.setFiledType("3"); + add_status.setAddType("2"); + add_status.setUpdateType("2"); + add_status.setShowType("2"); + add_status.setQueryType("2"); + add_status.setListType("2"); + add_status.setViewType("2"); + add_status.setFiledLength("1"); + add_status.setCreate(); + add_status.setDataType("1"); + mdmModuleDbFiledsEntities.add(add_status); + } + if ("1".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity update_status = new MdmModuleDbFiledsEntity(); + update_status.setMdmId(entity.getMdmId()); + update_status.setDbId(entity.getId()); + update_status.setEnName("update_status"); + update_status.setChName("修改数据状态 0待下发 1已下发"); + update_status.setFiledType("3"); + update_status.setAddType("2"); + update_status.setUpdateType("2"); + update_status.setShowType("2"); + update_status.setQueryType("2"); + update_status.setListType("2"); + update_status.setViewType("2"); + update_status.setFiledLength("1"); + update_status.setCreate(); + update_status.setDataType("1"); + mdmModuleDbFiledsEntities.add(update_status); + } + + if ("1".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity delete_status = new MdmModuleDbFiledsEntity(); + delete_status.setMdmId(entity.getMdmId()); + delete_status.setDbId(entity.getId()); + delete_status.setEnName("delete_status"); + delete_status.setChName("删除数据状态 0待下发 1已下发"); + delete_status.setFiledType("3"); + delete_status.setAddType("2"); + delete_status.setUpdateType("2"); + delete_status.setShowType("2"); + delete_status.setQueryType("2"); + delete_status.setListType("2"); + delete_status.setViewType("2"); + delete_status.setFiledLength("1"); + delete_status.setCreate(); + delete_status.setDataType("1"); + mdmModuleDbFiledsEntities.add(delete_status); + } + + MdmModuleDbFiledsEntity sorts = new MdmModuleDbFiledsEntity(); + sorts.setMdmId(entity.getMdmId()); + sorts.setDbId(entity.getId()); + sorts.setEnName("sorts"); + sorts.setChName("排序"); + sorts.setFiledType("1"); + sorts.setAddType("2"); + sorts.setUpdateType("2"); + sorts.setShowType("2"); + sorts.setQueryType("2"); + sorts.setListType("2"); + sorts.setViewType("2"); + sorts.setFiledLength("20"); + sorts.setCreate(); + sorts.setDataType("1"); + mdmModuleDbFiledsEntities.add(sorts); + MdmModuleDbFiledsEntity create_user_id = new MdmModuleDbFiledsEntity(); + create_user_id.setMdmId(entity.getMdmId()); + create_user_id.setDbId(entity.getId()); + create_user_id.setEnName("create_user_id"); + create_user_id.setChName("创建人id"); + create_user_id.setFiledType("3"); + create_user_id.setAddType("2"); + create_user_id.setUpdateType("2"); + create_user_id.setShowType("2"); + create_user_id.setQueryType("2"); + create_user_id.setListType("2"); + create_user_id.setViewType("2"); + create_user_id.setFiledLength("50"); + create_user_id.setCreate(); + create_user_id.setDataType("1"); + mdmModuleDbFiledsEntities.add(create_user_id); + MdmModuleDbFiledsEntity create_time = new MdmModuleDbFiledsEntity(); + create_time.setMdmId(entity.getMdmId()); + create_time.setDbId(entity.getId()); + create_time.setEnName("create_time"); + create_time.setChName("创建时间"); + create_time.setFiledType("4"); + create_time.setAddType("2"); + create_time.setUpdateType("2"); + create_time.setShowType("2"); + create_time.setQueryType("2"); + create_time.setListType("2"); + create_time.setViewType("2"); + create_time.setFiledLength(null); + create_time.setCreate(); + create_time.setDataType("1"); + mdmModuleDbFiledsEntities.add(create_time); + MdmModuleDbFiledsEntity modify_user_id = new MdmModuleDbFiledsEntity(); + modify_user_id.setMdmId(entity.getMdmId()); + modify_user_id.setDbId(entity.getId()); + modify_user_id.setEnName("modify_user_id"); + modify_user_id.setChName("修改人id"); + modify_user_id.setFiledType("3"); + modify_user_id.setAddType("2"); + modify_user_id.setUpdateType("2"); + modify_user_id.setShowType("2"); + modify_user_id.setQueryType("2"); + modify_user_id.setListType("2"); + modify_user_id.setViewType("2"); + modify_user_id.setFiledLength("50"); + modify_user_id.setCreate(); + modify_user_id.setDataType("1"); + mdmModuleDbFiledsEntities.add(modify_user_id); + MdmModuleDbFiledsEntity modify_time = new MdmModuleDbFiledsEntity(); + modify_time.setMdmId(entity.getMdmId()); + modify_time.setDbId(entity.getId()); + modify_time.setEnName("modify_time"); + modify_time.setChName("修改时间"); + modify_time.setFiledType("4"); + modify_time.setAddType("2"); + modify_time.setUpdateType("2"); + modify_time.setShowType("2"); + modify_time.setQueryType("2"); + modify_time.setListType("2"); + modify_time.setViewType("2"); + modify_time.setFiledLength(null); + modify_time.setCreate(); + modify_time.setDataType("1"); + mdmModuleDbFiledsEntities.add(modify_time); + MdmModuleDbFiledsEntity sts = new MdmModuleDbFiledsEntity(); + sts.setMdmId(entity.getMdmId()); + sts.setDbId(entity.getId()); + sts.setEnName("sts"); + sts.setChName("状态(Y正常N删除)"); + sts.setFiledType("3"); + sts.setAddType("2"); + sts.setUpdateType("2"); + sts.setShowType("2"); + sts.setQueryType("2"); + sts.setListType("2"); + sts.setViewType("2"); + sts.setFiledLength("1"); + sts.setCreate(); + sts.setDataType("1"); + mdmModuleDbFiledsEntities.add(sts); + MdmModuleDbFiledsEntity org_id = new MdmModuleDbFiledsEntity(); + org_id.setMdmId(entity.getMdmId()); + org_id.setDbId(entity.getId()); + org_id.setEnName("org_id"); + org_id.setChName("组织机构ID"); + org_id.setFiledType("3"); + org_id.setAddType("2"); + org_id.setUpdateType("2"); + org_id.setShowType("2"); + org_id.setQueryType("2"); + org_id.setListType("2"); + org_id.setViewType("2"); + org_id.setFiledLength("50"); + org_id.setCreate(); + org_id.setDataType("1"); + mdmModuleDbFiledsEntities.add(org_id); + MdmModuleDbFiledsEntity company_id = new MdmModuleDbFiledsEntity(); + company_id.setMdmId(entity.getMdmId()); + company_id.setDbId(entity.getId()); + company_id.setEnName("company_id"); + company_id.setChName("公司id"); + company_id.setFiledType("3"); + company_id.setAddType("2"); + company_id.setUpdateType("2"); + company_id.setShowType("2"); + company_id.setQueryType("2"); + company_id.setListType("2"); + company_id.setViewType("2"); + company_id.setFiledLength("50"); + company_id.setCreate(); + company_id.setDataType("1"); + mdmModuleDbFiledsEntities.add(company_id); + } + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmDb(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List<MdmModuleDbEntity> mdmModuleDbEntities = new ArrayList<>(); + entity.setDataType("2"); + mdmModuleDbEntities.add(entity); + mdmServiceCache.saveOrUpdateMdmModuleDb(entity.getMdmId(), mdmModuleDbEntities); + Map<String, String> tablename = new HashMap<>(); + tablename.put("tableName", entity.getDbName());//表名 + tablename.put("tableRemark", entity.getRemark());//表备注 + mdmModuleDao.alterTableName(tablename); + return BaseResult.getSuccessMessageEntity("修改数据源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表删除 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity deleteMdmDb(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbType() == null || "".equals(entity.getDbType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + + MdmQuery mdmQuery = new MdmQuery(); + mdmQuery.setTableName(entity.getDbName()); + Integer count = mdmModuleDao.queryMainCount(mdmQuery); + if (count > 0) { + return BaseResult.getFailureMessageEntity(entity.getDbName() + "存在数据,不允许删除"); + } + MdmModuleDbFiledsRuleEntity queryCount = new MdmModuleDbFiledsRuleEntity(); + queryCount.setMdmId(entity.getMdmId()); + queryCount.setRuleCode("service"); + queryCount.setRuleValue(entity.getDbName()); + Integer counts = mdmModuleDbFiledsRuleDao.queryUserMdm(queryCount); + if (counts > 0) { + return BaseResult.getFailureMessageEntity(entity.getDbName() + "已被引用,不允许删除"); + } + + if ("1".equals(entity.getDbType())) { + //删除视图设置的字段 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + + //删除显示信息 + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setUpdate(); + mdmModuleViewEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDao.logicRemoveMultiCondition(mdmModuleViewEntity); + + //删除字段规则表 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleEntity.setMdmId(entity.getMdmId()); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + //删除字段表 + mdmServiceCache.deleteMdmModuleDbFileds(entity.getMdmId(), null); + //删除设置的db,以及实体表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(entity.getMdmId()); + List<MdmModuleDbEntity> mdmModuleDbEntities1 = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntities1 != null && mdmModuleDbEntities1.size() > 0) { + for (int i = 0; i < mdmModuleDbEntities1.size(); i++) { + Map<String, Object> maps = new HashMap<>(); + maps.put("tableName", mdmModuleDbEntities1.get(i).getDbName()); + mdmModuleDao.deleteTable(maps); + } + } + mdmServiceCache.deleteMdmModuleDb(entity.getMdmId(), null); + + //删除菜单和按钮,以及权限分配(用户权限和角色权限) + SysMenuConfigEntity sysMenuConfigEntity = new SysMenuConfigEntity(); + sysMenuConfigEntity.setFormId(entity.getMdmId()); + sysMenuConfigEntity.setSts("Y"); + List<SysMenuConfigEntity> sysMenuConfigEntities = sysMenuConfigDao.queryBase(sysMenuConfigEntity); + if (sysMenuConfigEntities != null && sysMenuConfigEntities.size() > 0) { + for (int i = 0; i < sysMenuConfigEntities.size(); i++) { + SysButtonConfigEntity sysButtonConfigEntity = new SysButtonConfigEntity(); + sysButtonConfigEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysButtonConfigEntity.setSts("Y"); + sysButtonConfigEntity.setUpdate(); + sysButtonConfigDao.logicRemoveMultiCondition(sysButtonConfigEntity); + + SysPopedomOperateEntity sysPopedomOperateEntity = new SysPopedomOperateEntity(); + sysPopedomOperateEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysPopedomOperateEntity.setSts("Y"); + sysPopedomOperateEntity.setUpdate(); + sysPopedomOperateDao.logicRemoveMultiCondition(sysPopedomOperateEntity); + + SysPopedomMenuEntity sysPopedomMenuEntity = new SysPopedomMenuEntity(); + sysPopedomMenuEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysPopedomMenuEntity.setSts("Y"); + sysPopedomMenuEntity.setUpdate(); + sysPopedomMenuDao.logicRemoveMultiCondition(sysPopedomMenuEntity); + sysMenuConfigEntities.get(i).setUpdate(); + sysMenuConfigDao.logicRemoveMultiCondition(sysMenuConfigEntities.get(i)); + } + } + } + + if ("2".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setDbId(entity.getId()); + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) { + for (int i = 0; i < mdmModuleDbFiledsEntities.size(); i++) { + //删除视图设置的字段 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewFiled(mdmModuleDbFiledsEntities.get(i).getId()); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + } + } + //删除字段规则表 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleEntity.setMdmId(entity.getMdmId()); + mdmModuleDbFiledsRuleEntity.setDbId(entity.getId()); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + //删除字段表 + mdmServiceCache.deleteMdmModuleDbFileds(entity.getMdmId(), entity.getId()); + //删除设置的db,以及实体表 + + Map<String, Object> maps = new HashMap<>(); + maps.put("tableName", entity.getDbName()); + mdmModuleDao.deleteTable(maps); + mdmServiceCache.deleteMdmModuleDb(entity.getMdmId(), entity.getId()); + } + + return BaseResult.getSuccessMessageEntity("删除成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDbField(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbFiledsEntity queryEntity = new MdmModuleDbFiledsEntity(); + queryEntity.setMdmId(entity.getMdmId()); + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryEntity); + List<MdmModuleDbFiledsEntity> dbEntities = new ArrayList<>(); + if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) { + for (int i = 0; i < mdmModuleDbFiledsEntities.size(); i++) { + if (entity.getDbId().equals(mdmModuleDbFiledsEntities.get(i).getDbId()) && "1".equals(mdmModuleDbFiledsEntities.get(i).getViewType())) { + dbEntities.add(mdmModuleDbFiledsEntities.get(i)); + MdmModuleDbFiledsRuleEntity ruleEntity = new MdmModuleDbFiledsRuleEntity(); + ruleEntity.setMdmId(mdmModuleDbFiledsEntities.get(i).getMdmId()); + ruleEntity.setFiledId(mdmModuleDbFiledsEntities.get(i).getId()); + List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(ruleEntity); + mdmModuleDbFiledsEntities.get(i).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRuleEntities); + } + } + } + return BaseResult.getSuccessMessageEntity("获取数据源表字段成功", dbEntities); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段明细 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDbFieldDetail(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbFiledsEntity queryEntity = new MdmModuleDbFiledsEntity(); + queryEntity.setMdmId(entity.getMdmId()); + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryEntity); + List<MdmModuleDbFiledsEntity> dbEntities = new ArrayList<>(); + if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) { + for (int i = 0; i < mdmModuleDbFiledsEntities.size(); i++) { + if (entity.getId().equals(mdmModuleDbFiledsEntities.get(i).getId())) { + entity = mdmModuleDbFiledsEntities.get(i); + MdmModuleDbFiledsRuleEntity ruleEntity = new MdmModuleDbFiledsRuleEntity(); + ruleEntity.setMdmId(entity.getMdmId()); + ruleEntity.setFiledId(entity.getId()); + List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(ruleEntity); + entity.setMdmModuleDbFiledsRules(mdmModuleDbFiledsRuleEntities); + } + } + } + return BaseResult.getSuccessMessageEntity("获取数据源表字段成功", entity); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段新增 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveMdmDbField(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getEnName() == null || "".equals(entity.getEnName())) { + return BaseResult.getFailureMessageEntity("请输入中文名称"); + } + if (entity.getChName() == null || "".equals(entity.getChName())) { + return BaseResult.getFailureMessageEntity("请输入英文名称"); + } + if (entity.getFiledType() == null || "".equals(entity.getChName())) { + return BaseResult.getFailureMessageEntity("请选择字段类型"); + } + if (entity.getDbType() == null || "".equals(entity.getDbType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(entity.getMdmId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(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())){ + return BaseResult.getFailureMessageEntity("字段已存在,请修改"); + } + } + } + entity.setCreate(); + if("1".equals(entity.getDbType())){ + entity.setAddType("1"); + entity.setUpdateType("1"); + entity.setShowType("1"); + entity.setQueryType("1"); + entity.setListType("1"); + entity.setViewType("1"); + }else { + entity.setAddType("1"); + entity.setUpdateType("1"); + entity.setShowType("1"); + entity.setQueryType("1"); + entity.setListType("2"); + entity.setViewType("1"); + } + entity.setDataType("1"); + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = new ArrayList<>(); + mdmModuleDbFiledsEntities.add(entity); + mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities); + + if (entity.getMdmModuleDbFiledsRules() != null && entity.getMdmModuleDbFiledsRules().size() > 0) { + for (int i = 0; i < entity.getMdmModuleDbFiledsRules().size(); i++) { + entity.getMdmModuleDbFiledsRules().get(i).setDbId(entity.getDbId()); + entity.getMdmModuleDbFiledsRules().get(i).setMdmId(entity.getMdmId()); + entity.getMdmModuleDbFiledsRules().get(i).setFiledId(entity.getId()); + entity.getMdmModuleDbFiledsRules().get(i).setSts("Y"); + entity.getMdmModuleDbFiledsRules().get(i).setCreate(); + mdmModuleDbFiledsRuleDao.save(entity.getMdmModuleDbFiledsRules().get(i)); + } + } + + mdmModuleDao.alterTableField(entity); + return BaseResult.getSuccessMessageEntity("新增字段成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmDbField(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getEnName() == null || "".equals(entity.getEnName())) { + return BaseResult.getFailureMessageEntity("请输入中文名称"); + } + if (entity.getChName() == null || "".equals(entity.getChName())) { + return BaseResult.getFailureMessageEntity("请输入英文名称"); + } + if (entity.getFiledType() == null || "".equals(entity.getChName())) { + return BaseResult.getFailureMessageEntity("请选择字段类型"); + } + entity.setUpdate(); + entity.setDataType("2"); + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = new ArrayList<>(); + mdmModuleDbFiledsEntities.add(entity); + mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities); + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setFiledId(entity.getId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + if (entity.getMdmModuleDbFiledsRules() != null && entity.getMdmModuleDbFiledsRules().size() > 0) { + for (int i = 0; i < entity.getMdmModuleDbFiledsRules().size(); i++) { + entity.getMdmModuleDbFiledsRules().get(i).setDbId(entity.getDbId()); + entity.getMdmModuleDbFiledsRules().get(i).setMdmId(entity.getMdmId()); + entity.getMdmModuleDbFiledsRules().get(i).setFiledId(entity.getId()); + entity.getMdmModuleDbFiledsRules().get(i).setSts("Y"); + if (entity.getMdmModuleDbFiledsRules().get(i).getId() != null) { + entity.getMdmModuleDbFiledsRules().get(i).setUpdate(); + mdmModuleDbFiledsRuleDao.update(entity.getMdmModuleDbFiledsRules().get(i)); + } else { + entity.getMdmModuleDbFiledsRules().get(i).setCreate(); + mdmModuleDbFiledsRuleDao.save(entity.getMdmModuleDbFiledsRules().get(i)); + } + } + } + mdmModuleDao.alterTableField(entity); + return BaseResult.getSuccessMessageEntity("修改字段成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段删除 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity deleteMdmDbField(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getEnName() == null || "".equals(entity.getEnName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getFiledType() == null || "".equals(entity.getFiledType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbFiledsRuleEntity queryCount = new MdmModuleDbFiledsRuleEntity(); + queryCount.setDbId(entity.getDbId()); + queryCount.setRuleCode("label"); + queryCount.setRuleValue(entity.getEnName()); + Integer counts = mdmModuleDbFiledsRuleDao.queryUserMdm(queryCount); + if (counts > 0) { + return BaseResult.getFailureMessageEntity(entity.getEnName() + "已被引用,不允许删除"); + } + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setMdmId(entity.getMdmId()); + mdmModuleViewEntity.setViewFiled(entity.getId()); + mdmModuleViewEntity.setUpIdFiled(entity.getId()); + Integer countss = mdmModuleViewDao.queryUserMdm(mdmModuleViewEntity); + if (countss > 0) { + return BaseResult.getFailureMessageEntity(entity.getEnName() + "已被显示引用,不允许删除"); + } + entity.setUpdate(); + entity.setDataType("3"); + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = new ArrayList<>(); + mdmModuleDbFiledsEntities.add(entity); + mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities); + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setFiledId(entity.getId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setViewFiled(entity.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + mdmModuleDao.alterTableField(entity); + return BaseResult.getSuccessMessageEntity("删除字段成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段规则获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDbFieldRule(JSONObject object) { + MdmModuleDbFiledsRuleEntity entity = getData("jsonStr", object, MdmModuleDbFiledsRuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getFiledId() == null || "".equals(entity.getFiledId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(entity); + return BaseResult.getSuccessMessageEntity("获取数据源表字段规则成功", mdmModuleDbFiledsRuleEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段规则修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmDbFieldRule(JSONObject object) { + + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getFieldId() == null || "".equals(entity.getFieldId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmModuleDbFiledsRuleEntities() == null || entity.getMdmModuleDbFiledsRuleEntities().size() == 0) { + return BaseResult.getFailureMessageEntity("请先设置字段规则"); + } + + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setFiledId(entity.getFieldId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + if (entity.getMdmModuleDbFiledsRuleEntities() != null && entity.getMdmModuleDbFiledsRuleEntities().size() > 0) { + for (int i = 0; i < entity.getMdmModuleDbFiledsRuleEntities().size(); i++) { + entity.getMdmModuleDbFiledsRuleEntities().get(i).setDbId(entity.getDbId()); + entity.getMdmModuleDbFiledsRuleEntities().get(i).setMdmId(entity.getId()); + entity.getMdmModuleDbFiledsRuleEntities().get(i).setFiledId(entity.getFieldId()); + entity.getMdmModuleDbFiledsRuleEntities().get(i).setSts("Y"); + if (entity.getMdmModuleDbFiledsRuleEntities().get(i).getId() != null) { + entity.getMdmModuleDbFiledsRuleEntities().get(i).setUpdate(); + mdmModuleDbFiledsRuleDao.update(entity.getMdmModuleDbFiledsRuleEntities().get(i)); + } else { + entity.getMdmModuleDbFiledsRuleEntities().get(i).setCreate(); + mdmModuleDbFiledsRuleDao.save(entity.getMdmModuleDbFiledsRuleEntities().get(i)); + } + } + } + return BaseResult.getSuccessMessageEntity("保存字段规则成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示类型获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmView(JSONObject object) { + MdmModuleViewEntity entity = getData("jsonStr", object, MdmModuleViewEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List<MdmModuleViewEntity> moduleViewEntities = mdmModuleViewDao.queryBase(entity); + + if(moduleViewEntities == null || moduleViewEntities.size() == 0){ + return BaseResult.getSuccessMessageEntity("获取显示类型成功"); + }else if (moduleViewEntities != null && moduleViewEntities.size() > 1) { + return BaseResult.getFailureMessageEntity("获取显示类型失败"); + } else { + return BaseResult.getSuccessMessageEntity("获取显示类型成功", moduleViewEntities.get(0)); + } + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示类型保存 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveMdmView(JSONObject object) { + MdmModuleViewEntity entity = getData("jsonStr", object, MdmModuleViewEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmModuleDao.get(entity.getMdmId()); + + entity.setCreate(); + mdmModuleViewDao.save(entity); + SysMenuConfigEntity module = new SysMenuConfigEntity(); + module.setCreate(); + module.setFormId(mdmModuleEntity.getId()); + if("1".equals(mdmModuleEntity.getMdmType())){ + //1、档案 + module.setParentMenuId("ea22757e99c144fb9ef381dd322e233c"); + }else { + //2、单据 + module.setParentMenuId("58714ddb7ec94f5da91df74efada042f"); + } + module.setMenuName(mdmModuleEntity.getMdmName()); + module.setMenuEnglishName("integrationOptionAdmin" + mdmModuleEntity.getMdmCode()); + module.setMenuIcon(null);//模块图标 + module.setRoute("integrationOptionAdmin/" + mdmModuleEntity.getMdmCode());//路由地址 + module.setMenuPage("integrationOptionV2/index");//一级Layout 二级 ParntView 三级component + module.setRemark("主数据生成菜单"); + module.setVisibles("0"); + module.setShowType("1"); + JSONObject object1 = new JSONObject(); + object1.put("mdmId", mdmModuleEntity.getId());//主数据id + object1.put("mdmCode", mdmModuleEntity.getMdmCode());//主数据编码 + object1.put("viewType", entity.getViewName());//1、树 2、列表 + module.setOptions(object1.toString());//菜单mate参数 + sysMenuConfigDao.save(module); + return BaseResult.getSuccessMessageEntity("保存显示类型成功"); + + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示类型修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmView(JSONObject object) { + MdmModuleViewEntity entity = getData("jsonStr", object, MdmModuleViewEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmModuleDao.get(entity.getMdmId()); + + entity.setUpdate(); + mdmModuleViewDao.update(entity); + SysMenuConfigEntity module = new SysMenuConfigEntity(); + module.setFormId(mdmModuleEntity.getId()); + List<SysMenuConfigEntity> sysMenuConfigEntities = sysMenuConfigDao.queryBase(module); + + if(sysMenuConfigEntities != null && sysMenuConfigEntities.size() == 1){ + module = sysMenuConfigEntities.get(0); + module.setUpdate(); + module.setFormId(mdmModuleEntity.getId()); + if("1".equals(mdmModuleEntity.getMdmType())){ + //1、档案 + module.setParentMenuId("ea22757e99c144fb9ef381dd322e233c"); + }else { + //2、单据 + module.setParentMenuId("58714ddb7ec94f5da91df74efada042f"); + } + module.setMenuName(mdmModuleEntity.getMdmName()); + module.setMenuEnglishName("integrationOptionAdmin" + mdmModuleEntity.getMdmCode()); + module.setMenuIcon(null);//模块图标 + module.setRoute("integrationOptionAdmin/" + mdmModuleEntity.getMdmCode());//路由地址 + module.setMenuPage("integrationOptionV2/index");//一级Layout 二级 ParntView 三级component + module.setRemark("主数据生成菜单"); + module.setVisibles("0"); + module.setShowType("1"); + JSONObject object1 = new JSONObject(); + object1.put("mdmId", mdmModuleEntity.getId());//主数据id + object1.put("mdmCode", mdmModuleEntity.getMdmCode());//主数据编码 + object1.put("viewType", entity.getViewName());//1、树 2、列表 + module.setOptions(object1.toString());//菜单mate参数 + sysMenuConfigDao.update(module); + } + return BaseResult.getSuccessMessageEntity("修改显示类型成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示字段获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmViewField(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleViewVo mdmModuleViewVo = new MdmModuleViewVo(); + //查询设置各种类型字段 + //查询模版数据源 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(entity.getId()); + mdmModuleDbEntity.setSts("Y"); + List<MdmModuleDbEntity> mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(entity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + setFiledType(mdmModuleViewVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList); + } + mdmModuleViewVo.setDbAddFiled(new ArrayList<>()); + mdmModuleViewVo.setDbEditFiled(new ArrayList<>()); + mdmModuleViewVo.setDbShowFiled(new ArrayList<>()); + mdmModuleViewVo.setDbQueryFiled(new ArrayList<>()); + mdmModuleViewVo.setDbListFiled(new ArrayList<>()); + + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntityList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); + setDbFiledType(mdmModuleViewVo, mdmModuleViewDetailEntityList); + + + return BaseResult.getSuccessMessageEntity("查询视图成功", mdmModuleViewVo); + } + + private void setDbFiledType(MdmModuleViewVo mdmModuleViewVo, List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntityList) { + //新增 + List<MdmModuleViewDetailEntity> addFiled = new ArrayList<>(); + //修改 + List<MdmModuleViewDetailEntity> editFiled = new ArrayList<>(); + //查看 + List<MdmModuleViewDetailEntity> showFiled = new ArrayList<>(); + //查询 + List<MdmModuleViewDetailEntity> queryFiled = new ArrayList<>(); + //列表 + List<MdmModuleViewDetailEntity> listFiled = new ArrayList<>(); + if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { + for (int i = 0; i < mdmModuleViewDetailEntityList.size(); i++) { + switch (mdmModuleViewDetailEntityList.get(i).getViewType()) { + //1、查询2、列表3、新增4、修改 5、查看 + case "1": + if(mdmModuleViewVo.getQueryFiled() != null && mdmModuleViewVo.getQueryFiled().size() > 0 ){ + for (int i1 = 0; i1 < mdmModuleViewVo.getQueryFiled().size(); i1++) { + if(mdmModuleViewVo.getQueryFiled().get(i1).getId().equals(mdmModuleViewDetailEntityList.get(i).getViewFiled())){ + mdmModuleViewDetailEntityList.get(i).setViewName(mdmModuleViewVo.getQueryFiled().get(i1).getName()); + queryFiled.add(mdmModuleViewDetailEntityList.get(i)); + } + } + } + break; + case "2": + if(mdmModuleViewVo.getListFiled() != null && mdmModuleViewVo.getListFiled().size() > 0 ){ + for (int i1 = 0; i1 < mdmModuleViewVo.getListFiled().size(); i1++) { + if(mdmModuleViewVo.getListFiled().get(i1).getId().equals(mdmModuleViewDetailEntityList.get(i).getViewFiled())){ + mdmModuleViewDetailEntityList.get(i).setViewName(mdmModuleViewVo.getListFiled().get(i1).getName()); + listFiled.add(mdmModuleViewDetailEntityList.get(i)); + } + } + } + break; + case "3": + if(mdmModuleViewVo.getAddFiled() != null && mdmModuleViewVo.getAddFiled().size() > 0 ){ + for (int i1 = 0; i1 < mdmModuleViewVo.getAddFiled().size(); i1++) { + if(mdmModuleViewVo.getAddFiled().get(i1).getId().equals(mdmModuleViewDetailEntityList.get(i).getViewFiled())){ + mdmModuleViewDetailEntityList.get(i).setViewName(mdmModuleViewVo.getAddFiled().get(i1).getName()); + addFiled.add(mdmModuleViewDetailEntityList.get(i)); + } + } + } + break; + case "4": + if(mdmModuleViewVo.getEditFiled() != null && mdmModuleViewVo.getEditFiled().size() > 0 ){ + for (int i1 = 0; i1 < mdmModuleViewVo.getEditFiled().size(); i1++) { + if(mdmModuleViewVo.getEditFiled().get(i1).getId().equals(mdmModuleViewDetailEntityList.get(i).getViewFiled())){ + mdmModuleViewDetailEntityList.get(i).setViewName(mdmModuleViewVo.getEditFiled().get(i1).getName()); + editFiled.add(mdmModuleViewDetailEntityList.get(i)); + } + } + } + break; + case "5": + if(mdmModuleViewVo.getShowFiled() != null && mdmModuleViewVo.getShowFiled().size() > 0 ){ + for (int i1 = 0; i1 < mdmModuleViewVo.getShowFiled().size(); i1++) { + if(mdmModuleViewVo.getShowFiled().get(i1).getId().equals(mdmModuleViewDetailEntityList.get(i).getViewFiled())){ + mdmModuleViewDetailEntityList.get(i).setViewName(mdmModuleViewVo.getShowFiled().get(i1).getName()); + showFiled.add(mdmModuleViewDetailEntityList.get(i)); + } + } + } + break; + default: + } + } + } + mdmModuleViewVo.setDbAddFiled(addFiled); + mdmModuleViewVo.setDbEditFiled(editFiled); + mdmModuleViewVo.setDbShowFiled(showFiled); + mdmModuleViewVo.setDbQueryFiled(queryFiled); + mdmModuleViewVo.setDbListFiled(listFiled); + } + + /** + * @param mdmModuleViewVo + * @param mdmModuleDbEntityList + * @param mdmModuleDbFiledsEntityList + * @return void + * @Author lvleigang + * @Description 设置对应的字段类型 + * @Date 2023/10/25 + **/ + private void setFiledType(MdmModuleViewVo mdmModuleViewVo, List<MdmModuleDbEntity> mdmModuleDbEntityList, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList) { + //新增 + List<MdmDbFiledVo> addFiled = new ArrayList<>(); + //修改 + List<MdmDbFiledVo> editFiled = new ArrayList<>(); + //查看 + List<MdmDbFiledVo> showFiled = new ArrayList<>(); + //查询 + List<MdmDbFiledVo> queryFiled = new ArrayList<>(); + //列表 + List<MdmDbFiledVo> listFiled = new ArrayList<>(); + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if("3".equals(mdmModuleDbEntityList.get(i).getDbType()) || "4".equals(mdmModuleDbEntityList.get(i).getDbType())){ + continue; + } + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + if("document_rule".equals(mdmModuleDbFiledsEntityList.get(i1).getEnName())){ + continue; + } + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //1、主表 + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getAddType())){ + addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getUpdateType())){ + editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getShowType())){ + showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getQueryType())){ + queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getListType())){ + listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + } else { + //2、明细 + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getQueryType())){ + queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getAddType())){ + addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getUpdateType())){ + editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getShowType())){ + showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + } + } + } + } + } + } + mdmModuleViewVo.setAddFiled(addFiled); + mdmModuleViewVo.setEditFiled(editFiled); + mdmModuleViewVo.setShowFiled(showFiled); + mdmModuleViewVo.setQueryFiled(queryFiled); + mdmModuleViewVo.setListFiled(listFiled); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示字段设置保存 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveOrUpdateMdmViewField(JSONObject object) { + MdmModuleViewVo entity = getData("jsonStr", object, MdmModuleViewVo.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getViewType() == null || "".equals(entity.getViewType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //1、查询2、列表3、新增4、修改 5、查看 + if ("1".equals(entity.getViewType())) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewType(entity.getViewType()); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + if (entity.getDbQueryFiled() != null && entity.getDbQueryFiled().size() > 0) { + for (int i = 0; i < entity.getDbQueryFiled().size(); i++) { + entity.getDbQueryFiled().get(i).setViewType(entity.getViewType()); + entity.getDbQueryFiled().get(i).setMdmId(entity.getMdmId()); + entity.getDbQueryFiled().get(i).setCreate(); + mdmModuleViewDetailDao.save(entity.getDbQueryFiled().get(i)); + } + } + + } else if ("2".equals(entity.getViewType())) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewType(entity.getViewType()); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + if (entity.getDbListFiled() != null && entity.getDbListFiled().size() > 0) { + for (int i = 0; i < entity.getDbListFiled().size(); i++) { + entity.getDbListFiled().get(i).setMdmId(entity.getMdmId()); + entity.getDbListFiled().get(i).setViewType(entity.getViewType()); + entity.getDbListFiled().get(i).setCreate(); + mdmModuleViewDetailDao.save(entity.getDbListFiled().get(i)); + } + } + + } else if ("3".equals(entity.getViewType())) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewType(entity.getViewType()); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + if (entity.getDbAddFiled() != null && entity.getDbAddFiled().size() > 0) { + for (int i = 0; i < entity.getDbAddFiled().size(); i++) { + entity.getDbAddFiled().get(i).setMdmId(entity.getMdmId()); + entity.getDbAddFiled().get(i).setViewType(entity.getViewType()); + entity.getDbAddFiled().get(i).setCreate(); + mdmModuleViewDetailDao.save(entity.getDbAddFiled().get(i)); + } + } + + } else if ("4".equals(entity.getViewType())) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewType(entity.getViewType()); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + if (entity.getDbEditFiled() != null && entity.getDbEditFiled().size() > 0) { + for (int i = 0; i < entity.getDbEditFiled().size(); i++) { + entity.getDbEditFiled().get(i).setMdmId(entity.getMdmId()); + entity.getDbEditFiled().get(i).setViewType(entity.getViewType()); + entity.getDbEditFiled().get(i).setCreate(); + mdmModuleViewDetailDao.save(entity.getDbEditFiled().get(i)); + } + } + + } else if ("5".equals(entity.getViewType())) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewType(entity.getViewType()); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + if (entity.getDbShowFiled() != null && entity.getDbShowFiled().size() > 0) { + for (int i = 0; i < entity.getDbShowFiled().size(); i++) { + entity.getDbShowFiled().get(i).setMdmId(entity.getMdmId()); + entity.getDbShowFiled().get(i).setViewType(entity.getViewType()); + entity.getDbShowFiled().get(i).setCreate(); + mdmModuleViewDetailDao.save(entity.getDbShowFiled().get(i)); + } + } + + } + return BaseResult.getSuccessMessageEntity("修改成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示按钮获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmViewButton(JSONObject object) { + MdmModuleViewButtonEntity entity = getData("jsonStr", object, MdmModuleViewButtonEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List<MdmModuleViewButtonEntity> moduleViewButtonEntities = mdmModuleViewButtonDao.queryBase(entity); + return BaseResult.getSuccessMessageEntity("获取显示按钮成功", moduleViewButtonEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示按钮保存 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveOrUpdateMdmViewButton(JSONObject object) { + MdmModuleViewVo entity = getData("jsonStr", object, MdmModuleViewVo.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + + MdmModuleViewButtonEntity mdmModuleViewButtonEntity = new MdmModuleViewButtonEntity(); + mdmModuleViewButtonEntity.setMdmId(entity.getMdmId()); + mdmModuleViewButtonEntity.setUpdate(); + mdmModuleViewButtonDao.logicRemoveMultiCondition(mdmModuleViewButtonEntity); + if (entity.getDbButtonFiled() != null && entity.getDbButtonFiled().size() > 0) { + for (int i = 0; i < entity.getDbButtonFiled().size(); i++) { + entity.getDbButtonFiled().get(i).setMdmId(entity.getMdmId()); + if (entity.getDbButtonFiled().get(i).getId() != null) { + entity.getDbButtonFiled().get(i).setUpdate(); + mdmModuleViewButtonDao.update(entity.getDbButtonFiled().get(i)); + } else { + entity.getDbButtonFiled().get(i).setCreate(); + mdmModuleViewButtonDao.save(entity.getDbButtonFiled().get(i)); + } + } + } + MdmModuleEntity mdmModuleEntity = mdmModuleDao.get(entity.getMdmId()); + SysMenuConfigEntity module = new SysMenuConfigEntity(); + module.setFormId(mdmModuleEntity.getId()); + List<SysMenuConfigEntity> sysMenuConfigEntities = sysMenuConfigDao.queryBase(module); + if(sysMenuConfigEntities != null && sysMenuConfigEntities.size() == 1){ + module = sysMenuConfigEntities.get(0); + SysButtonConfigEntity buttonConfigEntity = new SysButtonConfigEntity(); + buttonConfigEntity.setMenuId(module.getId()); + buttonConfigEntity.setSts("Y"); + List<SysButtonConfigEntity> sysButtonConfigEntities = sysButtonConfigDao.queryBase(buttonConfigEntity); + //1、查询按钮权限 + SysPopedomOperateEntity sysPopedomOperateEntity = new SysPopedomOperateEntity(); + sysPopedomOperateEntity.setMenuId(module.getId()); + sysPopedomOperateEntity.setSts("Y"); + List<SysPopedomOperateEntity> sysPopedomOperateEntities = sysPopedomOperateDao.queryBase(sysPopedomOperateEntity); + //删除按钮和删除按钮权限 + sysButtonConfigDao.logicRemoveMultiCondition(buttonConfigEntity); + sysPopedomOperateDao.logicRemoveMultiCondition(sysPopedomOperateEntity); + //删除处理权限 + doMdmModuleButton(module,entity.getDbButtonFiled(),sysButtonConfigEntities,sysPopedomOperateEntities); + } + return BaseResult.getSuccessMessageEntity("修改显示按钮成功"); + } + /** + * @Author lvleigang + * @Description + * @Date 3:29 下午 2024/6/4 + * @param module 菜单 + * @param mdmModuleViewButtonEntities 主数据按钮 + * @param sysButtonConfigEntities 菜单按钮 + * @param sysPopedomOperateEntities 按钮权限 + * @return void + **/ + private void doMdmModuleButton(SysMenuConfigEntity module,List<MdmModuleViewButtonEntity> mdmModuleViewButtonEntities, List<SysButtonConfigEntity> sysButtonConfigEntities, List<SysPopedomOperateEntity> sysPopedomOperateEntities) { + //循环设置的按钮,再循环菜单的按钮,如果有把原先的修改状态,如果没有新增 + if(mdmModuleViewButtonEntities != null && mdmModuleViewButtonEntities.size() > 0){ + for (int i = 0; i < mdmModuleViewButtonEntities.size(); i++) { + boolean flag = false; + if(sysButtonConfigEntities != null && sysButtonConfigEntities.size() > 0){ + for (int i1 = 0; i1 < sysButtonConfigEntities.size(); i1++) { + if(mdmModuleViewButtonEntities.get(i).getButtonValue().equals(sysButtonConfigEntities.get(i1).getCode())){ + flag = true; + sysButtonConfigEntities.get(i1).setSts("Y"); + sysButtonConfigEntities.get(i1).setUpdate(); + sysButtonConfigDao.update(sysButtonConfigEntities.get(i1)); + if(sysPopedomOperateEntities != null && sysPopedomOperateEntities.size() > 0){ + for (int i2 = 0; i2 < sysPopedomOperateEntities.size(); i2++) { + if(sysPopedomOperateEntities.get(i2).getOperate().equals(sysButtonConfigEntities.get(i1).getId())){ + sysPopedomOperateEntities.get(i2).setSts("Y"); + sysPopedomOperateEntities.get(i2).setUpdate(); + sysPopedomOperateDao.update(sysPopedomOperateEntities.get(i2)); + } + } + } + break; + } + } + } + //原先没有需要新增 + if(!flag){ + if("new".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())){ + SysButtonConfigEntity xz = new SysButtonConfigEntity(); + xz.setCode("new"); + xz.setNameCh("新建"); + xz.setNameEn("new"); + xz.setMenuId(module.getId()); + xz.setIconName(""); + xz.setStyles(""); + xz.setBtnFunction("new"); + xz.setRemark("主数据新建按钮"); + xz.setCreate(); + sysButtonConfigDao.save(xz); + } + if("resize".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())){ + + SysButtonConfigEntity cz = new SysButtonConfigEntity(); + cz.setCode("resize"); + cz.setNameCh("重置"); + cz.setNameEn("resize"); + cz.setMenuId(module.getId()); + cz.setIconName(""); + cz.setStyles(""); + cz.setBtnFunction("resize"); + cz.setRemark("主数据重置按钮"); + cz.setCreate(); + sysButtonConfigDao.save(cz); + } + if("search".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { + + SysButtonConfigEntity cx = new SysButtonConfigEntity(); + cx.setCode("search"); + cx.setNameCh("查询"); + cx.setNameEn("search"); + cx.setMenuId(module.getId()); + cx.setIconName(""); + cx.setStyles(""); + cx.setBtnFunction("search"); + cx.setRemark("主数据查询按钮"); + cx.setCreate(); + sysButtonConfigDao.save(cx); + } + if("edit".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { + + SysButtonConfigEntity xg = new SysButtonConfigEntity(); + xg.setCode("edit"); + xg.setNameCh("修改"); + xg.setNameEn("edit"); + xg.setMenuId(module.getId()); + xg.setIconName(""); + xg.setStyles(""); + xg.setBtnFunction("edit"); + xg.setRemark("主数据修改按钮"); + xg.setCreate(); + sysButtonConfigDao.save(xg); + } + if("dele".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { + + SysButtonConfigEntity sc = new SysButtonConfigEntity(); + sc.setCode("dele"); + sc.setNameCh("删除"); + sc.setNameEn("dele"); + sc.setMenuId(module.getId()); + sc.setIconName(""); + sc.setStyles(""); + sc.setBtnFunction("dele"); + sc.setRemark("主数据删除按钮"); + sc.setCreate(); + sysButtonConfigDao.save(sc); + } + if("view".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { + + SysButtonConfigEntity ck = new SysButtonConfigEntity(); + ck.setCode("view"); + ck.setNameCh("查看"); + ck.setNameEn("view"); + ck.setMenuId(module.getId()); + ck.setIconName(""); + ck.setStyles(""); + ck.setBtnFunction("view"); + ck.setRemark("主数据查看按钮"); + ck.setCreate(); + sysButtonConfigDao.save(ck); + } + if("send".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { + SysButtonConfigEntity xf = new SysButtonConfigEntity(); + xf.setCode("send"); + xf.setNameCh("下发"); + xf.setNameEn("send"); + xf.setMenuId(module.getId()); + xf.setIconName(""); + xf.setStyles(""); + xf.setBtnFunction("send"); + xf.setRemark("主数据下发按钮"); + xf.setCreate(); + sysButtonConfigDao.save(xf); + } + + + } + } + } + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据来源-列表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmSource(JSONObject object) { + MdmModuleSourceEntity entity = getData("jsonStr", object, MdmModuleSourceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List<MdmModuleSourceEntity> list = mdmModuleSourceDao.queryBase(entity); + return BaseResult.getSuccessMessageEntity("获取数据来源成功", list); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据来源保存 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveMdmSource(JSONObject object) { + MdmModuleSourceEntity entity = getData("jsonStr", object, MdmModuleSourceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setCreate(); + mdmModuleSourceDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存数据来源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据来源获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity getMdmSource(JSONObject object) { + MdmModuleSourceEntity entity = getData("jsonStr", object, MdmModuleSourceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = mdmModuleSourceDao.get(entity.getId()); + return BaseResult.getSuccessMessageEntity("获取数据来源成功", entity); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据来源修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmSource(JSONObject object) { + MdmModuleSourceEntity entity = getData("jsonStr", object, MdmModuleSourceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + mdmModuleSourceDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改数据来源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据来源删除 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity deleteMdmSource(JSONObject object) { + MdmModuleSourceEntity entity = getData("jsonStr", object, MdmModuleSourceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + mdmModuleSourceDao.logicRemoveMultiCondition(entity); + return BaseResult.getSuccessMessageEntity("删除数据来源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-分发设置-列表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDistribute(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List<MdmModuleDistributeEntity> list = mdmModuleDistributeDao.queryBase(entity); + return BaseResult.getSuccessMessageEntity("获取分发设置成功", list); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-分发设置保存 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveMdmDistribute(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setCreate(); + mdmModuleDistributeDao.save(entity); + if (entity.getMdmModuleDistributeDetailEntities() != null && entity.getMdmModuleDistributeDetailEntities().size() > 0) { + for (int i = 0; i < entity.getMdmModuleDistributeDetailEntities().size(); i++) { + entity.getMdmModuleDistributeDetailEntities().get(i).setCreate(); + entity.getMdmModuleDistributeDetailEntities().get(i).setDistributeId(entity.getId()); + entity.getMdmModuleDistributeDetailEntities().get(i).setMdmId(entity.getMdmId()); + mdmModuleDistributeDetailDao.save(entity.getMdmModuleDistributeDetailEntities().get(i)); + } + } + return BaseResult.getSuccessMessageEntity("保存分发设置成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-分发设置获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity getMdmDistribute(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = mdmModuleDistributeDao.get(entity.getId()); + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setDistributeId(entity.getId()); + List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + entity.setMdmModuleDistributeDetailEntities(mdmModuleDistributeDetailEntities); + return BaseResult.getSuccessMessageEntity("获取分发设置成功", entity); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-分发设置修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmDistribute(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + mdmModuleDistributeDao.update(entity); + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setDistributeId(entity.getId()); + mdmModuleDistributeDetailEntity.setUpdate(); + mdmModuleDistributeDetailDao.logicRemoveMultiCondition(mdmModuleDistributeDetailEntity); + if (entity.getMdmModuleDistributeDetailEntities() != null && entity.getMdmModuleDistributeDetailEntities().size() > 0) { + for (int i = 0; i < entity.getMdmModuleDistributeDetailEntities().size(); i++) { + entity.getMdmModuleDistributeDetailEntities().get(i).setSts("Y"); + if (entity.getMdmModuleDistributeDetailEntities().get(i).getId() != null) { + entity.getMdmModuleDistributeDetailEntities().get(i).setUpdate(); + mdmModuleDistributeDetailDao.update(entity.getMdmModuleDistributeDetailEntities().get(i)); + } else { + entity.getMdmModuleDistributeDetailEntities().get(i).setCreate(); + mdmModuleDistributeDetailDao.save(entity.getMdmModuleDistributeDetailEntities().get(i)); + } + } + } + return BaseResult.getSuccessMessageEntity("修改数据来源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-分发设置删除 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity deleteMdmDistribute(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + mdmModuleDistributeDao.logicRemoveMultiCondition(entity); + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setDistributeId(entity.getId()); + mdmModuleDistributeDetailEntity.setUpdate(); + mdmModuleDistributeDetailDao.logicRemoveMultiCondition(mdmModuleDistributeDetailEntity); + + return BaseResult.getSuccessMessageEntity("删除数据来源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-写入日志-列表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmOptionLogPage(JSONObject object) { + MdmModuleOptionLogEntity entity = getData("jsonStr", object, MdmModuleOptionLogEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0 ){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_option_log"); + break; + } + } + }else { + return BaseResult.getFailureMessageEntity("请先设置数据源"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List<MdmModuleOptionLogEntity> list = mdmModuleOptionLogDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-下发日志-列表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDistributeLogPage(JSONObject object) { + MdmModuleSendLogEntity entity = getData("jsonStr", object, MdmModuleSendLogEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0) { + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if ("1".equals(mdmModuleDbEntities.get(i).getDbType())) { + entity.setTableName(mdmModuleDbEntities.get(i).getDbName() + "_send_log"); + break; + } + } + } else { + return BaseResult.getFailureMessageEntity("请先设置数据源"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List<MdmModuleSendLogEntity> list = mdmModuleSendLogDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @Author lvleigang + * @Description 主数据-数据源-服务获取(只获取主表) + * @Date 11:43 上午 2024/6/11 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryMdmService(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setSts("Y"); + mdmModuleDbEntity.setDbType("1"); + List<MdmModuleDbEntity> mdmModuleDbEntities = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + return BaseResult.getSuccessMessageEntity("查询数据成功", mdmModuleDbEntities); + } + + + /** + * @Author lvleigang + * @Description 主数据-数据源-服务字段获取 + * @Date 11:43 上午 2024/6/11 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryMdmServiceField(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setMdmId(entity.getMdmId()); + List<MdmModuleDbFiledsEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + List<MdmModuleDbFiledsEntity> list = new ArrayList<>(); + if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if(entity.getDbId().equals(mdmModuleDbEntities.get(i).getDbId()) && "1".equals(mdmModuleDbEntities.get(i).getViewType())){ + list.add(mdmModuleDbEntities.get(i)); + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } + + /** + * @Author lvleigang + * @Description 主数据-分发-只获取主表 + * @Date 11:43 上午 2024/6/11 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryMdmMainDB(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setSts("Y"); + mdmModuleDbEntity.setMdmId(entity.getMdmId()); + List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + List<MdmModuleDbEntity> list = new ArrayList<>(); + if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + list.add(mdmModuleDbEntities.get(i)); + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } + + /** + * @Author lvleigang + * @Description 主数据-数据源-只获取主表字段 + * @Date 11:43 上午 2024/6/11 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryMdmMainDBField(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setSts("Y"); + mdmModuleDbEntity.setMdmId(entity.getMdmId()); + List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setMdmId(entity.getMdmId()); + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + + List<MdmModuleDbFiledsEntity> list = new ArrayList<>(); + if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){ + for (int i1 = 0; i1 < mdmModuleDbFiledsEntities.size(); i1++) { + if(mdmModuleDbEntities.get(i).getId().equals(mdmModuleDbFiledsEntities.get(i1).getDbId()) && "1".equals(mdmModuleDbFiledsEntities.get(i1).getViewType())){ + list.add(mdmModuleDbFiledsEntities.get(i1)); + } + } + } + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java index 89849461..75785b1a 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java @@ -17,5 +17,7 @@ public interface IMdmModuleDbDao extends IBaseDao<MdmModuleDbEntity, String> { HashMap<String, Object> getServiceDataById(Map<String, Object> queryData); List<HashMap<String, Object>> getServiceByFormmainId(Map<String, Object> queryData); List<HashMap<String, Object>> getServiceByDistributeId(Map<String, Object> queryData); + + int deleteMdmModuleDb(MdmModuleDbEntity mdmModuleDbEntity); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java index 8bf06ee1..85351316 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java @@ -37,5 +37,11 @@ public class MdmModuleDbDaoImpl extends MybatisGenericDao<MdmModuleDbEntity, Str } + @Override + public int deleteMdmModuleDb(MdmModuleDbEntity entity) { + Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteMdmModuleDb", entity); + return o; + } + } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml index 2340cbcd..ce49938a 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml @@ -2,23 +2,23 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.hzya.frame.mdm.mdmModuleDb.dao.impl.MdmModuleDbDaoImpl"> - <resultMap id="get-MdmModuleDbEntity-result" type="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity" > - <result property="id" column="id" jdbcType="VARCHAR"/> - <result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/> - <result property="dbName" column="db_name" jdbcType="VARCHAR"/> - <result property="dbType" column="db_type" jdbcType="VARCHAR"/> - <result property="remark" column="remark" jdbcType="VARCHAR"/> - <result property="sorts" column="sorts" jdbcType="INTEGER"/> - <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/> - <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/> - <result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/> - <result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/> - <result property="sts" column="sts" jdbcType="VARCHAR"/> - <result property="org_id" column="org_id" jdbcType="VARCHAR"/> - <result property="companyId" column="company_id" jdbcType="VARCHAR"/> - </resultMap> + <resultMap id="get-MdmModuleDbEntity-result" type="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> + <result property="id" column="id" jdbcType="VARCHAR"/> + <result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/> + <result property="dbName" column="db_name" jdbcType="VARCHAR"/> + <result property="dbType" column="db_type" jdbcType="VARCHAR"/> + <result property="remark" column="remark" jdbcType="VARCHAR"/> + <result property="sorts" column="sorts" jdbcType="INTEGER"/> + <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/> + <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/> + <result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/> + <result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/> + <result property="sts" column="sts" jdbcType="VARCHAR"/> + <result property="org_id" column="org_id" jdbcType="VARCHAR"/> + <result property="companyId" column="company_id" jdbcType="VARCHAR"/> + </resultMap> <!-- 查询的字段--> - <sql id = "MdmModuleDbEntity_Base_Column_List"> + <sql id="MdmModuleDbEntity_Base_Column_List"> id ,mdm_id ,db_name @@ -33,209 +33,222 @@ ,org_id ,company_id </sql> - <!-- 查询 采用==查询 --> - <select id="entity_list_base" resultMap="get-MdmModuleDbEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> - select - <include refid="MdmModuleDbEntity_Base_Column_List" /> - from mdm_module_db - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''"> and id = #{id} </if> - <if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if> - <if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if> - <if test="dbType != null and dbType != ''"> and db_type = #{dbType} </if> - <if test="remark != null and remark != ''"> and remark = #{remark} </if> - <if test="sorts != null"> and sorts = #{sorts} </if> - <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> - <if test="create_time != null"> and create_time = #{create_time} </if> - <if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if> - <if test="modify_time != null"> and modify_time = #{modify_time} </if> - <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> + <!-- 查询 采用==查询 --> + <select id="entity_list_base" resultMap="get-MdmModuleDbEntity-result" + parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> + select + <include refid="MdmModuleDbEntity_Base_Column_List"/> + from mdm_module_db + <trim prefix="where" prefixOverrides="and"> + <if test="id != null and id != ''">and id = #{id}</if> + <if test="mdmId != null and mdmId != ''">and mdm_id = #{mdmId}</if> + <if test="dbName != null and dbName != ''">and db_name = #{dbName}</if> + <if test="dbType != null and dbType != ''">and db_type = #{dbType}</if> + <if test="remark != null and remark != ''">and remark = #{remark}</if> + <if test="sorts != null">and sorts = #{sorts}</if> + <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if> + <if test="create_time != null">and create_time = #{create_time}</if> + <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if> + <if test="modify_time != null">and modify_time = #{modify_time}</if> + <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> and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> -</select> - -<!-- 查询符合条件的数量 --> -<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> - select count(1) from mdm_module_db - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''"> and id = #{id} </if> - <if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if> - <if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if> - <if test="dbType != null and dbType != ''"> and db_type = #{dbType} </if> - <if test="remark != null and remark != ''"> and remark = #{remark} </if> - <if test="sorts != null"> and sorts = #{sorts} </if> - <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> - <if test="create_time != null"> and create_time = #{create_time} </if> - <if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if> - <if test="modify_time != null"> and modify_time = #{modify_time} </if> - <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> + </trim> + <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> + <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> + </select> + + <!-- 查询符合条件的数量 --> + <select id="entity_count" resultType="Integer" + parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> + select count(1) from mdm_module_db + <trim prefix="where" prefixOverrides="and"> + <if test="id != null and id != ''">and id = #{id}</if> + <if test="mdmId != null and mdmId != ''">and mdm_id = #{mdmId}</if> + <if test="dbName != null and dbName != ''">and db_name = #{dbName}</if> + <if test="dbType != null and dbType != ''">and db_type = #{dbType}</if> + <if test="remark != null and remark != ''">and remark = #{remark}</if> + <if test="sorts != null">and sorts = #{sorts}</if> + <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if> + <if test="create_time != null">and create_time = #{create_time}</if> + <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if> + <if test="modify_time != null">and modify_time = #{modify_time}</if> + <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> and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if> + </trim> + <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> + <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> </select> <!-- 分页查询列表 采用like格式 --> -<select id="entity_list_like" resultMap="get-MdmModuleDbEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> - select - <include refid="MdmModuleDbEntity_Base_Column_List" /> - from mdm_module_db - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if> - <if test="mdmId != null and mdmId != ''"> and mdm_id like concat('%',#{mdmId},'%') </if> - <if test="dbName != null and dbName != ''"> and db_name like concat('%',#{dbName},'%') </if> - <if test="dbType != null and dbType != ''"> and db_type like concat('%',#{dbType},'%') </if> - <if test="remark != null and remark != ''"> and remark like concat('%',#{remark},'%') </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_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_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> + <select id="entity_list_like" resultMap="get-MdmModuleDbEntity-result" + parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> + select + <include refid="MdmModuleDbEntity_Base_Column_List"/> + from mdm_module_db + <trim prefix="where" prefixOverrides="and"> + <if test="id != null and id != ''">and id like concat('%',#{id},'%')</if> + <if test="mdmId != null and mdmId != ''">and mdm_id like concat('%',#{mdmId},'%')</if> + <if test="dbName != null and dbName != ''">and db_name like concat('%',#{dbName},'%')</if> + <if test="dbType != null and dbType != ''">and db_type like concat('%',#{dbType},'%')</if> + <if test="remark != null and remark != ''">and remark like concat('%',#{remark},'%')</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_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_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> and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> -</select> + </trim> + <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> + <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> + </select> -<!-- 查询列表 字段采用or格式 --> -<select id="MdmModuleDbentity_list_or" resultMap="get-MdmModuleDbEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> - select - <include refid="MdmModuleDbEntity_Base_Column_List" /> - from mdm_module_db - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''"> or id = #{id} </if> - <if test="mdmId != null and mdmId != ''"> or mdm_id = #{mdmId} </if> - <if test="dbName != null and dbName != ''"> or db_name = #{dbName} </if> - <if test="dbType != null and dbType != ''"> or db_type = #{dbType} </if> - <if test="remark != null and remark != ''"> or remark = #{remark} </if> - <if test="sorts != null"> or sorts = #{sorts} </if> - <if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if> - <if test="create_time != null"> or create_time = #{create_time} </if> - <if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if> - <if test="modify_time != null"> or modify_time = #{modify_time} </if> - <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> + <!-- 查询列表 字段采用or格式 --> + <select id="MdmModuleDbentity_list_or" resultMap="get-MdmModuleDbEntity-result" + parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> + select + <include refid="MdmModuleDbEntity_Base_Column_List"/> + from mdm_module_db + <trim prefix="where" prefixOverrides="and"> + <if test="id != null and id != ''">or id = #{id}</if> + <if test="mdmId != null and mdmId != ''">or mdm_id = #{mdmId}</if> + <if test="dbName != null and dbName != ''">or db_name = #{dbName}</if> + <if test="dbType != null and dbType != ''">or db_type = #{dbType}</if> + <if test="remark != null and remark != ''">or remark = #{remark}</if> + <if test="sorts != null">or sorts = #{sorts}</if> + <if test="create_user_id != null and create_user_id != ''">or create_user_id = #{create_user_id}</if> + <if test="create_time != null">or create_time = #{create_time}</if> + <if test="modify_user_id != null and modify_user_id != ''">or modify_user_id = #{modify_user_id}</if> + <if test="modify_time != null">or modify_time = #{modify_time}</if> + <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> and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> -</select> + </trim> + <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> + <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> + </select> -<!--新增所有列--> -<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity" > - insert into mdm_module_db( - <trim suffix="" suffixOverrides=","> - <if test="id != null and id != ''"> id , </if> - <if test="mdmId != null and mdmId != ''"> mdm_id , </if> - <if test="dbName != null and dbName != ''"> db_name , </if> - <if test="dbType != null and dbType != ''"> db_type , </if> - <if test="remark != null and remark != ''"> remark , </if> - <if test="sorts != null"> sorts , </if> - <if test="create_user_id != null and create_user_id != ''"> create_user_id , </if> - <if test="create_time != null"> create_time , </if> - <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if> - <if test="modify_time != null"> modify_time , </if> - <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="sts == null ">sts,</if> - </trim> - )values( - <trim suffix="" suffixOverrides=","> - <if test="id != null and id != ''"> #{id} ,</if> - <if test="mdmId != null and mdmId != ''"> #{mdmId} ,</if> - <if test="dbName != null and dbName != ''"> #{dbName} ,</if> - <if test="dbType != null and dbType != ''"> #{dbType} ,</if> - <if test="remark != null and remark != ''"> #{remark} ,</if> - <if test="sorts != null"> #{sorts} ,</if> - <if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if> - <if test="create_time != null"> #{create_time} ,</if> - <if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if> - <if test="modify_time != null"> #{modify_time} ,</if> - <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="sts == null ">'Y',</if> - </trim> - ) -</insert> -<!-- 批量新增 --> -<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) - 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}, 'Y') - </foreach> -</insert> -<!-- 批量新增或者修改--> -<insert id="entityInsertOrUpdateBatch" > - 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) - 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}) - </foreach> - on duplicate key update - mdm_id = values(mdm_id), - db_name = values(db_name), - db_type = values(db_type), - remark = values(remark), - create_user_id = values(create_user_id), - create_time = values(create_time), - modify_user_id = values(modify_user_id), - modify_time = values(modify_time), - sts = values(sts), - org_id = values(org_id), - company_id = values(company_id)</insert> -<!--通过主键修改方法--> -<update id="entity_update" parameterType = "com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity" > -update mdm_module_db set -<trim suffix="" suffixOverrides=","> - <if test="mdmId != null and mdmId != ''"> mdm_id = #{mdmId},</if> - <if test="dbName != null and dbName != ''"> db_name = #{dbName},</if> - <if test="dbType != null and dbType != ''"> db_type = #{dbType},</if> - <if test="remark != null and remark != ''"> remark = #{remark},</if> - <if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if> - <if test="create_time != null"> create_time = #{create_time},</if> - <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if> - <if test="modify_time != null"> modify_time = #{modify_time},</if> - <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> -</trim> -where id = #{id} -</update> -<!-- 逻辑删除 --> -<update id="entity_logicDelete" parameterType = "com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity" > + <!--新增所有列--> + <insert id="entity_insert" parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> + insert into mdm_module_db( + <trim suffix="" suffixOverrides=","> + <if test="id != null and id != ''">id ,</if> + <if test="mdmId != null and mdmId != ''">mdm_id ,</if> + <if test="dbName != null and dbName != ''">db_name ,</if> + <if test="dbType != null and dbType != ''">db_type ,</if> + <if test="remark != null and remark != ''">remark ,</if> + <if test="sorts != null">sorts ,</if> + <if test="create_user_id != null and create_user_id != ''">create_user_id ,</if> + <if test="create_time != null">create_time ,</if> + <if test="modify_user_id != null and modify_user_id != ''">modify_user_id ,</if> + <if test="modify_time != null">modify_time ,</if> + <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="sts == null ">sts,</if> + </trim> + )values( + <trim suffix="" suffixOverrides=","> + <if test="id != null and id != ''">#{id} ,</if> + <if test="mdmId != null and mdmId != ''">#{mdmId} ,</if> + <if test="dbName != null and dbName != ''">#{dbName} ,</if> + <if test="dbType != null and dbType != ''">#{dbType} ,</if> + <if test="remark != null and remark != ''">#{remark} ,</if> + <if test="sorts != null">#{sorts} ,</if> + <if test="create_user_id != null and create_user_id != ''">#{create_user_id} ,</if> + <if test="create_time != null">#{create_time} ,</if> + <if test="modify_user_id != null and modify_user_id != ''">#{modify_user_id} ,</if> + <if test="modify_time != null">#{modify_time} ,</if> + <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="sts == null ">'Y',</if> + </trim> + ) + </insert> + <!-- 批量新增 --> + <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) + 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}, + 'Y') + </foreach> + </insert> + <!-- 批量新增或者修改--> + <insert id="entityInsertOrUpdateBatch"> + 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) + 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}) + </foreach> + on duplicate key update + mdm_id = values(mdm_id), + db_name = values(db_name), + db_type = values(db_type), + remark = values(remark), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + </insert> + <!--通过主键修改方法--> + <update id="entity_update" parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> + update mdm_module_db set + <trim suffix="" suffixOverrides=","> + <if test="mdmId != null and mdmId != ''">mdm_id = #{mdmId},</if> + <if test="dbName != null and dbName != ''">db_name = #{dbName},</if> + <if test="dbType != null and dbType != ''">db_type = #{dbType},</if> + <if test="remark != null and remark != ''">remark = #{remark},</if> + <if test="create_user_id != null and create_user_id != ''">create_user_id = #{create_user_id},</if> + <if test="create_time != null">create_time = #{create_time},</if> + <if test="modify_user_id != null and modify_user_id != ''">modify_user_id = #{modify_user_id},</if> + <if test="modify_time != null">modify_time = #{modify_time},</if> + <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> + </trim> + where id = #{id} + </update> + <!-- 逻辑删除 --> + <update id="entity_logicDelete" parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> update mdm_module_db 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.mdmModuleDb.entity.MdmModuleDbEntity" > -update mdm_module_db 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> - <if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if> - <if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if> - <if test="dbType != null and dbType != ''"> and db_type = #{dbType} </if> - <if test="remark != null and remark != ''"> and remark = #{remark} </if> - <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> + <!-- 多条件逻辑删除 --> + <update id="entity_logicDelete_Multi_Condition" + parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> + update mdm_module_db 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> + <if test="mdmId != null and mdmId != ''">and mdm_id = #{mdmId}</if> + <if test="dbName != null and dbName != ''">and db_name = #{dbName}</if> + <if test="dbType != null and dbType != ''">and db_type = #{dbType}</if> + <if test="remark != null and remark != ''">and remark = #{remark}</if> + <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> and sts='Y' - </trim> -</update> -<!--通过主键删除--> -<delete id="entity_delete"> + </trim> + </update> + <!--通过主键删除--> + <delete id="entity_delete"> delete from mdm_module_db where id = #{id} </delete> <select id="getServiceDataById" resultType="java.util.HashMap" parameterType="java.util.HashMap"> @@ -299,5 +312,9 @@ update mdm_module_db set sts= 'N' ,modify_time = #{modify_time},modify_user_id order by sorts asc </select> + <!--通过mdmCode删除--> + <delete id="deleteMdmModuleDb" parameterType="com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity"> + delete from mdm_module_db where mdm_id = #{mdmId} +</delete> </mapper> diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java index 9bbd8915..9cf1ab43 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java @@ -11,5 +11,6 @@ import com.hzya.frame.basedao.dao.IBaseDao; */ public interface IMdmModuleDbFiledsDao extends IBaseDao<MdmModuleDbFiledsEntity, String> { + int deleteMdmModuleDbFileds(MdmModuleDbFiledsEntity entity); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java index 1e32d5a9..054270b4 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java @@ -12,6 +12,11 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; */ @Repository(value = "MdmModuleDbFiledsDaoImpl") public class MdmModuleDbFiledsDaoImpl extends MybatisGenericDao<MdmModuleDbFiledsEntity, String> implements IMdmModuleDbFiledsDao{ - + + @Override + public int deleteMdmModuleDbFileds(MdmModuleDbFiledsEntity entity) { + Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteMdmModuleDbFileds", entity); + return o; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java index abb89344..80e26fd1 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java @@ -5,6 +5,8 @@ import java.util.List; import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.web.entity.BaseEntity; +import org.apache.poi.ss.formula.functions.T; + /** * 模版数据库字段表(MdmModuleDbFileds)实体类 * @@ -13,6 +15,8 @@ import com.hzya.frame.web.entity.BaseEntity; */ public class MdmModuleDbFiledsEntity extends BaseEntity { + /** 主数据模版ID */ + private String dbName; /** 主数据模版ID */ private String mdmId; /** 模版数据库id */ @@ -41,6 +45,8 @@ public class MdmModuleDbFiledsEntity extends BaseEntity { private String companyId; /** 数据类型 1、新增 2、修改 */ private String dataType; + /** 类型 1、主表 2、明细 3、操作日志 4、下发日志 */ + private String dbType; /** * roletype */ @@ -51,6 +57,8 @@ public class MdmModuleDbFiledsEntity extends BaseEntity { private String roleValue; private List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules; + //1、查询2、列表3、新增4、修改 5、查看 + private String fieldType; public String getMdmId() { return mdmId; } @@ -186,5 +194,29 @@ public class MdmModuleDbFiledsEntity extends BaseEntity { public void setRoleValue(String roleValue) { this.roleValue = roleValue; } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getFieldType() { + return fieldType; + } + + public void setFieldType(String fieldType) { + this.fieldType = fieldType; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml index 8e4d37a4..cdac2db1 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml @@ -326,6 +326,9 @@ update mdm_module_db_fileds set sts= 'N' ,modify_time = #{modify_time},modify_u <delete id="entity_delete"> 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> </mapper> diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java index 7e29594b..ab7def4b 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java @@ -11,5 +11,6 @@ import com.hzya.frame.basedao.dao.IBaseDao; */ public interface IMdmModuleDbFiledsRuleDao extends IBaseDao<MdmModuleDbFiledsRuleEntity, String> { + Integer queryUserMdm(MdmModuleDbFiledsRuleEntity queryCount); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java index d3c4f630..2f11bed8 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java @@ -12,6 +12,11 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; */ @Repository(value = "MdmModuleDbFiledsRuleDaoImpl") public class MdmModuleDbFiledsRuleDaoImpl extends MybatisGenericDao<MdmModuleDbFiledsRuleEntity, String> implements IMdmModuleDbFiledsRuleDao{ - + + @Override + public Integer queryUserMdm(MdmModuleDbFiledsRuleEntity queryCount) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "queryUserMdm", queryCount); + return o; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml index 2d1e1e9f..2c2213f8 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml @@ -283,5 +283,17 @@ update mdm_module_db_fileds_rule set sts= 'N' ,modify_time = #{modify_time},mod delete from mdm_module_db_fileds_rule where id = #{id} </delete> + <!-- 查询符合条件的数量 --> + <select id="queryUserMdm" resultType="Integer" 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="ruleCode != null and ruleCode != ''"> and rule_code = #{ruleCode} </if> + <if test="ruleValue != null and ruleValue != ''"> and rule_value = #{ruleValue} </if> + and sts='Y' + </trim> + </select> + + </mapper> diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java index 2e2f90f5..895f30cd 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java @@ -7,7 +7,7 @@ import com.hzya.frame.basedao.dao.IBaseDao; * 主数据功能应用分发表(mdm_module_distribute: table)表数据库访问层 * * @author makejava - * @since 2024-06-03 08:47:33 + * @since 2024-06-14 10:06:36 */ public interface IMdmModuleDistributeDao extends IBaseDao<MdmModuleDistributeEntity, String> { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java index 3318c2c2..4c029e80 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java @@ -8,7 +8,7 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; * 主数据功能应用分发表(MdmModuleDistribute)表数据库访问层 * * @author makejava - * @since 2024-06-03 08:47:33 + * @since 2024-06-14 10:06:36 */ @Repository(value = "MdmModuleDistributeDaoImpl") public class MdmModuleDistributeDaoImpl extends MybatisGenericDao<MdmModuleDistributeEntity, String> implements IMdmModuleDistributeDao{ diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java index 0ce7e336..9b6677b9 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java @@ -9,7 +9,7 @@ import com.hzya.frame.web.entity.BaseEntity; * 主数据功能应用分发表(MdmModuleDistribute)实体类 * * @author makejava - * @since 2024-06-03 08:47:33 + * @since 2024-06-14 10:06:36 */ public class MdmModuleDistributeEntity extends BaseEntity { @@ -25,8 +25,11 @@ public class MdmModuleDistributeEntity extends BaseEntity { private String deleteApi; /** 启用停用 0、停用1、启用 */ private String enabledState; + /** 主表ID */ + private String dbId; /** 公司id */ private String companyId; + private List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities; public String getMdmId() { @@ -77,6 +80,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.enabledState = enabledState; } + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } + public String getCompanyId() { return companyId; } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml index 82243342..20e5de5b 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml @@ -10,6 +10,7 @@ <result property="addApi" column="add_api" jdbcType="VARCHAR"/> <result property="deleteApi" column="delete_api" jdbcType="VARCHAR"/> <result property="enabledState" column="enabled_state" jdbcType="VARCHAR"/> + <result property="dbId" column="db_id" jdbcType="VARCHAR"/> <result property="sorts" column="sorts" jdbcType="INTEGER"/> <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/> <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/> @@ -28,6 +29,7 @@ ,add_api ,delete_api ,enabled_state + ,db_id ,sorts ,create_user_id ,create_time @@ -37,6 +39,13 @@ ,org_id ,company_id </sql> + + <!--通过ID获取数据 --> + <select id="entity_get" resultMap="get-MdmModuleDistributeEntity-result"> + select + <include refid="MdmModuleDistributeEntity_Base_Column_List" /> + from mdm_module_distribute where id = #{ id } and sts='Y' + </select> <!-- 查询 采用==查询 --> <select id="entity_list_base" resultMap="get-MdmModuleDistributeEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity"> select @@ -50,6 +59,7 @@ <if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if> <if test="deleteApi != null and deleteApi != ''"> and delete_api = #{deleteApi} </if> <if test="enabledState != null and enabledState != ''"> and enabled_state = #{enabledState} </if> + <if test="dbId != null and dbId != ''"> and db_id = #{dbId} </if> <if test="sorts != null"> and sorts = #{sorts} </if> <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> <if test="create_time != null"> and create_time = #{create_time} </if> @@ -75,6 +85,7 @@ <if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if> <if test="deleteApi != null and deleteApi != ''"> and delete_api = #{deleteApi} </if> <if test="enabledState != null and enabledState != ''"> and enabled_state = #{enabledState} </if> + <if test="dbId != null and dbId != ''"> and db_id = #{dbId} </if> <if test="sorts != null"> and sorts = #{sorts} </if> <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> <if test="create_time != null"> and create_time = #{create_time} </if> @@ -102,6 +113,7 @@ <if test="addApi != null and addApi != ''"> and add_api like concat('%',#{addApi},'%') </if> <if test="deleteApi != null and deleteApi != ''"> and delete_api like concat('%',#{deleteApi},'%') </if> <if test="enabledState != null and enabledState != ''"> and enabled_state like concat('%',#{enabledState},'%') </if> + <if test="dbId != null and dbId != ''"> and db_id like concat('%',#{dbId},'%') </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_time != null"> and create_time like concat('%',#{create_time},'%') </if> @@ -129,6 +141,7 @@ <if test="addApi != null and addApi != ''"> or add_api = #{addApi} </if> <if test="deleteApi != null and deleteApi != ''"> or delete_api = #{deleteApi} </if> <if test="enabledState != null and enabledState != ''"> or enabled_state = #{enabledState} </if> + <if test="dbId != null and dbId != ''"> or db_id = #{dbId} </if> <if test="sorts != null"> or sorts = #{sorts} </if> <if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if> <if test="create_time != null"> or create_time = #{create_time} </if> @@ -144,7 +157,7 @@ </select> <!--新增所有列--> -<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity" > +<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity" > insert into mdm_module_distribute( <trim suffix="" suffixOverrides=","> <if test="id != null and id != ''"> id , </if> @@ -154,6 +167,7 @@ <if test="addApi != null and addApi != ''"> add_api , </if> <if test="deleteApi != null and deleteApi != ''"> delete_api , </if> <if test="enabledState != null and enabledState != ''"> enabled_state , </if> + <if test="dbId != null and dbId != ''"> db_id , </if> <if test="sorts != null"> sorts , </if> <if test="create_user_id != null and create_user_id != ''"> create_user_id , </if> <if test="create_time != null"> create_time , </if> @@ -162,6 +176,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="sorts == null ">sorts,</if> <if test="sts == null ">sts,</if> </trim> )values( @@ -173,6 +188,7 @@ <if test="addApi != null and addApi != ''"> #{addApi} ,</if> <if test="deleteApi != null and deleteApi != ''"> #{deleteApi} ,</if> <if test="enabledState != null and enabledState != ''"> #{enabledState} ,</if> + <if test="dbId != null and dbId != ''"> #{dbId} ,</if> <if test="sorts != null"> #{sorts} ,</if> <if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if> <if test="create_time != null"> #{create_time} ,</if> @@ -181,24 +197,25 @@ <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="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute a WHERE a.sts = 'Y' ),</if> <if test="sts == null ">'Y',</if> </trim> ) </insert> <!-- 批量新增 --> -<insert id="entityInsertBatch" > - insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) +<insert id="entityInsertBatch" > + insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, db_id, 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.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{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.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.dbId},#{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_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) +<insert id="entityInsertOrUpdateBatch" > + insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, db_id, 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.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + (#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) </foreach> on duplicate key update mdm_id = values(mdm_id), @@ -207,6 +224,7 @@ add_api = values(add_api), delete_api = values(delete_api), enabled_state = values(enabled_state), + db_id = values(db_id), create_user_id = values(create_user_id), create_time = values(create_time), modify_user_id = values(modify_user_id), @@ -224,6 +242,7 @@ update mdm_module_distribute set <if test="addApi != null and addApi != ''"> add_api = #{addApi},</if> <if test="deleteApi != null and deleteApi != ''"> delete_api = #{deleteApi},</if> <if test="enabledState != null and enabledState != ''"> enabled_state = #{enabledState},</if> + <if test="dbId != null and dbId != ''"> db_id = #{dbId},</if> <if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if> <if test="create_time != null"> create_time = #{create_time},</if> <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if> @@ -250,6 +269,7 @@ update mdm_module_distribute set sts= 'N' ,modify_time = #{modify_time},modify_ <if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if> <if test="deleteApi != null and deleteApi != ''"> and delete_api = #{deleteApi} </if> <if test="enabledState != null and enabledState != ''"> and enabled_state = #{enabledState} </if> + <if test="dbId != null and dbId != ''"> and db_id = #{dbId} </if> <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> diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java index 577b0e3c..ab9fe2da 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java @@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService; * 主数据功能应用分发表(MdmModuleDistribute)表服务接口 * * @author makejava - * @since 2024-06-03 08:47:33 + * @since 2024-06-14 10:06:36 */ public interface IMdmModuleDistributeService extends IBaseService<MdmModuleDistributeEntity, String>{ } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java index 24fe61e3..5133bc1a 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java @@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService; * 主数据功能应用分发表(MdmModuleDistribute)表服务实现类 * * @author makejava - * @since 2024-06-03 08:47:33 + * @since 2024-06-14 10:06:36 */ @Service(value = "mdmModuleDistributeService") public class MdmModuleDistributeServiceImpl extends BaseService<MdmModuleDistributeEntity, String> implements IMdmModuleDistributeService { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java index 2b55a63a..3b39e01d 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java @@ -7,7 +7,7 @@ import com.hzya.frame.basedao.dao.IBaseDao; * 主数据功能应用分发明细表(mdm_module_distribute_detail: table)表数据库访问层 * * @author makejava - * @since 2024-06-03 08:48:18 + * @since 2024-06-14 10:03:50 */ public interface IMdmModuleDistributeDetailDao extends IBaseDao<MdmModuleDistributeDetailEntity, String> { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java index 68878631..c184298c 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java @@ -8,7 +8,7 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; * 主数据功能应用分发明细表(MdmModuleDistributeDetail)表数据库访问层 * * @author makejava - * @since 2024-06-03 08:48:18 + * @since 2024-06-14 10:03:50 */ @Repository(value = "MdmModuleDistributeDetailDaoImpl") public class MdmModuleDistributeDetailDaoImpl extends MybatisGenericDao<MdmModuleDistributeDetailEntity, String> implements IMdmModuleDistributeDetailDao{ diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java index b0438ba8..18bd952c 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java @@ -6,7 +6,7 @@ import com.hzya.frame.web.entity.BaseEntity; * 主数据功能应用分发明细表(MdmModuleDistributeDetail)实体类 * * @author makejava - * @since 2024-06-03 08:48:18 + * @since 2024-06-14 10:03:50 */ public class MdmModuleDistributeDetailEntity extends BaseEntity { @@ -18,12 +18,18 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity { private String apiId; /** 数据类型 1、新增2、修改3、删除 */ private String dataType; + /** 左括号 */ + private String leftBracket; /** 字段名 */ private String filedName; - /** 对比类型 1、等于 */ + /** 对比类型 1、等于 2、不等于 3、大于 4、小于 */ private String compareType; /** 目标API字段默认值 */ private String filedVaule; + /** 连接符号 1\and 2\or */ + private String connectionSymbol; + /** 右括号 */ + private String rightParenthesis; /** 公司id */ private String companyId; @@ -60,6 +66,14 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity { this.dataType = dataType; } + public String getLeftBracket() { + return leftBracket; + } + + public void setLeftBracket(String leftBracket) { + this.leftBracket = leftBracket; + } + public String getFiledName() { return filedName; } @@ -84,6 +98,22 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity { this.filedVaule = filedVaule; } + public String getConnectionSymbol() { + return connectionSymbol; + } + + public void setConnectionSymbol(String connectionSymbol) { + this.connectionSymbol = connectionSymbol; + } + + public String getRightParenthesis() { + return rightParenthesis; + } + + public void setRightParenthesis(String rightParenthesis) { + this.rightParenthesis = rightParenthesis; + } + public String getCompanyId() { return companyId; } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml index 15113e4f..962f618a 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml @@ -8,9 +8,12 @@ <result property="distributeId" column="distribute_id" jdbcType="VARCHAR"/> <result property="apiId" column="api_id" jdbcType="VARCHAR"/> <result property="dataType" column="data_type" jdbcType="VARCHAR"/> + <result property="leftBracket" column="left_bracket" jdbcType="VARCHAR"/> <result property="filedName" column="filed_name" jdbcType="VARCHAR"/> <result property="compareType" column="compare_type" jdbcType="VARCHAR"/> <result property="filedVaule" column="filed_vaule" jdbcType="VARCHAR"/> + <result property="connectionSymbol" column="connection_symbol" jdbcType="VARCHAR"/> + <result property="rightParenthesis" column="right_parenthesis" jdbcType="VARCHAR"/> <result property="sorts" column="sorts" jdbcType="INTEGER"/> <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/> <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/> @@ -27,9 +30,12 @@ ,distribute_id ,api_id ,data_type + ,left_bracket ,filed_name ,compare_type ,filed_vaule + ,connection_symbol + ,right_parenthesis ,sorts ,create_user_id ,create_time @@ -39,6 +45,12 @@ ,org_id ,company_id </sql> + <!--通过ID获取数据 --> + <select id="entity_get" resultMap="get-MdmModuleDistributeDetailEntity-result"> + select + <include refid="MdmModuleDistributeDetailEntity_Base_Column_List" /> + from mdm_module_distribute_detail where id = #{ id } and sts='Y' + </select> <!-- 查询 采用==查询 --> <select id="entity_list_base" resultMap="get-MdmModuleDistributeDetailEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity"> select @@ -50,9 +62,12 @@ <if test="distributeId != null and distributeId != ''"> and distribute_id = #{distributeId} </if> <if test="apiId != null and apiId != ''"> and api_id = #{apiId} </if> <if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if> + <if test="leftBracket != null and leftBracket != ''"> and left_bracket = #{leftBracket} </if> <if test="filedName != null and filedName != ''"> and filed_name = #{filedName} </if> <if test="compareType != null and compareType != ''"> and compare_type = #{compareType} </if> <if test="filedVaule != null and filedVaule != ''"> and filed_vaule = #{filedVaule} </if> + <if test="connectionSymbol != null and connectionSymbol != ''"> and connection_symbol = #{connectionSymbol} </if> + <if test="rightParenthesis != null and rightParenthesis != ''"> and right_parenthesis = #{rightParenthesis} </if> <if test="sorts != null"> and sorts = #{sorts} </if> <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> <if test="create_time != null"> and create_time = #{create_time} </if> @@ -76,9 +91,12 @@ <if test="distributeId != null and distributeId != ''"> and distribute_id = #{distributeId} </if> <if test="apiId != null and apiId != ''"> and api_id = #{apiId} </if> <if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if> + <if test="leftBracket != null and leftBracket != ''"> and left_bracket = #{leftBracket} </if> <if test="filedName != null and filedName != ''"> and filed_name = #{filedName} </if> <if test="compareType != null and compareType != ''"> and compare_type = #{compareType} </if> <if test="filedVaule != null and filedVaule != ''"> and filed_vaule = #{filedVaule} </if> + <if test="connectionSymbol != null and connectionSymbol != ''"> and connection_symbol = #{connectionSymbol} </if> + <if test="rightParenthesis != null and rightParenthesis != ''"> and right_parenthesis = #{rightParenthesis} </if> <if test="sorts != null"> and sorts = #{sorts} </if> <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> <if test="create_time != null"> and create_time = #{create_time} </if> @@ -104,9 +122,12 @@ <if test="distributeId != null and distributeId != ''"> and distribute_id like concat('%',#{distributeId},'%') </if> <if test="apiId != null and apiId != ''"> and api_id like concat('%',#{apiId},'%') </if> <if test="dataType != null and dataType != ''"> and data_type like concat('%',#{dataType},'%') </if> + <if test="leftBracket != null and leftBracket != ''"> and left_bracket like concat('%',#{leftBracket},'%') </if> <if test="filedName != null and filedName != ''"> and filed_name like concat('%',#{filedName},'%') </if> <if test="compareType != null and compareType != ''"> and compare_type like concat('%',#{compareType},'%') </if> <if test="filedVaule != null and filedVaule != ''"> and filed_vaule like concat('%',#{filedVaule},'%') </if> + <if test="connectionSymbol != null and connectionSymbol != ''"> and connection_symbol like concat('%',#{connectionSymbol},'%') </if> + <if test="rightParenthesis != null and rightParenthesis != ''"> and right_parenthesis like concat('%',#{rightParenthesis},'%') </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_time != null"> and create_time like concat('%',#{create_time},'%') </if> @@ -132,9 +153,12 @@ <if test="distributeId != null and distributeId != ''"> or distribute_id = #{distributeId} </if> <if test="apiId != null and apiId != ''"> or api_id = #{apiId} </if> <if test="dataType != null and dataType != ''"> or data_type = #{dataType} </if> + <if test="leftBracket != null and leftBracket != ''"> or left_bracket = #{leftBracket} </if> <if test="filedName != null and filedName != ''"> or filed_name = #{filedName} </if> <if test="compareType != null and compareType != ''"> or compare_type = #{compareType} </if> <if test="filedVaule != null and filedVaule != ''"> or filed_vaule = #{filedVaule} </if> + <if test="connectionSymbol != null and connectionSymbol != ''"> or connection_symbol = #{connectionSymbol} </if> + <if test="rightParenthesis != null and rightParenthesis != ''"> or right_parenthesis = #{rightParenthesis} </if> <if test="sorts != null"> or sorts = #{sorts} </if> <if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if> <if test="create_time != null"> or create_time = #{create_time} </if> @@ -150,7 +174,7 @@ </select> <!--新增所有列--> -<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity" > +<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity" > insert into mdm_module_distribute_detail( <trim suffix="" suffixOverrides=","> <if test="id != null and id != ''"> id , </if> @@ -158,9 +182,12 @@ <if test="distributeId != null and distributeId != ''"> distribute_id , </if> <if test="apiId != null and apiId != ''"> api_id , </if> <if test="dataType != null and dataType != ''"> data_type , </if> + <if test="leftBracket != null and leftBracket != ''"> left_bracket , </if> <if test="filedName != null and filedName != ''"> filed_name , </if> <if test="compareType != null and compareType != ''"> compare_type , </if> <if test="filedVaule != null and filedVaule != ''"> filed_vaule , </if> + <if test="connectionSymbol != null and connectionSymbol != ''"> connection_symbol , </if> + <if test="rightParenthesis != null and rightParenthesis != ''"> right_parenthesis , </if> <if test="sorts != null"> sorts , </if> <if test="create_user_id != null and create_user_id != ''"> create_user_id , </if> <if test="create_time != null"> create_time , </if> @@ -169,6 +196,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="sorts == null ">sorts,</if> <if test="sts == null ">sts,</if> </trim> )values( @@ -178,9 +206,12 @@ <if test="distributeId != null and distributeId != ''"> #{distributeId} ,</if> <if test="apiId != null and apiId != ''"> #{apiId} ,</if> <if test="dataType != null and dataType != ''"> #{dataType} ,</if> + <if test="leftBracket != null and leftBracket != ''"> #{leftBracket} ,</if> <if test="filedName != null and filedName != ''"> #{filedName} ,</if> <if test="compareType != null and compareType != ''"> #{compareType} ,</if> <if test="filedVaule != null and filedVaule != ''"> #{filedVaule} ,</if> + <if test="connectionSymbol != null and connectionSymbol != ''"> #{connectionSymbol} ,</if> + <if test="rightParenthesis != null and rightParenthesis != ''"> #{rightParenthesis} ,</if> <if test="sorts != null"> #{sorts} ,</if> <if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if> <if test="create_time != null"> #{create_time} ,</if> @@ -189,33 +220,37 @@ <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="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute_detail a WHERE a.sts = 'Y' ),</if> <if test="sts == null ">'Y',</if> </trim> ) </insert> <!-- 批量新增 --> -<insert id="entityInsertBatch" > - insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, filed_name, compare_type, filed_vaule, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) +<insert id="entityInsertBatch" > + insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, left_bracket, filed_name, compare_type, filed_vaule, connection_symbol, right_parenthesis, 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.distributeId},#{entity.apiId},#{entity.dataType},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{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.distributeId},#{entity.apiId},#{entity.dataType},#{entity.leftBracket},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.connectionSymbol},#{entity.rightParenthesis},#{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_distribute_detail(mdm_id, distribute_id, api_id, data_type, filed_name, compare_type, filed_vaule, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) +<insert id="entityInsertOrUpdateBatch" > + insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, left_bracket, filed_name, compare_type, filed_vaule, connection_symbol, right_parenthesis, 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.distributeId},#{entity.apiId},#{entity.dataType},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.leftBracket},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.connectionSymbol},#{entity.rightParenthesis},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) </foreach> on duplicate key update mdm_id = values(mdm_id), distribute_id = values(distribute_id), api_id = values(api_id), data_type = values(data_type), + left_bracket = values(left_bracket), filed_name = values(filed_name), compare_type = values(compare_type), filed_vaule = values(filed_vaule), + connection_symbol = values(connection_symbol), + right_parenthesis = values(right_parenthesis), create_user_id = values(create_user_id), create_time = values(create_time), modify_user_id = values(modify_user_id), @@ -231,9 +266,12 @@ update mdm_module_distribute_detail set <if test="distributeId != null and distributeId != ''"> distribute_id = #{distributeId},</if> <if test="apiId != null and apiId != ''"> api_id = #{apiId},</if> <if test="dataType != null and dataType != ''"> data_type = #{dataType},</if> + <if test="leftBracket != null and leftBracket != ''"> left_bracket = #{leftBracket},</if> <if test="filedName != null and filedName != ''"> filed_name = #{filedName},</if> <if test="compareType != null and compareType != ''"> compare_type = #{compareType},</if> <if test="filedVaule != null and filedVaule != ''"> filed_vaule = #{filedVaule},</if> + <if test="connectionSymbol != null and connectionSymbol != ''"> connection_symbol = #{connectionSymbol},</if> + <if test="rightParenthesis != null and rightParenthesis != ''"> right_parenthesis = #{rightParenthesis},</if> <if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if> <if test="create_time != null"> create_time = #{create_time},</if> <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if> @@ -258,9 +296,12 @@ update mdm_module_distribute_detail set sts= 'N' ,modify_time = #{modify_time}, <if test="distributeId != null and distributeId != ''"> and distribute_id = #{distributeId} </if> <if test="apiId != null and apiId != ''"> and api_id = #{apiId} </if> <if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if> + <if test="leftBracket != null and leftBracket != ''"> and left_bracket = #{leftBracket} </if> <if test="filedName != null and filedName != ''"> and filed_name = #{filedName} </if> <if test="compareType != null and compareType != ''"> and compare_type = #{compareType} </if> <if test="filedVaule != null and filedVaule != ''"> and filed_vaule = #{filedVaule} </if> + <if test="connectionSymbol != null and connectionSymbol != ''"> and connection_symbol = #{connectionSymbol} </if> + <if test="rightParenthesis != null and rightParenthesis != ''"> and right_parenthesis = #{rightParenthesis} </if> <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> diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java index 9b2fb7f8..735d9003 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java @@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService; * 主数据功能应用分发明细表(MdmModuleDistributeDetail)表服务接口 * * @author makejava - * @since 2024-06-03 08:48:18 + * @since 2024-06-14 10:03:50 */ public interface IMdmModuleDistributeDetailService extends IBaseService<MdmModuleDistributeDetailEntity, String>{ } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java index 6dd4b505..8dd367f5 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java @@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService; * 主数据功能应用分发明细表(MdmModuleDistributeDetail)表服务实现类 * * @author makejava - * @since 2024-06-03 08:48:18 + * @since 2024-06-14 10:03:50 */ @Service(value = "mdmModuleDistributeDetailService") public class MdmModuleDistributeDetailServiceImpl extends BaseService<MdmModuleDistributeDetailEntity, String> implements IMdmModuleDistributeDetailService { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.java index 84e0358b..30f3c515 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.java @@ -12,7 +12,7 @@ public class MdmModuleSourceEntity extends BaseEntity { /** 主数据模版ID */ private String mdmId; - /** 来源类型 */ + /** 来源类型1、插件2、api */ private String sourceType; /** 来源名称 */ private String sourceName; diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml index 245446f4..b4625605 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml @@ -33,6 +33,11 @@ ,org_id ,company_id </sql> + <select id="entity_get" resultMap="get-MdmModuleSourceEntity-result"> + select + <include refid="MdmModuleSourceEntity_Base_Column_List" /> + from mdm_module_source where sts = 'Y' and id = #{id} + </select> <!-- 查询 采用==查询 --> <select id="entity_list_base" resultMap="get-MdmModuleSourceEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity"> select diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java index c1daba93..bf04e65d 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java @@ -1,5 +1,6 @@ package com.hzya.frame.mdm.mdmModuleView.dao; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; import com.hzya.frame.basedao.dao.IBaseDao; @@ -11,5 +12,6 @@ import com.hzya.frame.basedao.dao.IBaseDao; */ public interface IMdmModuleViewDao extends IBaseDao<MdmModuleViewEntity, String> { + Integer queryUserMdm(MdmModuleViewEntity mdmModuleViewEntity); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java index 453f7b44..cf3aace2 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java @@ -1,5 +1,6 @@ package com.hzya.frame.mdm.mdmModuleView.dao.impl; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; import org.springframework.stereotype.Repository; @@ -12,6 +13,14 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; */ @Repository(value = "MdmModuleViewDaoImpl") public class MdmModuleViewDaoImpl extends MybatisGenericDao<MdmModuleViewEntity, String> implements IMdmModuleViewDao{ - + + + + + @Override + public Integer queryUserMdm(MdmModuleViewEntity mdmModuleViewEntity) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "queryUserMdm", mdmModuleViewEntity); + return o; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java index 83103ab3..e8232cc1 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java @@ -12,7 +12,7 @@ public class MdmModuleViewEntity extends BaseEntity { /** 主数据模版ID */ private String mdmId; - /** 显示类型 */ + /** 显示类型 1、树2、列表*/ private String viewName; /** 显示字段 */ private String viewFiled; diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml index 0e990f0d..f6af148b 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml @@ -238,6 +238,14 @@ update mdm_module_view set sts= 'N' ,modify_time = #{modify_time},modify_user_i <delete id="entity_delete"> delete from mdm_module_view where id = #{id} </delete> - + <!-- 查询符合条件的数量 --> + <select id="queryUserMdm" resultType="Integer" parameterType = "com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity"> + select count(1) from mdm_module_view + <trim prefix="where" prefixOverrides="and"> + and mdm_id = #{mdmId} + and (view_filed = #{viewFiled} or up_id_filed = #{upIdFiled}) + and sts='Y' + </trim> + </select> </mapper> diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewButton/entity/MdmModuleViewButtonEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewButton/entity/MdmModuleViewButtonEntity.java index 6ac2b94f..19949393 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewButton/entity/MdmModuleViewButtonEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewButton/entity/MdmModuleViewButtonEntity.java @@ -14,7 +14,7 @@ public class MdmModuleViewButtonEntity extends BaseEntity { private String mdmId; /** 视图id */ private String viewId; - /** 类型1、新建2、重置3、查询4、修改 5、删除 6、查看 */ + /** 类型1、新建2、重置3、查询4、修改 5、删除 6、查看 7、下发 */ private String buttonType; /** 按钮值 */ private String buttonValue; diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java index 8d10318a..5b5295d9 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java @@ -16,6 +16,8 @@ public class MdmModuleViewDetailEntity extends BaseEntity { private String viewId; /** 字段 */ private String viewFiled; + /** 字段 */ + private String viewName; /** 类型1、查询2、列表3、新增4、修改 5、查看 */ private String viewType; /** 公司id */ @@ -70,5 +72,13 @@ public class MdmModuleViewDetailEntity extends BaseEntity { public void setDataType(String dataType) { this.dataType = dataType; } + + public String getViewName() { + return viewName; + } + + public void setViewName(String viewName) { + this.viewName = viewName; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java b/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java index d588e694..ae9ef52c 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java @@ -8,222 +8,6 @@ import com.hzya.frame.web.entity.JsonResultEntity; */ public interface IMdmService { - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据列表查询接口分页 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmPage(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据列表查询接口列表 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmList(JSONObject jsonObject); - - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据新增 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity addMdm(JSONObject jsonObject); - - - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据基本信息获取 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmModule(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据基本信息修改 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity doSaveMdmModule(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询数据源 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmModuleDb(JSONObject jsonObject); - // - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询数据源的服务 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmModuleServer(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询数据源字段的服务 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmModuleServerFiled(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询主表字段 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmModuleServerMainFiled(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置保存数据源 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity saveMdmModuleDb(JSONObject jsonObject); - - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询显示信息 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmModuleView(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置修改显示信息 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity doSaveMdmModuleView(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询权限配置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleRule(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置保存权限配置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity doSaveMdmModuleRule(JSONObject jsonObject); - // - // - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询分发设置 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmModuleDistribute(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置保存分发设置 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity doSaveMdmModuleDistribute(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询数据来源 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmModuleSource(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置保存数据来源 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity doSaveMdmModuleSource(JSONObject jsonObject); - - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询下发日志 - * @Date 11:52 上午 2024/3/27 - **/ - JsonResultEntity querySendEntityPage(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 获取下发日志 - * @Date 2:36 下午 2024/3/27 - **/ - JsonResultEntity getSendEntity(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 删除下发日志 - * @Date 2:37 下午 2024/3/27 - **/ - JsonResultEntity deleteSendEntity(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询操作日志 - * @Date 11:52 上午 2024/3/27 - **/ - JsonResultEntity queryOptionEntityPage(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 获取操作日志 - * @Date 2:36 下午 2024/3/27 - **/ - JsonResultEntity getOptionEntity(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 删除操作日志 - * @Date 2:37 下午 2024/3/27 - **/ - JsonResultEntity deleteOptionEntity(JSONObject jsonObject); - // /** * @param jsonObject * @return com.hzya.frame.web.entity.JsonResultEntity @@ -326,7 +110,6 @@ public interface IMdmService { * @Date 9:40 上午 2023/10/18 **/ JsonResultEntity deleteMdmShowDetailsData(JSONObject jsonObject); - // ///** // * @param jsonObject // * @return com.hzya.frame.web.entity.JsonResultEntity @@ -336,4 +119,5 @@ public interface IMdmService { // **/ //JsonResultEntity doMdmDistribute(JSONObject jsonObject); + } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java b/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java index 4174d5fa..ef527337 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java @@ -13,6 +13,8 @@ import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity; import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; import java.util.List; @@ -21,7 +23,6 @@ import java.util.List; */ public interface IMdmServiceCache { - /** * @Author lvleigang * @Description 获取模版主表 @@ -30,14 +31,24 @@ public interface IMdmServiceCache { * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity **/ MdmModuleEntity getMdmModuleEntity(Long mdmCode); + /** * @Author lvleigang - * @Description 获取模版单据编码规则 + * @Description 修改模版主表 * @Date 10:13 上午 2024/6/3 - * @param mdmTableCodeRuleEntity + * @param entity * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity **/ - List<MdmTableCodeRuleEntity> queryMdmTableCodeRuleEntity(MdmTableCodeRuleEntity mdmTableCodeRuleEntity); + void updateMdmModuleEntity(MdmModuleEntity entity); + + /** + * @Author lvleigang + * @Description 删除模版主表 + * @Date 10:13 上午 2024/6/3 + * @param entity + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ + void deleteMdmModuleEntity(MdmModuleEntity entity); /** * @Author lvleigang * @Description 获取模版表数据 @@ -46,6 +57,26 @@ public interface IMdmServiceCache { * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity **/ List<MdmModuleDbEntity> queryMdmModuleDb(MdmModuleDbEntity queryDb); + + /** + * @Author lvleigang + * @Description 修改模版表数据 + * @Date 4:23 下午 2024/6/11 + * @param mdmId + * @param mdmModuleDbEntities + * @return void + **/ + void saveOrUpdateMdmModuleDb(String mdmId, List<MdmModuleDbEntity> mdmModuleDbEntities); + + + /** + * @Author lvleigang + * @Description 删除模版表数据 + * @Date 4:23 下午 2024/6/11 + * @param mdmId + * @return void + **/ + void deleteMdmModuleDb(String mdmId,String dbID); /** * @Author lvleigang * @Description 获取模版字段表数据 @@ -55,38 +86,21 @@ public interface IMdmServiceCache { **/ List<MdmModuleDbFiledsEntity> queryMdmModuleDbFileds(MdmModuleDbFiledsEntity queryDbFiled); - void updateMdmModuleEntity(MdmModuleEntity entity); - - - List<MdmModuleDbFiledsRuleEntity> queryMdmModuleDbFiledsRule(MdmModuleDbFiledsRuleEntity queryDbFiledRule); - - void saveMdmTableCodeRule(String mdmid, List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntities); - - void saveMdmModuleDb(String id, List<MdmModuleDbEntity> mdmModuleDbEntities); - - void saveMdmModuleDbFileds(String id, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities); - - void saveMdmModuleDbFiledsRule(String id, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities); - - List<MdmModuleViewDetailEntity> queryMdmModuleViewDetail(MdmModuleViewDetailEntity mdmModuleViewDetailEntity); - - List<MdmModuleViewEntity> queryMdmModuleView(MdmModuleViewEntity mdmModuleViewEntity); - - List<MdmModuleViewButtonEntity> queryMdmModuleViewButton(MdmModuleViewButtonEntity mdmModuleViewButtonEntity); - - void saveMdmModuleView(String id, MdmModuleViewEntity mdmModuleViewEntity); - - void saveMdmModuleViewDetail(String id, List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities); - - void saveMdmModuleViewButton(String id, List<MdmModuleViewButtonEntity> mdmModuleViewButtonEntities); - - List<MdmModuleDistributeEntity> queryMdmModuleDistribute(String id,MdmModuleDistributeEntity mdmModuleDistributeEntity); - - void saveMdmModuleDistribute(String id, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities); - - List<MdmModuleSourceEntity> queryMdmModuleSource(MdmModuleSourceEntity mdmModuleSourceEntity); - - void saveMdmModuleSource(String id, List<MdmModuleSourceEntity> mdmModuleSourceEntities); - - List<MdmModuleDistributeDetailEntity> queryMdmModuleDistributeDetail(MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity); + /** + * @Author lvleigang + * @Description 修改数据源db的字段 + * @Date 4:25 下午 2024/6/11 + * @param mdmId + * @param mdmModuleDbFiledsEntities + * @return void + **/ + void saveOrUpdateMdmModuleDbFileds(String mdmId, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities); + /** + * @Author lvleigang + * @Description 删除数据源db的字段 + * @Date 4:25 下午 2024/6/11 + * @param mdmId + * @return void + **/ + void deleteMdmModuleDbFileds(String mdmId,String dbID); } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java index b847f145..759aaa10 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java @@ -73,27 +73,53 @@ public class MdmServiceCache implements IMdmServiceCache { @Resource private IMdmTableCodeRuleDao mdmTableCodeRuleDao; + /** + * @Author lvleigang + * @Description 缓存主数据 + * @Date 4:03 下午 2024/6/11 + * @param mdmCode + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ @Override @Cacheable(cacheNames="mdmModule",key = "#mdmCode") public MdmModuleEntity getMdmModuleEntity(Long mdmCode) { MdmModuleEntity entity = mdmModuleDao.getByMdmCode(mdmCode); return entity; } - + /** + * @Author lvleigang + * @Description 缓存删除主数据 + * @Date 4:03 下午 2024/6/11 + * @param entity + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ @Override @CacheEvict(cacheNames="mdmModule",key = "#entity.mdmCode") public void updateMdmModuleEntity(MdmModuleEntity entity) { mdmModuleDao.update(entity); } + /** + * @param entity + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + * @Author lvleigang + * @Description 删除模版主表 + * @Date 10:13 上午 2024/6/3 + **/ @Override - @Cacheable(cacheNames="mdmTableCodeRule",key = "#entity.mdmId") - public List<MdmTableCodeRuleEntity> queryMdmTableCodeRuleEntity(MdmTableCodeRuleEntity entity) { - List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntityList = mdmTableCodeRuleDao.queryBase(entity); - return mdmTableCodeRuleEntityList; + @CacheEvict(cacheNames="mdmModule",key = "#entity.mdmCode") + public void deleteMdmModuleEntity(MdmModuleEntity entity) { + entity.setUpdate(); + mdmModuleDao.logicRemoveMultiCondition(entity); } - + /** + * @Author lvleigang + * @Description 缓存主数据DB + * @Date 4:03 下午 2024/6/11 + * @param entity + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ @Override @Cacheable(cacheNames="mdmModuleDb",key = "#entity.mdmId") public List<MdmModuleDbEntity> queryMdmModuleDb(MdmModuleDbEntity entity) { @@ -101,38 +127,17 @@ public class MdmServiceCache implements IMdmServiceCache { return mdmModuleDbEntities; } - @Override - @Cacheable(cacheNames="mdmModuleDbFileds",key = "#entity.mdmId") - public List<MdmModuleDbFiledsEntity> queryMdmModuleDbFileds(MdmModuleDbFiledsEntity entity) { - List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmModuleDbFiledsDao.queryBase(entity); - return mdmModuleDbFiledsEntities; - } - - @Override - @Cacheable(cacheNames="mdmModuleDbFiledsRule",key = "#entity.mdmId") - public List<MdmModuleDbFiledsRuleEntity> queryMdmModuleDbFiledsRule(MdmModuleDbFiledsRuleEntity entity) { - List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(entity); - return mdmModuleDbFiledsRuleEntities; - } - - @Override - @CacheEvict(cacheNames="mdmTableCodeRule",key = "#mdmId") - public void saveMdmTableCodeRule(String mdmId, List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntities) { - MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); - mdmTableCodeRuleEntity.setMdmId(mdmId); - mdmTableCodeRuleEntity.setSts("Y"); - mdmTableCodeRuleEntity.setUpdate(); - mdmTableCodeRuleDao.logicRemoveMultiCondition(mdmTableCodeRuleEntity); - if(mdmTableCodeRuleEntities != null && mdmTableCodeRuleEntities.size() > 0){ - for (int i = 0; i < mdmTableCodeRuleEntities.size(); i++) { - mdmTableCodeRuleDao.save(mdmTableCodeRuleEntities.get(i)); - } - } - } - + /** + * @Author lvleigang + * @Description 修改模版表数据 + * @Date 4:23 下午 2024/6/11 + * @param mdmId + * @param mdmModuleDbEntities + * @return void + **/ @Override @CacheEvict(cacheNames="mdmModuleDb",key = "#mdmId") - public void saveMdmModuleDb(String mdmId, List<MdmModuleDbEntity> mdmModuleDbEntities) { + public void saveOrUpdateMdmModuleDb(String mdmId, List<MdmModuleDbEntity> mdmModuleDbEntities) { if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0){ for (int i = 0; i < mdmModuleDbEntities.size(); i++) { if("1".equals(mdmModuleDbEntities.get(i).getDataType())){ @@ -143,204 +148,318 @@ public class MdmServiceCache implements IMdmServiceCache { } } } + + /** + * @param mdmId + * @return void + * @Author lvleigang + * @Description 删除模版表数据 + * @Date 4:23 下午 2024/6/11 + **/ + @Override + @CacheEvict(cacheNames="mdmModuleDb",key = "#mdmId") + public void deleteMdmModuleDb(String mdmId,String dbID) { + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmId); + mdmModuleDbEntity.setId(dbID); + mdmModuleDbEntity.setUpdate(); + mdmModuleDbDao.logicRemoveMultiCondition(mdmModuleDbEntity); + } + + /** + * @Author lvleigang + * @Description 缓存主数据DB的所有字段 + * @Date 4:11 下午 2024/6/11 + * @param entity + * @return java.util.List<com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity> + **/ + @Override + @Cacheable(cacheNames="mdmModuleDbFileds",key = "#entity.mdmId") + public List<MdmModuleDbFiledsEntity> queryMdmModuleDbFileds(MdmModuleDbFiledsEntity entity) { + List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmModuleDbFiledsDao.queryBase(entity); + return mdmModuleDbFiledsEntities; + } + + /** + * @Author lvleigang + * @Description 修改数据源db的字段 + * @Date 4:25 下午 2024/6/11 + * @param mdmId + * @param mdmModuleDbFiledsEntities + * @return void + **/ @Override @CacheEvict(cacheNames="mdmModuleDbFileds",key = "#mdmId") - public void saveMdmModuleDbFileds(String mdmId, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) { + public void saveOrUpdateMdmModuleDbFileds(String mdmId, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) { if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){ for (int i = 0; i < mdmModuleDbFiledsEntities.size(); i++) { if("1".equals(mdmModuleDbFiledsEntities.get(i).getDataType())){ mdmModuleDbFiledsDao.save(mdmModuleDbFiledsEntities.get(i)); - }else { + }else if ("2".equals(mdmModuleDbFiledsEntities.get(i).getDataType())) { mdmModuleDbFiledsDao.update(mdmModuleDbFiledsEntities.get(i)); - } - } - } - } - @Override - @CacheEvict(cacheNames="mdmModuleDbFiledsRule",key = "#mdmId") - public void saveMdmModuleDbFiledsRule(String mdmId, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities) { - MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); - mdmModuleDbFiledsRuleEntity.setMdmId(mdmId); - mdmModuleDbFiledsRuleEntity.setSts("Y"); - mdmModuleDbFiledsRuleEntity.setUpdate(); - mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); - if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){ - for (int i = 0; i < mdmModuleDbFiledsRuleEntities.size(); i++) { - if("1".equals(mdmModuleDbFiledsRuleEntities.get(i).getDataType())){ - mdmModuleDbFiledsRuleDao.save(mdmModuleDbFiledsRuleEntities.get(i)); - }else { - mdmModuleDbFiledsRuleDao.update(mdmModuleDbFiledsRuleEntities.get(i)); + }else if ("3".equals(mdmModuleDbFiledsEntities.get(i).getDataType())) { + mdmModuleDbFiledsDao.logicRemoveMultiCondition(mdmModuleDbFiledsEntities.get(i)); } } } } + /** + * @param mdmId + * @return void + * @Author lvleigang + * @Description 删除数据源db的字段 + * @Date 4:25 下午 2024/6/11 + **/ @Override - @Cacheable(cacheNames="mdmModuleViewDetail",key = "#entity.mdmId") - public List<MdmModuleViewDetailEntity> queryMdmModuleViewDetail(MdmModuleViewDetailEntity entity) { - List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities = mdmModuleViewDetailDao.queryBase(entity); - return mdmModuleViewDetailEntities; + @CacheEvict(cacheNames="mdmModuleDbFileds",key = "#mdmId") + public void deleteMdmModuleDbFileds(String mdmId,String dbID) { + MdmModuleDbFiledsEntity entity = new MdmModuleDbFiledsEntity(); + entity.setMdmId(mdmId); + entity.setDbId(dbID); + entity.setUpdate(); + mdmModuleDbFiledsDao.logicRemoveMultiCondition(entity); } - @Override - @Cacheable(cacheNames="mdmModuleView",key = "#entity.mdmId") - public List<MdmModuleViewEntity> queryMdmModuleView(MdmModuleViewEntity entity) { - List<MdmModuleViewEntity> moduleViewEntities = mdmModuleViewDao.queryBase(entity); - return moduleViewEntities; - } + // + ///** + // * @Author lvleigang + // * @Description 缓存主数据DB的所有字段的规则 + // * @Date 4:11 下午 2024/6/11 + // * @param entity + // * @return java.util.List<com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity> + // **/ + //@Override + //@Cacheable(cacheNames="mdmModuleDbFiledsRule",key = "#entity.mdmId") + //public List<MdmModuleDbFiledsRuleEntity> queryMdmModuleDbFiledsRule(MdmModuleDbFiledsRuleEntity entity) { + // List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(entity); + // return mdmModuleDbFiledsRuleEntities; + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleDistribute",key = "#mdmId") + //public List<MdmModuleDistributeEntity> queryMdmModuleDistribute(String mdmId,MdmModuleDistributeEntity mdmModuleDistributeEntity) { + // List<MdmModuleDistributeEntity> mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); + // //查询模块下的应用列表 + // MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + // mdmModuleDistributeDetailEntity.setSts("Y"); + // mdmModuleDistributeDetailEntity.setMdmId(mdmId); + // List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + // if(mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0){ + // for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { + // List<MdmModuleDistributeDetailEntity> moduleDistributeDetailEntities = new ArrayList<>(); + // if(mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0){ + // for (int i1 = 0; i1 < mdmModuleDistributeDetailEntities.size(); i1++) { + // if(mdmModuleDistributeEntities.get(i).getId().equals(mdmModuleDistributeDetailEntities.get(i1).getDistributeId())){ + // moduleDistributeDetailEntities.add(mdmModuleDistributeDetailEntities.get(i1)); + // } + // } + // } + // mdmModuleDistributeEntities.get(i).setMdmModuleDistributeDetailEntities(moduleDistributeDetailEntities); + // } + // } + // return mdmModuleDistributeEntities; + //} + // + // + + // + //@Override + //@Cacheable(cacheNames="mdmTableCodeRule",key = "#entity.mdmId") + //public List<MdmTableCodeRuleEntity> queryMdmTableCodeRuleEntity(MdmTableCodeRuleEntity entity) { + // List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntityList = mdmTableCodeRuleDao.queryBase(entity); + // return mdmTableCodeRuleEntityList; + //} + // + // + // + //@Override + //@CacheEvict(cacheNames="mdmTableCodeRule",key = "#mdmId") + //public void saveMdmTableCodeRule(String mdmId, List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntities) { + // MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); + // mdmTableCodeRuleEntity.setMdmId(mdmId); + // mdmTableCodeRuleEntity.setSts("Y"); + // mdmTableCodeRuleEntity.setUpdate(); + // mdmTableCodeRuleDao.logicRemoveMultiCondition(mdmTableCodeRuleEntity); + // if(mdmTableCodeRuleEntities != null && mdmTableCodeRuleEntities.size() > 0){ + // for (int i = 0; i < mdmTableCodeRuleEntities.size(); i++) { + // mdmTableCodeRuleDao.save(mdmTableCodeRuleEntities.get(i)); + // } + // } + //} + // + + + //@Override + //@CacheEvict(cacheNames="mdmModuleDbFiledsRule",key = "#mdmId") + //public void saveMdmModuleDbFiledsRule(String mdmId, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities) { + // MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + // mdmModuleDbFiledsRuleEntity.setMdmId(mdmId); + // mdmModuleDbFiledsRuleEntity.setSts("Y"); + // mdmModuleDbFiledsRuleEntity.setUpdate(); + // mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + // if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){ + // for (int i = 0; i < mdmModuleDbFiledsRuleEntities.size(); i++) { + // if("1".equals(mdmModuleDbFiledsRuleEntities.get(i).getDataType())){ + // mdmModuleDbFiledsRuleDao.save(mdmModuleDbFiledsRuleEntities.get(i)); + // }else { + // mdmModuleDbFiledsRuleDao.update(mdmModuleDbFiledsRuleEntities.get(i)); + // } + // } + // } + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleViewDetail",key = "#entity.mdmId") + //public List<MdmModuleViewDetailEntity> queryMdmModuleViewDetail(MdmModuleViewDetailEntity entity) { + // List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities = mdmModuleViewDetailDao.queryBase(entity); + // return mdmModuleViewDetailEntities; + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleView",key = "#entity.mdmId") + //public List<MdmModuleViewEntity> queryMdmModuleView(MdmModuleViewEntity entity) { + // List<MdmModuleViewEntity> moduleViewEntities = mdmModuleViewDao.queryBase(entity); + // return moduleViewEntities; + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleViewButton",key = "#entity.mdmId") + //public List<MdmModuleViewButtonEntity> queryMdmModuleViewButton(MdmModuleViewButtonEntity entity) { + // List<MdmModuleViewButtonEntity> mdmModuleViewButtonEntities = mdmModuleViewButtonDao.queryBase(entity); + // return mdmModuleViewButtonEntities; + //} + // + //@Override + //@CacheEvict(cacheNames="mdmModuleView",key = "#mdmId") + //public void saveMdmModuleView(String mdmId, MdmModuleViewEntity mdmModuleViewEntity) { + // mdmModuleViewDao.update(mdmModuleViewEntity); + //} + // + //@Override + //@CacheEvict(cacheNames="mdmModuleViewDetail",key = "#mdmId") + //public void saveMdmModuleViewDetail(String mdmId, List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities) { + // MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + // mdmModuleViewDetailEntity.setMdmId(mdmId); + // mdmModuleViewDetailEntity.setUpdate(); + // mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + // if(mdmModuleViewDetailEntities != null && mdmModuleViewDetailEntities.size() > 0){ + // for (int i = 0; i < mdmModuleViewDetailEntities.size(); i++) { + // if("1".equals(mdmModuleViewDetailEntities.get(i).getDataType())){ + // mdmModuleViewDetailDao.save(mdmModuleViewDetailEntities.get(i)); + // }else { + // mdmModuleViewDetailDao.update(mdmModuleViewDetailEntities.get(i)); + // } + // } + // } + //} + // + //@Override + //@CacheEvict(cacheNames="mdmModuleViewButton",key = "#mdmId") + //public void saveMdmModuleViewButton(String mdmId, List<MdmModuleViewButtonEntity> mdmModuleViewButtonEntities) { + // MdmModuleViewButtonEntity mdmModuleViewButtonEntity = new MdmModuleViewButtonEntity(); + // mdmModuleViewButtonEntity.setMdmId(mdmId); + // mdmModuleViewButtonEntity.setUpdate(); + // mdmModuleViewButtonDao.logicRemoveMultiCondition(mdmModuleViewButtonEntity); + // if(mdmModuleViewButtonEntities != null && mdmModuleViewButtonEntities.size() > 0){ + // for (int i = 0; i < mdmModuleViewButtonEntities.size(); i++) { + // if("1".equals(mdmModuleViewButtonEntities.get(i).getDataType())){ + // mdmModuleViewButtonDao.save(mdmModuleViewButtonEntities.get(i)); + // }else { + // mdmModuleViewButtonDao.update(mdmModuleViewButtonEntities.get(i)); + // } + // } + // } + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleDistributeDetail",key = "#entity.mdmId") + //public List<MdmModuleDistributeDetailEntity> queryMdmModuleDistributeDetail(MdmModuleDistributeDetailEntity entity){ + // List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(entity); + // return mdmModuleDistributeDetailEntities; + //} + // + //@Override + //@CacheEvict(cacheNames="mdmModuleDistribute",key = "#mdmId") + //public void saveMdmModuleDistribute(String mdmId, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities) { + // //先删除 + // MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + // mdmModuleDistributeEntity.setMdmId(mdmId); + // mdmModuleDistributeEntity.setUpdate(); + // mdmModuleDistributeDao.logicRemoveMultiCondition(mdmModuleDistributeEntity); + // //保存主数据 + // if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) { + // for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { + // MdmModuleDistributeEntity moduleDistributeEntity = mdmModuleDistributeEntities.get(i); + // moduleDistributeEntity.setMdmId(mdmId); + // if (moduleDistributeEntity.getId() != null && !"".equals(moduleDistributeEntity.getId())) { + // moduleDistributeEntity.setUpdate(); + // //修改 + // mdmModuleDistributeDao.update(moduleDistributeEntity); + // } else { + // //新增 + // moduleDistributeEntity.setCreate(); + // mdmModuleDistributeDao.save(moduleDistributeEntity); + // } + // if(moduleDistributeEntity.getMdmModuleDistributeDetailEntities() != null && moduleDistributeEntity.getMdmModuleDistributeDetailEntities().size() > 0){ + // for (int i1 = 0; i1 < moduleDistributeEntity.getMdmModuleDistributeDetailEntities().size(); i1++) { + // MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = moduleDistributeEntity.getMdmModuleDistributeDetailEntities().get(i1); + // mdmModuleDistributeDetailEntity.setMdmId(mdmId); + // mdmModuleDistributeDetailEntity.setDistributeId(moduleDistributeEntity.getId()); + // if (mdmModuleDistributeDetailEntity.getId() != null && !"".equals(mdmModuleDistributeDetailEntity.getId())) { + // mdmModuleDistributeDetailEntity.setUpdate(); + // //修改 + // mdmModuleDistributeDetailDao.update(mdmModuleDistributeDetailEntity); + // } else { + // //新增 + // mdmModuleDistributeDetailEntity.setCreate(); + // mdmModuleDistributeDetailDao.save(mdmModuleDistributeDetailEntity); + // } + // } + // } + // } + // } + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleSource",key = "#entity.mdmId") + //public List<MdmModuleSourceEntity> queryMdmModuleSource(MdmModuleSourceEntity entity) { + // List<MdmModuleSourceEntity> mdmModuleSourceEntities = mdmModuleSourceDao.queryBase(entity); + // return mdmModuleSourceEntities; + //} + // + //@Override + //@CacheEvict(cacheNames="mdmModuleSource",key = "#mdmId") + //public void saveMdmModuleSource(String mdmId, List<MdmModuleSourceEntity> mdmModuleSourceEntities) { + // //先删除 + // MdmModuleSourceEntity mdmModuleSourceEntity = new MdmModuleSourceEntity(); + // mdmModuleSourceEntity.setMdmId(mdmId); + // mdmModuleSourceEntity.setUpdate(); + // mdmModuleSourceDao.logicRemoveMultiCondition(mdmModuleSourceEntity); + // //保存主数据 + // if (mdmModuleSourceEntities != null && mdmModuleSourceEntities.size() > 0) { + // for (int i = 0; i < mdmModuleSourceEntities.size(); i++) { + // MdmModuleSourceEntity mdmModuleSourceEntity1 = mdmModuleSourceEntities.get(i); + // mdmModuleSourceEntity1.setMdmId(mdmId); + // if (mdmModuleSourceEntity1.getId() != null && !"".equals(mdmModuleSourceEntity1.getId())) { + // mdmModuleSourceEntity1.setUpdate(); + // //修改 + // mdmModuleSourceDao.update(mdmModuleSourceEntity1); + // } else { + // //新增 + // mdmModuleSourceEntity1.setCreate(); + // mdmModuleSourceDao.save(mdmModuleSourceEntity1); + // } + // } + // } + //} + - @Override - @Cacheable(cacheNames="mdmModuleViewButton",key = "#entity.mdmId") - public List<MdmModuleViewButtonEntity> queryMdmModuleViewButton(MdmModuleViewButtonEntity entity) { - List<MdmModuleViewButtonEntity> mdmModuleViewButtonEntities = mdmModuleViewButtonDao.queryBase(entity); - return mdmModuleViewButtonEntities; - } - @Override - @CacheEvict(cacheNames="mdmModuleView",key = "#mdmId") - public void saveMdmModuleView(String mdmId, MdmModuleViewEntity mdmModuleViewEntity) { - mdmModuleViewDao.update(mdmModuleViewEntity); - } - @Override - @CacheEvict(cacheNames="mdmModuleViewDetail",key = "#mdmId") - public void saveMdmModuleViewDetail(String mdmId, List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities) { - MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - mdmModuleViewDetailEntity.setMdmId(mdmId); - mdmModuleViewDetailEntity.setUpdate(); - mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); - if(mdmModuleViewDetailEntities != null && mdmModuleViewDetailEntities.size() > 0){ - for (int i = 0; i < mdmModuleViewDetailEntities.size(); i++) { - if("1".equals(mdmModuleViewDetailEntities.get(i).getDataType())){ - mdmModuleViewDetailDao.save(mdmModuleViewDetailEntities.get(i)); - }else { - mdmModuleViewDetailDao.update(mdmModuleViewDetailEntities.get(i)); - } - } - } - } - @Override - @CacheEvict(cacheNames="mdmModuleViewButton",key = "#mdmId") - public void saveMdmModuleViewButton(String mdmId, List<MdmModuleViewButtonEntity> mdmModuleViewButtonEntities) { - MdmModuleViewButtonEntity mdmModuleViewButtonEntity = new MdmModuleViewButtonEntity(); - mdmModuleViewButtonEntity.setMdmId(mdmId); - mdmModuleViewButtonEntity.setUpdate(); - mdmModuleViewButtonDao.logicRemoveMultiCondition(mdmModuleViewButtonEntity); - if(mdmModuleViewButtonEntities != null && mdmModuleViewButtonEntities.size() > 0){ - for (int i = 0; i < mdmModuleViewButtonEntities.size(); i++) { - if("1".equals(mdmModuleViewButtonEntities.get(i).getDataType())){ - mdmModuleViewButtonDao.save(mdmModuleViewButtonEntities.get(i)); - }else { - mdmModuleViewButtonDao.update(mdmModuleViewButtonEntities.get(i)); - } - } - } - } - @Override - @Cacheable(cacheNames="mdmModuleDistribute",key = "#mdmId") - public List<MdmModuleDistributeEntity> queryMdmModuleDistribute(String mdmId,MdmModuleDistributeEntity mdmModuleDistributeEntity) { - List<MdmModuleDistributeEntity> mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); - //查询模块下的应用列表 - MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); - mdmModuleDistributeDetailEntity.setSts("Y"); - mdmModuleDistributeDetailEntity.setMdmId(mdmId); - List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); - if(mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0){ - for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { - List<MdmModuleDistributeDetailEntity> moduleDistributeDetailEntities = new ArrayList<>(); - if(mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0){ - for (int i1 = 0; i1 < mdmModuleDistributeDetailEntities.size(); i1++) { - if(mdmModuleDistributeEntities.get(i).getId().equals(mdmModuleDistributeDetailEntities.get(i1).getDistributeId())){ - moduleDistributeDetailEntities.add(mdmModuleDistributeDetailEntities.get(i1)); - } - } - } - mdmModuleDistributeEntities.get(i).setMdmModuleDistributeDetailEntities(moduleDistributeDetailEntities); - } - } - return mdmModuleDistributeEntities; - } - @Override - @Cacheable(cacheNames="mdmModuleDistributeDetail",key = "#entity.mdmId") - public List<MdmModuleDistributeDetailEntity> queryMdmModuleDistributeDetail(MdmModuleDistributeDetailEntity entity){ - List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(entity); - return mdmModuleDistributeDetailEntities; - } - @Override - @CacheEvict(cacheNames="mdmModuleDistribute",key = "#mdmId") - public void saveMdmModuleDistribute(String mdmId, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities) { - //先删除 - MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); - mdmModuleDistributeEntity.setMdmId(mdmId); - mdmModuleDistributeEntity.setUpdate(); - mdmModuleDistributeDao.logicRemoveMultiCondition(mdmModuleDistributeEntity); - //保存主数据 - if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) { - for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { - MdmModuleDistributeEntity moduleDistributeEntity = mdmModuleDistributeEntities.get(i); - moduleDistributeEntity.setMdmId(mdmId); - if (moduleDistributeEntity.getId() != null && !"".equals(moduleDistributeEntity.getId())) { - moduleDistributeEntity.setUpdate(); - //修改 - mdmModuleDistributeDao.update(moduleDistributeEntity); - } else { - //新增 - moduleDistributeEntity.setCreate(); - mdmModuleDistributeDao.save(moduleDistributeEntity); - } - if(moduleDistributeEntity.getMdmModuleDistributeDetailEntities() != null && moduleDistributeEntity.getMdmModuleDistributeDetailEntities().size() > 0){ - for (int i1 = 0; i1 < moduleDistributeEntity.getMdmModuleDistributeDetailEntities().size(); i1++) { - MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = moduleDistributeEntity.getMdmModuleDistributeDetailEntities().get(i1); - mdmModuleDistributeDetailEntity.setMdmId(mdmId); - mdmModuleDistributeDetailEntity.setDistributeId(moduleDistributeEntity.getId()); - if (mdmModuleDistributeDetailEntity.getId() != null && !"".equals(mdmModuleDistributeDetailEntity.getId())) { - mdmModuleDistributeDetailEntity.setUpdate(); - //修改 - mdmModuleDistributeDetailDao.update(mdmModuleDistributeDetailEntity); - } else { - //新增 - mdmModuleDistributeDetailEntity.setCreate(); - mdmModuleDistributeDetailDao.save(mdmModuleDistributeDetailEntity); - } - } - } - } - } - } - @Override - @Cacheable(cacheNames="mdmModuleSource",key = "#entity.mdmId") - public List<MdmModuleSourceEntity> queryMdmModuleSource(MdmModuleSourceEntity entity) { - List<MdmModuleSourceEntity> mdmModuleSourceEntities = mdmModuleSourceDao.queryBase(entity); - return mdmModuleSourceEntities; - } - @Override - @CacheEvict(cacheNames="mdmModuleSource",key = "#mdmId") - public void saveMdmModuleSource(String mdmId, List<MdmModuleSourceEntity> mdmModuleSourceEntities) { - //先删除 - MdmModuleSourceEntity mdmModuleSourceEntity = new MdmModuleSourceEntity(); - mdmModuleSourceEntity.setMdmId(mdmId); - mdmModuleSourceEntity.setUpdate(); - mdmModuleSourceDao.logicRemoveMultiCondition(mdmModuleSourceEntity); - //保存主数据 - if (mdmModuleSourceEntities != null && mdmModuleSourceEntities.size() > 0) { - for (int i = 0; i < mdmModuleSourceEntities.size(); i++) { - MdmModuleSourceEntity mdmModuleSourceEntity1 = mdmModuleSourceEntities.get(i); - mdmModuleSourceEntity1.setMdmId(mdmId); - if (mdmModuleSourceEntity1.getId() != null && !"".equals(mdmModuleSourceEntity1.getId())) { - mdmModuleSourceEntity1.setUpdate(); - //修改 - mdmModuleSourceDao.update(mdmModuleSourceEntity1); - } else { - //新增 - mdmModuleSourceEntity1.setCreate(); - mdmModuleSourceDao.save(mdmModuleSourceEntity1); - } - } - } - } } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java index 145b9b67..73c99cc4 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java @@ -41,6 +41,7 @@ import com.hzya.frame.mdm.mdmModuleViewButton.dao.IMdmModuleViewButtonDao; import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity; import com.hzya.frame.mdm.mdmModuleViewDetail.dao.IMdmModuleViewDetailDao; import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; +import com.hzya.frame.mdm.mdmTableCodeRule.dao.IMdmTableCodeRuleDao; import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; import com.hzya.frame.mdm.service.IMdmService; @@ -100,6 +101,8 @@ public class MdmServiceImpl implements IMdmService { @Resource private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao; @Resource + private IMdmTableCodeRuleDao mdmTableCodeRuleDao; + @Resource private IMdmModuleDistributeDao mdmModuleDistributeDao; @Resource private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao; @@ -110,2353 +113,7 @@ public class MdmServiceImpl implements IMdmService { @Resource private IMdmModuleViewDetailDao mdmModuleViewDetailDao; - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据列表查询接口分页 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmPage(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - //判断分页 - if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { - return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - } - PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - List<MdmModuleEntity> mdmVos = mdmModuleDao.queryMdm(entity); - PageInfo pageInfo = new PageInfo(mdmVos); - return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据列表查询接口列表 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmList(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - List<MdmModuleEntity> mdmVos = mdmModuleDao.queryMdm(entity); - return BaseResult.getSuccessMessageEntity("查询数据成功", mdmVos); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据新增 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity addMdm(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmName() == null || "".equals(entity.getMdmName())) { - return BaseResult.getFailureMessageEntity("请先输入主数据名称"); - } - if (entity.getMdmType() == null || "".equals(entity.getMdmType())) { - return BaseResult.getFailureMessageEntity("请先选择主数据类型"); - } - //新增 - entity.setCreate(); - mdmModuleDao.save(entity); - return BaseResult.getSuccessMessageEntity("保存数据成功", entity); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据基本信息获取 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmModule(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - //使用缓存 - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - return BaseResult.getSuccessMessageEntity("查询数据成功", mdmModuleEntity); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据基本信息保存 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity doSaveMdmModule(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmName() == null || "".equals(entity.getMdmName())) { - return BaseResult.getFailureMessageEntity("请先输入主数据名称"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null ){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity.setId(mdmModuleEntity.getId()); - //修改 - entity.setUpdate(); - mdmServiceCache.updateMdmModuleEntity(entity); - return BaseResult.getSuccessMessageEntity("修改主数据成功", entity); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询数据源 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmModuleDb(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - //判断分页 - if (entity == null) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmDbVo mdmDbVo = new MdmDbVo(); - //获取主数据 - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - //查询设置的规则表 - MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); - mdmTableCodeRuleEntity.setSts("Y"); - mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); - List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntityList = mdmServiceCache.queryMdmTableCodeRuleEntity(mdmTableCodeRuleEntity); - mdmDbVo.setMdmTableCodeRuleEntityList(mdmTableCodeRuleEntityList); - //查询数据源表 - MdmModuleDbEntity queryDb = new MdmModuleDbEntity(); - queryDb.setMdmId(mdmModuleEntity.getId()); - queryDb.setSts("Y"); - List<MdmModuleDbEntity> mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(queryDb); - //数据源字段 - MdmModuleDbFiledsEntity queryDbFiled = new MdmModuleDbFiledsEntity(); - queryDbFiled.setMdmId(mdmModuleEntity.getId()); - queryDbFiled.setSts("Y"); - List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(queryDbFiled); - //数据源字段规则 - MdmModuleDbFiledsRuleEntity queryDbFiledRule = new MdmModuleDbFiledsRuleEntity(); - queryDbFiledRule.setMdmId(mdmModuleEntity.getId()); - queryDbFiledRule.setSts("Y"); - List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntityList = mdmServiceCache.queryMdmModuleDbFiledsRule(queryDbFiledRule); - //组装数据 - setMdmDb(mdmDbVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList); - return BaseResult.getSuccessMessageEntity("查询数据成功", mdmDbVo); - } - /** - * @param mdmDbVo 返回对象 - * @param mdmModuleDbEntityList 数据表 - * @param mdmModuleDbFiledsEntityList 字段 - * @param mdmModuleDbFiledsRuleEntityList 字段属性 - * @return void - * @Author lvleigang - * @Description 组装返回数据 - * @Date 4:51 下午 2023/10/18 - **/ - private void setMdmDb(MdmDbVo mdmDbVo, List<MdmModuleDbEntity> mdmModuleDbEntityList, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntityList) { - //主数据主表 - MdmModuleDbEntity mainMdmModuleDb = new MdmModuleDbEntity(); - //主数据子表 - List<MdmModuleDbEntity> sublistMdmModuleDb = new ArrayList<>(); - //主数据主表字段 - List<MdmModuleDbFiledsEntity> mainMdmModuleDbFileds = new ArrayList<>(); - - - if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - //1、主表 2、明细 - mainMdmModuleDb = mdmModuleDbEntityList.get(i); - //循环字段表 - if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); - List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = new ArrayList<>(); - //循环字段属性 - if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { - for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { - if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) - && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { - mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); - } - } - } - mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); - } - } - } - } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { - //2、明细 - sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i)); - //循环字段表 - if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds = new ArrayList<>(); - for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); - List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = new ArrayList<>(); - //循环字段属性 - if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { - for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { - if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) - && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { - mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); - } - } - } - mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); - } - } - mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds); - } - } - } - } - mainMdmModuleDb.setSublistMdmModuleDbFileds(mainMdmModuleDbFileds); - mdmDbVo.setMainMdmModuleDb(mainMdmModuleDb); - mdmDbVo.setSublistMdmModuleDb(sublistMdmModuleDb); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置保存数据源 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity saveMdmModuleDb(JSONObject object) { - //判断新增还是修改,保存数据生成表结构 - MdmDto entity = getData("jsonStr", object, MdmDto.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - //单据规则校验 - if(entity.getMdmTableCodeRuleEntityList() == null || entity.getMdmTableCodeRuleEntityList().size() == 0){ - return BaseResult.getFailureMessageEntity("请先设置单据规则"); - } - //主表校验 - if (entity.getMainMdmModuleDb() == null || entity.getMainMdmModuleDb().getDbName() == null || "".equals(entity.getMainMdmModuleDb().getDbName())) { - return BaseResult.getFailureMessageEntity("请先输入主表名称"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - //主数据主表 - MdmModuleDbEntity mainMdmModuleDb = entity.getMainMdmModuleDb(); - //主数据主表字段 - List<MdmModuleDbFiledsEntity> mainMdmModuleDbFileds = mainMdmModuleDb.getSublistMdmModuleDbFileds(); - //主数据子表 - List<MdmModuleDbEntity> sublistMdmModuleDb = entity.getSublistMdmModuleDb(); - //单据规则 - List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntities = entity.getMdmTableCodeRuleEntityList(); - // 需要校验表是否存在 - if (checkTable(mainMdmModuleDb.getDbName())) { - return BaseResult.getFailureMessageEntity("主表表名已经存在"); - } - if(mainMdmModuleDbFileds == null || mainMdmModuleDbFileds.size() == 0){ - return BaseResult.getFailureMessageEntity("请先设置主表字段"); - } - //判断明细表 - if (sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0) { - for (int i = 0; i < sublistMdmModuleDb.size(); i++) { - // 需要校验表是否存在 - if (checkTable(sublistMdmModuleDb.get(i).getDbName())) { - return BaseResult.getFailureMessageEntity("子表" + sublistMdmModuleDb.get(i).getDbName() + "已经存在"); - } - if (sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds() == null && sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds().size() == 0) { - return BaseResult.getFailureMessageEntity("请先设置子表" + sublistMdmModuleDb.get(i).getDbName() + "的字段"); - } - - } - } - //处理数据 - //分别设置成 数据源 数据源字段 数据源规则表 设置是否新增修改 没有id新增,有ID修改 - List<MdmModuleDbEntity> mdmModuleDbEntities = new ArrayList<>(); - List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = new ArrayList<>(); - List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = new ArrayList<>(); - - //主表 - if(mainMdmModuleDb.getId() != null && !"".equals(mainMdmModuleDb.getId())){ - //修改 - mainMdmModuleDb.setDataType("2"); - mainMdmModuleDb.setUpdate(); - }else { - //新增 - mainMdmModuleDb.setDataType("1"); - mainMdmModuleDb.setMdmId(mdmModuleEntity.getId()); - mainMdmModuleDb.setCreate(); - } - mainMdmModuleDb.setDbType("1"); - mdmModuleDbEntities.add(mainMdmModuleDb); - for (int i = 0; i < mdmTableCodeRuleEntities.size(); i++) { - mdmTableCodeRuleEntities.get(i).setMdmId(mdmModuleEntity.getId()); - mdmTableCodeRuleEntities.get(i).setDbId(mainMdmModuleDb.getId()); - mdmTableCodeRuleEntities.get(i).setCreate(); - } - for (int i = 0; i < mainMdmModuleDbFileds.size(); i++) { - if(mainMdmModuleDbFileds.get(i).getId() != null && !"".equals(mainMdmModuleDbFileds.get(i).getId())){ - //修改 - mainMdmModuleDbFileds.get(i).setDataType("2"); - mainMdmModuleDbFileds.get(i).setUpdate(); - }else { - //新增 - mainMdmModuleDbFileds.get(i).setDataType("1"); - mainMdmModuleDbFileds.get(i).setCreate(); - } - mainMdmModuleDbFileds.get(i).setMdmId(mdmModuleEntity.getId()); - mainMdmModuleDbFileds.get(i).setDbId(mainMdmModuleDb.getId()); - mainMdmModuleDbFileds.get(i).setAddType("1"); - mainMdmModuleDbFileds.get(i).setUpdateType("1"); - mainMdmModuleDbFileds.get(i).setShowType("1"); - mainMdmModuleDbFileds.get(i).setQueryType("1"); - mainMdmModuleDbFileds.get(i).setListType("1"); - mainMdmModuleDbFileds.get(i).setViewType("1"); - if(mainMdmModuleDbFileds.get(i).getMdmModuleDbFiledsRules() != null && mainMdmModuleDbFileds.get(i).getMdmModuleDbFiledsRules().size() > 0){ - for (int i1 = 0; i1 < mainMdmModuleDbFileds.get(i).getMdmModuleDbFiledsRules().size(); i1++) { - MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = mainMdmModuleDbFileds.get(i).getMdmModuleDbFiledsRules().get(i1); - if(mdmModuleDbFiledsRuleEntity.getId() != null && !"".equals(mdmModuleDbFiledsRuleEntity.getId())){ - //修改 - mdmModuleDbFiledsRuleEntity.setDataType("2"); - mdmModuleDbFiledsRuleEntity.setUpdate(); - }else { - //新增 - mdmModuleDbFiledsRuleEntity.setDataType("1"); - mdmModuleDbFiledsRuleEntity.setCreate(); - } - mdmModuleDbFiledsRuleEntities.add(mdmModuleDbFiledsRuleEntity); - } - } - mdmModuleDbFiledsEntities.add(mainMdmModuleDbFileds.get(i)); - } - if("1".equals(mainMdmModuleDb.getDataType())){ - //新增 设置默认字段 - List<MdmModuleDbFiledsEntity> moduleDbFiledsEntities = getCreateMdm(mdmModuleEntity.getId(),mainMdmModuleDb.getId(),"1"); - mdmModuleDbFiledsEntities.addAll(moduleDbFiledsEntities); - } - //明细表 - if(sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0){ - for (int i = 0; i < sublistMdmModuleDb.size(); i++) { - MdmModuleDbEntity mdmModuleDbEntity = sublistMdmModuleDb.get(i); - if(mdmModuleDbEntity.getId() != null && !"".equals(mdmModuleDbEntity.getId())){ - //修改 - mdmModuleDbEntity.setDataType("2"); - mdmModuleDbEntity.setUpdate(); - }else { - //新增 - mdmModuleDbEntity.setDataType("1"); - mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.setCreate(); - } - mainMdmModuleDb.setDbType("2"); - mdmModuleDbEntities.add(mdmModuleDbEntity); - for (int a = 0; a < mdmModuleDbEntity.getSublistMdmModuleDbFileds().size(); a++) { - if(mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).getId() != null && !"".equals(mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).getId())){ - //修改 - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setDataType("2"); - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setUpdate(); - }else { - //新增 - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setDataType("1"); - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setCreate(); - } - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setDbId(mainMdmModuleDb.getId()); - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setAddType("1"); - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setUpdateType("1"); - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setShowType("1"); - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setQueryType("1"); - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setListType("1"); - mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).setViewType("1"); - if(mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).getMdmModuleDbFiledsRules() != null && mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a).getMdmModuleDbFiledsRules().size() > 0){ - for (int i1 = 0; i1 < mainMdmModuleDbFileds.get(a).getMdmModuleDbFiledsRules().size(); i1++) { - MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = mainMdmModuleDbFileds.get(a).getMdmModuleDbFiledsRules().get(i1); - if(mdmModuleDbFiledsRuleEntity.getId() != null && !"".equals(mdmModuleDbFiledsRuleEntity.getId())){ - //修改 - mdmModuleDbFiledsRuleEntity.setDataType("2"); - mdmModuleDbFiledsRuleEntity.setUpdate(); - }else { - //新增 - mdmModuleDbFiledsRuleEntity.setDataType("1"); - mdmModuleDbFiledsRuleEntity.setCreate(); - } - mdmModuleDbFiledsRuleEntities.add(mdmModuleDbFiledsRuleEntity); - } - } - mdmModuleDbFiledsEntities.add(mdmModuleDbEntity.getSublistMdmModuleDbFileds().get(a)); - } - if("1".equals(mainMdmModuleDb.getDataType())){ - //新增 设置默认字段 - List<MdmModuleDbFiledsEntity> moduleDbFiledsEntities = getCreateMdm(mdmModuleEntity.getId(),mainMdmModuleDb.getId(),"2"); - mdmModuleDbFiledsEntities.addAll(moduleDbFiledsEntities); - } - } - } - - - //新增日志表 - if("1".equals(mainMdmModuleDb.getDataType())){ - MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.setDbName(mainMdmModuleDb.getDbName()+"_option_log"); - mdmModuleDbEntity.setDbType("3"); - mdmModuleDbEntity.setDataType("1"); - mdmModuleDbEntity.setCreate(); - mdmModuleDbEntities.add(mdmModuleDbEntity); - //新增 设置日志表 - List<MdmModuleDbFiledsEntity> moduleDbFiledsEntities = getCreateMdm(mdmModuleEntity.getId(),mdmModuleDbEntity.getId(),"3"); - mdmModuleDbFiledsEntities.addAll(moduleDbFiledsEntities); - - MdmModuleDbEntity mdmModuleDbEntity1 = new MdmModuleDbEntity(); - mdmModuleDbEntity1.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity1.setDbName(mainMdmModuleDb.getDbName()+"_option_log"); - mdmModuleDbEntity1.setDbType("4"); - mdmModuleDbEntity1.setDataType("1"); - mdmModuleDbEntity1.setCreate(); - mdmModuleDbEntities.add(mdmModuleDbEntity1); - //新增 设置日志表 - List<MdmModuleDbFiledsEntity> moduleDbFiledsEntities1 = getCreateMdm(mdmModuleEntity.getId(),mdmModuleDbEntity1.getId(),"4"); - mdmModuleDbFiledsEntities.addAll(moduleDbFiledsEntities1); - } - //保存单据规则 - mdmServiceCache.saveMdmTableCodeRule(mdmModuleEntity.getId(),mdmTableCodeRuleEntities); - //保存db - mdmServiceCache.saveMdmModuleDb(mdmModuleEntity.getId(),mdmModuleDbEntities); - //保存字段 - mdmServiceCache.saveMdmModuleDbFileds(mdmModuleEntity.getId(),mdmModuleDbFiledsEntities); - //保存规则 - mdmServiceCache.saveMdmModuleDbFiledsRule(mdmModuleEntity.getId(),mdmModuleDbFiledsRuleEntities); - //创建或者修改表 - - for (int i = 0; i < mdmModuleDbEntities.size(); i++) { - Map<String, Object> maps = new HashMap<>(); - maps.put("tableName", mdmModuleDbEntities.get(i).getDbName());//表名 - maps.put("tableRemark", mdmModuleDbEntities.get(i).getRemark());//表备注 - List<DbFiledsDto> dbFiledsDtos = new ArrayList<>(); - for (int i1 = 0; i1 < mdmModuleDbFiledsEntities.size(); i1++) { - if(mdmModuleDbEntities.get(i).getId().equals(mdmModuleDbFiledsEntities.get(i1).getDbId())){ - dbFiledsDtos.add(new DbFiledsDto(mdmModuleDbFiledsEntities.get(i1).getDataType(), mdmModuleDbFiledsEntities.get(i1).getChName(), mdmModuleDbFiledsEntities.get(i1).getEnName(), mdmModuleDbFiledsEntities.get(i1).getFiledType(), mdmModuleDbFiledsEntities.get(i1).getFiledLength())); - } - } - maps.put("databaseFields", dbFiledsDtos);//字段 - if("1".equals(mdmModuleDbEntities.get(i).getDataType())){ - mdmModuleDao.createTable(maps); - }else { - Map<String, String> tablename = new HashMap<>(); - tablename.put("tableName", mdmModuleDbEntities.get(i).getDbName());//表名 - tablename.put("tableRemark", mdmModuleDbEntities.get(i).getRemark());//表备注 - mdmModuleDao.alterTableName(tablename); - mdmModuleDao.alterTable(maps); - } - } - return BaseResult.getSuccessMessageEntity("保存数据源成功"); - } - - /** - * @Author lvleigang - * @Description 新建设置默认字段 - * @Date 2:06 下午 2024/6/3 - * @param mdmId - * @param dbId - * @param type - * @return java.util.List<com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity> - **/ - private List<MdmModuleDbFiledsEntity> getCreateMdm(String mdmId, String dbId, String type) { - List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = new ArrayList<>(); - MdmModuleDbFiledsEntity id = new MdmModuleDbFiledsEntity(); - id.setMdmId(mdmId); - id.setDbId(dbId); - id.setChName("id"); - id.setEnName("id"); - id.setFiledType("3"); - id.setAddType("2"); - id.setUpdateType("2"); - id.setShowType("2"); - id.setQueryType("2"); - id.setListType("2"); - id.setViewType("2"); - id.setFiledLength("50"); - id.setDataType("1"); - mdmModuleDbFiledsEntities.add(id); - - if("1".equals(type)){ - MdmModuleDbFiledsEntity documentRule = new MdmModuleDbFiledsEntity(); - documentRule.setMdmId(mdmId); - documentRule.setDbId(dbId); - documentRule.setChName("document_rule"); - documentRule.setEnName("单据规则"); - documentRule.setFiledType("3"); - documentRule.setAddType("2"); - documentRule.setUpdateType("1"); - documentRule.setShowType("1"); - documentRule.setQueryType("1"); - documentRule.setListType("1"); - documentRule.setViewType("1"); - documentRule.setFiledLength("50"); - documentRule.setDataType("1"); - mdmModuleDbFiledsEntities.add(documentRule); - } - - if("1".equals(type)){ - MdmModuleDbFiledsEntity document_rule_num = new MdmModuleDbFiledsEntity(); - document_rule_num.setMdmId(mdmId); - document_rule_num.setDbId(dbId); - document_rule_num.setChName("document_rule_num"); - document_rule_num.setEnName("单据规则流水号"); - document_rule_num.setFiledType("1"); - document_rule_num.setAddType("2"); - document_rule_num.setUpdateType("2"); - document_rule_num.setShowType("2"); - document_rule_num.setQueryType("2"); - document_rule_num.setListType("2"); - document_rule_num.setViewType("2"); - document_rule_num.setFiledLength("50"); - document_rule_num.setDataType("1"); - mdmModuleDbFiledsEntities.add(document_rule_num); - } - if("2".equals(type) || "3".equals(type) || "4".equals(type) ){ - MdmModuleDbFiledsEntity formmain_id = new MdmModuleDbFiledsEntity(); - formmain_id.setMdmId(mdmId); - formmain_id.setDbId(dbId); - formmain_id.setChName("formmain_id"); - formmain_id.setEnName("主表id"); - formmain_id.setFiledType("3"); - formmain_id.setAddType("2"); - formmain_id.setUpdateType("2"); - formmain_id.setShowType("2"); - formmain_id.setQueryType("2"); - formmain_id.setListType("2"); - formmain_id.setViewType("2"); - formmain_id.setFiledLength("50"); - formmain_id.setDataType("1"); - mdmModuleDbFiledsEntities.add(formmain_id); - } - //写入日志字段:操作人 - if("3".equals(type)){ - MdmModuleDbFiledsEntity source_name = new MdmModuleDbFiledsEntity(); - source_name.setMdmId(mdmId); - source_name.setDbId(dbId); - source_name.setChName("source_name"); - source_name.setEnName("来源名称"); - source_name.setFiledType("3"); - source_name.setAddType("2"); - source_name.setUpdateType("2"); - source_name.setShowType("2"); - source_name.setQueryType("2"); - source_name.setListType("2"); - source_name.setViewType("2"); - source_name.setFiledLength("50"); - source_name.setDataType("1"); - mdmModuleDbFiledsEntities.add(source_name); - - MdmModuleDbFiledsEntity code = new MdmModuleDbFiledsEntity(); - code.setMdmId(mdmId); - code.setDbId(dbId); - code.setChName("code"); - code.setEnName("编码"); - code.setFiledType("3"); - code.setAddType("2"); - code.setUpdateType("2"); - code.setShowType("2"); - code.setQueryType("2"); - code.setListType("2"); - code.setViewType("2"); - code.setFiledLength("50"); - code.setDataType("1"); - mdmModuleDbFiledsEntities.add(code); - - MdmModuleDbFiledsEntity source_data = new MdmModuleDbFiledsEntity(); - source_data.setMdmId(mdmId); - source_data.setDbId(dbId); - source_data.setChName("source_data"); - source_data.setEnName("源数据"); - source_data.setFiledType("3"); - source_data.setAddType("2"); - source_data.setUpdateType("2"); - source_data.setShowType("2"); - source_data.setQueryType("2"); - source_data.setListType("2"); - source_data.setViewType("2"); - source_data.setFiledLength("255"); - source_data.setDataType("1"); - mdmModuleDbFiledsEntities.add(source_data); - - MdmModuleDbFiledsEntity option_type = new MdmModuleDbFiledsEntity(); - option_type.setMdmId(mdmId); - option_type.setDbId(dbId); - option_type.setChName("option_type"); - option_type.setEnName("操作类型"); - option_type.setFiledType("3"); - option_type.setAddType("2"); - option_type.setUpdateType("2"); - option_type.setShowType("2"); - option_type.setQueryType("2"); - option_type.setListType("2"); - option_type.setViewType("2"); - option_type.setFiledLength("255"); - option_type.setDataType("1"); - mdmModuleDbFiledsEntities.add(option_type); - - MdmModuleDbFiledsEntity option_Name = new MdmModuleDbFiledsEntity(); - option_Name.setMdmId(mdmId); - option_Name.setDbId(dbId); - option_Name.setChName("option_name"); - option_Name.setEnName("操作人"); - option_Name.setFiledType("3"); - option_Name.setAddType("2"); - option_Name.setUpdateType("2"); - option_Name.setShowType("2"); - option_Name.setQueryType("2"); - option_Name.setListType("2"); - option_Name.setViewType("2"); - option_Name.setFiledLength("255"); - option_Name.setDataType("1"); - mdmModuleDbFiledsEntities.add(option_Name); - } - - //目标应用、目标api、 - if("4".equals(type)){ - MdmModuleDbFiledsEntity target_app = new MdmModuleDbFiledsEntity(); - target_app.setMdmId(mdmId); - target_app.setDbId(dbId); - target_app.setChName("target_app"); - target_app.setEnName("目标应用"); - target_app.setFiledType("1"); - target_app.setAddType("2"); - target_app.setUpdateType("2"); - target_app.setShowType("2"); - target_app.setQueryType("2"); - target_app.setListType("2"); - target_app.setViewType("2"); - target_app.setFiledLength("50"); - target_app.setDataType("1"); - mdmModuleDbFiledsEntities.add(target_app); - - MdmModuleDbFiledsEntity target_api = new MdmModuleDbFiledsEntity(); - target_api.setMdmId(mdmId); - target_api.setDbId(dbId); - target_api.setChName("target_api"); - target_api.setEnName("目标api"); - target_api.setFiledType("1"); - target_api.setAddType("2"); - target_api.setUpdateType("2"); - target_api.setShowType("2"); - target_api.setQueryType("2"); - target_api.setListType("2"); - target_api.setViewType("2"); - target_api.setFiledLength("50"); - target_api.setDataType("1"); - mdmModuleDbFiledsEntities.add(target_api); - - MdmModuleDbFiledsEntity source_data = new MdmModuleDbFiledsEntity(); - source_data.setMdmId(mdmId); - source_data.setDbId(dbId); - source_data.setChName("source_data"); - source_data.setEnName("源数据"); - source_data.setFiledType("3"); - source_data.setAddType("2"); - source_data.setUpdateType("2"); - source_data.setShowType("2"); - source_data.setQueryType("2"); - source_data.setListType("2"); - source_data.setViewType("2"); - source_data.setFiledLength("255"); - source_data.setDataType("1"); - mdmModuleDbFiledsEntities.add(source_data); - - MdmModuleDbFiledsEntity option_type = new MdmModuleDbFiledsEntity(); - option_type.setMdmId(mdmId); - option_type.setDbId(dbId); - option_type.setChName("option_type"); - option_type.setEnName("操作类型"); - option_type.setFiledType("3"); - option_type.setAddType("2"); - option_type.setUpdateType("2"); - option_type.setShowType("2"); - option_type.setQueryType("2"); - option_type.setListType("2"); - option_type.setViewType("2"); - option_type.setFiledLength("255"); - option_type.setDataType("1"); - mdmModuleDbFiledsEntities.add(option_type); - } - if("2".equals(type) || "1".equals(type) ) { - MdmModuleDbFiledsEntity data_status = new MdmModuleDbFiledsEntity(); - data_status.setMdmId(mdmId); - data_status.setDbId(dbId); - data_status.setChName("data_status"); - data_status.setEnName("数据状态 Y正常 N删除 F修改"); - data_status.setFiledType("3"); - data_status.setAddType("2"); - data_status.setUpdateType("2"); - data_status.setShowType("2"); - data_status.setQueryType("2"); - data_status.setListType("2"); - data_status.setViewType("2"); - data_status.setFiledLength("1"); - data_status.setDataType("1"); - mdmModuleDbFiledsEntities.add(data_status); - } - if("1".equals(type)){ - MdmModuleDbFiledsEntity add_status = new MdmModuleDbFiledsEntity(); - add_status.setMdmId(mdmId); - add_status.setDbId(dbId); - add_status.setChName("add_status"); - add_status.setEnName("新增数据状态 0待下发 1已下发"); - add_status.setFiledType("3"); - add_status.setAddType("2"); - add_status.setUpdateType("2"); - add_status.setShowType("2"); - add_status.setQueryType("2"); - add_status.setListType("2"); - add_status.setViewType("2"); - add_status.setFiledLength("1"); - add_status.setDataType("1"); - mdmModuleDbFiledsEntities.add(add_status); - } - if("1".equals(type)){ - MdmModuleDbFiledsEntity update_status = new MdmModuleDbFiledsEntity(); - update_status.setMdmId(mdmId); - update_status.setDbId(dbId); - update_status.setChName("update_status"); - update_status.setEnName("修改数据状态 0待下发 1已下发"); - update_status.setFiledType("3"); - update_status.setAddType("2"); - update_status.setUpdateType("2"); - update_status.setShowType("2"); - update_status.setQueryType("2"); - update_status.setListType("2"); - update_status.setViewType("2"); - update_status.setFiledLength("1"); - update_status.setDataType("1"); - mdmModuleDbFiledsEntities.add(update_status); - } - - if("1".equals(type)){ - MdmModuleDbFiledsEntity delete_status = new MdmModuleDbFiledsEntity(); - delete_status.setMdmId(mdmId); - delete_status.setDbId(dbId); - delete_status.setChName("delete_status"); - delete_status.setEnName("删除数据状态 0待下发 1已下发"); - delete_status.setFiledType("3"); - delete_status.setAddType("2"); - delete_status.setUpdateType("2"); - delete_status.setShowType("2"); - delete_status.setQueryType("2"); - delete_status.setListType("2"); - delete_status.setViewType("2"); - delete_status.setFiledLength("1"); - delete_status.setDataType("1"); - mdmModuleDbFiledsEntities.add(delete_status); - } - - MdmModuleDbFiledsEntity sorts = new MdmModuleDbFiledsEntity(); - sorts.setMdmId(mdmId); - sorts.setDbId(dbId); - sorts.setChName("sorts"); - sorts.setEnName("排序"); - sorts.setFiledType("1"); - sorts.setAddType("2"); - sorts.setUpdateType("2"); - sorts.setShowType("2"); - sorts.setQueryType("2"); - sorts.setListType("2"); - sorts.setViewType("2"); - sorts.setFiledLength("20"); - sorts.setDataType("1"); - mdmModuleDbFiledsEntities.add(sorts); - MdmModuleDbFiledsEntity create_user_id = new MdmModuleDbFiledsEntity(); - create_user_id.setMdmId(mdmId); - create_user_id.setDbId(dbId); - create_user_id.setChName("create_user_id"); - create_user_id.setEnName("创建人id"); - create_user_id.setFiledType("3"); - create_user_id.setAddType("2"); - create_user_id.setUpdateType("2"); - create_user_id.setShowType("2"); - create_user_id.setQueryType("2"); - create_user_id.setListType("2"); - create_user_id.setViewType("2"); - create_user_id.setFiledLength("50"); - create_user_id.setDataType("1"); - mdmModuleDbFiledsEntities.add(create_user_id); - MdmModuleDbFiledsEntity create_time = new MdmModuleDbFiledsEntity(); - create_time.setMdmId(mdmId); - create_time.setDbId(dbId); - create_time.setChName("create_time"); - create_time.setEnName("创建时间"); - create_time.setFiledType("4"); - create_time.setAddType("2"); - create_time.setUpdateType("2"); - create_time.setShowType("2"); - create_time.setQueryType("2"); - create_time.setListType("2"); - create_time.setViewType("2"); - create_time.setFiledLength("50"); - create_time.setDataType("1"); - mdmModuleDbFiledsEntities.add(create_time); - MdmModuleDbFiledsEntity modify_user_id = new MdmModuleDbFiledsEntity(); - modify_user_id.setMdmId(mdmId); - modify_user_id.setDbId(dbId); - modify_user_id.setChName("modify_user_id"); - modify_user_id.setEnName("修改人id"); - modify_user_id.setFiledType("3"); - modify_user_id.setAddType("2"); - modify_user_id.setUpdateType("2"); - modify_user_id.setShowType("2"); - modify_user_id.setQueryType("2"); - modify_user_id.setListType("2"); - modify_user_id.setViewType("2"); - modify_user_id.setFiledLength("50"); - modify_user_id.setDataType("1"); - mdmModuleDbFiledsEntities.add(modify_user_id); - MdmModuleDbFiledsEntity modify_time = new MdmModuleDbFiledsEntity(); - modify_time.setMdmId(mdmId); - modify_time.setDbId(dbId); - modify_time.setChName("modify_time"); - modify_time.setEnName("修改时间"); - modify_time.setFiledType("4"); - modify_time.setAddType("2"); - modify_time.setUpdateType("2"); - modify_time.setShowType("2"); - modify_time.setQueryType("2"); - modify_time.setListType("2"); - modify_time.setViewType("2"); - modify_time.setFiledLength("50"); - modify_time.setDataType("1"); - mdmModuleDbFiledsEntities.add(modify_time); - MdmModuleDbFiledsEntity sts = new MdmModuleDbFiledsEntity(); - sts.setMdmId(mdmId); - sts.setDbId(dbId); - sts.setChName("sts"); - sts.setEnName("状态(Y正常N删除)"); - sts.setFiledType("3"); - sts.setAddType("2"); - sts.setUpdateType("2"); - sts.setShowType("2"); - sts.setQueryType("2"); - sts.setListType("2"); - sts.setViewType("2"); - sts.setFiledLength("1"); - sts.setDataType("1"); - mdmModuleDbFiledsEntities.add(sts); - MdmModuleDbFiledsEntity org_id = new MdmModuleDbFiledsEntity(); - org_id.setMdmId(mdmId); - org_id.setDbId(dbId); - org_id.setChName("org_id"); - org_id.setEnName("组织机构ID"); - org_id.setFiledType("3"); - org_id.setAddType("2"); - org_id.setUpdateType("2"); - org_id.setShowType("2"); - org_id.setQueryType("2"); - org_id.setListType("2"); - org_id.setViewType("2"); - org_id.setFiledLength("50"); - org_id.setDataType("1"); - mdmModuleDbFiledsEntities.add(org_id); - MdmModuleDbFiledsEntity company_id = new MdmModuleDbFiledsEntity(); - company_id.setMdmId(mdmId); - company_id.setDbId(dbId); - company_id.setChName("company_id"); - company_id.setEnName("公司id"); - company_id.setFiledType("3"); - company_id.setAddType("2"); - company_id.setUpdateType("2"); - company_id.setShowType("2"); - company_id.setQueryType("2"); - company_id.setListType("2"); - company_id.setViewType("2"); - company_id.setFiledLength("50"); - company_id.setDataType("1"); - mdmModuleDbFiledsEntities.add(company_id); - return mdmModuleDbFiledsEntities; - } - - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询显示信息 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmModuleView(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - //判断分页 - if (entity == null) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleViewVo mdmModuleViewVo = new MdmModuleViewVo(); - - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - //查询数据库字段 - MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.setSts("Y"); - List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); - MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbFiledsEntity.setSts("Y"); - List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); - - //设置数据库字段 - setFiledType(mdmModuleViewVo,mdmModuleDbEntities,mdmModuleDbFiledsEntities); - - MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleViewDetailEntity.setSts("Y"); - List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities = mdmServiceCache.queryMdmModuleViewDetail(mdmModuleViewDetailEntity); - setDbFiledType(mdmModuleViewVo,mdmModuleViewDetailEntities); - MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); - mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleViewEntity.setSts("Y"); - List<MdmModuleViewEntity> moduleViewEntities = mdmServiceCache.queryMdmModuleView(mdmModuleViewEntity); - if(moduleViewEntities != null && moduleViewEntities.size() == 1){ - mdmModuleViewVo.setMdmModuleViewEntity(moduleViewEntities.get(0)); - } - MdmModuleViewButtonEntity mdmModuleViewButtonEntity = new MdmModuleViewButtonEntity(); - mdmModuleViewButtonEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleViewButtonEntity.setSts("Y"); - List<MdmModuleViewButtonEntity> mdmModuleViewButtonEntities = mdmServiceCache.queryMdmModuleViewButton(mdmModuleViewButtonEntity); - mdmModuleViewVo.setDbButtonFiled(mdmModuleViewButtonEntities); - return BaseResult.getSuccessMessageEntity("查询视图成功", mdmModuleViewVo); - } - - private void setDbFiledType(MdmModuleViewVo mdmModuleViewVo, List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntityList) { - //新增 - List<MdmModuleViewDetailEntity> addFiled = new ArrayList<>(); - //修改 - List<MdmModuleViewDetailEntity> editFiled = new ArrayList<>(); - //查看 - List<MdmModuleViewDetailEntity> showFiled = new ArrayList<>(); - //查询 - List<MdmModuleViewDetailEntity> queryFiled = new ArrayList<>(); - //列表 - List<MdmModuleViewDetailEntity> listFiled = new ArrayList<>(); - if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { - for (int i = 0; i < mdmModuleViewDetailEntityList.size(); i++) { - switch (mdmModuleViewDetailEntityList.get(i).getViewType()) { - //1、查询2、列表3、新增4、修改 5、查看 - case "1": - queryFiled.add(mdmModuleViewDetailEntityList.get(i)); - break; - case "2": - listFiled.add(mdmModuleViewDetailEntityList.get(i)); - break; - case "3": - addFiled.add(mdmModuleViewDetailEntityList.get(i)); - break; - case "4": - editFiled.add(mdmModuleViewDetailEntityList.get(i)); - break; - case "5": - showFiled.add(mdmModuleViewDetailEntityList.get(i)); - break; - default: - } - } - } - mdmModuleViewVo.setDbAddFiled(addFiled); - mdmModuleViewVo.setDbEditFiled(editFiled); - mdmModuleViewVo.setDbShowFiled(showFiled); - mdmModuleViewVo.setDbQueryFiled(queryFiled); - mdmModuleViewVo.setDbListFiled(listFiled); - } - - /** - * @param mdmModuleViewVo - * @param mdmModuleDbEntityList - * @param mdmModuleDbFiledsEntityList - * @return void - * @Author lvleigang - * @Description 设置对应的字段类型 - * @Date 2023/10/25 - **/ - private void setFiledType(MdmModuleViewVo mdmModuleViewVo, List<MdmModuleDbEntity> mdmModuleDbEntityList, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList) { - //新增 - List<MdmDbFiledVo> addFiled = new ArrayList<>(); - //修改 - List<MdmDbFiledVo> editFiled = new ArrayList<>(); - //查看 - List<MdmDbFiledVo> showFiled = new ArrayList<>(); - //查询 - List<MdmDbFiledVo> queryFiled = new ArrayList<>(); - //列表 - List<MdmDbFiledVo> listFiled = new ArrayList<>(); - if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - - if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getViewType())){ - if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - //1、主表 - if ("1".equals(mdmModuleDbFiledsEntityList.get(i1).getAddType())) { - addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - } - if ("1".equals(mdmModuleDbFiledsEntityList.get(i1).getUpdateType())) { - editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - } - if ("1".equals(mdmModuleDbFiledsEntityList.get(i1).getShowType())) { - showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - } - if ("1".equals(mdmModuleDbFiledsEntityList.get(i1).getQueryType())) { - queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - } - if ("1".equals(mdmModuleDbFiledsEntityList.get(i1).getListType())) { - listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - } - } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())){ - //2、明细 - if ("1".equals(mdmModuleDbFiledsEntityList.get(i1).getAddType())) { - addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - } - if ("1".equals(mdmModuleDbFiledsEntityList.get(i1).getUpdateType())) { - editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - } - if ("1".equals(mdmModuleDbFiledsEntityList.get(i1).getShowType())) { - showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - } - if ("1".equals(mdmModuleDbFiledsEntityList.get(i1).getQueryType())) { - queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - } - if ("1".equals(mdmModuleDbFiledsEntityList.get(i1).getListType())) { - listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - } - } - } - } - } - } - } - } - mdmModuleViewVo.setAddFiled(addFiled); - mdmModuleViewVo.setEditFiled(editFiled); - mdmModuleViewVo.setShowFiled(showFiled); - mdmModuleViewVo.setQueryFiled(queryFiled); - mdmModuleViewVo.setListFiled(listFiled); - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置修改显示信息 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity doSaveMdmModuleView(JSONObject object) { - MdmModuleViewDto entity = getData("jsonStr", object, MdmModuleViewDto.class); - //判断是否有数据 - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getMdmModuleViewEntity() == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - - //保存视图 - MdmModuleViewEntity mdmModuleViewEntity = entity.getMdmModuleViewEntity(); - mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); - if(mdmModuleViewEntity.getId() != null && !"".equals(mdmModuleViewEntity.getId())){ - mdmModuleViewEntity.setDataType("2"); - mdmModuleViewEntity.setUpdate(); - mdmServiceCache.saveMdmModuleView(mdmModuleEntity.getId(),mdmModuleViewEntity); - }else { - mdmModuleViewEntity.setDataType("1"); - mdmModuleViewEntity.setCreate(); - mdmModuleViewDao.save(mdmModuleViewEntity); - } - //保存字段 - List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities = new ArrayList<>(); - //1、查询2、列表3、新增4、修改 5、查看 - saveDbViewFiled(mdmModuleEntity.getId(),mdmModuleViewEntity.getId(),entity.getQueryFiled(),"1",mdmModuleViewDetailEntities); - saveDbViewFiled(mdmModuleEntity.getId(),mdmModuleViewEntity.getId(),entity.getListFiled(),"2",mdmModuleViewDetailEntities); - saveDbViewFiled(mdmModuleEntity.getId(),mdmModuleViewEntity.getId(),entity.getAddFiled(),"3",mdmModuleViewDetailEntities); - saveDbViewFiled(mdmModuleEntity.getId(),mdmModuleViewEntity.getId(),entity.getEditFiled(),"4",mdmModuleViewDetailEntities); - saveDbViewFiled(mdmModuleEntity.getId(),mdmModuleViewEntity.getId(),entity.getShowFiled(),"5",mdmModuleViewDetailEntities); - mdmServiceCache.saveMdmModuleViewDetail(mdmModuleEntity.getId(),mdmModuleViewDetailEntities); - //保存按钮 - List<MdmModuleViewButtonEntity> mdmModuleViewButtonEntities = entity.getDbButtonFiled(); - if(mdmModuleViewButtonEntities != null && mdmModuleViewButtonEntities.size() > 0){ - for (int i = 0; i < mdmModuleViewButtonEntities.size(); i++) { - mdmModuleViewButtonEntities.get(i).setMdmId(mdmModuleEntity.getId()); - mdmModuleViewButtonEntities.get(i).setViewId(mdmModuleViewEntity.getId()); - if(mdmModuleViewButtonEntities.get(i).getId() != null && !"".equals(mdmModuleViewButtonEntities.get(i).getId())){ - mdmModuleViewButtonEntities.get(i).setDataType("2"); - mdmModuleViewButtonEntities.get(i).setUpdate(); - }else { - mdmModuleViewButtonEntities.get(i).setDataType("1"); - mdmModuleViewButtonEntities.get(i).setCreate(); - } - } - mdmServiceCache.saveMdmModuleViewButton(mdmModuleEntity.getId(),mdmModuleViewButtonEntities); - } - - //保存菜单 - //保存按钮 - - if("1".equals(mdmModuleViewEntity.getDataType())){ - //新增 - SysMenuConfigEntity module = new SysMenuConfigEntity(); - module.setCreate(); - module.setFormId(mdmModuleEntity.getId()); - if("1".equals(mdmModuleEntity.getMdmType())){ - //1、档案 - module.setParentMenuId("ea22757e99c144fb9ef381dd322e233c"); - }else { - //2、单据 - module.setParentMenuId("58714ddb7ec94f5da91df74efada042f"); - } - module.setMenuName(mdmModuleEntity.getMdmName()); - module.setMenuEnglishName("integrationOptionAdmin" + mdmModuleEntity.getMdmCode()); - module.setMenuIcon(null);//模块图标 - module.setRoute("integrationOptionAdmin/" + mdmModuleEntity.getMdmCode());//路由地址 - module.setMenuPage("integrationOptionV2/index");//一级Layout 二级 ParntView 三级component - module.setRemark("主数据生成菜单"); - module.setVisibles("0"); - module.setShowType("1"); - JSONObject object1 = new JSONObject(); - object1.put("mdmId", mdmModuleEntity.getId());//主数据id - object1.put("mdmCode", mdmModuleEntity.getMdmCode());//主数据编码 - object1.put("viewType", mdmModuleViewEntity.getViewName());//1、树 2、列表 - module.setOptions(object1.toString());//菜单mate参数 - sysMenuConfigDao.save(module); - if(mdmModuleViewButtonEntities != null && mdmModuleViewButtonEntities.size() > 0){ - for (int i = 0; i < mdmModuleViewButtonEntities.size(); i++) { - if("new".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())){ - SysButtonConfigEntity xz = new SysButtonConfigEntity(); - xz.setCode("new"); - xz.setNameCh("新建"); - xz.setNameEn("new"); - xz.setMenuId(module.getId()); - xz.setIconName(""); - xz.setStyles(""); - xz.setBtnFunction("new"); - xz.setRemark("主数据新建按钮"); - xz.setCreate(); - sysButtonConfigDao.save(xz); - } - if("resize".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())){ - - SysButtonConfigEntity cz = new SysButtonConfigEntity(); - cz.setCode("resize"); - cz.setNameCh("重置"); - cz.setNameEn("resize"); - cz.setMenuId(module.getId()); - cz.setIconName(""); - cz.setStyles(""); - cz.setBtnFunction("resize"); - cz.setRemark("主数据重置按钮"); - cz.setCreate(); - sysButtonConfigDao.save(cz); - } - if("search".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { - - SysButtonConfigEntity cx = new SysButtonConfigEntity(); - cx.setCode("search"); - cx.setNameCh("查询"); - cx.setNameEn("search"); - cx.setMenuId(module.getId()); - cx.setIconName(""); - cx.setStyles(""); - cx.setBtnFunction("search"); - cx.setRemark("主数据查询按钮"); - cx.setCreate(); - sysButtonConfigDao.save(cx); - } - if("edit".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { - - SysButtonConfigEntity xg = new SysButtonConfigEntity(); - xg.setCode("edit"); - xg.setNameCh("修改"); - xg.setNameEn("edit"); - xg.setMenuId(module.getId()); - xg.setIconName(""); - xg.setStyles(""); - xg.setBtnFunction("edit"); - xg.setRemark("主数据修改按钮"); - xg.setCreate(); - sysButtonConfigDao.save(xg); - } - if("dele".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { - - SysButtonConfigEntity sc = new SysButtonConfigEntity(); - sc.setCode("dele"); - sc.setNameCh("删除"); - sc.setNameEn("dele"); - sc.setMenuId(module.getId()); - sc.setIconName(""); - sc.setStyles(""); - sc.setBtnFunction("dele"); - sc.setRemark("主数据删除按钮"); - sc.setCreate(); - sysButtonConfigDao.save(sc); - } - if("view".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { - - SysButtonConfigEntity ck = new SysButtonConfigEntity(); - ck.setCode("view"); - ck.setNameCh("查看"); - ck.setNameEn("view"); - ck.setMenuId(module.getId()); - ck.setIconName(""); - ck.setStyles(""); - ck.setBtnFunction("view"); - ck.setRemark("主数据查看按钮"); - ck.setCreate(); - sysButtonConfigDao.save(ck); - } - if("send".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { - SysButtonConfigEntity xf = new SysButtonConfigEntity(); - xf.setCode("send"); - xf.setNameCh("下发"); - xf.setNameEn("send"); - xf.setMenuId(module.getId()); - xf.setIconName(""); - xf.setStyles(""); - xf.setBtnFunction("send"); - xf.setRemark("主数据下发按钮"); - xf.setCreate(); - sysButtonConfigDao.save(xf); - } - } - } - }else { - //修改 - //修改菜单 注意因为可能修改显示类型,所以需要修改菜单的属性 - SysMenuConfigEntity module = new SysMenuConfigEntity(); - module.setFormId(mdmModuleEntity.getId()); - module.setSts("Y"); - List<SysMenuConfigEntity> moduleList = sysMenuConfigDao.queryBase(module); - if (moduleList != null && moduleList.size() == 1) { - module = moduleList.get(0); - module.setUpdate(); - module.setMenuName(mdmModuleEntity.getMdmName()); - JSONObject object1 = new JSONObject(); - object1.put("mdmId", mdmModuleEntity.getId());//主数据id - object1.put("mdmCode", mdmModuleEntity.getMdmCode());//主数据id - object1.put("viewType", mdmModuleViewEntity.getViewName());//1、树 2、列表 - module.setOptions(object1.toString());//菜单mate参数 - sysMenuConfigDao.update(module); - //修改按钮 - //1、查询所有按钮 - SysButtonConfigEntity buttonConfigEntity = new SysButtonConfigEntity(); - buttonConfigEntity.setMenuId(module.getId()); - buttonConfigEntity.setSts("Y"); - List<SysButtonConfigEntity> sysButtonConfigEntities = sysButtonConfigDao.queryBase(buttonConfigEntity); - //1、查询按钮权限 - SysPopedomOperateEntity sysPopedomOperateEntity = new SysPopedomOperateEntity(); - sysPopedomOperateEntity.setMenuId(module.getId()); - sysPopedomOperateEntity.setSts("Y"); - List<SysPopedomOperateEntity> sysPopedomOperateEntities = sysPopedomOperateDao.queryBase(sysPopedomOperateEntity); - //删除按钮和删除按钮权限 - sysButtonConfigDao.logicRemoveMultiCondition(buttonConfigEntity); - sysPopedomOperateDao.logicRemoveMultiCondition(sysPopedomOperateEntity); - //删除处理权限 - doMdmModuleButton(module,mdmModuleViewButtonEntities,sysButtonConfigEntities,sysPopedomOperateEntities); - } - } - return BaseResult.getSuccessMessageEntity("保存显示信息成功"); - } - - /** - * @Author lvleigang - * @Description - * @Date 3:29 下午 2024/6/4 - * @param module 菜单 - * @param mdmModuleViewButtonEntities 主数据按钮 - * @param sysButtonConfigEntities 菜单按钮 - * @param sysPopedomOperateEntities 按钮权限 - * @return void - **/ - private void doMdmModuleButton(SysMenuConfigEntity module,List<MdmModuleViewButtonEntity> mdmModuleViewButtonEntities, List<SysButtonConfigEntity> sysButtonConfigEntities, List<SysPopedomOperateEntity> sysPopedomOperateEntities) { - //循环设置的按钮,再循环菜单的按钮,如果有把原先的修改状态,如果没有新增 - if(mdmModuleViewButtonEntities != null && mdmModuleViewButtonEntities.size() > 0){ - for (int i = 0; i < mdmModuleViewButtonEntities.size(); i++) { - boolean flag = false; - if(sysButtonConfigEntities != null && sysButtonConfigEntities.size() > 0){ - for (int i1 = 0; i1 < sysButtonConfigEntities.size(); i1++) { - if(mdmModuleViewButtonEntities.get(i).getButtonValue().equals(sysButtonConfigEntities.get(i1).getCode())){ - flag = true; - sysButtonConfigEntities.get(i1).setSts("Y"); - sysButtonConfigEntities.get(i1).setUpdate(); - sysButtonConfigDao.update(sysButtonConfigEntities.get(i1)); - if(sysPopedomOperateEntities != null && sysPopedomOperateEntities.size() > 0){ - for (int i2 = 0; i2 < sysPopedomOperateEntities.size(); i2++) { - if(sysPopedomOperateEntities.get(i2).getOperate().equals(sysButtonConfigEntities.get(i1).getId())){ - sysPopedomOperateEntities.get(i2).setSts("Y"); - sysPopedomOperateEntities.get(i2).setUpdate(); - sysPopedomOperateDao.update(sysPopedomOperateEntities.get(i2)); - } - } - } - break; - } - } - } - //原先没有需要新增 - if(!flag){ - if("new".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())){ - SysButtonConfigEntity xz = new SysButtonConfigEntity(); - xz.setCode("new"); - xz.setNameCh("新建"); - xz.setNameEn("new"); - xz.setMenuId(module.getId()); - xz.setIconName(""); - xz.setStyles(""); - xz.setBtnFunction("new"); - xz.setRemark("主数据新建按钮"); - xz.setCreate(); - sysButtonConfigDao.save(xz); - } - if("resize".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())){ - - SysButtonConfigEntity cz = new SysButtonConfigEntity(); - cz.setCode("resize"); - cz.setNameCh("重置"); - cz.setNameEn("resize"); - cz.setMenuId(module.getId()); - cz.setIconName(""); - cz.setStyles(""); - cz.setBtnFunction("resize"); - cz.setRemark("主数据重置按钮"); - cz.setCreate(); - sysButtonConfigDao.save(cz); - } - if("search".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { - - SysButtonConfigEntity cx = new SysButtonConfigEntity(); - cx.setCode("search"); - cx.setNameCh("查询"); - cx.setNameEn("search"); - cx.setMenuId(module.getId()); - cx.setIconName(""); - cx.setStyles(""); - cx.setBtnFunction("search"); - cx.setRemark("主数据查询按钮"); - cx.setCreate(); - sysButtonConfigDao.save(cx); - } - if("edit".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { - - SysButtonConfigEntity xg = new SysButtonConfigEntity(); - xg.setCode("edit"); - xg.setNameCh("修改"); - xg.setNameEn("edit"); - xg.setMenuId(module.getId()); - xg.setIconName(""); - xg.setStyles(""); - xg.setBtnFunction("edit"); - xg.setRemark("主数据修改按钮"); - xg.setCreate(); - sysButtonConfigDao.save(xg); - } - if("dele".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { - - SysButtonConfigEntity sc = new SysButtonConfigEntity(); - sc.setCode("dele"); - sc.setNameCh("删除"); - sc.setNameEn("dele"); - sc.setMenuId(module.getId()); - sc.setIconName(""); - sc.setStyles(""); - sc.setBtnFunction("dele"); - sc.setRemark("主数据删除按钮"); - sc.setCreate(); - sysButtonConfigDao.save(sc); - } - if("view".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { - - SysButtonConfigEntity ck = new SysButtonConfigEntity(); - ck.setCode("view"); - ck.setNameCh("查看"); - ck.setNameEn("view"); - ck.setMenuId(module.getId()); - ck.setIconName(""); - ck.setStyles(""); - ck.setBtnFunction("view"); - ck.setRemark("主数据查看按钮"); - ck.setCreate(); - sysButtonConfigDao.save(ck); - } - if("send".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { - SysButtonConfigEntity xf = new SysButtonConfigEntity(); - xf.setCode("send"); - xf.setNameCh("下发"); - xf.setNameEn("send"); - xf.setMenuId(module.getId()); - xf.setIconName(""); - xf.setStyles(""); - xf.setBtnFunction("send"); - xf.setRemark("主数据下发按钮"); - xf.setCreate(); - sysButtonConfigDao.save(xf); - } - - - } - } - } - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询分发设置 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmModuleDistribute(JSONObject object) { - MdmDto entity = getData("jsonStr", object, MdmDto.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - //查询模块下的应用列表 - MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); - mdmModuleDistributeEntity.setSts("Y"); - mdmModuleDistributeEntity.setMdmId(mdmModuleEntity.getId()); - List<MdmModuleDistributeEntity> mdmModuleDistributeEntities = mdmServiceCache.queryMdmModuleDistribute(mdmModuleEntity.getId(),mdmModuleDistributeEntity); - return BaseResult.getSuccessMessageEntity("查询成功", mdmModuleDistributeEntities); - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置保存分发设置 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity doSaveMdmModuleDistribute(JSONObject object) { - MdmDistributeDto entity = getData("jsonStr", object, MdmDistributeDto.class); - //判断是否有数据 - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - mdmServiceCache.saveMdmModuleDistribute(mdmModuleEntity.getId(),entity.getMdmModuleDistributeEntities()); - return BaseResult.getSuccessMessageEntity("保存发布设置成功"); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询数据来源 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmModuleSource(JSONObject object) { - MdmDto entity = getData("jsonStr", object, MdmDto.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - //查询模块下的应用列表 - MdmModuleSourceEntity mdmModuleSourceEntity = new MdmModuleSourceEntity(); - mdmModuleSourceEntity.setSts("Y"); - mdmModuleSourceEntity.setMdmId(mdmModuleEntity.getId()); - List<MdmModuleSourceEntity> mdmModuleSourceEntities = mdmServiceCache.queryMdmModuleSource(mdmModuleSourceEntity); - return BaseResult.getSuccessMessageEntity("查询成功", mdmModuleSourceEntities); - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置保存数据来源 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity doSaveMdmModuleSource(JSONObject object) { - MdmSourceDto entity = getData("jsonStr", object, MdmSourceDto.class); - //判断是否有数据 - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - mdmServiceCache.saveMdmModuleSource(mdmModuleEntity.getId(),entity.getMdmModuleSourceEntities()); - return BaseResult.getSuccessMessageEntity("保存发布设置成功"); - } - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询下发日志 - * @Date 11:52 上午 2024/3/27 - **/ - @Override - public JsonResultEntity querySendEntityPage(JSONObject jsonObject) { - MdmModuleSendLogEntity entity = getData("jsonStr", jsonObject, MdmModuleSendLogEntity.class); - //判断分页 - if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { - return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.setSts("Y"); - List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); - if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0 ){ - for (int i = 0; i < mdmModuleDbEntities.size(); i++) { - if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ - entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_send_log"); - break; - } - } - }else { - return BaseResult.getFailureMessageEntity("请先设置数据源"); - } - PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - List<MdmModuleSendLogEntity> list = mdmModuleSendLogDao.queryByLike(entity); - PageInfo pageInfo = new PageInfo(list); - return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - } - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 获取下发日志 - * @Date 2:36 下午 2024/3/27 - **/ - @Override - public JsonResultEntity getSendEntity(JSONObject jsonObject) { - MdmModuleSendLogEntity entity = getData("jsonStr", jsonObject, MdmModuleSendLogEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.setSts("Y"); - List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); - if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0 ){ - for (int i = 0; i < mdmModuleDbEntities.size(); i++) { - if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ - entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_send_log"); - break; - } - } - }else { - return BaseResult.getFailureMessageEntity("请先设置数据源"); - } - entity = mdmModuleSendLogDao.get(entity.getId()); - if (entity == null) { - return BaseResult.getFailureMessageEntity("获取日志失败"); - } - return BaseResult.getSuccessMessageEntity("获取日志成功", entity); - } - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 删除下发日志 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity deleteSendEntity(JSONObject jsonObject) { - MdmModuleSendLogEntity entity = getData("jsonStr", jsonObject, MdmModuleSendLogEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.setSts("Y"); - List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); - if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0 ){ - for (int i = 0; i < mdmModuleDbEntities.size(); i++) { - if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ - entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_send_log"); - break; - } - } - }else { - return BaseResult.getFailureMessageEntity("请先设置数据源"); - } - entity.setUpdate(); - mdmModuleSendLogDao.logicRemove(entity); - return BaseResult.getSuccessMessageEntity("删除日志成功"); - } - - - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询操作日志 - * @Date 11:52 上午 2024/3/27 - **/ - @Override - public JsonResultEntity queryOptionEntityPage(JSONObject jsonObject) { - MdmModuleOptionLogEntity entity = getData("jsonStr", jsonObject, MdmModuleOptionLogEntity.class); - //判断分页 - if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { - return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.setSts("Y"); - List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); - if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0 ){ - for (int i = 0; i < mdmModuleDbEntities.size(); i++) { - if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ - entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_option_log"); - break; - } - } - }else { - return BaseResult.getFailureMessageEntity("请先设置数据源"); - } - PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - List<MdmModuleOptionLogEntity> list = mdmModuleOptionLogDao.queryByLike(entity); - PageInfo pageInfo = new PageInfo(list); - return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - } - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 获取操作日志 - * @Date 2:36 下午 2024/3/27 - **/ - @Override - public JsonResultEntity getOptionEntity(JSONObject jsonObject) { - MdmModuleOptionLogEntity entity = getData("jsonStr", jsonObject, MdmModuleOptionLogEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.setSts("Y"); - List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); - if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0 ){ - for (int i = 0; i < mdmModuleDbEntities.size(); i++) { - if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ - entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_option_log"); - break; - } - } - }else { - return BaseResult.getFailureMessageEntity("请先设置数据源"); - } - entity = mdmModuleOptionLogDao.get(entity.getId()); - if (entity == null) { - return BaseResult.getFailureMessageEntity("获取日志失败"); - } - return BaseResult.getSuccessMessageEntity("获取日志成功", entity); - } - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 删除操作日志 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity deleteOptionEntity(JSONObject jsonObject) { - MdmModuleOptionLogEntity entity = getData("jsonStr", jsonObject, MdmModuleOptionLogEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.setSts("Y"); - List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); - if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0 ){ - for (int i = 0; i < mdmModuleDbEntities.size(); i++) { - if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ - entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_option_log"); - break; - } - } - }else { - return BaseResult.getFailureMessageEntity("请先设置数据源"); - } - entity.setUpdate(); - mdmModuleOptionLogDao.logicRemove(entity); - return BaseResult.getSuccessMessageEntity("删除日志成功"); - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询数据源的服务 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmModuleServer(JSONObject object) { - MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); - //判断分页 - if (entity == null) { - entity = new MdmModuleDbEntity(); - } - //查询数据源表 - entity.setSts("Y"); - List<MdmModuleDbEntity> allDb = mdmModuleDbDao.queryByLike(entity); - List<MdmModuleDbEntity> mdmModuleDbEntityList = new ArrayList<>(); - if(allDb != null && allDb.size() > 0){ - for (int i = 0; i < allDb.size(); i++) { - if("1".equals(allDb.get(i).getDbType()) || "2".equals(allDb.get(i).getDbType() )){ - mdmModuleDbEntityList.add(allDb.get(i)); - } - } - } - return BaseResult.getSuccessMessageEntity("查询数据成功", mdmModuleDbEntityList); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询数据源的服务的字段 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmModuleServerFiled(JSONObject object) { - MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); - //判断分页 - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getDbName() == null || "".equals(entity.getDbName())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - //查询数据源表 - entity.setSts("Y"); - List<MdmModuleDbEntity> dblist = mdmModuleDbDao.queryBase(entity); - if (dblist != null && dblist.size() == 1) { - MdmModuleDbFiledsEntity queryDbFiled = new MdmModuleDbFiledsEntity(); - queryDbFiled.setSts("Y"); - queryDbFiled.setDbId(dblist.get(0).getId()); - queryDbFiled.setViewType("1"); - List<MdmModuleDbFiledsEntity> list = mdmModuleDbFiledsDao.queryBase(queryDbFiled); - MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - mdmModuleDbFiledsEntity.setChName("id"); - mdmModuleDbFiledsEntity.setEnName("id"); - list.add(0, mdmModuleDbFiledsEntity); - return BaseResult.getSuccessMessageEntity("查询数据成功", list); - } else { - return BaseResult.getFailureMessageEntity("服务不存在"); - } - } - // - // - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询主表字段 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmModuleServerMainFiled(JSONObject object) { - MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); - //判断分页 - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - //查询数据源表 - entity.setSts("Y"); - entity.setDbType("1"); - List<MdmModuleDbEntity> mdmModuleDbEntityList = mdmModuleDbDao.queryBase(entity); - if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 1) { - MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - mdmModuleDbFiledsEntity.setSts("Y"); - mdmModuleDbFiledsEntity.setViewType("1"); - mdmModuleDbFiledsEntity.setDbId(mdmModuleDbEntityList.get(0).getId()); - List<MdmModuleDbFiledsEntity> list = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - return BaseResult.getSuccessMessageEntity("查询数据成功", list); - } else if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 0) { - return BaseResult.getFailureMessageEntity("请先配置数据源"); - } else { - return BaseResult.getFailureMessageEntity("查询数据失败"); - } - } - - - - // - ///** - // * @param entity - // * @param mainMdmModuleDb - // * @param mainMdmModuleDbFileds - // * @return void - // * @Author lvleigang - // * @Description 设置保存主表和字段以及字段的属性 - // * @Date 10:34 上午 2023/10/19 - // **/ - //private void setMainTable(MdmDto entity, MdmModuleDbEntity mainMdmModuleDb, List<MdmModuleDbFiledsEntity> mainMdmModuleDbFileds) { - // //先保存或修改主表数据 - // mainMdmModuleDb.setMdmId(entity.getId()); - // mainMdmModuleDb.setDbType("1"); - // boolean flag = false; - // - // if (mainMdmModuleDb.getId() != null && !"".equals(mainMdmModuleDb.getId())) { - // mainMdmModuleDb.setSts("Y"); - // mainMdmModuleDb.setModify_user_id(StpUtil.getLoginIdAsString()); - // mainMdmModuleDb.setModify_time(new Date()); - // mdmModuleDbDao.update(mainMdmModuleDb); - // //删除规则表 - // MdmModuleDbFiledsRuleEntity delectFiledsRule = new MdmModuleDbFiledsRuleEntity(); - // delectFiledsRule.setMdmId(entity.getId()); - // delectFiledsRule.setModify_user_id(StpUtil.getLoginIdAsString()); - // delectFiledsRule.setModify_time(new Date()); - // mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(delectFiledsRule); - // } else { - // flag = true; - // mainMdmModuleDb.setId(UUIDUtils.getUUID()); - // mainMdmModuleDb.setSts("Y"); - // mainMdmModuleDb.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mainMdmModuleDb.setModify_user_id(StpUtil.getLoginIdAsString()); - // mainMdmModuleDb.setCreate_time(new Date()); - // mainMdmModuleDb.setModify_time(new Date()); - // mdmModuleDbDao.save(mainMdmModuleDb); - // } - // List<DbFiledsDto> dbFiledsDtos = new ArrayList<>(); - // - // //保存主表字段 因为字段不允许删除,所以不用先删除再新增 - // if (mainMdmModuleDbFileds != null && mainMdmModuleDbFileds.size() > 0) { - // for (int i = 0; i < mainMdmModuleDbFileds.size(); i++) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = mainMdmModuleDbFileds.get(i); - // mdmModuleDbFiledsEntity.setMdmId(entity.getId()); - // mdmModuleDbFiledsEntity.setDbId(mainMdmModuleDb.getId()); - // if (mdmModuleDbFiledsEntity.getId() != null && !"".equals(mdmModuleDbFiledsEntity.getId())) { - // DbFiledsDto dbFiledsDto = new DbFiledsDto("1", mdmModuleDbFiledsEntity.getChName(), mdmModuleDbFiledsEntity.getEnName(), mdmModuleDbFiledsEntity.getFiledType(), mdmModuleDbFiledsEntity.getFiledLength()); - // dbFiledsDtos.add(dbFiledsDto); - // - // mdmModuleDbFiledsEntity.setSts("Y"); - // mdmModuleDbFiledsEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsEntity.setModify_time(new Date()); - // mdmModuleDbFiledsDao.update(mdmModuleDbFiledsEntity); - // } else { - // DbFiledsDto dbFiledsDto = new DbFiledsDto("2", mdmModuleDbFiledsEntity.getChName(), mdmModuleDbFiledsEntity.getEnName(), mdmModuleDbFiledsEntity.getFiledType(), mdmModuleDbFiledsEntity.getFiledLength()); - // dbFiledsDtos.add(dbFiledsDto); - // mdmModuleDbFiledsEntity.setId(UUIDUtils.getUUID()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // mdmModuleDbFiledsEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsEntity.setCreate_time(new Date()); - // mdmModuleDbFiledsEntity.setModify_time(new Date()); - // mdmModuleDbFiledsDao.save(mdmModuleDbFiledsEntity); - // } - // //修改或保存属性 - // List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = mdmModuleDbFiledsEntity.getMdmModuleDbFiledsRules(); - // if (mdmModuleDbFiledsRules != null && mdmModuleDbFiledsRules.size() > 0) { - // for (int a = 0; a < mdmModuleDbFiledsRules.size(); a++) { - // MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = mdmModuleDbFiledsRules.get(a); - // mdmModuleDbFiledsRuleEntity.setMdmId(entity.getId()); - // mdmModuleDbFiledsRuleEntity.setDbId(mainMdmModuleDb.getId()); - // mdmModuleDbFiledsRuleEntity.setFiledId(mdmModuleDbFiledsEntity.getId()); - // if (mdmModuleDbFiledsRuleEntity.getId() != null && !"".equals(mdmModuleDbFiledsRuleEntity.getId())) { - // mdmModuleDbFiledsRuleEntity.setSts("Y"); - // mdmModuleDbFiledsRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsRuleEntity.setModify_time(new Date()); - // mdmModuleDbFiledsRuleDao.update(mdmModuleDbFiledsRuleEntity); - // } else { - // mdmModuleDbFiledsRuleEntity.setId(UUIDUtils.getUUID()); - // mdmModuleDbFiledsRuleEntity.setSts("Y"); - // mdmModuleDbFiledsRuleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsRuleEntity.setCreate_time(new Date()); - // mdmModuleDbFiledsRuleEntity.setModify_time(new Date()); - // mdmModuleDbFiledsRuleDao.save(mdmModuleDbFiledsRuleEntity); - // } - // } - // } - // } - // } - // if (flag) { - // //新增 - // Map<String, Object> maps = new HashMap<>(); - // maps.put("dbType", "1");//表类型 - // maps.put("tableName", mainMdmModuleDb.getDbName());//表名 - // maps.put("tableRemark", mainMdmModuleDb.getRemark());//表备注 - // maps.put("databaseFields", dbFiledsDtos);//字段 - // mdmModuleDao.createTable(maps); - // Map<String, Object> mapsDistribute = new HashMap<>(); - // mapsDistribute.put("tableName", mainMdmModuleDb.getDbName() + "_distribute");//表名 - // List<DbFiledsDto> distribute = getDistribute(); - // maps.put("databaseFields", distribute);//字段 - // mapsDistribute.put("tableRemark", mainMdmModuleDb.getRemark() + "分发表");//表备注 - // mdmModuleDao.createTableDistribute(mapsDistribute); - // } else { - // //修改 - // Map<String, String> tablename = new HashMap<>(); - // tablename.put("tableName", mainMdmModuleDb.getDbName());//表名 - // tablename.put("tableRemark", mainMdmModuleDb.getRemark());//表备注 - // mdmModuleDao.alterTableName(tablename); - // Map<String, Object> maps = new HashMap<>(); - // maps.put("tableName", mainMdmModuleDb.getDbName());//表名 - // maps.put("tableRemark", mainMdmModuleDb.getRemark());//表备注 - // maps.put("databaseFields", dbFiledsDtos);//字段 - // mdmModuleDao.alterTable(maps); - // } - //} - // - ///** - // * @param - // * @return java.util.List<com.hzya.frame.mdm.entity.DbFiledsDto> - // * @Author lvleigang - // * @Description 设置分发表字段 - // * @Date 8:49 上午 2023/11/9 - // **/ - //private List<DbFiledsDto> getDistribute() { - // List<DbFiledsDto> dbFiledsDtos = new ArrayList<>(); - // dbFiledsDtos.add(new DbFiledsDto("1", "数据id", "formmain_id", "3", "50")); - // dbFiledsDtos.add(new DbFiledsDto("1", "应用id", "app_id", "3", "50")); - // dbFiledsDtos.add(new DbFiledsDto("1", "状态1、发送成功 2、发送中 3、发送失败", "status", "3", "50")); - // dbFiledsDtos.add(new DbFiledsDto("1", "描述", "msg", "3", "50")); - // return dbFiledsDtos; - //} - // - /** - * @param tableName - * @return java.lang.Long - * @Author lvleigang - * @Description 校验表是否存在 - * @Date 3:58 下午 2023/7/11 - **/ - private boolean checkTable(String tableName) { - Map<String, String> maps = new HashMap<>(); - maps.put("tableName", tableName); - Integer i = mdmModuleDao.checkTable(maps); - if (i != null && i > 0) { - return true; - } - return false; - } - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询显示信息 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleView(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // MdmModuleViewVo mdmModuleViewVo = new MdmModuleViewVo(); - // //查询设置各种类型字段 - // //查询模版数据源 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(entity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List<MdmModuleDbEntity> mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setMdmId(entity.getId()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // setFiledType(mdmModuleViewVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList); - // } - // //查询数据库设置的字段 - // MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); - // mdmModuleViewEntity.setMdmId(entity.getId()); - // mdmModuleViewEntity.setSts("Y"); - // List<MdmModuleViewEntity> moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); - // if (moduleViewEntityList != null && moduleViewEntityList.size() == 1) { - // mdmModuleViewVo.setMdmModuleViewEntity(moduleViewEntityList.get(0)); - // //查询明细 - // MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - // mdmModuleViewDetailEntity.setMdmId(entity.getId()); - // mdmModuleViewDetailEntity.setViewId(moduleViewEntityList.get(0).getId()); - // mdmModuleViewDetailEntity.setSts("Y"); - // List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntityList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); - // setDbFiledType(mdmModuleViewVo, mdmModuleViewDetailEntityList); - // } else { - // mdmModuleViewVo.setMdmModuleViewEntity(new MdmModuleViewEntity()); - // mdmModuleViewVo.setDbAddFiled(new ArrayList<>()); - // mdmModuleViewVo.setDbEditFiled(new ArrayList<>()); - // mdmModuleViewVo.setDbShowFiled(new ArrayList<>()); - // mdmModuleViewVo.setDbQueryFiled(new ArrayList<>()); - // mdmModuleViewVo.setDbListFiled(new ArrayList<>()); - // } - // return BaseResult.getSuccessMessageEntity("查询视图成功", mdmModuleViewVo); - //} - // - //private void setDbFiledType(MdmModuleViewVo mdmModuleViewVo, List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntityList) { - // //新增 - // List<MdmModuleViewDetailEntity> addFiled = new ArrayList<>(); - // //修改 - // List<MdmModuleViewDetailEntity> editFiled = new ArrayList<>(); - // //查看 - // List<MdmModuleViewDetailEntity> showFiled = new ArrayList<>(); - // //查询 - // List<MdmModuleViewDetailEntity> queryFiled = new ArrayList<>(); - // //列表 - // List<MdmModuleViewDetailEntity> listFiled = new ArrayList<>(); - // if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { - // for (int i = 0; i < mdmModuleViewDetailEntityList.size(); i++) { - // switch (mdmModuleViewDetailEntityList.get(i).getViewType()) { - // //1、查询2、列表3、新增4、修改 5、查看 - // case "1": - // queryFiled.add(mdmModuleViewDetailEntityList.get(i)); - // break; - // case "2": - // listFiled.add(mdmModuleViewDetailEntityList.get(i)); - // break; - // case "3": - // addFiled.add(mdmModuleViewDetailEntityList.get(i)); - // break; - // case "4": - // editFiled.add(mdmModuleViewDetailEntityList.get(i)); - // break; - // case "5": - // showFiled.add(mdmModuleViewDetailEntityList.get(i)); - // break; - // default: - // } - // } - // } - // mdmModuleViewVo.setDbAddFiled(addFiled); - // mdmModuleViewVo.setDbEditFiled(editFiled); - // mdmModuleViewVo.setDbShowFiled(showFiled); - // mdmModuleViewVo.setDbQueryFiled(queryFiled); - // mdmModuleViewVo.setDbListFiled(listFiled); - //} - // - ///** - // * @param mdmModuleViewVo - // * @param mdmModuleDbEntityList - // * @param mdmModuleDbFiledsEntityList - // * @return void - // * @Author lvleigang - // * @Description 设置对应的字段类型 - // * @Date 2023/10/25 - // **/ - //private void setFiledType(MdmModuleViewVo mdmModuleViewVo, List<MdmModuleDbEntity> mdmModuleDbEntityList, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList) { - // //新增 - // List<MdmDbFiledVo> addFiled = new ArrayList<>(); - // //修改 - // List<MdmDbFiledVo> editFiled = new ArrayList<>(); - // //查看 - // List<MdmDbFiledVo> showFiled = new ArrayList<>(); - // //查询 - // List<MdmDbFiledVo> queryFiled = new ArrayList<>(); - // //列表 - // List<MdmDbFiledVo> listFiled = new ArrayList<>(); - // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // //1、主表 - // addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // } else { - // //2、明细 - // queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // } - // } - // } - // } - // } - // } - // mdmModuleViewVo.setAddFiled(addFiled); - // mdmModuleViewVo.setEditFiled(editFiled); - // mdmModuleViewVo.setShowFiled(showFiled); - // mdmModuleViewVo.setQueryFiled(queryFiled); - // mdmModuleViewVo.setListFiled(listFiled); - //} - // - // - - // - /** - * @param mdmDbFiledVoList - * @param type - * @return void - * @Author lvleigang - * @Description 保存数据 - * @Date 1:37 下午 2023/10/25 - **/ - private void saveDbViewFiled(String mdmID, String viewid, List<MdmDbFiledVo> mdmDbFiledVoList, String type,List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities) { - if (mdmDbFiledVoList != null && mdmDbFiledVoList.size() > 0) { - for (int i = 0; i < mdmDbFiledVoList.size(); i++) { - MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - mdmModuleViewDetailEntity.setCreate(); - mdmModuleViewDetailEntity.setMdmId(mdmID); - mdmModuleViewDetailEntity.setViewId(viewid); - mdmModuleViewDetailEntity.setViewFiled(mdmDbFiledVoList.get(i).getId()); - mdmModuleViewDetailEntity.setViewType(type); - mdmModuleViewDetailEntity.setDataType("1"); - mdmModuleViewDetailEntities.add(mdmModuleViewDetailEntity); - } - } - } - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询权限配置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleRule(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询模块下的角色列表 - // MdmModuleRoleEntity mdmModuleRoleEntity = new MdmModuleRoleEntity(); - // mdmModuleRoleEntity.setSts("Y"); - // mdmModuleRoleEntity.setMdmId(entity.getId()); - // List<MdmModuleRoleEntity> mdmModuleRoleEntities = mdmModuleRoleDao.queryBase(mdmModuleRoleEntity); - // if (mdmModuleRoleEntities != null && mdmModuleRoleEntities.size() > 0) { - // MdmModuleRoleButtonEntity mdmModuleRoleButtonEntity = new MdmModuleRoleButtonEntity(); - // mdmModuleRoleButtonEntity.setSts("Y"); - // mdmModuleRoleButtonEntity.setMdmId(entity.getId()); - // List<MdmModuleRoleButtonEntity> mdmModuleRoleButtonEntities = mdmModuleRoleButtonDao.queryBase(mdmModuleRoleButtonEntity); - // if (mdmModuleRoleButtonEntities != null && mdmModuleRoleButtonEntities.size() > 0) { - // for (int i = 0; i < mdmModuleRoleEntities.size(); i++) { - // List<MdmModuleRoleButtonEntity> list = new ArrayList<>(); - // for (int i1 = 0; i1 < mdmModuleRoleButtonEntities.size(); i1++) { - // if (mdmModuleRoleEntities.get(i).getRoleId().equals(mdmModuleRoleButtonEntities.get(i1).getRoleId())) { - // list.add(mdmModuleRoleButtonEntities.get(i1)); - // } - // } - // mdmModuleRoleEntities.get(i).setMdmModuleRoleButtonEntities(list); - // } - // } - // } - // return BaseResult.getSuccessMessageEntity("查询成功", mdmModuleRoleEntities); - //} - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置保存权限配置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity doSaveMdmModuleRule(JSONObject object) { - // MdmRoleDto entity = getData("jsonStr", object, MdmRoleDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询菜单 - // Module module = new Module(); - // module.setFormId(entity.getId()); - // List<Module> moduleList = moduleMapper.entity_list_base(module); - // if (moduleList != null && moduleList.size() == 1) { - // module = moduleList.get(0); - // } else { - // return BaseResult.getFailureMessageEntity("菜单错误请检查菜单"); - // } - // //先删除 - // RoleModule roleModule = new RoleModule(); - // roleModule.setSts("Y"); - // roleModule.setUpdate(); - // roleModule.setModuleId(module.getId()); - // roleModuleMapper.entity_logicDelete_Multi_Condition(roleModule); - // MdmModuleRoleEntity mdmModuleRoleEntity = new MdmModuleRoleEntity(); - // mdmModuleRoleEntity.setMdmId(entity.getId()); - // mdmModuleRoleEntity.setSts("Y"); - // mdmModuleRoleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleRoleEntity.setModify_time(new Date()); - // mdmModuleRoleDao.logicRemoveMultiCondition(mdmModuleRoleEntity); - // MdmModuleRoleButtonEntity mdmModuleRoleButtonEntity = new MdmModuleRoleButtonEntity(); - // mdmModuleRoleButtonEntity.setMdmId(entity.getId()); - // mdmModuleRoleButtonEntity.setSts("Y"); - // mdmModuleRoleButtonEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleRoleButtonEntity.setModify_time(new Date()); - // mdmModuleRoleButtonDao.logicRemoveMultiCondition(mdmModuleRoleButtonEntity); - // - // if (entity.getMdmModuleRoleEntities() != null && entity.getMdmModuleRoleEntities().size() > 0) { - // for (int i = 0; i < entity.getMdmModuleRoleEntities().size(); i++) { - // - // MdmModuleRoleEntity moduleRoleEntity = entity.getMdmModuleRoleEntities().get(i); - // moduleRoleEntity.setMdmId(entity.getId()); - // moduleRoleEntity.setSts("Y"); - // moduleRoleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // moduleRoleEntity.setModify_time(new Date()); - // if (moduleRoleEntity.getId() != null && !"".equals(moduleRoleEntity.getId())) { - // //修改 - // mdmModuleRoleDao.update(moduleRoleEntity); - // } else { - // //新增 - // moduleRoleEntity.setId(UUIDUtils.getUUID()); - // moduleRoleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // moduleRoleEntity.setCreate_time(new Date()); - // mdmModuleRoleDao.save(moduleRoleEntity); - // } - // if (moduleRoleEntity.getMdmModuleRoleButtonEntities() != null && moduleRoleEntity.getMdmModuleRoleButtonEntities().size() > 0) { - // for (int i1 = 0; i1 < moduleRoleEntity.getMdmModuleRoleButtonEntities().size(); i1++) { - // MdmModuleRoleButtonEntity moduleRoleButtonEntity = moduleRoleEntity.getMdmModuleRoleButtonEntities().get(i1); - // moduleRoleButtonEntity.setMdmId(entity.getId()); - // moduleRoleButtonEntity.setSts("Y"); - // moduleRoleButtonEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // moduleRoleButtonEntity.setModify_time(new Date()); - // moduleRoleButtonEntity.setModuleRoleId(moduleRoleEntity.getRoleId()); - // moduleRoleButtonEntity.setRoleId(moduleRoleEntity.getRoleId()); - // if (moduleRoleButtonEntity.getId() != null && !"".equals(moduleRoleButtonEntity.getId())) { - // //修改 - // mdmModuleRoleButtonDao.update(moduleRoleButtonEntity); - // } else { - // //新增 - // moduleRoleButtonEntity.setId(UUIDUtils.getUUID()); - // moduleRoleButtonEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // moduleRoleButtonEntity.setCreate_time(new Date()); - // mdmModuleRoleButtonDao.save(moduleRoleButtonEntity); - // } - // } - // } - // //再添加 - // RoleModule saveRole = new RoleModule(); - // saveRole.setCreate(); - // saveRole.setRoleId(moduleRoleEntity.getRoleId()); - // saveRole.setModuleId(module.getId()); - // roleModuleMapper.entity_insert(saveRole); - // } - // } - // return BaseResult.getSuccessMessageEntity("保存成功"); - //} - // - - // - - // /** * @param object * @return com.hzya.frame.web.entity.JsonResultEntity @@ -2486,7 +143,7 @@ public class MdmServiceImpl implements IMdmService { MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); mdmModuleViewEntity.setSts("Y"); - List<MdmModuleViewEntity> moduleViewEntityList = mdmServiceCache.queryMdmModuleView(mdmModuleViewEntity); + List<MdmModuleViewEntity> moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { return BaseResult.getFailureMessageEntity("系统错误"); } @@ -2513,7 +170,7 @@ public class MdmServiceImpl implements IMdmService { MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); mdmModuleDbFiledsRuleEntity.setSts("Y"); - List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntityList = mdmServiceCache.queryMdmModuleDbFiledsRule(mdmModuleDbFiledsRuleEntity); + List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity); if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { return BaseResult.getFailureMessageEntity("系统错误"); } @@ -2522,7 +179,7 @@ public class MdmServiceImpl implements IMdmService { MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); mdmModuleViewDetailEntity.setSts("Y"); - List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities = mdmServiceCache.queryMdmModuleViewDetail(mdmModuleViewDetailEntity); + List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); if (mdmModuleViewDetailEntities == null || mdmModuleViewDetailEntities.size() == 0) { return BaseResult.getFailureMessageEntity("系统错误"); } @@ -3179,7 +836,7 @@ public class MdmServiceImpl implements IMdmService { MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntities.getId()); mdmModuleDbFiledsRuleEntity.setSts("Y"); - List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntityList = mdmServiceCache.queryMdmModuleDbFiledsRule(mdmModuleDbFiledsRuleEntity); + List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity); if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { return BaseResult.getFailureMessageEntity("系统错误"); } @@ -3673,7 +1330,7 @@ public class MdmServiceImpl implements IMdmService { MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); mdmModuleViewEntity.setSts("Y"); - List<MdmModuleViewEntity> moduleViewEntityList = mdmServiceCache.queryMdmModuleView(mdmModuleViewEntity); + List<MdmModuleViewEntity> moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { return BaseResult.getFailureMessageEntity("系统错误"); } @@ -4022,7 +1679,7 @@ public class MdmServiceImpl implements IMdmService { mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); mdmTableCodeRuleEntity.setDbId(mdmModuleDbEntityList.get(i).getId()); mdmTableCodeRuleEntity.setSts("Y"); - List<MdmTableCodeRuleEntity> allMdmTableCodeRuleEntities = mdmServiceCache.queryMdmTableCodeRuleEntity(mdmTableCodeRuleEntity); + List<MdmTableCodeRuleEntity> allMdmTableCodeRuleEntities = mdmTableCodeRuleDao.queryBase(mdmTableCodeRuleEntity); List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntities = new ArrayList<>(); if(allMdmTableCodeRuleEntities != null && allMdmTableCodeRuleEntities.size() > 0){ for (int i1 = 0; i1 < allMdmTableCodeRuleEntities.size(); i1++) { @@ -4207,18 +1864,4 @@ public class MdmServiceImpl implements IMdmService { return flag; } - /** - * @param str - * @return void - * @Author lvleigang - * @Description 校验字符串 - * @Date 11:41 上午 2022/12/7 - **/ - protected Boolean checkInt(Integer str) { - Boolean flag = true; - if (str == null) { - flag = false; - } - return flag; - } } diff --git a/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java b/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java index 693c62e5..b88c5880 100644 --- a/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java +++ b/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java @@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; import com.baomidou.dynamic.datasource.exception.CannotFindDataSourceException; import com.hzya.frame.datasource.DataSourceUtilProperties; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; +import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity; import com.hzya.frame.sysnew.application.entity.SysApplicationDatasourceDto; import com.hzya.frame.util.AESUtil; import org.slf4j.Logger; @@ -24,21 +24,20 @@ public class DsDataSourceUtil { @Resource private DataSource dataSource; - public void addDataSource(SysDataSourceEntity sysDataSourceVo) throws Exception { + public void addDataSource(SysApplicationDatabaseEntity sysDataSourceVo) throws Exception { DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource; JSONObject defaultDataSourceProperties = new JSONObject(); defaultDataSourceProperties.put("datasource_code", sysDataSourceVo.getSourceCode()); defaultDataSourceProperties.put("source_url", sysDataSourceVo.getSourceUrl()); defaultDataSourceProperties.put("source_type", sysDataSourceVo.getSourceTypeName()); defaultDataSourceProperties.put("login_name", sysDataSourceVo.getLoginName()); - defaultDataSourceProperties.put("password", sysDataSourceVo.getPassword()); + defaultDataSourceProperties.put("password", AESUtil.decrypt(sysDataSourceVo.getPassword())); defaultDataSourceProperties.put("db_name", sysDataSourceVo.getDbName()); logger.info("***初始化数据源-{}:*********", sysDataSourceVo.getSourceName()); DruidDataSource dataSource = createDefaultDataSource(defaultDataSourceProperties); ds.addDataSource(sysDataSourceVo.getSourceCode(), dataSource); logger.info("***初始化数据源-{}成功:*********", sysDataSourceVo.getSourceName()); } - /** * @param code * @return boolean @@ -57,16 +56,16 @@ public class DsDataSourceUtil { } /** - * @param sysDataSourceVo + * @param sysApplicationDatabaseEntity * @return boolean * @Author lvleigang * @Description 修改数据源 * @Date 11:40 上午 2023/9/6 **/ - public void editDataSource(SysDataSourceEntity sysDataSourceVo) throws Exception { + public void editDataSource(SysApplicationDatabaseEntity sysApplicationDatabaseEntity) throws Exception { //先删除后添加 - removeDataSource(sysDataSourceVo.getSourceCode()); - addDataSource(sysDataSourceVo); + removeDataSource(sysApplicationDatabaseEntity.getSourceCode()); + addDataSource(sysApplicationDatabaseEntity); } diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/dao/ISysDataSourceDao.java b/service/src/main/java/com/hzya/frame/sys/dataSource/dao/ISysDataSourceDao.java deleted file mode 100644 index acfcaf47..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/dao/ISysDataSourceDao.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hzya.frame.sys.dataSource.dao; - -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; -import com.hzya.frame.basedao.dao.IBaseDao; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo; - -import java.util.List; - -/** - * 数据源表(sys_data_source: table)表数据库访问层 - * - * @author makejava - * @since 2023-09-05 16:07:01 - */ -public interface ISysDataSourceDao extends IBaseDao<SysDataSourceEntity, String> { - - List<SysDataSourceVo> queryVoList(SysDataSourceEntity entity); - int queryVoList_COUNT(SysDataSourceEntity entity); - - Integer entity_count_not_id(SysDataSourceEntity checkEntity); - - List<SysDataSourceVo> queryDSBase(SysDataSourceEntity entity); -} - diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/dao/impl/SysDataSourceDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/dataSource/dao/impl/SysDataSourceDaoImpl.java deleted file mode 100644 index 0f9948f1..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/dao/impl/SysDataSourceDaoImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.hzya.frame.sys.dataSource.dao.impl; - -import com.baomidou.dynamic.datasource.annotation.DS; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; -import com.hzya.frame.sys.dataSource.dao.ISysDataSourceDao; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo; -import org.springframework.stereotype.Repository; -import com.hzya.frame.basedao.dao.MybatisGenericDao; - -import java.util.List; - -/** - * 数据源表(SysDataSource)表数据库访问层 - * - * @author makejava - * @since 2023-09-05 16:07:03 - */ -@Repository(value = "SysDataSourceDaoImpl") -public class SysDataSourceDaoImpl extends MybatisGenericDao<SysDataSourceEntity, String> implements ISysDataSourceDao{ - - - @DS("master") - @Override - public List<SysDataSourceVo> queryVoList(SysDataSourceEntity entity) { - List<SysDataSourceVo> o = (List<SysDataSourceVo>) super.selectList(getSqlIdPrifx() + "queryVoList", entity); - return o; - } - @Override - public int queryVoList_COUNT(SysDataSourceEntity entity) { - int o = (int) super.selectOne(getSqlIdPrifx() + "queryVoList_COUNT", entity); - return o; - } - - @Override - public Integer entity_count_not_id(SysDataSourceEntity entity) { - Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "entity_count_not_id", entity); - return o; - } - - @DS("master") - @Override - public List<SysDataSourceVo> queryDSBase(SysDataSourceEntity entity) { - List<SysDataSourceVo> o = (List<SysDataSourceVo>) super.selectList(getSqlIdPrifx() + "queryDSBase", entity); - return o; - } -} - diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.java b/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.java deleted file mode 100644 index d830b13b..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.hzya.frame.sys.dataSource.entity; - -import java.util.Date; -import com.hzya.frame.web.entity.BaseEntity; -/** - * 数据源表(SysDataSource)实体类 - * - * @author makejava - * @since 2023-09-05 16:07:06 - */ -public class SysDataSourceEntity extends BaseEntity { - - /** 数据源唯一编码 */ - private String sourceCode; - /** 数据源名称 */ - private String sourceName; - /** ip */ - private String sourceIp; - /** 端口 */ - private String sourcePort; - /** 数据库名称 */ - private String dbName; - /** 数据源类型 1oracle 2sqlsever 3mysql */ - private String sourceType; - /** 登录名 */ - private String loginName; - /** 密码 */ - private String password; - /** 选择oracle下服务名称 */ - private String serviceName; - /** 使用状态1启用0锁定 */ - private Integer useState; - /** 数据源状态 1校验成功0校验失败 */ - private String dataState; - - public String getSourceCode() { - return sourceCode; - } - - public void setSourceCode(String sourceCode) { - this.sourceCode = sourceCode; - } - - public String getSourceName() { - return sourceName; - } - - public void setSourceName(String sourceName) { - this.sourceName = sourceName; - } - - public String getSourceIp() { - return sourceIp; - } - - public void setSourceIp(String sourceIp) { - this.sourceIp = sourceIp; - } - - public String getSourcePort() { - return sourcePort; - } - - public void setSourcePort(String sourcePort) { - this.sourcePort = sourcePort; - } - - public String getDbName() { - return dbName; - } - - public void setDbName(String dbName) { - this.dbName = dbName; - } - - public String getSourceType() { - return sourceType; - } - - public void setSourceType(String sourceType) { - this.sourceType = sourceType; - } - - public String getLoginName() { - return loginName; - } - - public void setLoginName(String loginName) { - this.loginName = loginName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public Integer getUseState() { - return useState; - } - - public void setUseState(Integer useState) { - this.useState = useState; - } - public String getSourceUrl() { - StringBuffer sourceUrl = new StringBuffer(); - if(sourceType != null){ - switch (sourceType) { - case "1": //oracle - //jdbc:oracle:thin:@60.204.132.91:1521:ORCL - sourceUrl.append("jdbc:oracle:thin:@").append(sourceIp).append(":").append(sourcePort).append(":").append(serviceName); - break; - case "2": //sqlsever - //jdbc:sqlserver://221.12.175.82:1433;DatabaseName=U8CLOUD;encrypt=false;trustServerCertificate=true - sourceUrl.append("jdbc:jtds:sqlserver://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append(";encrypt=false;trustServerCertificate=true"); - break; - case "3": //mysql - //jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true - sourceUrl.append("jdbc:mysql://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append("?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true"); - break; - case "4": //dm - //jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&characterEncoding=UTF-8 - sourceUrl.append("jdbc:dm://").append(sourceIp).append(":").append(sourcePort).append("?schema=").append(dbName).append("&characterEncoding=UTF-8"); - break; - default: - } - } - return sourceUrl.toString(); - } - public String getSourceTypeName() { - String sourceTypeName = null; - if(sourceType != null){ - switch (sourceType) { - case "1": //oracle - sourceTypeName = "oracle"; - break; - case "2": //sqlsever - sourceTypeName = "sqlServer"; - break; - case "3": //mysql - sourceTypeName = "mysql"; - break; - default: - } - } - - return sourceTypeName; - } - - public String getDataState() { - return dataState; - } - - public void setDataState(String dataState) { - this.dataState = dataState; - } -} - diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.xml b/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.xml deleted file mode 100644 index 54bbc98d..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.xml +++ /dev/null @@ -1,484 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.hzya.frame.sys.dataSource.dao.impl.SysDataSourceDaoImpl"> - - <resultMap id="get-SysDataSourceEntity-result" type="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> - <result property="id" column="id" jdbcType="VARCHAR"/> - <result property="sourceCode" column="source_code" jdbcType="VARCHAR"/> - <result property="sourceName" column="source_name" jdbcType="VARCHAR"/> - <result property="sourceIp" column="source_ip" jdbcType="VARCHAR"/> - <result property="sourcePort" column="source_port" jdbcType="VARCHAR"/> - <result property="dbName" column="db_name" jdbcType="VARCHAR"/> - <result property="sourceType" column="source_type" jdbcType="VARCHAR"/> - <result property="loginName" column="login_name" jdbcType="VARCHAR"/> - <result property="password" column="password" jdbcType="VARCHAR"/> - <result property="serviceName" column="service_name" jdbcType="VARCHAR"/> - <result property="useState" column="use_state" jdbcType="INTEGER"/> - <result property="dataState" column="data_state" jdbcType="INTEGER"/> - <result property="sorts" column="sorts" jdbcType="INTEGER"/> - <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/> - <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/> - <result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/> - <result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/> - <result property="sts" column="sts" jdbcType="VARCHAR"/> - <result property="org_id" column="org_id" jdbcType="VARCHAR"/> - </resultMap> - <!-- 查询的字段--> - <sql id="SysDataSourceEntity_Base_Column_List"> - id - ,source_code - ,source_name - ,source_ip - ,source_port - ,db_name - ,source_type - ,login_name - ,password - ,service_name - ,use_state - ,data_state - ,sorts - ,create_user_id - ,create_time - ,modify_user_id - ,modify_time - ,sts - ,org_id - </sql> - <!-- 查询 采用==查询 --> - <select id="entity_list_base" resultMap="get-SysDataSourceEntity-result" - parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> - select - <include refid="SysDataSourceEntity_Base_Column_List"/> - from sys_data_source - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''">and id = #{id}</if> - <if test="sourceCode != null and sourceCode != ''">and source_code = #{sourceCode}</if> - <if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if> - <if test="sourceIp != null and sourceIp != ''">and source_ip = #{sourceIp}</if> - <if test="sourcePort != null and sourcePort != ''">and source_port = #{sourcePort}</if> - <if test="dbName != null and dbName != ''">and db_name = #{dbName}</if> - <if test="sourceType != null and sourceType != ''">and source_type = #{sourceType}</if> - <if test="loginName != null and loginName != ''">and login_name = #{loginName}</if> - <if test="password != null and password != ''">and password = #{password}</if> - <if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if> - <if test="useState != null">and use_state = #{useState}</if> - <if test="dataState != null">and data_state = #{dataState}</if> - <if test="sorts != null">and sorts = #{sorts}</if> - <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if> - <if test="create_time != null">and create_time = #{create_time}</if> - <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if> - <if test="modify_time != null">and modify_time = #{modify_time}</if> - <if test="sts != null and sts != ''">and sts = #{sts}</if> - <if test="org_id != null and org_id != ''">and org_id = #{org_id}</if> - and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> - </select> - - <!-- 查询 采用==查询 --> - <select id="entity_count_not_id" resultType="Integer" - parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> - select - count(1) - from sys_data_source - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''">and id != #{id}</if> - <if test="sourceCode != null and sourceCode != ''">and source_code = #{sourceCode}</if> - <if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if> - <if test="sourceIp != null and sourceIp != ''">and source_ip = #{sourceIp}</if> - <if test="sourcePort != null and sourcePort != ''">and source_port = #{sourcePort}</if> - <if test="dbName != null and dbName != ''">and db_name = #{dbName}</if> - <if test="sourceType != null and sourceType != ''">and source_type = #{sourceType}</if> - <if test="loginName != null and loginName != ''">and login_name = #{loginName}</if> - <if test="password != null and password != ''">and password = #{password}</if> - <if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if> - <if test="useState != null">and use_state = #{useState}</if> - <if test="dataState != null">and data_state = #{dataState}</if> - <if test="sorts != null">and sorts = #{sorts}</if> - <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if> - <if test="create_time != null">and create_time = #{create_time}</if> - <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if> - <if test="modify_time != null">and modify_time = #{modify_time}</if> - <if test="sts != null and sts != ''">and sts = #{sts}</if> - <if test="org_id != null and org_id != ''">and org_id = #{org_id}</if> - and sts='Y' - </trim> - </select> - - <!-- 查询符合条件的数量 --> - <select id="entity_count" resultType="Integer" - parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> - select count(1) from sys_data_source - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''">and id = #{id}</if> - <if test="sourceCode != null and sourceCode != ''">and source_code = #{sourceCode}</if> - <if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if> - <if test="sourceIp != null and sourceIp != ''">and source_ip = #{sourceIp}</if> - <if test="sourcePort != null and sourcePort != ''">and source_port = #{sourcePort}</if> - <if test="dbName != null and dbName != ''">and db_name = #{dbName}</if> - <if test="sourceType != null and sourceType != ''">and source_type = #{sourceType}</if> - <if test="loginName != null and loginName != ''">and login_name = #{loginName}</if> - <if test="password != null and password != ''">and password = #{password}</if> - <if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if> - <if test="useState != null">and use_state = #{useState}</if> - <if test="dataState != null">and data_state = #{dataState}</if> - <if test="sorts != null">and sorts = #{sorts}</if> - <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if> - <if test="create_time != null">and create_time = #{create_time}</if> - <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if> - <if test="modify_time != null">and modify_time = #{modify_time}</if> - <if test="sts != null and sts != ''">and sts = #{sts}</if> - <if test="org_id != null and org_id != ''">and org_id = #{org_id}</if> - and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> - </select> - - <!-- 分页查询列表 采用like格式 --> - <select id="entity_list_like" resultMap="get-SysDataSourceEntity-result" - parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> - select - <include refid="SysDataSourceEntity_Base_Column_List"/> - from sys_data_source - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''">and id like concat('%',#{id},'%')</if> - <if test="sourceCode != null and sourceCode != ''">and source_code like concat('%',#{sourceCode},'%')</if> - <if test="sourceName != null and sourceName != ''">and source_name like concat('%',#{sourceName},'%')</if> - <if test="sourceIp != null and sourceIp != ''">and source_ip like concat('%',#{sourceIp},'%')</if> - <if test="sourcePort != null and sourcePort != ''">and source_port like concat('%',#{sourcePort},'%')</if> - <if test="dbName != null and dbName != ''">and db_name like concat('%',#{dbName},'%')</if> - <if test="sourceType != null and sourceType != ''">and source_type like concat('%',#{sourceType},'%')</if> - <if test="loginName != null and loginName != ''">and login_name like concat('%',#{loginName},'%')</if> - <if test="password != null and password != ''">and password like concat('%',#{password},'%')</if> - <if test="serviceName != null and serviceName != ''">and service_name like concat('%',#{serviceName},'%') - </if> - <if test="useState != null">and use_state like concat('%',#{useState},'%')</if> - <if test="dataState != null">and data_state like concat('%',#{dataState},'%')</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_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_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> - and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> - </select> - - - <!-- 分页查询列表 采用like格式 --> - <select id="queryVoList" resultType="com.hzya.frame.sys.dataSource.entity.SysDataSourceVo" - parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> - select - id, - source_code as sourceCode, - source_name as sourceName, - source_ip as sourceIp, - source_port as sourcePort, - db_name as dbName, - source_type as sourceType, - login_name as loginName, - password as password, - service_name as serviceName, - use_state as useState, - data_state as dataState - from sys_data_source - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''">and id like concat('%',#{id},'%')</if> - <if test="sourceCode != null and sourceCode != ''">and source_code like concat('%',#{sourceCode},'%')</if> - <if test="sourceName != null and sourceName != ''">and source_name like concat('%',#{sourceName},'%')</if> - <if test="sourceIp != null and sourceIp != ''">and source_ip like concat('%',#{sourceIp},'%')</if> - <if test="sourcePort != null and sourcePort != ''">and source_port like concat('%',#{sourcePort},'%')</if> - <if test="dbName != null and dbName != ''">and db_name like concat('%',#{dbName},'%')</if> - <if test="sourceType != null and sourceType != ''">and source_type like concat('%',#{sourceType},'%')</if> - <if test="loginName != null and loginName != ''">and login_name like concat('%',#{loginName},'%')</if> - <if test="password != null and password != ''">and password like concat('%',#{password},'%')</if> - <if test="serviceName != null and serviceName != ''">and service_name like concat('%',#{serviceName},'%') - </if> - <if test="useState != null">and use_state like concat('%',#{useState},'%')</if> - <if test="dataState != null">and data_state like concat('%',#{dataState},'%')</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_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_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> - and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> - </select> - <select id="queryDSBase" resultType="com.hzya.frame.sys.dataSource.entity.SysDataSourceVo" - parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> - select - id, - source_code as sourceCode, - source_name as sourceName, - source_ip as sourceIp, - source_port as sourcePort, - db_name as dbName, - source_type as sourceType, - login_name as loginName, - password as password, - service_name as serviceName, - use_state as useState, - data_state as dataState - from sys_data_source - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''">and id = #{id}</if> - <if test="sourceCode != null and sourceCode != ''">and source_code = #{sourceCode}</if> - <if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if> - <if test="sourceIp != null and sourceIp != ''">and source_ip = #{sourceIp}</if> - <if test="sourcePort != null and sourcePort != ''">and source_port = #{sourcePort}</if> - <if test="dbName != null and dbName != ''">and db_name = #{dbName}</if> - <if test="sourceType != null and sourceType != ''">and source_type = #{sourceType}</if> - <if test="loginName != null and loginName != ''">and login_name = #{loginName}</if> - <if test="password != null and password != ''">and password = #{password}</if> - <if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if> - <if test="useState != null">and use_state = #{useState}</if> - <if test="dataState != null">and data_state = #{dataState}</if> - <if test="sorts != null">and sorts = #{sorts}</if> - <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if> - <if test="create_time != null">and create_time = #{create_time}</if> - <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if> - <if test="modify_time != null">and modify_time = #{modify_time}</if> - <if test="sts != null and sts != ''">and sts = #{sts}</if> - <if test="org_id != null and org_id != ''">and org_id = #{org_id}</if> - and sts='Y' - </trim> - </select> - - - <!-- 分页查询列表 采用like格式 --> - <select id="queryVoList_COUNT" resultType="int" parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> - select - count(*) - from sys_data_source - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''">and id like concat('%',#{id},'%')</if> - <if test="sourceCode != null and sourceCode != ''">and source_code like concat('%',#{sourceCode},'%')</if> - <if test="sourceName != null and sourceName != ''">and source_name like concat('%',#{sourceName},'%')</if> - <if test="sourceIp != null and sourceIp != ''">and source_ip like concat('%',#{sourceIp},'%')</if> - <if test="sourcePort != null and sourcePort != ''">and source_port like concat('%',#{sourcePort},'%')</if> - <if test="dbName != null and dbName != ''">and db_name like concat('%',#{dbName},'%')</if> - <if test="sourceType != null and sourceType != ''">and source_type like concat('%',#{sourceType},'%')</if> - <if test="loginName != null and loginName != ''">and login_name like concat('%',#{loginName},'%')</if> - <if test="password != null and password != ''">and password like concat('%',#{password},'%')</if> - <if test="serviceName != null and serviceName != ''">and service_name like concat('%',#{serviceName},'%') - </if> - <if test="useState != null">and use_state like concat('%',#{useState},'%')</if> - <if test="dataState != null">and data_state like concat('%',#{dataState},'%')</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_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_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> - and sts='Y' - </trim> - </select> - - <!-- 查询列表 字段采用or格式 --> - <select id="SysDataSourceentity_list_or" resultMap="get-SysDataSourceEntity-result" - parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> - select - <include refid="SysDataSourceEntity_Base_Column_List"/> - from sys_data_source - <trim prefix="where" prefixOverrides="and"> - <if test="id != null and id != ''">or id = #{id}</if> - <if test="sourceCode != null and sourceCode != ''">or source_code = #{sourceCode}</if> - <if test="sourceName != null and sourceName != ''">or source_name = #{sourceName}</if> - <if test="sourceIp != null and sourceIp != ''">or source_ip = #{sourceIp}</if> - <if test="sourcePort != null and sourcePort != ''">or source_port = #{sourcePort}</if> - <if test="dbName != null and dbName != ''">or db_name = #{dbName}</if> - <if test="sourceType != null and sourceType != ''">or source_type = #{sourceType}</if> - <if test="loginName != null and loginName != ''">or login_name = #{loginName}</if> - <if test="password != null and password != ''">or password = #{password}</if> - <if test="serviceName != null and serviceName != ''">or service_name = #{serviceName}</if> - <if test="useState != null">or use_state = #{useState}</if> - <if test="dataState != null">or data_state = #{dataState}</if> - <if test="sorts != null">or sorts = #{sorts}</if> - <if test="create_user_id != null and create_user_id != ''">or create_user_id = #{create_user_id}</if> - <if test="create_time != null">or create_time = #{create_time}</if> - <if test="modify_user_id != null and modify_user_id != ''">or modify_user_id = #{modify_user_id}</if> - <if test="modify_time != null">or modify_time = #{modify_time}</if> - <if test="sts != null and sts != ''">or sts = #{sts}</if> - <if test="org_id != null and org_id != ''">or org_id = #{org_id}</if> - and sts='Y' - </trim> - <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> - <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> - </select> - - <!--新增所有列--> - <insert id="entity_insert" parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity" keyProperty="id" - useGeneratedKeys="true"> - insert into sys_data_source( - <trim suffix="" suffixOverrides=","> - <if test="id != null and id != ''">id ,</if> - <if test="sourceCode != null and sourceCode != ''">source_code ,</if> - <if test="sourceName != null and sourceName != ''">source_name ,</if> - <if test="sourceIp != null and sourceIp != ''">source_ip ,</if> - <if test="sourcePort != null and sourcePort != ''">source_port ,</if> - <if test="dbName != null and dbName != ''">db_name ,</if> - <if test="sourceType != null and sourceType != ''">source_type ,</if> - <if test="loginName != null and loginName != ''">login_name ,</if> - <if test="password != null and password != ''">password ,</if> - <if test="serviceName != null and serviceName != ''">service_name ,</if> - <if test="useState != null">use_state ,</if> - <if test="dataState != null">data_state ,</if> - <if test="sorts != null">sorts ,</if> - <if test="create_user_id != null and create_user_id != ''">create_user_id ,</if> - <if test="create_time != null">create_time ,</if> - <if test="modify_user_id != null and modify_user_id != ''">modify_user_id ,</if> - <if test="modify_time != null">modify_time ,</if> - <if test="sts != null and sts != ''">sts ,</if> - <if test="org_id != null and org_id != ''">org_id ,</if> - <if test="sorts == null ">sorts,</if> - <if test="sts == null ">sts,</if> - </trim> - )values( - <trim suffix="" suffixOverrides=","> - <if test="id != null and id != ''">#{id} ,</if> - <if test="sourceCode != null and sourceCode != ''">#{sourceCode} ,</if> - <if test="sourceName != null and sourceName != ''">#{sourceName} ,</if> - <if test="sourceIp != null and sourceIp != ''">#{sourceIp} ,</if> - <if test="sourcePort != null and sourcePort != ''">#{sourcePort} ,</if> - <if test="dbName != null and dbName != ''">#{dbName} ,</if> - <if test="sourceType != null and sourceType != ''">#{sourceType} ,</if> - <if test="loginName != null and loginName != ''">#{loginName} ,</if> - <if test="password != null and password != ''">#{password} ,</if> - <if test="serviceName != null and serviceName != ''">#{serviceName} ,</if> - <if test="useState != null">#{useState} ,</if> - <if test="dataState != null">#{dataState} ,</if> - <if test="sorts != null">#{sorts} ,</if> - <if test="create_user_id != null and create_user_id != ''">#{create_user_id} ,</if> - <if test="create_time != null">#{create_time} ,</if> - <if test="modify_user_id != null and modify_user_id != ''">#{modify_user_id} ,</if> - <if test="modify_time != null">#{modify_time} ,</if> - <if test="sts != null and sts != ''">#{sts} ,</if> - <if test="org_id != null and org_id != ''">#{org_id} ,</if> - <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_data_source a WHERE a.sts - = 'Y' ), - </if> - <if test="sts == null ">'Y',</if> - </trim> - ) - </insert> - <!-- 批量新增 --> - <insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true"> - insert into sys_data_source(source_code, source_name, source_ip, source_port, db_name, source_type, login_name, - password, service_name, use_state, data_state, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, - sts) - values - <foreach collection="entities" item="entity" separator=","> - (#{entity.sourceCode},#{entity.sourceName},#{entity.sourceIp},#{entity.sourcePort},#{entity.dbName},#{entity.sourceType},#{entity.loginName},#{entity.password},#{entity.serviceName},#{entity.useState},#{entity.dataState},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, - 'Y') - </foreach> - </insert> - <!-- 批量新增或者修改--> - <insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> - insert into sys_data_source(source_code, source_name, source_ip, source_port, db_name, source_type, login_name, - password, service_name, use_state, data_state, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) - values - <foreach collection="entities" item="entity" separator=","> - (#{entity.sourceCode},#{entity.sourceName},#{entity.sourceIp},#{entity.sourcePort},#{entity.dbName},#{entity.sourceType},#{entity.loginName},#{entity.password},#{entity.serviceName},#{entity.useState},#{entity.dataState},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) - </foreach> - on duplicate key update - source_code = values(source_code), - source_name = values(source_name), - source_ip = values(source_ip), - source_port = values(source_port), - db_name = values(db_name), - source_type = values(source_type), - login_name = values(login_name), - password = values(password), - service_name = values(service_name), - use_state = values(use_state), - data_state = values(data_state), - sorts = values(sorts), - create_user_id = values(create_user_id), - create_time = values(create_time), - modify_user_id = values(modify_user_id), - modify_time = values(modify_time), - sts = values(sts), - org_id = values(org_id) - </insert> - <!--通过主键修改方法--> - <update id="entity_update" parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> - update sys_data_source set - <trim suffix="" suffixOverrides=","> - <if test="sourceCode != null and sourceCode != ''">source_code = #{sourceCode},</if> - <if test="sourceName != null and sourceName != ''">source_name = #{sourceName},</if> - <if test="sourceIp != null and sourceIp != ''">source_ip = #{sourceIp},</if> - <if test="sourcePort != null and sourcePort != ''">source_port = #{sourcePort},</if> - <if test="dbName != null and dbName != ''">db_name = #{dbName},</if> - <if test="sourceType != null and sourceType != ''">source_type = #{sourceType},</if> - <if test="loginName != null and loginName != ''">login_name = #{loginName},</if> - <if test="password != null and password != ''">password = #{password},</if> - <if test="serviceName != null and serviceName != ''">service_name = #{serviceName},</if> - <if test="useState != null">use_state = #{useState},</if> - <if test="dataState != null">data_state = #{dataState},</if> - <if test="sorts != null">sorts = #{sorts},</if> - <if test="create_user_id != null and create_user_id != ''">create_user_id = #{create_user_id},</if> - <if test="create_time != null">create_time = #{create_time},</if> - <if test="modify_user_id != null and modify_user_id != ''">modify_user_id = #{modify_user_id},</if> - <if test="modify_time != null">modify_time = #{modify_time},</if> - <if test="sts != null and sts != ''">sts = #{sts},</if> - <if test="org_id != null and org_id != ''">org_id = #{org_id},</if> - </trim> - where id = #{id} - </update> - <!-- 逻辑删除 --> - <update id="entity_logicDelete" parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity"> -update sys_data_source 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.sys.dataSource.entity.SysDataSourceEntity"> - update sys_data_source 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> - <if test="sourceCode != null and sourceCode != ''">and source_code = #{sourceCode}</if> - <if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if> - <if test="sourceIp != null and sourceIp != ''">and source_ip = #{sourceIp}</if> - <if test="sourcePort != null and sourcePort != ''">and source_port = #{sourcePort}</if> - <if test="dbName != null and dbName != ''">and db_name = #{dbName}</if> - <if test="sourceType != null and sourceType != ''">and source_type = #{sourceType}</if> - <if test="loginName != null and loginName != ''">and login_name = #{loginName}</if> - <if test="password != null and password != ''">and password = #{password}</if> - <if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if> - <if test="useState != null">and use_state = #{useState}</if> - <if test="dataState != null">and data_state = #{dataState}</if> - <if test="sorts != null">and sorts = #{sorts}</if> - <if test="sts != null and sts != ''">and sts = #{sts}</if> - and sts='Y' - </trim> - </update> - <!--通过主键删除--> - <delete id="entity_delete"> - delete from sys_data_source where id = #{id} -</delete> - -</mapper> - diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceVo.java b/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceVo.java deleted file mode 100644 index ed00d0d2..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceVo.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.hzya.frame.sys.dataSource.entity; - - -import com.hzya.frame.web.exception.BaseSystemException; - -public class SysDataSourceVo { - - /** 主键ID */ - private String id; - /** 数据源编码 */ - private String sourceCode; - /** 数据源名称 */ - private String sourceName; - /** ip */ - private String sourceIp; - /** 端口 */ - private String sourcePort; - /** 数据库名称 */ - private String dbName; - /** 数据源类型 1oracle 2sqlsever 3mysql 4dm*/ - private String sourceType; - /** 登录名 */ - private String loginName; - /** 密码 */ - private String password; - /** 选择oracle下服务名称 */ - private String serviceName; - /** 使用状态1启用0锁定 */ - private Integer useState; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getSourceCode() { - return sourceCode; - } - - public void setSourceCode(String sourceCode) { - this.sourceCode = sourceCode; - } - - public String getSourceName() { - return sourceName; - } - - public void setSourceName(String sourceName) { - this.sourceName = sourceName; - } - - public String getSourceIp() { - return sourceIp; - } - - public void setSourceIp(String sourceIp) { - this.sourceIp = sourceIp; - } - - public String getSourcePort() { - return sourcePort; - } - - public void setSourcePort(String sourcePort) { - this.sourcePort = sourcePort; - } - - public String getDbName() { - return dbName; - } - - public void setDbName(String dbName) { - this.dbName = dbName; - } - - public String getSourceType() { - return sourceType; - } - - public void setSourceType(String sourceType) { - this.sourceType = sourceType; - } - - public String getLoginName() { - return loginName; - } - - public void setLoginName(String loginName) { - this.loginName = loginName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public Integer getUseState() { - return useState; - } - - public void setUseState(Integer useState) { - this.useState = useState; - } - - public String getSourceUrl() { - StringBuffer sourceUrl = new StringBuffer(); - switch (sourceType) { - case "1": //oracle - //jdbc:oracle:thin:@60.204.132.91:1521:ORCL - sourceUrl.append("jdbc:oracle:thin:@").append(sourceIp).append(":").append(sourcePort).append(":").append(serviceName); - break; - case "2": //sqlsever - //jdbc:sqlserver://221.12.175.82:1433;DatabaseName=U8CLOUD;encrypt=false;trustServerCertificate=true - sourceUrl.append("jdbc:jtds:sqlserver://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append(";encrypt=false;trustServerCertificate=true"); - break; - case "3": //mysql - //jdbc:mysql://hzya.ufyct.com:9096/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false - sourceUrl.append("jdbc:mysql://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append("?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false"); - break; - case "4": //dm - //jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&characterEncoding=UTF-8 - sourceUrl.append("jdbc:dm://").append(sourceIp).append(":").append(sourcePort).append("?schema=").append(dbName).append("&characterEncoding=UTF-8"); - break; - default: - } - return sourceUrl.toString(); - } - public String getSourceTypeName() { - String sourceTypeName = null; - switch (sourceType) { - case "1": //oracle - sourceTypeName = "oracle"; - break; - case "2": //sqlsever - sourceTypeName = "sqlServer"; - break; - case "3": //mysql - sourceTypeName = "mysql"; - break; - case "4": //mysql - sourceTypeName = "dm"; - break; - default: - } - return sourceTypeName; - } -} - diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/service/ISysDataSourceService.java b/service/src/main/java/com/hzya/frame/sys/dataSource/service/ISysDataSourceService.java deleted file mode 100644 index 841841a5..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/service/ISysDataSourceService.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.hzya.frame.sys.dataSource.service; - -import com.alibaba.fastjson.JSONObject; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; -import com.hzya.frame.basedao.service.IBaseService; -import com.hzya.frame.web.entity.JsonResultEntity; - -/** - * 数据源表(SysDataSource)表服务接口 - * - * @author makejava - * @since 2023-09-05 16:07:10 - */ -public interface ISysDataSourceService extends IBaseService<SysDataSourceEntity, String>{ - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询列表 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity queryList(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询列表 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity queryPage(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 获取数据 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity queryEntity(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 新增数据 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity addEntity(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 修改数据 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity editEntity(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 删除数据 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity deleteEntity(JSONObject jsonObject); - /** - * @Author lvleigang - * @Description 数据源测试接口 测试当前页面数据源是否配置正确 - * @Date 2:08 下午 2023/9/23 - * @param jsonObject - * @return - **/ - JsonResultEntity testDatabase(JSONObject jsonObject); -} diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/service/impl/SysDataSourceServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/dataSource/service/impl/SysDataSourceServiceImpl.java deleted file mode 100644 index 504cca64..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/service/impl/SysDataSourceServiceImpl.java +++ /dev/null @@ -1,256 +0,0 @@ -package com.hzya.frame.sys.dataSource.service.impl; - -import cn.dev33.satoken.stp.StpUtil; -import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.hzya.frame.serviceUtil.DsDataSourceUtil; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; -import com.hzya.frame.sys.dataSource.dao.ISysDataSourceDao; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo; -import com.hzya.frame.sys.dataSource.service.ISysDataSourceService; -import com.hzya.frame.sysnew.application.entity.SysApplicationDatasourceDto; -import com.hzya.frame.util.AESUtil; -import com.hzya.frame.uuid.UUIDUtils; -import com.hzya.frame.web.entity.BaseResult; -import com.hzya.frame.web.entity.JsonResultEntity; -import org.springframework.stereotype.Service; -import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.Resource; -import com.hzya.frame.basedao.service.impl.BaseService; - -import java.util.Date; -import java.util.List; - -/** - * 数据源表(SysDataSource)表服务实现类 - * - * @author makejava - * @since 2023-09-05 16:07:13 - */ -@Service(value = "sysDataSourceService") -public class SysDataSourceServiceImpl extends BaseService<SysDataSourceEntity, String> implements ISysDataSourceService { - - private ISysDataSourceDao sysDataSourceDao; - @Resource - private DsDataSourceUtil dsDataSourceUtil; - - @Autowired - public void setSysDataSourceDao(ISysDataSourceDao dao) { - this.sysDataSourceDao = dao; - this.dao = dao; - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询列表 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity queryList(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - List<SysDataSourceVo> sysDataSourceEntities = sysDataSourceDao.queryVoList(entity); - return BaseResult.getSuccessMessageEntity("查询数据成功", sysDataSourceEntities); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询列表 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity queryPage(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - //判断分页 - if(entity == null || entity.getPageNum() == null || entity.getPageSize() == null){ - return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - } - PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - List<SysDataSourceVo> sysDataSourceEntities = sysDataSourceDao.queryVoList(entity); - if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){ - for (int i = 0; i < sysDataSourceEntities.size(); i++) { - sysDataSourceEntities.get(i).setPassword(AESUtil.decrypt(sysDataSourceEntities.get(i).getPassword())); - } - } - PageInfo pageInfo = new PageInfo(sysDataSourceEntities); - return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 获取数据 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity queryEntity(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - //判断分页 - if(entity == null || entity.getId() == null || "".equals(entity.getId())){ - return BaseResult.getFailureMessageEntity("请先传递请求主键"); - } - SysDataSourceEntity sysDataSourceEntity = sysDataSourceDao.queryOne(entity); - sysDataSourceEntity.setPassword(AESUtil.decrypt(sysDataSourceEntity.getPassword())); - return BaseResult.getSuccessMessageEntity("查询数据成功", sysDataSourceEntity); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 新增数据 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity addEntity(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - if(entity == null){ - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if(entity.getSourceName() == null || "".equals(entity.getSourceName())){ - return BaseResult.getFailureMessageEntity("请先输入数据源名称"); - } - if(entity.getSourceCode() == null || "".equals(entity.getSourceCode())){ - return BaseResult.getFailureMessageEntity("请先输入数据源编码"); - } - SysDataSourceEntity checkEntity = new SysDataSourceEntity(); - checkEntity.setSts("Y"); - checkEntity.setSourceCode(entity.getSourceCode()); - int checkCount = sysDataSourceDao.getCount(checkEntity); - if(checkCount > 0){ - return BaseResult.getFailureMessageEntity("数据源编码已存在"); - } - setCreate(entity); - if(entity.getUseState() == 1){ - try { - dsDataSourceUtil.addDataSource(entity); - entity.setDataState("1"); - } catch (Exception e) { - entity.setDataState("0"); - //return BaseResult.getFailureMessageEntity("初始化数据源失败,请检查数据源配置是否正确"); - } - } - entity.setPassword(AESUtil.encrypt(entity.getPassword())); - sysDataSourceDao.save(entity); - return BaseResult.getSuccessMessageEntity("保存数据源成功",entity.getId()); - } - private void setCreate(SysDataSourceEntity entity) { - entity.setId(UUIDUtils.getUUID()); - entity.setSts("Y"); - entity.setCreate_user_id(StpUtil.getLoginIdAsString()); - entity.setModify_user_id(StpUtil.getLoginIdAsString()); - entity.setCreate_time(new Date()); - entity.setModify_time(new Date()); - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 修改数据 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity editEntity(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - if(entity == null){ - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if(entity.getId() == null || "".equals(entity.getId())){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - if(entity.getSourceName() == null || "".equals(entity.getSourceName())){ - return BaseResult.getFailureMessageEntity("请先输入数据源名称"); - } - if(entity.getSourceCode() == null || "".equals(entity.getSourceCode())){ - return BaseResult.getFailureMessageEntity("请先输入数据源编码"); - } - SysDataSourceEntity checkEntity = new SysDataSourceEntity(); - checkEntity.setSts("Y"); - checkEntity.setId(entity.getId()); - checkEntity.setSourceCode(entity.getSourceCode()); - int checkCount = sysDataSourceDao.entity_count_not_id(checkEntity); - if(checkCount > 0){ - return BaseResult.getFailureMessageEntity("接口编码已存在"); - } - entity.setModify_user_id(StpUtil.getLoginIdAsString()); - entity.setModify_time(new Date()); - entity.setSts("Y"); - if(entity.getUseState() == 1){ - try { - dsDataSourceUtil.editDataSource(entity); - } catch (Exception e) { - //return BaseResult.getSuccessMessageEntity("修改数据源失败,请检查数据源配置是否正确"); - } - }else { - try { - dsDataSourceUtil.removeDataSource(entity.getSourceCode()); - } catch (Exception e) { - return BaseResult.getSuccessMessageEntity("修改数据源失败"); - } - } - if(entity.getPassword() != null ){ - entity.setPassword(AESUtil.encrypt(entity.getPassword())); - } - sysDataSourceDao.update(entity); - return BaseResult.getSuccessMessageEntity("修改数据源成功",entity.getId()); - - } - /** - * @param object - * @return - * @Author lvleigang - * @Description 数据源测试接口 测试当前页面数据源是否配置正确 - * @Date 2:08 下午 2023/9/23 - **/ - @Override - public JsonResultEntity testDatabase(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - SysApplicationDatasourceDto sysApplicationDatasourceDto = new SysApplicationDatasourceDto(); - sysApplicationDatasourceDto.setSourceType(entity.getSourceType()); - sysApplicationDatasourceDto.setSourceUrl(entity.getSourceUrl()); - sysApplicationDatasourceDto.setLoginName(entity.getLoginName()); - sysApplicationDatasourceDto.setPassword(entity.getPassword()); - if (dsDataSourceUtil.testConnection(sysApplicationDatasourceDto)) { - return BaseResult.getSuccessMessageEntity("测试连接数据源成功",true); - } else { - return BaseResult.getSuccessMessageEntity("测试连接数据源失败",false); - } - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 删除数据 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity deleteEntity(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - //判断编码是否重复 - if (entity == null) { - return BaseResult.getFailureMessageEntity("请先填写内容"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("请先选择数据"); - } - SysDataSourceEntity deleteEntity = sysDataSourceDao.queryOne(entity); - //删除主表和明细表 - entity.setModify_user_id(StpUtil.getLoginIdAsString()); - entity.setModify_time(new Date()); - entity.setSts("Y"); - try { - dsDataSourceUtil.removeDataSource(deleteEntity.getSourceCode()); - } catch (Exception e) { - return BaseResult.getSuccessMessageEntity("删除数据源失败"); - } - sysDataSourceDao.logicRemoveMultiCondition(entity); - return BaseResult.getSuccessMessageEntity("删除成功"); - } -} diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/ISysApplicationDatabaseDao.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/ISysApplicationDatabaseDao.java index 110ab6e0..14806c32 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/ISysApplicationDatabaseDao.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/ISysApplicationDatabaseDao.java @@ -1,15 +1,18 @@ package com.hzya.frame.sysnew.application.database.dao; import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity; -import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.basedao.dao.IBaseDao; + +import java.util.List; /** * 数据源表(sys_application_database: table)表数据库访问层 * * @author makejava - * @since 2023-09-25 11:46:27 + * @since 2024-06-16 21:49:26 */ public interface ISysApplicationDatabaseDao extends IBaseDao<SysApplicationDatabaseEntity, String> { + List<SysApplicationDatabaseEntity> queryDSBase(SysApplicationDatabaseEntity entity); } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java index 332f2092..6b523995 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java @@ -1,17 +1,26 @@ package com.hzya.frame.sysnew.application.database.dao.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity; import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao; import org.springframework.stereotype.Repository; import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.List; + /** * 数据源表(SysApplicationDatabase)表数据库访问层 * * @author makejava - * @since 2023-09-25 11:46:31 + * @since 2024-06-16 21:49:30 */ @Repository(value = "SysApplicationDatabaseDaoImpl") public class SysApplicationDatabaseDaoImpl extends MybatisGenericDao<SysApplicationDatabaseEntity, String> implements ISysApplicationDatabaseDao{ - + @DS("master") + @Override + public List<SysApplicationDatabaseEntity> queryDSBase(SysApplicationDatabaseEntity entity) { + List<SysApplicationDatabaseEntity> o = (List<SysApplicationDatabaseEntity>) super.selectList(getSqlIdPrifx() + "queryDSBase", entity); + return o; + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java index 03aa04df..a7817419 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java @@ -6,22 +6,30 @@ import com.hzya.frame.web.entity.BaseEntity; * 数据源表(SysApplicationDatabase)实体类 * * @author makejava - * @since 2023-09-25 11:46:34 + * @since 2024-06-16 21:49:31 */ public class SysApplicationDatabaseEntity extends BaseEntity { /** 应用id */ private String appId; + /** 数据源唯一编码 */ + private String sourceCode; + /** 数据源名称 */ + private String sourceName; /** 数据源类型(1、oracle 2、sqlServer3、mysql) */ private String sourceType; - /** 实例地址 */ - private String sourceUrl; - /** 账户 */ + /** ip */ + private String sourceIp; + /** 端口 */ + private String sourcePort; + /** 登录名 */ private String loginName; /** 密码 */ private String password; /** 库名 */ private String dbName; + /** 选择oracle下服务名称 */ + private String serviceName; /** 数据源是否启用(1、开启 2、关闭) */ private String dbStatus; @@ -34,6 +42,22 @@ public class SysApplicationDatabaseEntity extends BaseEntity { this.appId = appId; } + public String getSourceCode() { + return sourceCode; + } + + public void setSourceCode(String sourceCode) { + this.sourceCode = sourceCode; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + public String getSourceType() { return sourceType; } @@ -42,12 +66,20 @@ public class SysApplicationDatabaseEntity extends BaseEntity { this.sourceType = sourceType; } - public String getSourceUrl() { - return sourceUrl; + public String getSourceIp() { + return sourceIp; } - public void setSourceUrl(String sourceUrl) { - this.sourceUrl = sourceUrl; + public void setSourceIp(String sourceIp) { + this.sourceIp = sourceIp; + } + + public String getSourcePort() { + return sourcePort; + } + + public void setSourcePort(String sourcePort) { + this.sourcePort = sourcePort; } public String getLoginName() { @@ -74,6 +106,14 @@ public class SysApplicationDatabaseEntity extends BaseEntity { this.dbName = dbName; } + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + public String getDbStatus() { return dbStatus; } @@ -81,6 +121,49 @@ public class SysApplicationDatabaseEntity extends BaseEntity { public void setDbStatus(String dbStatus) { this.dbStatus = dbStatus; } + public String getSourceUrl() { + StringBuffer sourceUrl = new StringBuffer(); + if(sourceType != null){ + switch (sourceType) { + case "1": //oracle + //jdbc:oracle:thin:@60.204.132.91:1521:ORCL + sourceUrl.append("jdbc:oracle:thin:@").append(sourceIp).append(":").append(sourcePort).append(":").append(serviceName); + break; + case "2": //sqlsever + //jdbc:sqlserver://221.12.175.82:1433;DatabaseName=U8CLOUD;encrypt=false;trustServerCertificate=true + sourceUrl.append("jdbc:jtds:sqlserver://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append(";encrypt=false;trustServerCertificate=true"); + break; + case "3": //mysql + //jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true + sourceUrl.append("jdbc:mysql://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append("?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true"); + break; + case "4": //dm + //jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&characterEncoding=UTF-8 + sourceUrl.append("jdbc:dm://").append(sourceIp).append(":").append(sourcePort).append("?schema=").append(dbName).append("&characterEncoding=UTF-8"); + break; + default: + } + } + return sourceUrl.toString(); + } + public String getSourceTypeName() { + String sourceTypeName = null; + if(sourceType != null){ + switch (sourceType) { + case "1": //oracle + sourceTypeName = "oracle"; + break; + case "2": //sqlsever + sourceTypeName = "sqlServer"; + break; + case "3": //mysql + sourceTypeName = "mysql"; + break; + default: + } + } + return sourceTypeName; + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml index 67637941..2b51b38e 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml @@ -5,44 +5,46 @@ <resultMap id="get-SysApplicationDatabaseEntity-result" type="com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity" > <result property="id" column="id" jdbcType="VARCHAR"/> <result property="appId" column="app_id" jdbcType="VARCHAR"/> + <result property="sourceCode" column="source_code" jdbcType="VARCHAR"/> + <result property="sourceName" column="source_name" jdbcType="VARCHAR"/> <result property="sourceType" column="source_type" jdbcType="VARCHAR"/> - <result property="sourceUrl" column="source_url" jdbcType="VARCHAR"/> + <result property="sourceIp" column="source_ip" jdbcType="VARCHAR"/> + <result property="sourcePort" column="source_port" jdbcType="VARCHAR"/> <result property="loginName" column="login_name" jdbcType="VARCHAR"/> <result property="password" column="password" jdbcType="VARCHAR"/> <result property="dbName" column="db_name" jdbcType="VARCHAR"/> + <result property="serviceName" column="service_name" jdbcType="VARCHAR"/> <result property="dbStatus" column="db_status" jdbcType="VARCHAR"/> <result property="sorts" column="sorts" jdbcType="INTEGER"/> - <result property="org_id" column="org_id" jdbcType="VARCHAR"/> - <result property="sts" column="sts" jdbcType="VARCHAR"/> - <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/> <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/> - <result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/> + <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/> <result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/> + <result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/> + <result property="sts" column="sts" jdbcType="VARCHAR"/> + <result property="org_id" column="org_id" jdbcType="VARCHAR"/> </resultMap> <!-- 查询的字段--> <sql id = "SysApplicationDatabaseEntity_Base_Column_List"> id ,app_id + ,source_code + ,source_name ,source_type - ,source_url + ,source_ip + ,source_port ,login_name ,password ,db_name + ,service_name ,db_status ,sorts - ,org_id - ,sts - ,create_time ,create_user_id - ,modify_time + ,create_time ,modify_user_id + ,modify_time + ,sts + ,org_id </sql> - <!--通过ID获取数据 --> - <select id="entity_get" resultMap="get-SysApplicationDatabaseEntity-result"> - select - <include refid="SysApplicationDatabaseEntity_Base_Column_List" /> - from sys_application_database where sts = 'Y' and id = #{id} - </select> <!-- 查询 采用==查询 --> <select id="entity_list_base" resultMap="get-SysApplicationDatabaseEntity-result" parameterType = "com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity"> select @@ -51,19 +53,23 @@ <trim prefix="where" prefixOverrides="and"> <if test="id != null and id != ''"> and id = #{id} </if> <if test="appId != null and appId != ''"> and app_id = #{appId} </if> + <if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if> + <if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if> <if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if> - <if test="sourceUrl != null and sourceUrl != ''"> and source_url = #{sourceUrl} </if> + <if test="sourceIp != null and sourceIp != ''"> and source_ip = #{sourceIp} </if> + <if test="sourcePort != null and sourcePort != ''"> and source_port = #{sourcePort} </if> <if test="loginName != null and loginName != ''"> and login_name = #{loginName} </if> <if test="password != null and password != ''"> and password = #{password} </if> <if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if> + <if test="serviceName != null and serviceName != ''"> and service_name = #{serviceName} </if> <if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if> <if test="sorts != null"> and sorts = #{sorts} </if> - <if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if> - <if test="sts != null and sts != ''"> and sts = #{sts} </if> - <if test="create_time != null"> and create_time = #{create_time} </if> <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> - <if test="modify_time != null"> and modify_time = #{modify_time} </if> + <if test="create_time != null"> and create_time = #{create_time} </if> <if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if> + <if test="modify_time != null"> and modify_time = #{modify_time} </if> + <if test="sts != null and sts != ''"> and sts = #{sts} </if> + <if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if> and sts='Y' </trim> <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> @@ -76,19 +82,23 @@ <trim prefix="where" prefixOverrides="and"> <if test="id != null and id != ''"> and id = #{id} </if> <if test="appId != null and appId != ''"> and app_id = #{appId} </if> + <if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if> + <if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if> <if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if> - <if test="sourceUrl != null and sourceUrl != ''"> and source_url = #{sourceUrl} </if> + <if test="sourceIp != null and sourceIp != ''"> and source_ip = #{sourceIp} </if> + <if test="sourcePort != null and sourcePort != ''"> and source_port = #{sourcePort} </if> <if test="loginName != null and loginName != ''"> and login_name = #{loginName} </if> <if test="password != null and password != ''"> and password = #{password} </if> <if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if> + <if test="serviceName != null and serviceName != ''"> and service_name = #{serviceName} </if> <if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if> <if test="sorts != null"> and sorts = #{sorts} </if> - <if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if> - <if test="sts != null and sts != ''"> and sts = #{sts} </if> - <if test="create_time != null"> and create_time = #{create_time} </if> <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> - <if test="modify_time != null"> and modify_time = #{modify_time} </if> + <if test="create_time != null"> and create_time = #{create_time} </if> <if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if> + <if test="modify_time != null"> and modify_time = #{modify_time} </if> + <if test="sts != null and sts != ''"> and sts = #{sts} </if> + <if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if> and sts='Y' </trim> <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> @@ -103,19 +113,23 @@ <trim prefix="where" prefixOverrides="and"> <if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if> <if test="appId != null and appId != ''"> and app_id like concat('%',#{appId},'%') </if> + <if test="sourceCode != null and sourceCode != ''"> and source_code like concat('%',#{sourceCode},'%') </if> + <if test="sourceName != null and sourceName != ''"> and source_name like concat('%',#{sourceName},'%') </if> <if test="sourceType != null and sourceType != ''"> and source_type like concat('%',#{sourceType},'%') </if> - <if test="sourceUrl != null and sourceUrl != ''"> and source_url like concat('%',#{sourceUrl},'%') </if> + <if test="sourceIp != null and sourceIp != ''"> and source_ip like concat('%',#{sourceIp},'%') </if> + <if test="sourcePort != null and sourcePort != ''"> and source_port like concat('%',#{sourcePort},'%') </if> <if test="loginName != null and loginName != ''"> and login_name like concat('%',#{loginName},'%') </if> <if test="password != null and password != ''"> and password like concat('%',#{password},'%') </if> <if test="dbName != null and dbName != ''"> and db_name like concat('%',#{dbName},'%') </if> + <if test="serviceName != null and serviceName != ''"> and service_name like concat('%',#{serviceName},'%') </if> <if test="dbStatus != null and dbStatus != ''"> and db_status like concat('%',#{dbStatus},'%') </if> <if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if> - <if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if> - <if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if> - <if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if> <if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if> - <if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </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_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> and sts='Y' </trim> <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> @@ -130,19 +144,23 @@ <trim prefix="where" prefixOverrides="and"> <if test="id != null and id != ''"> or id = #{id} </if> <if test="appId != null and appId != ''"> or app_id = #{appId} </if> + <if test="sourceCode != null and sourceCode != ''"> or source_code = #{sourceCode} </if> + <if test="sourceName != null and sourceName != ''"> or source_name = #{sourceName} </if> <if test="sourceType != null and sourceType != ''"> or source_type = #{sourceType} </if> - <if test="sourceUrl != null and sourceUrl != ''"> or source_url = #{sourceUrl} </if> + <if test="sourceIp != null and sourceIp != ''"> or source_ip = #{sourceIp} </if> + <if test="sourcePort != null and sourcePort != ''"> or source_port = #{sourcePort} </if> <if test="loginName != null and loginName != ''"> or login_name = #{loginName} </if> <if test="password != null and password != ''"> or password = #{password} </if> <if test="dbName != null and dbName != ''"> or db_name = #{dbName} </if> + <if test="serviceName != null and serviceName != ''"> or service_name = #{serviceName} </if> <if test="dbStatus != null and dbStatus != ''"> or db_status = #{dbStatus} </if> <if test="sorts != null"> or sorts = #{sorts} </if> - <if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if> - <if test="sts != null and sts != ''"> or sts = #{sts} </if> - <if test="create_time != null"> or create_time = #{create_time} </if> - <if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if> - <if test="modify_time != null"> or modify_time = #{modify_time} </if> + <if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if> + <if test="create_time != null"> or create_time = #{create_time} </if> <if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if> + <if test="modify_time != null"> or modify_time = #{modify_time} </if> + <if test="sts != null and sts != ''"> or sts = #{sts} </if> + <if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if> and sts='Y' </trim> <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> @@ -155,19 +173,23 @@ <trim suffix="" suffixOverrides=","> <if test="id != null and id != ''"> id , </if> <if test="appId != null and appId != ''"> app_id , </if> + <if test="sourceCode != null and sourceCode != ''"> source_code , </if> + <if test="sourceName != null and sourceName != ''"> source_name , </if> <if test="sourceType != null and sourceType != ''"> source_type , </if> - <if test="sourceUrl != null and sourceUrl != ''"> source_url , </if> + <if test="sourceIp != null and sourceIp != ''"> source_ip , </if> + <if test="sourcePort != null and sourcePort != ''"> source_port , </if> <if test="loginName != null and loginName != ''"> login_name , </if> <if test="password != null and password != ''"> password , </if> <if test="dbName != null and dbName != ''"> db_name , </if> + <if test="serviceName != null and serviceName != ''"> service_name , </if> <if test="dbStatus != null and dbStatus != ''"> db_status , </if> <if test="sorts != null"> sorts , </if> - <if test="org_id != null and org_id != ''"> org_id , </if> - <if test="sts != null and sts != ''"> sts , </if> - <if test="create_time != null"> create_time , </if> <if test="create_user_id != null and create_user_id != ''"> create_user_id , </if> - <if test="modify_time != null"> modify_time , </if> + <if test="create_time != null"> create_time , </if> <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if> + <if test="modify_time != null"> modify_time , </if> + <if test="sts != null and sts != ''"> sts , </if> + <if test="org_id != null and org_id != ''"> org_id , </if> <if test="sorts == null ">sorts,</if> <if test="sts == null ">sts,</if> </trim> @@ -175,19 +197,23 @@ <trim suffix="" suffixOverrides=","> <if test="id != null and id != ''"> #{id} ,</if> <if test="appId != null and appId != ''"> #{appId} ,</if> + <if test="sourceCode != null and sourceCode != ''"> #{sourceCode} ,</if> + <if test="sourceName != null and sourceName != ''"> #{sourceName} ,</if> <if test="sourceType != null and sourceType != ''"> #{sourceType} ,</if> - <if test="sourceUrl != null and sourceUrl != ''"> #{sourceUrl} ,</if> + <if test="sourceIp != null and sourceIp != ''"> #{sourceIp} ,</if> + <if test="sourcePort != null and sourcePort != ''"> #{sourcePort} ,</if> <if test="loginName != null and loginName != ''"> #{loginName} ,</if> <if test="password != null and password != ''"> #{password} ,</if> <if test="dbName != null and dbName != ''"> #{dbName} ,</if> + <if test="serviceName != null and serviceName != ''"> #{serviceName} ,</if> <if test="dbStatus != null and dbStatus != ''"> #{dbStatus} ,</if> <if test="sorts != null"> #{sorts} ,</if> - <if test="org_id != null and org_id != ''"> #{org_id} ,</if> - <if test="sts != null and sts != ''"> #{sts} ,</if> - <if test="create_time != null"> #{create_time} ,</if> <if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if> - <if test="modify_time != null"> #{modify_time} ,</if> + <if test="create_time != null"> #{create_time} ,</if> <if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if> + <if test="modify_time != null"> #{modify_time} ,</if> + <if test="sts != null and sts != ''"> #{sts} ,</if> + <if test="org_id != null and org_id != ''"> #{org_id} ,</if> <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_database a WHERE a.sts = 'Y' ),</if> <if test="sts == null ">'Y',</if> </trim> @@ -195,52 +221,58 @@ </insert> <!-- 批量新增 --> <insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true"> - insert into sys_application_database(app_id, source_type, source_url, login_name, password, db_name, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) + insert into sys_application_database(app_id, source_code, source_name, source_type, source_ip, source_port, login_name, password, db_name, service_name, db_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values <foreach collection="entities" item="entity" separator=","> - (#{entity.appId},#{entity.sourceType},#{entity.sourceUrl},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y') + (#{entity.appId},#{entity.sourceCode},#{entity.sourceName},#{entity.sourceType},#{entity.sourceIp},#{entity.sourcePort},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.serviceName},#{entity.dbStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, 'Y') </foreach> </insert> <!-- 批量新增或者修改--> <insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> - insert into sys_application_database(app_id, source_type, source_url, login_name, password, db_name, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) + insert into sys_application_database(app_id, source_code, source_name, source_type, source_ip, source_port, login_name, password, db_name, service_name, db_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values <foreach collection="entities" item="entity" separator=","> - (#{entity.appId},#{entity.sourceType},#{entity.sourceUrl},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}) + (#{entity.appId},#{entity.sourceCode},#{entity.sourceName},#{entity.sourceType},#{entity.sourceIp},#{entity.sourcePort},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.serviceName},#{entity.dbStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) </foreach> on duplicate key update app_id = values(app_id), + source_code = values(source_code), + source_name = values(source_name), source_type = values(source_type), - source_url = values(source_url), + source_ip = values(source_ip), + source_port = values(source_port), login_name = values(login_name), password = values(password), db_name = values(db_name), + service_name = values(service_name), db_status = values(db_status), - sorts = values(sorts), - org_id = values(org_id), - sts = values(sts), - create_time = values(create_time), create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), modify_time = values(modify_time), - modify_user_id = values(modify_user_id)</insert> + sts = values(sts), + org_id = values(org_id)</insert> <!--通过主键修改方法--> <update id="entity_update" parameterType = "com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity" > update sys_application_database set <trim suffix="" suffixOverrides=","> <if test="appId != null and appId != ''"> app_id = #{appId},</if> + <if test="sourceCode != null and sourceCode != ''"> source_code = #{sourceCode},</if> + <if test="sourceName != null and sourceName != ''"> source_name = #{sourceName},</if> <if test="sourceType != null and sourceType != ''"> source_type = #{sourceType},</if> - <if test="sourceUrl != null and sourceUrl != ''"> source_url = #{sourceUrl},</if> + <if test="sourceIp != null and sourceIp != ''"> source_ip = #{sourceIp},</if> + <if test="sourcePort != null and sourcePort != ''"> source_port = #{sourcePort},</if> <if test="loginName != null and loginName != ''"> login_name = #{loginName},</if> <if test="password != null and password != ''"> password = #{password},</if> <if test="dbName != null and dbName != ''"> db_name = #{dbName},</if> + <if test="serviceName != null and serviceName != ''"> service_name = #{serviceName},</if> <if test="dbStatus != null and dbStatus != ''"> db_status = #{dbStatus},</if> - <if test="sorts != null"> sorts = #{sorts},</if> - <if test="org_id != null and org_id != ''"> org_id = #{org_id},</if> - <if test="sts != null and sts != ''"> sts = #{sts},</if> - <if test="create_time != null"> create_time = #{create_time},</if> - <if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if> - <if test="modify_time != null"> modify_time = #{modify_time},</if> + <if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if> + <if test="create_time != null"> create_time = #{create_time},</if> <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if> + <if test="modify_time != null"> modify_time = #{modify_time},</if> + <if test="sts != null and sts != ''"> sts = #{sts},</if> + <if test="org_id != null and org_id != ''"> org_id = #{org_id},</if> </trim> where id = #{id} </update> @@ -255,21 +287,52 @@ update sys_application_database set sts= 'N' ,modify_time = #{modify_time},modi <trim prefix="where" prefixOverrides="and"> <if test="id != null and id != ''"> and id = #{id} </if> <if test="appId != null and appId != ''"> and app_id = #{appId} </if> + <if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if> + <if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if> <if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if> - <if test="sourceUrl != null and sourceUrl != ''"> and source_url = #{sourceUrl} </if> + <if test="sourceIp != null and sourceIp != ''"> and source_ip = #{sourceIp} </if> + <if test="sourcePort != null and sourcePort != ''"> and source_port = #{sourcePort} </if> <if test="loginName != null and loginName != ''"> and login_name = #{loginName} </if> <if test="password != null and password != ''"> and password = #{password} </if> <if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if> + <if test="serviceName != null and serviceName != ''"> and service_name = #{serviceName} </if> <if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if> <if test="sorts != null"> and sorts = #{sorts} </if> - <if test="sts != null and sts != ''"> and sts = #{sts} </if> - and sts='Y' + <if test="sts != null and sts != ''"> and sts = #{sts} </if> + and sts='Y' </trim> </update> <!--通过主键删除--> <delete id="entity_delete"> delete from sys_application_database where id = #{id} </delete> - + <!-- 查询 采用==查询 --> + <select id="queryDSBase" resultMap="get-SysApplicationDatabaseEntity-result" parameterType = "com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity"> + select + <include refid="SysApplicationDatabaseEntity_Base_Column_List" /> + from sys_application_database + <trim prefix="where" prefixOverrides="and"> + <if test="id != null and id != ''"> and id = #{id} </if> + <if test="appId != null and appId != ''"> and app_id = #{appId} </if> + <if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if> + <if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if> + <if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if> + <if test="sourceIp != null and sourceIp != ''"> and source_ip = #{sourceIp} </if> + <if test="sourcePort != null and sourcePort != ''"> and source_port = #{sourcePort} </if> + <if test="loginName != null and loginName != ''"> and login_name = #{loginName} </if> + <if test="password != null and password != ''"> and password = #{password} </if> + <if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if> + <if test="serviceName != null and serviceName != ''"> and service_name = #{serviceName} </if> + <if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if> + <if test="sorts != null"> and sorts = #{sorts} </if> + <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> + <if test="create_time != null"> and create_time = #{create_time} </if> + <if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if> + <if test="modify_time != null"> and modify_time = #{modify_time} </if> + <if test="sts != null and sts != ''"> and sts = #{sts} </if> + <if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if> + and sts='Y' + </trim> + </select> </mapper> diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/service/ISysApplicationDatabaseService.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/service/ISysApplicationDatabaseService.java index 9f4ad126..c1d3776b 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/service/ISysApplicationDatabaseService.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/service/ISysApplicationDatabaseService.java @@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService; * 数据源表(SysApplicationDatabase)表服务接口 * * @author makejava - * @since 2023-09-25 11:46:39 + * @since 2024-06-16 21:49:32 */ public interface ISysApplicationDatabaseService extends IBaseService<SysApplicationDatabaseEntity, String>{ } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/service/impl/SysApplicationDatabaseServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/service/impl/SysApplicationDatabaseServiceImpl.java index 1f799bc6..881a9151 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/service/impl/SysApplicationDatabaseServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/service/impl/SysApplicationDatabaseServiceImpl.java @@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService; * 数据源表(SysApplicationDatabase)表服务实现类 * * @author makejava - * @since 2023-09-25 11:46:42 + * @since 2024-06-16 21:49:33 */ @Service(value = "sysApplicationDatabaseService") public class SysApplicationDatabaseServiceImpl extends BaseService<SysApplicationDatabaseEntity, String> implements ISysApplicationDatabaseService { diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java index 5775b7fc..2c90c614 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java @@ -551,14 +551,19 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity, **/ @Override public JsonResultEntity testDatabase(JSONObject object) { - SysApplicationDatasourceDto entity = getData("jsonStr", object, SysApplicationDatasourceDto.class); + SysApplicationDatabaseEntity entity = getData("jsonStr", object, SysApplicationDatabaseEntity.class); if (entity == null) { return BaseResult.getFailureMessageEntity("系统错误"); } - if (dsDataSourceUtil.testConnection(entity)) { - return BaseResult.getSuccessMessageEntity("测试连接数据源成功"); + SysApplicationDatasourceDto sysApplicationDatasourceDto = new SysApplicationDatasourceDto(); + sysApplicationDatasourceDto.setSourceType(entity.getSourceType()); + sysApplicationDatasourceDto.setSourceUrl(entity.getSourceUrl()); + sysApplicationDatasourceDto.setLoginName(entity.getLoginName()); + sysApplicationDatasourceDto.setPassword(entity.getPassword()); + if (dsDataSourceUtil.testConnection(sysApplicationDatasourceDto)) { + return BaseResult.getSuccessMessageEntity("测试连接数据源成功",true); } else { - return BaseResult.getFailureMessageEntity("测试连接数据源失败,请检查数据源配置是否正确"); + return BaseResult.getSuccessMessageEntity("测试连接数据源失败",false); } } @@ -573,7 +578,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity, sysApplicationDatabaseDao.logicRemoveMultiCondition(detailEntity); SysApplicationDatabaseEntity databaseEntity = entity.getDatabaseEntity(); if (databaseEntity != null) { - databaseEntity.setAppId(entity.getId()); + databaseEntity.setPassword(AESUtil.encrypt(databaseEntity.getPassword())); + databaseEntity.setSts("Y"); databaseEntity.setSts("Y"); databaseEntity.setDbStatus(entity.getDbStatus()); databaseEntity.setModify_user_id(StpUtil.getLoginIdAsString()); @@ -581,6 +587,19 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity, if (databaseEntity.getId() != null && !"".equals(databaseEntity.getId())) { //修改 sysApplicationDatabaseDao.update(databaseEntity); + if("1".equals(databaseEntity.getDbStatus())){ + try { + dsDataSourceUtil.editDataSource(databaseEntity); + } catch (Exception e) { + //return BaseResult.getSuccessMessageEntity("修改数据源失败,请检查数据源配置是否正确"); + } + }else { + try { + dsDataSourceUtil.removeDataSource(databaseEntity.getSourceCode()); + } catch (Exception e) { + //return BaseResult.getSuccessMessageEntity("修改数据源失败"); + } + } } else { //新增 databaseEntity.setId(UUIDUtils.getUUID()); @@ -1442,6 +1461,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity, if (list != null && list.size() > 0) { sysApplicationDatabaseEntity = list.get(0); + sysApplicationDatabaseEntity.setPassword(AESUtil.decrypt(sysApplicationDatabaseEntity.getPassword())); } else { sysApplicationDatabaseEntity = null; } diff --git a/service/src/main/java/com/hzya/frame/sysnew/login/impl/LoginServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/login/impl/LoginServiceImpl.java index 48fb1f2c..bef5714c 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/login/impl/LoginServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/login/impl/LoginServiceImpl.java @@ -3,6 +3,8 @@ package com.hzya.frame.sysnew.login.impl; import cn.dev33.satoken.stp.SaTokenInfo; import cn.dev33.satoken.stp.StpUtil; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.application.dao.ISysApplicationDao; +import com.hzya.frame.sysnew.application.entity.SysApplicationEntity; import com.hzya.frame.sysnew.login.ILoginService; import com.hzya.frame.sysnew.organ.dao.ISysOrganDao; import com.hzya.frame.sysnew.organ.entity.SysOrganEntity; @@ -37,6 +39,8 @@ public class LoginServiceImpl implements ILoginService { @Resource private ISysOrganDao sysOrganDao; + @Resource + private ISysApplicationDao sysApplicationDao; @Resource private InterfaceCache interfaceCache; /** @@ -111,6 +115,9 @@ public class LoginServiceImpl implements ILoginService { res.put("token", token); res.put("userInfo", sysUserEntity); res.put("company", sysOrganEntities); + + + //切换数据源查询 return BaseResult.getSuccessMessageEntity("登录成功", res); } diff --git a/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java b/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java index 390c1f15..9952517e 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java @@ -6,9 +6,8 @@ import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.exception.CannotFindDataSourceException; import com.hzya.frame.datasource.DataSourceUtilProperties; -import com.hzya.frame.sys.dataSource.dao.ISysDataSourceDao; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo; +import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao; +import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity; import com.hzya.frame.util.AESUtil; import com.hzya.frame.web.entity.BaseEntity; import com.hzya.frame.web.exception.BaseSystemException; @@ -38,7 +37,7 @@ public class AopDynamicRoutingDataSourceInit { @Resource private DataSource dataSource; @Resource - private ISysDataSourceDao sysDataSourceDao; + private ISysApplicationDatabaseDao sysApplicationDatabaseDao; @Before("@annotation(dsAnnotation)") @@ -64,12 +63,12 @@ public class AopDynamicRoutingDataSourceInit { dsDatasource = ds.getDataSource(dsValue); } catch (CannotFindDataSourceException exception) { //logger.info("beforeDynamicRoutingDataSourceInitMethod:根据ds获取dsDatasource失败!异常信息:" + "exception.getMessage()" + " 执行初始化数据源:" + dsValue); - SysDataSourceEntity entity = new SysDataSourceEntity(); + SysApplicationDatabaseEntity entity = new SysApplicationDatabaseEntity(); entity.setSts("Y"); - entity.setUseState(1); - entity.setDataState("1"); + entity.setDbStatus("1"); entity.setSourceCode(dsValue); - List<SysDataSourceVo> sysDataSourceEntities = sysDataSourceDao.queryDSBase(entity); + entity.setDataSourceCode("master"); + List<SysApplicationDatabaseEntity> sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(entity); //logger.info("beforeDynamicRoutingDataSourceInitMethod:根据dsValue获取数据源信息查询结果 sysDataSourceEntities.size:" + sysDataSourceEntities.size()); if (sysDataSourceEntities != null && sysDataSourceEntities.size() > 0) { for (int i = 0; i < sysDataSourceEntities.size(); i++) {