主数据下发,重新发送

This commit is contained in:
lvleigang 2024-06-19 10:16:47 +08:00
parent 2d4b3af64c
commit 0ba8aebf25
13 changed files with 235 additions and 48 deletions

View File

@ -13,6 +13,8 @@ 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.service.IMdmServiceCache;
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
@ -57,7 +59,7 @@ import java.util.Map;
public class MdmModulePluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(MdmModulePluginInitializer.class);
@Resource
private IIntegrationTaskLivingDetailsDao integrationTaskLivingDetailsDao;
private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao;
@Resource
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Resource
@ -176,6 +178,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
return BaseResult.getFailureMessageEntity("分发已停用");
}
MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ;
mdmModuleDistributeDetailEntity.setDistributeId(distributeId);
mdmModuleDistributeDetailEntity.setSts("Y");
List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity);
// 启用停用 0停用
//if("1".equals(mdmModuleDistributeEntity.getEnabledType())){
// taskDetailEntity.setResult("分发为手动下发");
@ -221,7 +228,6 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
taskDetailEntity.setResult("应用不存在");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("应用不存在");
}
//获取主数据db字段以及字段的规则
@ -232,11 +238,12 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
queryFildRule.setMdmId(mdmModuleEntity.getId());
queryFildRule.setRuleCode("service");
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
//获取主数据db对应的实体表的数据
JSONObject object = new JSONObject();
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
if("1".equals(mdmModuleDbEntities.get(i).getDbType())){
Map<String,String> map = new HashMap<>();
Map<String,Object> map = new HashMap<>();
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
map.put("documentRule",documentRule);
object = mdmModuleDao.queryMdmST(map);
@ -245,6 +252,20 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("当前数据不存在");
}
if(mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0){
for (int i1 = 0; i1 < mdmModuleDistributeDetailEntities.size(); i1++) {
Map<String,Object> checkData = new HashMap<>();
checkData.put("tableName",mdmModuleDbEntities.get(i).getDbName());
checkData.put("documentRule",documentRule);
checkData.put("mdmModuleDistributeDetailEntities",mdmModuleDistributeDetailEntities);
JSONObject object1 = mdmModuleDao.queryMdmST(checkData);
if(object1.getString("id") == null || "".equals(object1.getString("id")) ){
taskDetailEntity.setResult("当前数据不符合规则不发送");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送");
}
}
}
//查看主表是否有字段是关联的
if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){
for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
@ -252,7 +273,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
Map<String,String> mapDetail = new HashMap<>();
Map<String,Object> mapDetail = new HashMap<>();
mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
mapDetail.put("id",object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
@ -281,7 +302,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
for (int i3 = 0; i3 < detail.size(); i3++) {
Map<String,String> mapDetail = new HashMap<>();
Map<String,Object> mapDetail = new HashMap<>();
mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
mapDetail.put("id",detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
@ -326,7 +347,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
}catch (Exception e){
taskDetailEntity.setResult("分发脚本转换错误");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
//return BaseResult.getFailureMessageEntity("分发脚本转换错误");
return BaseResult.getFailureMessageEntity("分发脚本转换错误");
}
}
Map<String, String> headers = new HashMap<>();

View File

@ -49,7 +49,7 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> {
Integer deleteTable(Map<String, Object> maps);
JSONObject queryMdmST(Map<String, String> maps);
JSONObject queryMdmST(Map<String, Object> maps);
List<JSONObject> queryMdmSTDetail(Map<String, String> maps);
}

View File

@ -148,7 +148,7 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
}
@Override
public JSONObject queryMdmST(Map<String, String> maps) {
public JSONObject queryMdmST(Map<String, Object> maps) {
JSONObject o = (JSONObject) super.selectOne(getSqlIdPrifx() + "queryMdmST", maps);
return o;
}

View File

@ -801,6 +801,36 @@ where id = #{id}
<trim prefix="where" prefixOverrides="and">
<if test="documentRule != null and documentRule !='' ">and document_rule = #{documentRule}</if>
<if test="id != null and id !='' ">and id = #{id}</if>
<if test="mdmModuleDistributeDetailEntities != null and mdmModuleDistributeDetailEntities.size>0">
AND
<foreach collection="mdmModuleDistributeDetailEntities" item="item" index="index" open="(" close=")" separator=",">
${item.leftBracket} ${item.filedName}
<choose>
<when test="item.compareType == '1'.toString() ">
=
</when>
<when test="item.compareType == '2'.toString() ">
!=
</when>
<when test="item.compareType == '3'.toString() ">
&gt;
</when>
<when test="item.compareType == '4'.toString() ">
&lt;
</when>
</choose>
#{item.filedVaule}
<choose>
<when test="item.connectionSymbol == '1'.toString() ">
and
</when>
<when test="item.connectionSymbol == '2'.toString() ">
or
</when>
</choose>
${item.rightParenthesis}
</foreach>
</if>
and sts = 'Y'
</trim>
</select>

View File

@ -619,6 +619,23 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
source_name.setDataType("1");
mdmModuleDbFiledsEntities.add(source_name);
MdmModuleDbFiledsEntity data_type = new MdmModuleDbFiledsEntity();
data_type.setMdmId(entity.getMdmId());
data_type.setDbId(entity.getId());
data_type.setEnName("data_type");
data_type.setChName("状态");
data_type.setFiledType("3");
data_type.setAddType("1");
data_type.setUpdateType("1");
data_type.setShowType("1");
data_type.setQueryType("1");
data_type.setListType("1");
data_type.setViewType("1");
data_type.setFiledLength("255");
data_type.setCreate();
data_type.setDataType("1");
mdmModuleDbFiledsEntities.add(data_type);
MdmModuleDbFiledsEntity code = new MdmModuleDbFiledsEntity();
code.setMdmId(entity.getMdmId());
code.setDbId(entity.getId());

View File

@ -17,6 +17,8 @@ public class MdmModuleOptionLogEntity extends BaseEntity {
private String formmainId;
/** 来源名称 */
private String sourceName;
/** 状态 1、成功2、失败 */
private String dataType;
/** 编码 */
private String code;
/** source_data */
@ -28,6 +30,13 @@ public class MdmModuleOptionLogEntity extends BaseEntity {
/** 公司id */
private String companyId;
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getFormmainId() {
return formmainId;

View File

@ -6,6 +6,7 @@
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="formmainId" column="formmain_id" jdbcType="VARCHAR"/>
<result property="sourceName" column="source_name" jdbcType="VARCHAR"/>
<result property="dataType" column="data_type" jdbcType="VARCHAR"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="sourceData" column="source_data" jdbcType="VARCHAR"/>
<result property="optionType" column="option_type" jdbcType="VARCHAR"/>
@ -24,7 +25,8 @@
id
,formmain_id
,source_name
,code
,data_type
,code
,source_data
,option_type
,option_name
@ -51,6 +53,7 @@
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="formmainId != null and formmainId != ''"> and formmain_id = #{formmainId} </if>
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
<if test="code != null and code != ''"> and code = #{code} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
@ -76,6 +79,7 @@
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="formmainId != null and formmainId != ''"> and formmain_id = #{formmainId} </if>
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
<if test="code != null and code != ''"> and code = #{code} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
@ -103,6 +107,7 @@
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="formmainId != null and formmainId != ''"> and formmain_id like concat('%',#{formmainId},'%') </if>
<if test="sourceName != null and sourceName != ''"> and source_name like concat('%',#{sourceName},'%') </if>
<if test="dataType != null and dataType != ''"> and data_type like concat('%',#{dataType},'%') </if>
<if test="code != null and code != ''"> and code like concat('%',#{code},'%') </if>
<if test="sourceData != null and sourceData != ''"> and source_data like concat('%',#{sourceData},'%') </if>
<if test="optionType != null and optionType != ''"> and option_type like concat('%',#{optionType},'%') </if>
@ -130,6 +135,7 @@
<if test="id != null and id != ''"> or id = #{id} </if>
<if test="formmainId != null and formmainId != ''"> or formmain_id = #{formmainId} </if>
<if test="sourceName != null and sourceName != ''"> or source_name = #{sourceName} </if>
<if test="dataType != null and dataType != ''"> or data_type = #{dataType} </if>
<if test="code != null and code != ''"> or code = #{code} </if>
<if test="sourceData != null and sourceData != ''"> or source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> or option_type = #{optionType} </if>
@ -155,6 +161,7 @@
<if test="id != null and id != ''"> id , </if>
<if test="formmainId != null and formmainId != ''"> formmain_id , </if>
<if test="sourceName != null and sourceName != ''"> source_name , </if>
<if test="dataType != null and dataType != ''"> data_type , </if>
<if test="code != null and code != ''"> code , </if>
<if test="sourceData != null and sourceData != ''"> source_data , </if>
<if test="optionType != null and optionType != ''"> option_type , </if>
@ -174,6 +181,7 @@
<if test="id != null and id != ''"> #{id} ,</if>
<if test="formmainId != null and formmainId != ''"> #{formmainId} ,</if>
<if test="sourceName != null and sourceName != ''"> #{sourceName} ,</if>
<if test="dataType != null and dataType != ''"> #{dataType} ,</if>
<if test="code != null and code != ''"> #{code} ,</if>
<if test="sourceData != null and sourceData != ''"> #{sourceData} ,</if>
<if test="optionType != null and optionType != ''"> #{optionType} ,</if>
@ -192,22 +200,23 @@
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" >
insert into ${tableName}(formmain_id, source_name, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
insert into ${tableName}(formmain_id, source_name,data_type, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.formmainId},#{entity.sourceName},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
(#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{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 ${tableName}(formmain_id, source_name, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
insert into ${tableName}(formmain_id, source_name,data_type, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.formmainId},#{entity.sourceName},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
(#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{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
formmain_id = values(formmain_id),
source_name = values(source_name),
data_type = values(data_type),
code = values(code),
source_data = values(source_data),
option_type = values(option_type),
@ -225,6 +234,7 @@ update ${tableName} set
<trim suffix="" suffixOverrides=",">
<if test="formmainId != null and formmainId != ''"> formmain_id = #{formmainId},</if>
<if test="sourceName != null and sourceName != ''"> source_name = #{sourceName},</if>
<if test="dataType != null and dataType != ''"> data_type = #{dataType},</if>
<if test="code != null and code != ''"> code = #{code},</if>
<if test="sourceData != null and sourceData != ''"> source_data = #{sourceData},</if>
<if test="optionType != null and optionType != ''"> option_type = #{optionType},</if>
@ -251,6 +261,7 @@ update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id =
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="formmainId != null and formmainId != ''"> and formmain_id = #{formmainId} </if>
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
<if test="code != null and code != ''"> and code = #{code} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>

View File

@ -9,19 +9,17 @@ import java.util.List;
* 主数据数据来源(mdm_module_source: table)表数据库访问层
*
* @author makejava
* @since 2024-06-05 11:42:56
* @since 2024-06-19 09:11:50
*/
public interface IMdmModuleSourceDao extends IBaseDao<MdmModuleSourceEntity, String> {
/**
*
*
* @content 根据数据来源内类型是插件的应用类型做分组
* @Param
* @Return
* @Author hecan
* @Param
* @Return
* @Author hecan
* @Date 2024/6/6 10:43
* **/
List<MdmModuleSourceEntity> MdmModuleSourceentityGroupByType();
}

View File

@ -11,10 +11,11 @@ import java.util.List;
* 主数据数据来源(MdmModuleSource)表数据库访问层
*
* @author makejava
* @since 2024-06-05 11:42:56
* @since 2024-06-19 09:11:50
*/
@Repository(value = "MdmModuleSourceDaoImpl")
public class MdmModuleSourceDaoImpl extends MybatisGenericDao<MdmModuleSourceEntity, String> implements IMdmModuleSourceDao{
//根据数据来源内类型是插件的应用类型做分组
@Override
public List<MdmModuleSourceEntity> MdmModuleSourceentityGroupByType() {
@ -22,7 +23,5 @@ public class MdmModuleSourceDaoImpl extends MybatisGenericDao<MdmModuleSourceEnt
return list;
}
}

View File

@ -6,7 +6,7 @@ import com.hzya.frame.web.entity.BaseEntity;
* 主数据数据来源(MdmModuleSource)实体类
*
* @author makejava
* @since 2024-06-05 11:42:57
* @since 2024-06-19 09:11:50
*/
public class MdmModuleSourceEntity extends BaseEntity {
@ -14,13 +14,24 @@ public class MdmModuleSourceEntity extends BaseEntity {
private String mdmId;
/** 来源类型1、插件2、api */
private String sourceType;
/** 来源名称 */
/** 来源应用 */
private String sourceName;
/** 触发类型 1、手动 2、自动 */
private String triggerType;
/** 来源编码 */
private String sourceCode;
/** 新增接口 */
private String addApi;
/** 修改接口 */
private String updateApi;
/** 删除接口 */
private String deleteApi;
/** 启用停用 0、停用1、启用 */
private String enabledState;
/** 公司id */
private String companyId;
private String pluginCode;//插件编码
/** 公司id */
private String pluginCode;
public String getPluginCode() {
return pluginCode;
@ -54,6 +65,14 @@ public class MdmModuleSourceEntity extends BaseEntity {
this.sourceName = sourceName;
}
public String getTriggerType() {
return triggerType;
}
public void setTriggerType(String triggerType) {
this.triggerType = triggerType;
}
public String getSourceCode() {
return sourceCode;
}
@ -62,6 +81,38 @@ public class MdmModuleSourceEntity extends BaseEntity {
this.sourceCode = sourceCode;
}
public String getAddApi() {
return addApi;
}
public void setAddApi(String addApi) {
this.addApi = addApi;
}
public String getUpdateApi() {
return updateApi;
}
public void setUpdateApi(String updateApi) {
this.updateApi = updateApi;
}
public String getDeleteApi() {
return deleteApi;
}
public void setDeleteApi(String deleteApi) {
this.deleteApi = deleteApi;
}
public String getEnabledState() {
return enabledState;
}
public void setEnabledState(String enabledState) {
this.enabledState = enabledState;
}
public String getCompanyId() {
return companyId;
}

View File

@ -7,7 +7,12 @@
<result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/>
<result property="sourceType" column="source_type" jdbcType="VARCHAR"/>
<result property="sourceName" column="source_name" jdbcType="VARCHAR"/>
<result property="triggerType" column="trigger_type" jdbcType="VARCHAR"/>
<result property="sourceCode" column="source_code" jdbcType="VARCHAR"/>
<result property="addApi" column="add_api" jdbcType="VARCHAR"/>
<result property="updateApi" column="update_api" jdbcType="VARCHAR"/>
<result property="deleteApi" column="delete_api" jdbcType="VARCHAR"/>
<result property="enabledState" column="enabled_state" 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"/>
@ -23,7 +28,12 @@
,mdm_id
,source_type
,source_name
,trigger_type
,source_code
,add_api
,update_api
,delete_api
,enabled_state
,sorts
,create_user_id
,create_time
@ -33,11 +43,6 @@
,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
@ -48,7 +53,12 @@
<if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if>
<if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if>
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
<if test="triggerType != null and triggerType != ''"> and trigger_type = #{triggerType} </if>
<if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if>
<if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if>
<if test="updateApi != null and updateApi != ''"> and update_api = #{updateApi} </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="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>
@ -71,7 +81,12 @@
<if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if>
<if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if>
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
<if test="triggerType != null and triggerType != ''"> and trigger_type = #{triggerType} </if>
<if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if>
<if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if>
<if test="updateApi != null and updateApi != ''"> and update_api = #{updateApi} </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="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>
@ -96,7 +111,12 @@
<if test="mdmId != null and mdmId != ''"> and mdm_id like concat('%',#{mdmId},'%') </if>
<if test="sourceType != null and sourceType != ''"> and source_type like concat('%',#{sourceType},'%') </if>
<if test="sourceName != null and sourceName != ''"> and source_name like concat('%',#{sourceName},'%') </if>
<if test="triggerType != null and triggerType != ''"> and trigger_type like concat('%',#{triggerType},'%') </if>
<if test="sourceCode != null and sourceCode != ''"> and source_code like concat('%',#{sourceCode},'%') </if>
<if test="addApi != null and addApi != ''"> and add_api like concat('%',#{addApi},'%') </if>
<if test="updateApi != null and updateApi != ''"> and update_api like concat('%',#{updateApi},'%') </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="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>
@ -121,7 +141,12 @@
<if test="mdmId != null and mdmId != ''"> or mdm_id = #{mdmId} </if>
<if test="sourceType != null and sourceType != ''"> or source_type = #{sourceType} </if>
<if test="sourceName != null and sourceName != ''"> or source_name = #{sourceName} </if>
<if test="triggerType != null and triggerType != ''"> or trigger_type = #{triggerType} </if>
<if test="sourceCode != null and sourceCode != ''"> or source_code = #{sourceCode} </if>
<if test="addApi != null and addApi != ''"> or add_api = #{addApi} </if>
<if test="updateApi != null and updateApi != ''"> or update_api = #{updateApi} </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="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>
@ -136,23 +161,20 @@
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 根据数据来源内类型是插件的应用类型做分组 -->
<select id="queryMdmModuleSourceentityGroupByType" resultMap="get-MdmModuleSourceEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity">
select plugin_code,plugin_name,source_name,source_code
from mdm_module_source source
left join sys_application_plugin plug on plug.id=source.source_code
where source_type='1' and source.sts='Y' and plug.sts='Y'
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity" >
<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity" keyProperty="id" useGeneratedKeys="true">
insert into mdm_module_source(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="mdmId != null and mdmId != ''"> mdm_id , </if>
<if test="sourceType != null and sourceType != ''"> source_type , </if>
<if test="sourceName != null and sourceName != ''"> source_name , </if>
<if test="triggerType != null and triggerType != ''"> trigger_type , </if>
<if test="sourceCode != null and sourceCode != ''"> source_code , </if>
<if test="addApi != null and addApi != ''"> add_api , </if>
<if test="updateApi != null and updateApi != ''"> update_api , </if>
<if test="deleteApi != null and deleteApi != ''"> delete_api , </if>
<if test="enabledState != null and enabledState != ''"> enabled_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>
@ -161,6 +183,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(
@ -169,7 +192,12 @@
<if test="mdmId != null and mdmId != ''"> #{mdmId} ,</if>
<if test="sourceType != null and sourceType != ''"> #{sourceType} ,</if>
<if test="sourceName != null and sourceName != ''"> #{sourceName} ,</if>
<if test="triggerType != null and triggerType != ''"> #{triggerType} ,</if>
<if test="sourceCode != null and sourceCode != ''"> #{sourceCode} ,</if>
<if test="addApi != null and addApi != ''"> #{addApi} ,</if>
<if test="updateApi != null and updateApi != ''"> #{updateApi} ,</if>
<if test="deleteApi != null and deleteApi != ''"> #{deleteApi} ,</if>
<if test="enabledState != null and enabledState != ''"> #{enabledState} ,</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>
@ -178,30 +206,36 @@
<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_source a WHERE a.sts = 'Y' ),</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" >
insert into mdm_module_source(mdm_id, source_type, source_name, source_code, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mdm_module_source(mdm_id, source_type, source_name, trigger_type, source_code, add_api, update_api, delete_api, enabled_state, 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.sourceType},#{entity.sourceName},#{entity.sourceCode},#{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.sourceType},#{entity.sourceName},#{entity.triggerType},#{entity.sourceCode},#{entity.addApi},#{entity.updateApi},#{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')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" >
insert into mdm_module_source(mdm_id, source_type, source_name, source_code, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into mdm_module_source(mdm_id, source_type, source_name, trigger_type, source_code, add_api, update_api, delete_api, enabled_state, 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.sourceType},#{entity.sourceName},#{entity.sourceCode},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
(#{entity.mdmId},#{entity.sourceType},#{entity.sourceName},#{entity.triggerType},#{entity.sourceCode},#{entity.addApi},#{entity.updateApi},#{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})
</foreach>
on duplicate key update
mdm_id = values(mdm_id),
source_type = values(source_type),
source_name = values(source_name),
trigger_type = values(trigger_type),
source_code = values(source_code),
add_api = values(add_api),
update_api = values(update_api),
delete_api = values(delete_api),
enabled_state = values(enabled_state),
create_user_id = values(create_user_id),
create_time = values(create_time),
modify_user_id = values(modify_user_id),
@ -216,7 +250,12 @@ update mdm_module_source set
<if test="mdmId != null and mdmId != ''"> mdm_id = #{mdmId},</if>
<if test="sourceType != null and sourceType != ''"> source_type = #{sourceType},</if>
<if test="sourceName != null and sourceName != ''"> source_name = #{sourceName},</if>
<if test="triggerType != null and triggerType != ''"> trigger_type = #{triggerType},</if>
<if test="sourceCode != null and sourceCode != ''"> source_code = #{sourceCode},</if>
<if test="addApi != null and addApi != ''"> add_api = #{addApi},</if>
<if test="updateApi != null and updateApi != ''"> update_api = #{updateApi},</if>
<if test="deleteApi != null and deleteApi != ''"> delete_api = #{deleteApi},</if>
<if test="enabledState != null and enabledState != ''"> enabled_state = #{enabledState},</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>
@ -240,7 +279,12 @@ update mdm_module_source set sts= 'N' ,modify_time = #{modify_time},modify_user
<if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if>
<if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if>
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
<if test="triggerType != null and triggerType != ''"> and trigger_type = #{triggerType} </if>
<if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if>
<if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if>
<if test="updateApi != null and updateApi != ''"> and update_api = #{updateApi} </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="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>
@ -251,6 +295,13 @@ update mdm_module_source set sts= 'N' ,modify_time = #{modify_time},modify_user
<delete id="entity_delete">
delete from mdm_module_source where id = #{id}
</delete>
<!-- 根据数据来源内类型是插件的应用类型做分组 -->
<select id="queryMdmModuleSourceentityGroupByType" resultMap="get-MdmModuleSourceEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity">
select plugin_code,plugin_name,source_name,source_code
from mdm_module_source source
left join sys_application_plugin plug on plug.id=source.source_code
where source_type='1' and source.sts='Y' and plug.sts='Y'
</select>
</mapper>

View File

@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService;
* 主数据数据来源(MdmModuleSource)表服务接口
*
* @author makejava
* @since 2024-06-05 11:42:57
* @since 2024-06-19 09:11:50
*/
public interface IMdmModuleSourceService extends IBaseService<MdmModuleSourceEntity, String>{
}

View File

@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService;
* 主数据数据来源(MdmModuleSource)表服务实现类
*
* @author makejava
* @since 2024-06-05 11:42:57
* @since 2024-06-19 09:11:50
*/
@Service(value = "mdmModuleSourceService")
public class MdmModuleSourceServiceImpl extends BaseService<MdmModuleSourceEntity, String> implements IMdmModuleSourceService {