Merge branches 'dev' and 'dongj' of http://ufidahz.com.cn:9015/root/kangarooDataCenterV3 into dongj

 Conflicts:
	buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java
This commit is contained in:
lvleigang 2024-08-02 10:05:59 +08:00
commit a555abda9c
10 changed files with 529 additions and 262 deletions

View File

@ -474,7 +474,6 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
//查询主数据
MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity();
queryMdmModuleEntity.setSts("Y");
queryMdmModuleEntity.setMdmCode(10021L);
List<MdmModuleEntity> mdmModuleEntities = mdmModuleDao.queryBase(queryMdmModuleEntity);
if(mdmModuleEntities == null || mdmModuleEntities.size() == 0){
return BaseResult.getSuccessMessageEntity("主数据未设置,不需要下发");

View File

@ -7,6 +7,7 @@ import java.util.List;
public class MdmDataDto {
private String mdmId;
private String id;
private String tableName;
private String documentRule;
@ -65,5 +66,13 @@ public class MdmDataDto {
public void setDbType(String dbType) {
this.dbType = dbType;
}
public String getMdmId() {
return mdmId;
}
public void setMdmId(String mdmId) {
this.mdmId = mdmId;
}
}

View File

@ -64,5 +64,9 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> {
* @return java.util.List<java.lang.Object>
**/
List<String> queryMdMFields(Map<String, Object> maps);
void updataTreeUpData(Map<String, String> updateMaps);
void updataTreeUpDataDetail(Map<String, String> updateMaps);
}

View File

@ -171,6 +171,16 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
super.update(getSqlIdPrifx() + "updateMdmSTs", maps);
}
@Override
public void updataTreeUpData(Map<String, String> maps) {
super.update(getSqlIdPrifx() + "updataTreeUpData", maps);
}
@Override
public void updataTreeUpDataDetail(Map<String, String> maps) {
super.update(getSqlIdPrifx() + "updataTreeUpDataDetail", maps);
}
@Override
public List<String> queryMdMFields(Map<String, Object> maps) {
List<String> o = (List<String>) super.selectList(getSqlIdPrifx() + "queryMdMFields", maps);

View File

@ -397,6 +397,9 @@ where id = #{id}
`company_id` varchar(50) DEFAULT NULL COMMENT '公司id',
`data_type` varchar(50) DEFAULT NULL COMMENT '状态 1、成功2、失败',
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
`distribute_id` varchar(50) DEFAULT NULL COMMENT 'distribute_id',
`api_id` varchar(50) DEFAULT NULL COMMENT 'apiid',
`app_id` varchar(50) DEFAULT NULL COMMENT 'app_id',
</when>
</choose>
PRIMARY KEY (`sorts`,`id`) USING BTREE
@ -1030,6 +1033,8 @@ where id = #{id}
update ${tableName} set
<trim prefixOverrides=",">
<if test="addStatus != null and addStatus !='' ">, add_status = #{addStatus}</if>
<if test="updateStatus != null and updateStatus !='' ">, update_status = #{updateStatus}</if>
<if test="deleteStatus != null and deleteStatus !='' ">, delete_status = #{deleteStatus}</if>
,modify_time = now()
</trim>
<trim prefix="where" prefixOverrides="and">
@ -1037,5 +1042,42 @@ where id = #{id}
<if test="dataStatus != null and dataStatus !='' ">and data_status = #{dataStatus}</if>
</trim>
</update>
<update id="updataTreeUpData" parameterType="java.util.HashMap">
UPDATE ${tableName}
SET ${upFiled} = CONCAT(#{newData},SUBSTRING_INDEX( ${upFiled}, #{oldData},- 1 )),
modify_time = now(),
modify_user_id = #{modify_user_id},
data_status = 'F',
update_status = '0'
WHERE
${upFiled} LIKE concat(#{oldData},'%')
AND sts = 'Y'
AND data_status != 'N'
</update>
<update id="updataTreeUpDataDetail" parameterType="java.util.HashMap">
UPDATE ${tableName} a
JOIN ${mainDBTable} b ON a.formmain_id = b.id and b.sts = 'Y'
SET
a.${upFiled}=CONCAT(#{newData},SUBSTRING_INDEX(${upFiled},#{oldData},-1)),
a.modify_time = now(),
a.modify_user_id = '1',
a.data_status = 'F',
b.update_status = '0' ,
b.data_status = 'F',
b.modify_time = now(),
b.modify_user_id = '1'
WHERE
a.${upFiled} LIKE concat( #{oldData}, '%' )
AND a.sts = 'Y'
AND a.data_status != 'N'
AND b.sts = 'Y'
AND b.data_status != 'N'
</update>
</mapper>

View File

@ -1,7 +1,10 @@
package com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao;
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.basedao.dao.IBaseDao;
import java.util.List;
import java.util.Map;
/**
* 模版数据库字段规则表(mdm_module_db_fileds_rule: table)表数据库访问层
@ -12,5 +15,7 @@ import com.hzya.frame.basedao.dao.IBaseDao;
public interface IMdmModuleDbFiledsRuleDao extends IBaseDao<MdmModuleDbFiledsRuleEntity, String> {
Integer queryUserMdm(MdmModuleDbFiledsRuleEntity queryCount);
List<MdmModuleDbFiledsRuleEntity> queryServiceQuote(Map<String, String> maps);
}

View File

@ -4,6 +4,10 @@ import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEnti
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import java.util.List;
import java.util.Map;
/**
* 模版数据库字段规则表(MdmModuleDbFiledsRule)表数据库访问层
*
@ -18,5 +22,11 @@ public class MdmModuleDbFiledsRuleDaoImpl extends MybatisGenericDao<MdmModuleDbF
Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "queryUserMdm", queryCount);
return o;
}
@Override
public List<MdmModuleDbFiledsRuleEntity> queryServiceQuote(Map<String, String> maps) {
List<MdmModuleDbFiledsRuleEntity> o = (List<MdmModuleDbFiledsRuleEntity>) super.selectList(getSqlIdPrifx() + "queryServiceQuote", maps);
return o;
}
}

View File

@ -2,27 +2,28 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.impl.MdmModuleDbFiledsRuleDaoImpl">
<resultMap id="get-MdmModuleDbFiledsRuleEntity-result" type="com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/>
<result property="formName" column="form_name" jdbcType="VARCHAR"/>
<result property="dbId" column="db_id" jdbcType="VARCHAR"/>
<result property="filedId" column="filed_id" jdbcType="VARCHAR"/>
<result property="ruleName" column="rule_name" jdbcType="VARCHAR"/>
<result property="ruleCode" column="rule_code" jdbcType="VARCHAR"/>
<result property="ruleValue" column="rule_value" jdbcType="VARCHAR"/>
<result property="ruleType" column="rule_type" 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-MdmModuleDbFiledsRuleEntity-result"
type="com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/>
<result property="formName" column="form_name" jdbcType="VARCHAR"/>
<result property="dbId" column="db_id" jdbcType="VARCHAR"/>
<result property="filedId" column="filed_id" jdbcType="VARCHAR"/>
<result property="ruleName" column="rule_name" jdbcType="VARCHAR"/>
<result property="ruleCode" column="rule_code" jdbcType="VARCHAR"/>
<result property="ruleValue" column="rule_value" jdbcType="VARCHAR"/>
<result property="ruleType" column="rule_type" 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 = "MdmModuleDbFiledsRuleEntity_Base_Column_List">
<sql id="MdmModuleDbFiledsRuleEntity_Base_Column_List">
id
,mdm_id
,form_name
@ -39,261 +40,303 @@
,modify_time
,sts
,org_id
,company_id
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-MdmModuleDbFiledsRuleEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
select
<include refid="MdmModuleDbFiledsRuleEntity_Base_Column_List" />
from mdm_module_db_fileds_rule
<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="formName != null and formName != ''"> and form_name = #{formName} </if>
<if test="dbId != null and dbId != ''"> and db_id = #{dbId} </if>
<if test="filedId != null and filedId != ''"> and filed_id = #{filedId} </if>
<if test="ruleName != null and ruleName != ''"> and rule_name = #{ruleName} </if>
<if test="ruleCode != null and ruleCode != ''"> and rule_code = #{ruleCode} </if>
<if test="ruleValue != null and ruleValue != ''"> and rule_value = #{ruleValue} </if>
<if test="ruleType != null and ruleType != ''"> and rule_type = #{ruleType} </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>
,company_id
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-MdmModuleDbFiledsRuleEntity-result"
parameterType="com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
select
<include refid="MdmModuleDbFiledsRuleEntity_Base_Column_List"/>
from mdm_module_db_fileds_rule
<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="formName != null and formName != ''">and form_name = #{formName}</if>
<if test="dbId != null and dbId != ''">and db_id = #{dbId}</if>
<if test="filedId != null and filedId != ''">and filed_id = #{filedId}</if>
<if test="ruleName != null and ruleName != ''">and rule_name = #{ruleName}</if>
<if test="ruleCode != null and ruleCode != ''">and rule_code = #{ruleCode}</if>
<if test="ruleValue != null and ruleValue != ''">and rule_value = #{ruleValue}</if>
<if test="ruleType != null and ruleType != ''">and rule_type = #{ruleType}</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.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
select count(1) from mdm_module_db_fileds_rule
<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="formName != null and formName != ''"> and form_name = #{formName} </if>
<if test="dbId != null and dbId != ''"> and db_id = #{dbId} </if>
<if test="filedId != null and filedId != ''"> and filed_id = #{filedId} </if>
<if test="ruleName != null and ruleName != ''"> and rule_name = #{ruleName} </if>
<if test="ruleCode != null and ruleCode != ''"> and rule_code = #{ruleCode} </if>
<if test="ruleValue != null and ruleValue != ''"> and rule_value = #{ruleValue} </if>
<if test="ruleType != null and ruleType != ''"> and rule_type = #{ruleType} </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.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
select count(1) from mdm_module_db_fileds_rule
<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="formName != null and formName != ''">and form_name = #{formName}</if>
<if test="dbId != null and dbId != ''">and db_id = #{dbId}</if>
<if test="filedId != null and filedId != ''">and filed_id = #{filedId}</if>
<if test="ruleName != null and ruleName != ''">and rule_name = #{ruleName}</if>
<if test="ruleCode != null and ruleCode != ''">and rule_code = #{ruleCode}</if>
<if test="ruleValue != null and ruleValue != ''">and rule_value = #{ruleValue}</if>
<if test="ruleType != null and ruleType != ''">and rule_type = #{ruleType}</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-MdmModuleDbFiledsRuleEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
select
<include refid="MdmModuleDbFiledsRuleEntity_Base_Column_List" />
from mdm_module_db_fileds_rule
<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="formName != null and formName != ''"> and form_name like concat('%',#{formName},'%') </if>
<if test="dbId != null and dbId != ''"> and db_id like concat('%',#{dbId},'%') </if>
<if test="filedId != null and filedId != ''"> and filed_id like concat('%',#{filedId},'%') </if>
<if test="ruleName != null and ruleName != ''"> and rule_name like concat('%',#{ruleName},'%') </if>
<if test="ruleCode != null and ruleCode != ''"> and rule_code like concat('%',#{ruleCode},'%') </if>
<if test="ruleValue != null and ruleValue != ''"> and rule_value like concat('%',#{ruleValue},'%') </if>
<if test="ruleType != null and ruleType != ''"> and rule_type like concat('%',#{ruleType},'%') </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-MdmModuleDbFiledsRuleEntity-result"
parameterType="com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
select
<include refid="MdmModuleDbFiledsRuleEntity_Base_Column_List"/>
from mdm_module_db_fileds_rule
<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="formName != null and formName != ''">and form_name like concat('%',#{formName},'%')</if>
<if test="dbId != null and dbId != ''">and db_id like concat('%',#{dbId},'%')</if>
<if test="filedId != null and filedId != ''">and filed_id like concat('%',#{filedId},'%')</if>
<if test="ruleName != null and ruleName != ''">and rule_name like concat('%',#{ruleName},'%')</if>
<if test="ruleCode != null and ruleCode != ''">and rule_code like concat('%',#{ruleCode},'%')</if>
<if test="ruleValue != null and ruleValue != ''">and rule_value like concat('%',#{ruleValue},'%')</if>
<if test="ruleType != null and ruleType != ''">and rule_type like concat('%',#{ruleType},'%')</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="MdmModuleDbFiledsRuleentity_list_or" resultMap="get-MdmModuleDbFiledsRuleEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
select
<include refid="MdmModuleDbFiledsRuleEntity_Base_Column_List" />
from mdm_module_db_fileds_rule
<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="formName != null and formName != ''"> or form_name = #{formName} </if>
<if test="dbId != null and dbId != ''"> or db_id = #{dbId} </if>
<if test="filedId != null and filedId != ''"> or filed_id = #{filedId} </if>
<if test="ruleName != null and ruleName != ''"> or rule_name = #{ruleName} </if>
<if test="ruleCode != null and ruleCode != ''"> or rule_code = #{ruleCode} </if>
<if test="ruleValue != null and ruleValue != ''"> or rule_value = #{ruleValue} </if>
<if test="ruleType != null and ruleType != ''"> or rule_type = #{ruleType} </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="MdmModuleDbFiledsRuleentity_list_or" resultMap="get-MdmModuleDbFiledsRuleEntity-result"
parameterType="com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
select
<include refid="MdmModuleDbFiledsRuleEntity_Base_Column_List"/>
from mdm_module_db_fileds_rule
<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="formName != null and formName != ''">or form_name = #{formName}</if>
<if test="dbId != null and dbId != ''">or db_id = #{dbId}</if>
<if test="filedId != null and filedId != ''">or filed_id = #{filedId}</if>
<if test="ruleName != null and ruleName != ''">or rule_name = #{ruleName}</if>
<if test="ruleCode != null and ruleCode != ''">or rule_code = #{ruleCode}</if>
<if test="ruleValue != null and ruleValue != ''">or rule_value = #{ruleValue}</if>
<if test="ruleType != null and ruleType != ''">or rule_type = #{ruleType}</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.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity" >
insert into mdm_module_db_fileds_rule(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="mdmId != null and mdmId != ''"> mdm_id , </if>
<if test="formName != null and formName != ''"> form_name , </if>
<if test="dbId != null and dbId != ''"> db_id , </if>
<if test="filedId != null and filedId != ''"> filed_id , </if>
<if test="ruleName != null and ruleName != ''"> rule_name , </if>
<if test="ruleCode != null and ruleCode != ''"> rule_code , </if>
<if test="ruleValue != null and ruleValue != ''"> rule_value , </if>
<if test="ruleType != null and ruleType != ''"> rule_type , </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="formName != null and formName != ''"> #{formName} ,</if>
<if test="dbId != null and dbId != ''"> #{dbId} ,</if>
<if test="filedId != null and filedId != ''"> #{filedId} ,</if>
<if test="ruleName != null and ruleName != ''"> #{ruleName} ,</if>
<if test="ruleCode != null and ruleCode != ''"> #{ruleCode} ,</if>
<if test="ruleValue != null and ruleValue != ''"> #{ruleValue} ,</if>
<if test="ruleType != null and ruleType != ''"> #{ruleType} ,</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_fileds_rule(mdm_id, form_name, db_id, filed_id, rule_name, rule_code, rule_value, rule_type, 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.formName},#{entity.dbId},#{entity.filedId},#{entity.ruleName},#{entity.ruleCode},#{entity.ruleValue},#{entity.ruleType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" >
insert into mdm_module_db_fileds_rule(mdm_id, form_name, db_id, filed_id, rule_name, rule_code, rule_value, rule_type, 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.formName},#{entity.dbId},#{entity.filedId},#{entity.ruleName},#{entity.ruleCode},#{entity.ruleValue},#{entity.ruleType},#{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),
form_name = values(form_name),
db_id = values(db_id),
filed_id = values(filed_id),
rule_name = values(rule_name),
rule_code = values(rule_code),
rule_value = values(rule_value),
rule_type = values(rule_type),
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.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity" >
update mdm_module_db_fileds_rule set
<trim suffix="" suffixOverrides=",">
<if test="mdmId != null and mdmId != ''"> mdm_id = #{mdmId},</if>
<if test="formName != null and formName != ''"> form_name = #{formName},</if>
<if test="dbId != null and dbId != ''"> db_id = #{dbId},</if>
<if test="filedId != null and filedId != ''"> filed_id = #{filedId},</if>
<if test="ruleName != null and ruleName != ''"> rule_name = #{ruleName},</if>
<if test="ruleCode != null and ruleCode != ''"> rule_code = #{ruleCode},</if>
<if test="ruleValue != null and ruleValue != ''"> rule_value = #{ruleValue},</if>
<if test="ruleType != null and ruleType != ''"> rule_type = #{ruleType},</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.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity" >
update mdm_module_db_fileds_rule 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.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity" >
update mdm_module_db_fileds_rule 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="formName != null and formName != ''"> and form_name = #{formName} </if>
<if test="dbId != null and dbId != ''"> and db_id = #{dbId} </if>
<if test="filedId != null and filedId != ''"> and filed_id = #{filedId} </if>
<if test="ruleName != null and ruleName != ''"> and rule_name = #{ruleName} </if>
<if test="ruleCode != null and ruleCode != ''"> and rule_code = #{ruleCode} </if>
<if test="ruleValue != null and ruleValue != ''"> and rule_value = #{ruleValue} </if>
<if test="ruleType != null and ruleType != ''"> and rule_type = #{ruleType} </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>
<!--新增所有列-->
<insert id="entity_insert"
parameterType="com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
insert into mdm_module_db_fileds_rule(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''">id ,</if>
<if test="mdmId != null and mdmId != ''">mdm_id ,</if>
<if test="formName != null and formName != ''">form_name ,</if>
<if test="dbId != null and dbId != ''">db_id ,</if>
<if test="filedId != null and filedId != ''">filed_id ,</if>
<if test="ruleName != null and ruleName != ''">rule_name ,</if>
<if test="ruleCode != null and ruleCode != ''">rule_code ,</if>
<if test="ruleValue != null and ruleValue != ''">rule_value ,</if>
<if test="ruleType != null and ruleType != ''">rule_type ,</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="formName != null and formName != ''">#{formName} ,</if>
<if test="dbId != null and dbId != ''">#{dbId} ,</if>
<if test="filedId != null and filedId != ''">#{filedId} ,</if>
<if test="ruleName != null and ruleName != ''">#{ruleName} ,</if>
<if test="ruleCode != null and ruleCode != ''">#{ruleCode} ,</if>
<if test="ruleValue != null and ruleValue != ''">#{ruleValue} ,</if>
<if test="ruleType != null and ruleType != ''">#{ruleType} ,</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_fileds_rule(mdm_id, form_name, db_id, filed_id, rule_name, rule_code, rule_value,
rule_type, 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.formName},#{entity.dbId},#{entity.filedId},#{entity.ruleName},#{entity.ruleCode},#{entity.ruleValue},#{entity.ruleType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},
'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch">
insert into mdm_module_db_fileds_rule(mdm_id, form_name, db_id, filed_id, rule_name, rule_code, rule_value,
rule_type, 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.formName},#{entity.dbId},#{entity.filedId},#{entity.ruleName},#{entity.ruleCode},#{entity.ruleValue},#{entity.ruleType},#{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),
form_name = values(form_name),
db_id = values(db_id),
filed_id = values(filed_id),
rule_name = values(rule_name),
rule_code = values(rule_code),
rule_value = values(rule_value),
rule_type = values(rule_type),
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.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
update mdm_module_db_fileds_rule set
<trim suffix="" suffixOverrides=",">
<if test="mdmId != null and mdmId != ''">mdm_id = #{mdmId},</if>
<if test="formName != null and formName != ''">form_name = #{formName},</if>
<if test="dbId != null and dbId != ''">db_id = #{dbId},</if>
<if test="filedId != null and filedId != ''">filed_id = #{filedId},</if>
<if test="ruleName != null and ruleName != ''">rule_name = #{ruleName},</if>
<if test="ruleCode != null and ruleCode != ''">rule_code = #{ruleCode},</if>
<if test="ruleValue != null and ruleValue != ''">rule_value = #{ruleValue},</if>
<if test="ruleType != null and ruleType != ''">rule_type = #{ruleType},</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.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
update mdm_module_db_fileds_rule
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.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity">
update mdm_module_db_fileds_rule 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="formName != null and formName != ''">and form_name = #{formName}</if>
<if test="dbId != null and dbId != ''">and db_id = #{dbId}</if>
<if test="filedId != null and filedId != ''">and filed_id = #{filedId}</if>
<if test="ruleName != null and ruleName != ''">and rule_name = #{ruleName}</if>
<if test="ruleCode != null and ruleCode != ''">and rule_code = #{ruleCode}</if>
<if test="ruleValue != null and ruleValue != ''">and rule_value = #{ruleValue}</if>
<if test="ruleType != null and ruleType != ''">and rule_type = #{ruleType}</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">
delete from mdm_module_db_fileds_rule where id = #{id}
</delete>
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
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
<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>
<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>
<!-- 查询列表 字段采用or格式 -->
<select id="queryServiceQuote" resultMap="get-MdmModuleDbFiledsRuleEntity-result">
SELECT filed_id,
db_id,
mdm_id
from (
SELECT filed_id,
db_id,
mdm_id,
COUNT(*) as num
FROM mdm_module_db_fileds_rule
WHERE `sts` = 'Y'
and (
(rule_code = 'type' and rule_value = 'treeselect')
or (rule_code = 'service' and rule_value = #{service})
or (rule_code = 'upId' and rule_value = #{upId})
)
GROUP BY filed_id, db_id, mdm_id) a
WHERE a.num = 3
</select>
</mapper>

View File

@ -1,8 +1,11 @@
package com.hzya.frame.mdm.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.mdm.entity.MdmDataFiledDto;
import com.hzya.frame.web.entity.JsonResultEntity;
import java.util.List;
/**
* 主数据服务接口
*/
@ -118,6 +121,15 @@ public interface IMdmService {
* @Date 9:40 上午 2023/10/18
**/
JsonResultEntity doMdmDistribute(JSONObject jsonObject) throws Exception;
/**
* @Author lvleigang
* @Description 修改树结构的下级以及其他使用地方数据
* @Date 9:12 上午 2024/8/2
* @param mdmId 主数据mdmId
* @param tableName 主数据的表名
* @param id 数据id
* @param mdmDataFiledDtos 数据
* @return void
**/
void updateTreeUseData(String mdmId, String tableName, String id, List<MdmDataFiledDto> mdmDataFiledDtos);
}

View File

@ -2537,6 +2537,7 @@ public class MdmServiceImpl implements IMdmService {
JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName());
//保存数据
MdmDataDto mdmDataDto = new MdmDataDto();
mdmDataDto.setMdmId(mdmModuleEntity.getId());
mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName());
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId());
@ -2611,6 +2612,11 @@ public class MdmServiceImpl implements IMdmService {
mdmDataDto.setId(jsonObject.getString("id"));
id = jsonObject.getString("id");
updateTreeUseData(mdmModuleEntity.getId(),mdmDataDto.getTableName(),id,mdmDataFiledDtos);
int a = mdmModuleDao.updateForm(mdmDataDto);
} else {
@ -2762,6 +2768,7 @@ public class MdmServiceImpl implements IMdmService {
mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos);
if (jsonObject.getString("id") != null) {
mdmDataDto.setId(jsonObject.getString("id"));
int a = mdmModuleDao.updateForm(mdmDataDto);
} else {
mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType());
@ -2776,6 +2783,132 @@ public class MdmServiceImpl implements IMdmService {
return str.toString();
}
/**
* @Author lvleigang
* @Description 修改树结构的下级以及其他使用地方数据
* @Date 9:12 上午 2024/8/2
* @param mdmId 主数据mdmId
* @param tableName 主数据的表名
* @param id 数据id
* @param mdmDataFiledDtos 数据
* @return void
**/
public void updateTreeUseData(String mdmId, String tableName, String id, List<MdmDataFiledDto> mdmDataFiledDtos) {
//查询是否设置的树形
MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity();
mdmModuleViewEntity.setMdmId(mdmId);
mdmModuleViewEntity.setViewName("1");
mdmModuleViewEntity.setSts("Y");
List<MdmModuleViewEntity> moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity);
if (moduleViewEntityList != null && moduleViewEntityList.size() == 1) {
mdmModuleViewEntity = moduleViewEntityList.get(0);
//查询数据
Map<String, Object> queryData = new HashMap<>();
queryData.put("tableName", tableName);//表名
queryData.put("detailFlag", false);//是否明细
queryData.put("id", id);//字段
HashMap<String, Object> datas = mdmModuleDbDao.getServiceDataById(queryData);
convertKeysToLowerCase(datas);
//对比值是否有修改
boolean upFlag = false;
String oldData = "";
String newData = "";
for (int i1 = 0; i1 < mdmDataFiledDtos.size(); i1++) {
if (mdmDataFiledDtos.get(i1).getFiledsName().equals(mdmModuleViewEntity.getUpIdFiled())) {
newData = mdmDataFiledDtos.get(i1).getFiledsValue();
oldData = datas.get(mdmDataFiledDtos.get(i1).getFiledsName()).toString();
if (mdmDataFiledDtos.get(i1).getFiledsValue().equals(datas.get(mdmDataFiledDtos.get(i1).getFiledsName()).toString())) {
upFlag = true;
break;
}
}
}
if (!"".equals(oldData)) {
oldData = oldData + "," + id;
} else {
oldData = id;
}
if (!"".equals(newData)) {
newData = newData + "," + id;
} else {
newData = id;
}
if (!upFlag) {
//查询引用地方
Map<String, String> maps = new HashMap<>();
maps.put("service", tableName);
maps.put("upId", mdmModuleViewEntity.getUpIdFiled());
//maps.put("mdmId",mdmModuleEntity.getId());
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryServiceQuote(maps);
if (mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0) {
for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
//查询字段
String upFiled = "";
MdmModuleDbFiledsEntity moduleDbFiledsEntity = new MdmModuleDbFiledsEntity();
moduleDbFiledsEntity.setMdmId(mdmModuleDbFiledsRuleEntities.get(i1).getMdmId());
moduleDbFiledsEntity.setSts("Y");
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(moduleDbFiledsEntity);
if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) {
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
upFiled = mdmModuleDbFiledsEntities.get(i2).getEnName();
}
}
}
//修改引用数据
//查看是否主表
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
mdmModuleDbEntity.setMdmId(mdmModuleDbFiledsRuleEntities.get(i1).getMdmId());
mdmModuleDbEntity.setSts("Y");
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
//设置主表
String mainDBTable = "";
String dataDBTable = "";
if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0) {
for (int i2 = 0; i2 < mdmModuleDbEntities.size(); i2++) {
//主表
if ("1".equals(mdmModuleDbEntities.get(i2).getDbType())) {
mainDBTable = mdmModuleDbEntities.get(i2).getDbName();
}
if (mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i2).getId())) {
dataDBTable = mdmModuleDbEntities.get(i2).getDbName();
}
}
}
if (mainDBTable.equals(dataDBTable)) {//主表上的字段
Map<String, String> updateMaps = new HashMap<>();
updateMaps.put("tableName", dataDBTable);
updateMaps.put("upFiled", upFiled);
updateMaps.put("oldData", oldData);
updateMaps.put("newData", newData);
updateMaps.put("modify_user_id", StpUtil.getLoginIdAsString());
mdmModuleDao.updataTreeUpData(updateMaps);
} else {//明细表上的字段
Map<String, String> updateMaps = new HashMap<>();
updateMaps.put("mainDBTable", mainDBTable);
updateMaps.put("tableName", dataDBTable);
updateMaps.put("upFiled", upFiled);
updateMaps.put("oldData", oldData);
updateMaps.put("newData", newData);
updateMaps.put("modify_user_id", StpUtil.getLoginIdAsString());
mdmModuleDao.updataTreeUpDataDetail(updateMaps);
}
}
}
}
}
}
/**
* @param jsonObject