1、主数据新增合并规则

This commit is contained in:
zhengyf 2025-07-07 17:23:34 +08:00
parent 6bcf7c4589
commit 06edad895d
3 changed files with 46 additions and 2 deletions

View File

@ -443,6 +443,22 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
for (int i = 0; i < mdmModuleDbEntities.size(); i++) { for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
if ("1".equals(mdmModuleDbEntities.get(i).getDbType()) || "2".equals(mdmModuleDbEntities.get(i).getDbType())) { if ("1".equals(mdmModuleDbEntities.get(i).getDbType()) || "2".equals(mdmModuleDbEntities.get(i).getDbType())) {
dbEntities.add(mdmModuleDbEntities.get(i)); dbEntities.add(mdmModuleDbEntities.get(i));
//查询合并规则add by zyd 20250707
List<String> filedNames=new ArrayList<>();
if (mdmModuleDbEntities.get(i).getMergeRules() != null && !"".equals(mdmModuleDbEntities.get(i).getMergeRules())) {
String mergeRulesIds = mdmModuleDbEntities.get(i).getMergeRules();
String[] split = mergeRulesIds.split(",");
for (String filedId : split) {
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity.setId(filedId);
List<MdmModuleDbFiledsEntity> fileds = mdmModuleDbFiledsDao.query(mdmModuleDbFiledsEntity);
if(fileds.size()!=0){
filedNames.add(fileds.get(0).getChName());
}
}
}
mdmModuleDbEntities.get(i).setMergeRulesStr(String.join(",",filedNames));
} }
} }
} }

View File

@ -27,7 +27,25 @@ public class MdmModuleDbEntity extends BaseEntity {
/** 数据类型 1、新增 2、修改 */ /** 数据类型 1、新增 2、修改 */
private String dataType; private String dataType;
private List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds; private List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds;
/** 合并规则字段id使用逗号隔开 */
private String mergeRules;
private String mergeRulesStr;
public String getMergeRules() {
return mergeRules;
}
public void setMergeRules(String mergeRules) {
this.mergeRules = mergeRules;
}
public String getMergeRulesStr() {
return mergeRulesStr;
}
public void setMergeRulesStr(String mergeRulesStr) {
this.mergeRulesStr = mergeRulesStr;
}
public String getMdmId() { public String getMdmId() {
return mdmId; return mdmId;

View File

@ -16,6 +16,7 @@
<result property="sts" column="sts" jdbcType="VARCHAR"/> <result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/> <result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/> <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
<result property="mergeRules" column="merge_rules" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<!-- 查询的字段--> <!-- 查询的字段-->
<sql id="MdmModuleDbEntity_Base_Column_List"> <sql id="MdmModuleDbEntity_Base_Column_List">
@ -32,6 +33,7 @@
,sts ,sts
,org_id ,org_id
,company_id ,company_id
,merge_rules
</sql> </sql>
<!-- 查询 采用==查询 --> <!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-MdmModuleDbEntity-result" <select id="entity_list_base" resultMap="get-MdmModuleDbEntity-result"
@ -53,6 +55,7 @@
<if test="sts != null and sts != ''">and sts = #{sts}</if> <if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if> <if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if> <if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
<if test="mergeRules != null and mergeRules != ''">and merge_rules = #{mergeRules}</if>
and sts='Y' and sts='Y'
</trim> </trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -77,6 +80,7 @@
<if test="sts != null and sts != ''">and sts = #{sts}</if> <if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if> <if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if> <if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
<if test="mergeRules != null and mergeRules != ''">and merge_rules = #{mergeRules}</if>
and sts='Y' and sts='Y'
</trim> </trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -107,6 +111,7 @@
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if> <if test="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="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
<if test="companyId != null and companyId != ''">and company_id like concat('%',#{companyId},'%')</if> <if test="companyId != null and companyId != ''">and company_id like concat('%',#{companyId},'%')</if>
<if test="mergeRules != null and mergeRules != ''">and merge_rules like concat('%',#{mergeRules},'%')</if>
and sts='Y' and sts='Y'
</trim> </trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -133,6 +138,7 @@
<if test="sts != null and sts != ''">or sts = #{sts}</if> <if test="sts != null and sts != ''">or sts = #{sts}</if>
<if test="org_id != null and org_id != ''">or org_id = #{org_id}</if> <if test="org_id != null and org_id != ''">or org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">or company_id = #{companyId}</if> <if test="companyId != null and companyId != ''">or company_id = #{companyId}</if>
<if test="mergeRules != null and mergeRules != ''">or merge_rules = #{mergeRules}</if>
and sts='Y' and sts='Y'
</trim> </trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if> <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
@ -156,6 +162,7 @@
<if test="sts != null and sts != ''">sts ,</if> <if test="sts != null and sts != ''">sts ,</if>
<if test="org_id != null and org_id != ''">org_id ,</if> <if test="org_id != null and org_id != ''">org_id ,</if>
<if test="companyId != null and companyId != ''">company_id ,</if> <if test="companyId != null and companyId != ''">company_id ,</if>
<if test="mergeRules != null and mergeRules != ''">merge_rules ,</if>
<if test="sts == null ">sts,</if> <if test="sts == null ">sts,</if>
</trim> </trim>
)values( )values(
@ -173,6 +180,7 @@
<if test="sts != null and sts != ''">#{sts} ,</if> <if test="sts != null and sts != ''">#{sts} ,</if>
<if test="org_id != null and org_id != ''">#{org_id} ,</if> <if test="org_id != null and org_id != ''">#{org_id} ,</if>
<if test="companyId != null and companyId != ''">#{companyId} ,</if> <if test="companyId != null and companyId != ''">#{companyId} ,</if>
<if test="mergeRules != null and mergeRules != ''">#{mergeRules} ,</if>
<if test="sts == null ">'Y',</if> <if test="sts == null ">'Y',</if>
</trim> </trim>
) )
@ -180,10 +188,10 @@
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="entityInsertBatch"> <insert id="entityInsertBatch">
insert into mdm_module_db(mdm_id, db_name, db_type, remark, create_user_id, create_time, modify_user_id, insert into mdm_module_db(mdm_id, db_name, db_type, remark, create_user_id, create_time, modify_user_id,
modify_time, sts, org_id, company_id, sts) modify_time, sts, org_id, company_id, merge_rules, sts)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, (#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.mergeRules},
'Y') 'Y')
</foreach> </foreach>
</insert> </insert>
@ -223,6 +231,7 @@
<if test="sts != null and sts != ''">sts = #{sts},</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="org_id != null and org_id != ''">org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if> <if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
<if test="mergeRules != null and mergeRules != ''">merge_rules = #{mergeRules},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -244,6 +253,7 @@ where id = #{id}
<if test="sorts != null">and sorts = #{sorts}</if> <if test="sorts != null">and sorts = #{sorts}</if>
<if test="sts != null and sts != ''">and sts = #{sts}</if> <if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if> <if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
<if test="mergeRules != null and mergeRules != ''">and merge_rules = #{mergeRules}</if>
and sts='Y' and sts='Y'
</trim> </trim>
</update> </update>