Merge branches 'dev' and 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project

This commit is contained in:
lvleigang 2024-06-11 10:05:33 +08:00
commit 08994cefb1
27 changed files with 1965 additions and 62 deletions

View File

@ -0,0 +1,15 @@
package masterData.dao;
import masterData.entity.MdmOrgEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* 组织档案(mdm_org: table)表数据库访问层
*
* @author makejava
* @since 2024-06-07 18:30:04
*/
public interface IMdmOrgDao extends IBaseDao<MdmOrgEntity, String> {
}

View File

@ -0,0 +1,16 @@
package masterData.dao.impl;
import masterData.entity.MdmOrgEntity;
import masterData.dao.IMdmOrgDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* 组织档案(MdmOrg)表数据库访问层
*
* @author makejava
* @since 2024-06-07 18:30:04
*/
public class MdmOrgDaoImpl extends MybatisGenericDao<MdmOrgEntity, String> implements IMdmOrgDao{
}

View File

@ -0,0 +1,196 @@
package masterData.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 组织档案(MdmOrg)实体类
*
* @author makejava
* @since 2024-06-07 18:30:04
*/
public class MdmOrgEntity extends BaseEntity {
/** 单据规则 */
private String documentRule;
/** 单据规则流水号 */
private Long documentRuleNum;
/** 组织编码 */
private String orgCode;
/** 组织名称 */
private String orgName;
/** 地址 */
private String orgAddress;
/** 国家地区 */
private String orgCountryzone;
/** 内部编码 */
private String orgInnercode;
/** 说明 */
private String orgMemo;
/** 助记码 */
private String orgMnecode;
/** 所属行业 */
private String orgNcindustry;
/** 上级业务单元 */
private String orgFatherorg;
/** 负责人 */
private String orgPrincipal;
/** 电话 */
private String orgTel;
/** 数据状态 Y正常 N删除 F修改 */
private String dataStatus;
/** 新增数据状态 0待下发 1已下发 */
private String addStatus;
/** 修改数据状态 0待下发 1已下发 */
private String updateStatus;
/** 删除数据状态 0待下发 1已下发 */
private String deleteStatus;
/** 公司id */
private String companyId;
public String getDocumentRule() {
return documentRule;
}
public void setDocumentRule(String documentRule) {
this.documentRule = documentRule;
}
public Long getDocumentRuleNum() {
return documentRuleNum;
}
public void setDocumentRuleNum(Long documentRuleNum) {
this.documentRuleNum = documentRuleNum;
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public String getOrgName() {
return orgName;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public String getOrgAddress() {
return orgAddress;
}
public void setOrgAddress(String orgAddress) {
this.orgAddress = orgAddress;
}
public String getOrgCountryzone() {
return orgCountryzone;
}
public void setOrgCountryzone(String orgCountryzone) {
this.orgCountryzone = orgCountryzone;
}
public String getOrgInnercode() {
return orgInnercode;
}
public void setOrgInnercode(String orgInnercode) {
this.orgInnercode = orgInnercode;
}
public String getOrgMemo() {
return orgMemo;
}
public void setOrgMemo(String orgMemo) {
this.orgMemo = orgMemo;
}
public String getOrgMnecode() {
return orgMnecode;
}
public void setOrgMnecode(String orgMnecode) {
this.orgMnecode = orgMnecode;
}
public String getOrgNcindustry() {
return orgNcindustry;
}
public void setOrgNcindustry(String orgNcindustry) {
this.orgNcindustry = orgNcindustry;
}
public String getOrgFatherorg() {
return orgFatherorg;
}
public void setOrgFatherorg(String orgFatherorg) {
this.orgFatherorg = orgFatherorg;
}
public String getOrgPrincipal() {
return orgPrincipal;
}
public void setOrgPrincipal(String orgPrincipal) {
this.orgPrincipal = orgPrincipal;
}
public String getOrgTel() {
return orgTel;
}
public void setOrgTel(String orgTel) {
this.orgTel = orgTel;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public String getAddStatus() {
return addStatus;
}
public void setAddStatus(String addStatus) {
this.addStatus = addStatus;
}
public String getUpdateStatus() {
return updateStatus;
}
public void setUpdateStatus(String updateStatus) {
this.updateStatus = updateStatus;
}
public String getDeleteStatus() {
return deleteStatus;
}
public void setDeleteStatus(String deleteStatus) {
this.deleteStatus = deleteStatus;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
}

View File

@ -0,0 +1,388 @@
<?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="masterData.dao.impl.MdmOrgDaoImpl">
<resultMap id="get-MdmOrgEntity-result" type="masterData.entity.MdmOrgEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="documentRule" column="document_rule" jdbcType="VARCHAR"/>
<result property="documentRuleNum" column="document_rule_num" jdbcType="INTEGER"/>
<result property="orgCode" column="org_code" jdbcType="VARCHAR"/>
<result property="orgName" column="org_name" jdbcType="VARCHAR"/>
<result property="orgAddress" column="org_address" jdbcType="VARCHAR"/>
<result property="orgCountryzone" column="org_countryzone" jdbcType="VARCHAR"/>
<result property="orgInnercode" column="org_innercode" jdbcType="VARCHAR"/>
<result property="orgMemo" column="org_memo" jdbcType="VARCHAR"/>
<result property="orgMnecode" column="org_mnecode" jdbcType="VARCHAR"/>
<result property="orgNcindustry" column="org_ncindustry" jdbcType="VARCHAR"/>
<result property="orgFatherorg" column="org_fatherorg" jdbcType="VARCHAR"/>
<result property="orgPrincipal" column="org_principal" jdbcType="VARCHAR"/>
<result property="orgTel" column="org_tel" jdbcType="VARCHAR"/>
<result property="dataStatus" column="data_status" jdbcType="VARCHAR"/>
<result property="addStatus" column="add_status" jdbcType="VARCHAR"/>
<result property="updateStatus" column="update_status" jdbcType="VARCHAR"/>
<result property="deleteStatus" column="delete_status" 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 = "MdmOrgEntity_Base_Column_List">
id
,document_rule
,document_rule_num
,org_code
,org_name
,org_address
,org_countryzone
,org_innercode
,org_memo
,org_mnecode
,org_ncindustry
,org_fatherorg
,org_principal
,org_tel
,data_status
,add_status
,update_status
,delete_status
,sorts
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,org_id
,company_id
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-MdmOrgEntity-result" parameterType = "masterData.entity.MdmOrgEntity">
select
<include refid="MdmOrgEntity_Base_Column_List" />
from mdm_org
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="documentRule != null and documentRule != ''"> and document_rule = #{documentRule} </if>
<if test="documentRuleNum != null"> and document_rule_num = #{documentRuleNum} </if>
<if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode} </if>
<if test="orgName != null and orgName != ''"> and org_name = #{orgName} </if>
<if test="orgAddress != null and orgAddress != ''"> and org_address = #{orgAddress} </if>
<if test="orgCountryzone != null and orgCountryzone != ''"> and org_countryzone = #{orgCountryzone} </if>
<if test="orgInnercode != null and orgInnercode != ''"> and org_innercode = #{orgInnercode} </if>
<if test="orgMemo != null and orgMemo != ''"> and org_memo = #{orgMemo} </if>
<if test="orgMnecode != null and orgMnecode != ''"> and org_mnecode = #{orgMnecode} </if>
<if test="orgNcindustry != null and orgNcindustry != ''"> and org_ncindustry = #{orgNcindustry} </if>
<if test="orgFatherorg != null and orgFatherorg != ''"> and org_fatherorg = #{orgFatherorg} </if>
<if test="orgPrincipal != null and orgPrincipal != ''"> and org_principal = #{orgPrincipal} </if>
<if test="orgTel != null and orgTel != ''"> and org_tel = #{orgTel} </if>
<if test="dataStatus != null and dataStatus != ''"> and data_status = #{dataStatus} </if>
<if test="addStatus != null and addStatus != ''"> and add_status = #{addStatus} </if>
<if test="updateStatus != null and updateStatus != ''"> and update_status = #{updateStatus} </if>
<if test="deleteStatus != null and deleteStatus != ''"> and delete_status = #{deleteStatus} </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 = "masterData.entity.MdmOrgEntity">
select count(1) from mdm_org
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="documentRule != null and documentRule != ''"> and document_rule = #{documentRule} </if>
<if test="documentRuleNum != null"> and document_rule_num = #{documentRuleNum} </if>
<if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode} </if>
<if test="orgName != null and orgName != ''"> and org_name = #{orgName} </if>
<if test="orgAddress != null and orgAddress != ''"> and org_address = #{orgAddress} </if>
<if test="orgCountryzone != null and orgCountryzone != ''"> and org_countryzone = #{orgCountryzone} </if>
<if test="orgInnercode != null and orgInnercode != ''"> and org_innercode = #{orgInnercode} </if>
<if test="orgMemo != null and orgMemo != ''"> and org_memo = #{orgMemo} </if>
<if test="orgMnecode != null and orgMnecode != ''"> and org_mnecode = #{orgMnecode} </if>
<if test="orgNcindustry != null and orgNcindustry != ''"> and org_ncindustry = #{orgNcindustry} </if>
<if test="orgFatherorg != null and orgFatherorg != ''"> and org_fatherorg = #{orgFatherorg} </if>
<if test="orgPrincipal != null and orgPrincipal != ''"> and org_principal = #{orgPrincipal} </if>
<if test="orgTel != null and orgTel != ''"> and org_tel = #{orgTel} </if>
<if test="dataStatus != null and dataStatus != ''"> and data_status = #{dataStatus} </if>
<if test="addStatus != null and addStatus != ''"> and add_status = #{addStatus} </if>
<if test="updateStatus != null and updateStatus != ''"> and update_status = #{updateStatus} </if>
<if test="deleteStatus != null and deleteStatus != ''"> and delete_status = #{deleteStatus} </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>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-MdmOrgEntity-result" parameterType = "masterData.entity.MdmOrgEntity">
select
<include refid="MdmOrgEntity_Base_Column_List" />
from mdm_org
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="documentRule != null and documentRule != ''"> and document_rule like concat('%',#{documentRule},'%') </if>
<if test="documentRuleNum != null"> and document_rule_num like concat('%',#{documentRuleNum},'%') </if>
<if test="orgCode != null and orgCode != ''"> and org_code like concat('%',#{orgCode},'%') </if>
<if test="orgName != null and orgName != ''"> and org_name like concat('%',#{orgName},'%') </if>
<if test="orgAddress != null and orgAddress != ''"> and org_address like concat('%',#{orgAddress},'%') </if>
<if test="orgCountryzone != null and orgCountryzone != ''"> and org_countryzone like concat('%',#{orgCountryzone},'%') </if>
<if test="orgInnercode != null and orgInnercode != ''"> and org_innercode like concat('%',#{orgInnercode},'%') </if>
<if test="orgMemo != null and orgMemo != ''"> and org_memo like concat('%',#{orgMemo},'%') </if>
<if test="orgMnecode != null and orgMnecode != ''"> and org_mnecode like concat('%',#{orgMnecode},'%') </if>
<if test="orgNcindustry != null and orgNcindustry != ''"> and org_ncindustry like concat('%',#{orgNcindustry},'%') </if>
<if test="orgFatherorg != null and orgFatherorg != ''"> and org_fatherorg like concat('%',#{orgFatherorg},'%') </if>
<if test="orgPrincipal != null and orgPrincipal != ''"> and org_principal like concat('%',#{orgPrincipal},'%') </if>
<if test="orgTel != null and orgTel != ''"> and org_tel like concat('%',#{orgTel},'%') </if>
<if test="dataStatus != null and dataStatus != ''"> and data_status like concat('%',#{dataStatus},'%') </if>
<if test="addStatus != null and addStatus != ''"> and add_status like concat('%',#{addStatus},'%') </if>
<if test="updateStatus != null and updateStatus != ''"> and update_status like concat('%',#{updateStatus},'%') </if>
<if test="deleteStatus != null and deleteStatus != ''"> and delete_status like concat('%',#{deleteStatus},'%') </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>
<!-- 查询列表 字段采用or格式 -->
<select id="MdmOrgentity_list_or" resultMap="get-MdmOrgEntity-result" parameterType = "masterData.entity.MdmOrgEntity">
select
<include refid="MdmOrgEntity_Base_Column_List" />
from mdm_org
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> or id = #{id} </if>
<if test="documentRule != null and documentRule != ''"> or document_rule = #{documentRule} </if>
<if test="documentRuleNum != null"> or document_rule_num = #{documentRuleNum} </if>
<if test="orgCode != null and orgCode != ''"> or org_code = #{orgCode} </if>
<if test="orgName != null and orgName != ''"> or org_name = #{orgName} </if>
<if test="orgAddress != null and orgAddress != ''"> or org_address = #{orgAddress} </if>
<if test="orgCountryzone != null and orgCountryzone != ''"> or org_countryzone = #{orgCountryzone} </if>
<if test="orgInnercode != null and orgInnercode != ''"> or org_innercode = #{orgInnercode} </if>
<if test="orgMemo != null and orgMemo != ''"> or org_memo = #{orgMemo} </if>
<if test="orgMnecode != null and orgMnecode != ''"> or org_mnecode = #{orgMnecode} </if>
<if test="orgNcindustry != null and orgNcindustry != ''"> or org_ncindustry = #{orgNcindustry} </if>
<if test="orgFatherorg != null and orgFatherorg != ''"> or org_fatherorg = #{orgFatherorg} </if>
<if test="orgPrincipal != null and orgPrincipal != ''"> or org_principal = #{orgPrincipal} </if>
<if test="orgTel != null and orgTel != ''"> or org_tel = #{orgTel} </if>
<if test="dataStatus != null and dataStatus != ''"> or data_status = #{dataStatus} </if>
<if test="addStatus != null and addStatus != ''"> or add_status = #{addStatus} </if>
<if test="updateStatus != null and updateStatus != ''"> or update_status = #{updateStatus} </if>
<if test="deleteStatus != null and deleteStatus != ''"> or delete_status = #{deleteStatus} </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>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "masterData.entity.MdmOrgEntity" keyProperty="id" useGeneratedKeys="true">
insert into mdm_org(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="documentRule != null and documentRule != ''"> document_rule , </if>
<if test="documentRuleNum != null"> document_rule_num , </if>
<if test="orgCode != null and orgCode != ''"> org_code , </if>
<if test="orgName != null and orgName != ''"> org_name , </if>
<if test="orgAddress != null and orgAddress != ''"> org_address , </if>
<if test="orgCountryzone != null and orgCountryzone != ''"> org_countryzone , </if>
<if test="orgInnercode != null and orgInnercode != ''"> org_innercode , </if>
<if test="orgMemo != null and orgMemo != ''"> org_memo , </if>
<if test="orgMnecode != null and orgMnecode != ''"> org_mnecode , </if>
<if test="orgNcindustry != null and orgNcindustry != ''"> org_ncindustry , </if>
<if test="orgFatherorg != null and orgFatherorg != ''"> org_fatherorg , </if>
<if test="orgPrincipal != null and orgPrincipal != ''"> org_principal , </if>
<if test="orgTel != null and orgTel != ''"> org_tel , </if>
<if test="dataStatus != null and dataStatus != ''"> data_status , </if>
<if test="addStatus != null and addStatus != ''"> add_status , </if>
<if test="updateStatus != null and updateStatus != ''"> update_status , </if>
<if test="deleteStatus != null and deleteStatus != ''"> delete_status , </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="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="documentRule != null and documentRule != ''"> #{documentRule} ,</if>
<if test="documentRuleNum != null"> #{documentRuleNum} ,</if>
<if test="orgCode != null and orgCode != ''"> #{orgCode} ,</if>
<if test="orgName != null and orgName != ''"> #{orgName} ,</if>
<if test="orgAddress != null and orgAddress != ''"> #{orgAddress} ,</if>
<if test="orgCountryzone != null and orgCountryzone != ''"> #{orgCountryzone} ,</if>
<if test="orgInnercode != null and orgInnercode != ''"> #{orgInnercode} ,</if>
<if test="orgMemo != null and orgMemo != ''"> #{orgMemo} ,</if>
<if test="orgMnecode != null and orgMnecode != ''"> #{orgMnecode} ,</if>
<if test="orgNcindustry != null and orgNcindustry != ''"> #{orgNcindustry} ,</if>
<if test="orgFatherorg != null and orgFatherorg != ''"> #{orgFatherorg} ,</if>
<if test="orgPrincipal != null and orgPrincipal != ''"> #{orgPrincipal} ,</if>
<if test="orgTel != null and orgTel != ''"> #{orgTel} ,</if>
<if test="dataStatus != null and dataStatus != ''"> #{dataStatus} ,</if>
<if test="addStatus != null and addStatus != ''"> #{addStatus} ,</if>
<if test="updateStatus != null and updateStatus != ''"> #{updateStatus} ,</if>
<if test="deleteStatus != null and deleteStatus != ''"> #{deleteStatus} ,</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="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_org a WHERE a.sts = 'Y' ),</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mdm_org(document_rule, document_rule_num, org_code, org_name, org_address, org_countryzone, org_innercode, org_memo, org_mnecode, org_ncindustry, org_fatherorg, org_principal, org_tel, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.documentRule},#{entity.documentRuleNum},#{entity.orgCode},#{entity.orgName},#{entity.orgAddress},#{entity.orgCountryzone},#{entity.orgInnercode},#{entity.orgMemo},#{entity.orgMnecode},#{entity.orgNcindustry},#{entity.orgFatherorg},#{entity.orgPrincipal},#{entity.orgTel},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{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" keyProperty="id" useGeneratedKeys="true">
insert into mdm_org(document_rule, document_rule_num, org_code, org_name, org_address, org_countryzone, org_innercode, org_memo, org_mnecode, org_ncindustry, org_fatherorg, org_principal, org_tel, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.documentRule},#{entity.documentRuleNum},#{entity.orgCode},#{entity.orgName},#{entity.orgAddress},#{entity.orgCountryzone},#{entity.orgInnercode},#{entity.orgMemo},#{entity.orgMnecode},#{entity.orgNcindustry},#{entity.orgFatherorg},#{entity.orgPrincipal},#{entity.orgTel},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{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
document_rule = values(document_rule),
document_rule_num = values(document_rule_num),
org_code = values(org_code),
org_name = values(org_name),
org_address = values(org_address),
org_countryzone = values(org_countryzone),
org_innercode = values(org_innercode),
org_memo = values(org_memo),
org_mnecode = values(org_mnecode),
org_ncindustry = values(org_ncindustry),
org_fatherorg = values(org_fatherorg),
org_principal = values(org_principal),
org_tel = values(org_tel),
data_status = values(data_status),
add_status = values(add_status),
update_status = values(update_status),
delete_status = values(delete_status),
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 = "masterData.entity.MdmOrgEntity" >
update mdm_org set
<trim suffix="" suffixOverrides=",">
<if test="documentRule != null and documentRule != ''"> document_rule = #{documentRule},</if>
<if test="documentRuleNum != null"> document_rule_num = #{documentRuleNum},</if>
<if test="orgCode != null and orgCode != ''"> org_code = #{orgCode},</if>
<if test="orgName != null and orgName != ''"> org_name = #{orgName},</if>
<if test="orgAddress != null and orgAddress != ''"> org_address = #{orgAddress},</if>
<if test="orgCountryzone != null and orgCountryzone != ''"> org_countryzone = #{orgCountryzone},</if>
<if test="orgInnercode != null and orgInnercode != ''"> org_innercode = #{orgInnercode},</if>
<if test="orgMemo != null and orgMemo != ''"> org_memo = #{orgMemo},</if>
<if test="orgMnecode != null and orgMnecode != ''"> org_mnecode = #{orgMnecode},</if>
<if test="orgNcindustry != null and orgNcindustry != ''"> org_ncindustry = #{orgNcindustry},</if>
<if test="orgFatherorg != null and orgFatherorg != ''"> org_fatherorg = #{orgFatherorg},</if>
<if test="orgPrincipal != null and orgPrincipal != ''"> org_principal = #{orgPrincipal},</if>
<if test="orgTel != null and orgTel != ''"> org_tel = #{orgTel},</if>
<if test="dataStatus != null and dataStatus != ''"> data_status = #{dataStatus},</if>
<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>
<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 = "masterData.entity.MdmOrgEntity" >
update mdm_org set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "masterData.entity.MdmOrgEntity" >
update mdm_org 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="documentRule != null and documentRule != ''"> and document_rule = #{documentRule} </if>
<if test="documentRuleNum != null"> and document_rule_num = #{documentRuleNum} </if>
<if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode} </if>
<if test="orgName != null and orgName != ''"> and org_name = #{orgName} </if>
<if test="orgAddress != null and orgAddress != ''"> and org_address = #{orgAddress} </if>
<if test="orgCountryzone != null and orgCountryzone != ''"> and org_countryzone = #{orgCountryzone} </if>
<if test="orgInnercode != null and orgInnercode != ''"> and org_innercode = #{orgInnercode} </if>
<if test="orgMemo != null and orgMemo != ''"> and org_memo = #{orgMemo} </if>
<if test="orgMnecode != null and orgMnecode != ''"> and org_mnecode = #{orgMnecode} </if>
<if test="orgNcindustry != null and orgNcindustry != ''"> and org_ncindustry = #{orgNcindustry} </if>
<if test="orgFatherorg != null and orgFatherorg != ''"> and org_fatherorg = #{orgFatherorg} </if>
<if test="orgPrincipal != null and orgPrincipal != ''"> and org_principal = #{orgPrincipal} </if>
<if test="orgTel != null and orgTel != ''"> and org_tel = #{orgTel} </if>
<if test="dataStatus != null and dataStatus != ''"> and data_status = #{dataStatus} </if>
<if test="addStatus != null and addStatus != ''"> and add_status = #{addStatus} </if>
<if test="updateStatus != null and updateStatus != ''"> and update_status = #{updateStatus} </if>
<if test="deleteStatus != null and deleteStatus != ''"> and delete_status = #{deleteStatus} </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_org where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,62 @@
package com.hzya.frame.plugin.masterData.org.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.sysnew.comparison.masterData.service.impl.MasterDataOrgsServiceImpl;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 组织档案(MdmOrg)表服务接口
*
* @author makejava
* @since 2024-06-07 18:30:05
*/
public class MdmOrgPluginInitializer extends PluginBaseEntity{
Logger logger = LoggerFactory.getLogger(MdmOrgPluginInitializer.class);
@Autowired
private MasterDataOrgsServiceImpl masterDataOrgsService;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "MdmOrgPlugin";
}
@Override
public String getPluginName() {
return "MdmOrgPlugin插件";
}
@Override
public String getPluginLabel() {
return "MdmOrgPlugin";
}
@Override
public String getPluginType() {
return "1";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {
logger.info("======开始执行主数据档案组织档案同步========");
return masterDataOrgsService.queryOrgsArchives(requestJson);
}catch (Exception e){
logger.info("======执行主数据档案组织档案同步失败:{}========",e.getMessage());
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,12 @@
package masterData.service;
import masterData.entity.MdmOrgEntity;
import com.hzya.frame.basedao.service.IBaseService;
/**
* 组织档案(MdmOrg)表服务接口
*
* @author makejava
* @since 2024-06-07 18:30:05
*/
public interface IMdmOrgService extends IBaseService<MdmOrgEntity, String>{
}

View File

@ -0,0 +1,25 @@
package masterData.service.impl;
import masterData.entity.MdmOrgEntity;
import masterData.dao.IMdmOrgDao;
import masterData.service.IMdmOrgService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
/**
* 组织档案(MdmOrg)表服务实现类
*
* @author makejava
* @since 2024-06-07 18:30:05
*/
public class MdmOrgServiceImpl extends BaseService<MdmOrgEntity, String> implements IMdmOrgService {
private IMdmOrgDao mdmOrgDao;
@Autowired
public void setMdmOrgDao(IMdmOrgDao dao) {
this.mdmOrgDao = dao;
this.dao = dao;
}
}

View File

@ -0,0 +1,15 @@
package masterData.dao;
import masterData.entity.MdmProjectEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* 项目档案(mdm_project: table)表数据库访问层
*
* @author makejava
* @since 2024-06-07 18:29:23
*/
public interface IMdmProjectDao extends IBaseDao<MdmProjectEntity, String> {
}

View File

@ -0,0 +1,16 @@
package masterData.dao.impl;
import masterData.entity.MdmProjectEntity;
import masterData.dao.IMdmProjectDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* 项目档案(MdmProject)表数据库访问层
*
* @author makejava
* @since 2024-06-07 18:29:23
*/
public class MdmProjectDaoImpl extends MybatisGenericDao<MdmProjectEntity, String> implements IMdmProjectDao{
}

View File

@ -0,0 +1,186 @@
package masterData.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 项目档案(MdmProject)实体类
*
* @author makejava
* @since 2024-06-07 18:29:23
*/
public class MdmProjectEntity extends BaseEntity {
/** 单据规则 */
private String documentRule;
/** 单据规则流水号 */
private Long documentRuleNum;
/** 项目编码 */
private String projectCode;
/** 项目名称 */
private String projectName;
/** 单据类型 */
private String projectBillType;
/** 备注 */
private String projectMemo;
/** 币种 */
private String projectCurrtype;
/** 责任人 */
private String projectDutier;
/** 责任部门 */
private String projectDutyDept;
/** 管理组织 */
private String projectOrg;
/** 父项目 */
private String projectParentpro;
/** 项目简称 */
private String projectShName;
/** 数据状态 Y正常 N删除 F修改 */
private String dataStatus;
/** 新增数据状态 0待下发 1已下发 */
private String addStatus;
/** 修改数据状态 0待下发 1已下发 */
private String updateStatus;
/** 删除数据状态 0待下发 1已下发 */
private String deleteStatus;
/** 公司id */
private String companyId;
public String getDocumentRule() {
return documentRule;
}
public void setDocumentRule(String documentRule) {
this.documentRule = documentRule;
}
public Long getDocumentRuleNum() {
return documentRuleNum;
}
public void setDocumentRuleNum(Long documentRuleNum) {
this.documentRuleNum = documentRuleNum;
}
public String getProjectCode() {
return projectCode;
}
public void setProjectCode(String projectCode) {
this.projectCode = projectCode;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getProjectBillType() {
return projectBillType;
}
public void setProjectBillType(String projectBillType) {
this.projectBillType = projectBillType;
}
public String getProjectMemo() {
return projectMemo;
}
public void setProjectMemo(String projectMemo) {
this.projectMemo = projectMemo;
}
public String getProjectCurrtype() {
return projectCurrtype;
}
public void setProjectCurrtype(String projectCurrtype) {
this.projectCurrtype = projectCurrtype;
}
public String getProjectDutier() {
return projectDutier;
}
public void setProjectDutier(String projectDutier) {
this.projectDutier = projectDutier;
}
public String getProjectDutyDept() {
return projectDutyDept;
}
public void setProjectDutyDept(String projectDutyDept) {
this.projectDutyDept = projectDutyDept;
}
public String getProjectOrg() {
return projectOrg;
}
public void setProjectOrg(String projectOrg) {
this.projectOrg = projectOrg;
}
public String getProjectParentpro() {
return projectParentpro;
}
public void setProjectParentpro(String projectParentpro) {
this.projectParentpro = projectParentpro;
}
public String getProjectShName() {
return projectShName;
}
public void setProjectShName(String projectShName) {
this.projectShName = projectShName;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public String getAddStatus() {
return addStatus;
}
public void setAddStatus(String addStatus) {
this.addStatus = addStatus;
}
public String getUpdateStatus() {
return updateStatus;
}
public void setUpdateStatus(String updateStatus) {
this.updateStatus = updateStatus;
}
public String getDeleteStatus() {
return deleteStatus;
}
public void setDeleteStatus(String deleteStatus) {
this.deleteStatus = deleteStatus;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
}

View File

@ -0,0 +1,377 @@
<?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="masterData.dao.impl.MdmProjectDaoImpl">
<resultMap id="get-MdmProjectEntity-result" type="masterData.entity.MdmProjectEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="documentRule" column="document_rule" jdbcType="VARCHAR"/>
<result property="documentRuleNum" column="document_rule_num" jdbcType="INTEGER"/>
<result property="projectCode" column="project_code" jdbcType="VARCHAR"/>
<result property="projectName" column="project_name" jdbcType="VARCHAR"/>
<result property="projectBillType" column="project_bill_type" jdbcType="VARCHAR"/>
<result property="projectMemo" column="project_memo" jdbcType="VARCHAR"/>
<result property="projectCurrtype" column="project_currtype" jdbcType="VARCHAR"/>
<result property="projectDutier" column="project_dutier" jdbcType="VARCHAR"/>
<result property="projectDutyDept" column="project_duty_dept" jdbcType="VARCHAR"/>
<result property="projectOrg" column="project_org" jdbcType="VARCHAR"/>
<result property="projectParentpro" column="project_parentpro" jdbcType="VARCHAR"/>
<result property="projectShName" column="project_sh_name" jdbcType="VARCHAR"/>
<result property="dataStatus" column="data_status" jdbcType="VARCHAR"/>
<result property="addStatus" column="add_status" jdbcType="VARCHAR"/>
<result property="updateStatus" column="update_status" jdbcType="VARCHAR"/>
<result property="deleteStatus" column="delete_status" 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 = "MdmProjectEntity_Base_Column_List">
id
,document_rule
,document_rule_num
,project_code
,project_name
,project_bill_type
,project_memo
,project_currtype
,project_dutier
,project_duty_dept
,project_org
,project_parentpro
,project_sh_name
,data_status
,add_status
,update_status
,delete_status
,sorts
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,org_id
,company_id
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-MdmProjectEntity-result" parameterType = "masterData.entity.MdmProjectEntity">
select
<include refid="MdmProjectEntity_Base_Column_List" />
from mdm_project
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="documentRule != null and documentRule != ''"> and document_rule = #{documentRule} </if>
<if test="documentRuleNum != null"> and document_rule_num = #{documentRuleNum} </if>
<if test="projectCode != null and projectCode != ''"> and project_code = #{projectCode} </if>
<if test="projectName != null and projectName != ''"> and project_name = #{projectName} </if>
<if test="projectBillType != null and projectBillType != ''"> and project_bill_type = #{projectBillType} </if>
<if test="projectMemo != null and projectMemo != ''"> and project_memo = #{projectMemo} </if>
<if test="projectCurrtype != null and projectCurrtype != ''"> and project_currtype = #{projectCurrtype} </if>
<if test="projectDutier != null and projectDutier != ''"> and project_dutier = #{projectDutier} </if>
<if test="projectDutyDept != null and projectDutyDept != ''"> and project_duty_dept = #{projectDutyDept} </if>
<if test="projectOrg != null and projectOrg != ''"> and project_org = #{projectOrg} </if>
<if test="projectParentpro != null and projectParentpro != ''"> and project_parentpro = #{projectParentpro} </if>
<if test="projectShName != null and projectShName != ''"> and project_sh_name = #{projectShName} </if>
<if test="dataStatus != null and dataStatus != ''"> and data_status = #{dataStatus} </if>
<if test="addStatus != null and addStatus != ''"> and add_status = #{addStatus} </if>
<if test="updateStatus != null and updateStatus != ''"> and update_status = #{updateStatus} </if>
<if test="deleteStatus != null and deleteStatus != ''"> and delete_status = #{deleteStatus} </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 = "masterData.entity.MdmProjectEntity">
select count(1) from mdm_project
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="documentRule != null and documentRule != ''"> and document_rule = #{documentRule} </if>
<if test="documentRuleNum != null"> and document_rule_num = #{documentRuleNum} </if>
<if test="projectCode != null and projectCode != ''"> and project_code = #{projectCode} </if>
<if test="projectName != null and projectName != ''"> and project_name = #{projectName} </if>
<if test="projectBillType != null and projectBillType != ''"> and project_bill_type = #{projectBillType} </if>
<if test="projectMemo != null and projectMemo != ''"> and project_memo = #{projectMemo} </if>
<if test="projectCurrtype != null and projectCurrtype != ''"> and project_currtype = #{projectCurrtype} </if>
<if test="projectDutier != null and projectDutier != ''"> and project_dutier = #{projectDutier} </if>
<if test="projectDutyDept != null and projectDutyDept != ''"> and project_duty_dept = #{projectDutyDept} </if>
<if test="projectOrg != null and projectOrg != ''"> and project_org = #{projectOrg} </if>
<if test="projectParentpro != null and projectParentpro != ''"> and project_parentpro = #{projectParentpro} </if>
<if test="projectShName != null and projectShName != ''"> and project_sh_name = #{projectShName} </if>
<if test="dataStatus != null and dataStatus != ''"> and data_status = #{dataStatus} </if>
<if test="addStatus != null and addStatus != ''"> and add_status = #{addStatus} </if>
<if test="updateStatus != null and updateStatus != ''"> and update_status = #{updateStatus} </if>
<if test="deleteStatus != null and deleteStatus != ''"> and delete_status = #{deleteStatus} </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>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-MdmProjectEntity-result" parameterType = "masterData.entity.MdmProjectEntity">
select
<include refid="MdmProjectEntity_Base_Column_List" />
from mdm_project
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="documentRule != null and documentRule != ''"> and document_rule like concat('%',#{documentRule},'%') </if>
<if test="documentRuleNum != null"> and document_rule_num like concat('%',#{documentRuleNum},'%') </if>
<if test="projectCode != null and projectCode != ''"> and project_code like concat('%',#{projectCode},'%') </if>
<if test="projectName != null and projectName != ''"> and project_name like concat('%',#{projectName},'%') </if>
<if test="projectBillType != null and projectBillType != ''"> and project_bill_type like concat('%',#{projectBillType},'%') </if>
<if test="projectMemo != null and projectMemo != ''"> and project_memo like concat('%',#{projectMemo},'%') </if>
<if test="projectCurrtype != null and projectCurrtype != ''"> and project_currtype like concat('%',#{projectCurrtype},'%') </if>
<if test="projectDutier != null and projectDutier != ''"> and project_dutier like concat('%',#{projectDutier},'%') </if>
<if test="projectDutyDept != null and projectDutyDept != ''"> and project_duty_dept like concat('%',#{projectDutyDept},'%') </if>
<if test="projectOrg != null and projectOrg != ''"> and project_org like concat('%',#{projectOrg},'%') </if>
<if test="projectParentpro != null and projectParentpro != ''"> and project_parentpro like concat('%',#{projectParentpro},'%') </if>
<if test="projectShName != null and projectShName != ''"> and project_sh_name like concat('%',#{projectShName},'%') </if>
<if test="dataStatus != null and dataStatus != ''"> and data_status like concat('%',#{dataStatus},'%') </if>
<if test="addStatus != null and addStatus != ''"> and add_status like concat('%',#{addStatus},'%') </if>
<if test="updateStatus != null and updateStatus != ''"> and update_status like concat('%',#{updateStatus},'%') </if>
<if test="deleteStatus != null and deleteStatus != ''"> and delete_status like concat('%',#{deleteStatus},'%') </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>
<!-- 查询列表 字段采用or格式 -->
<select id="MdmProjectentity_list_or" resultMap="get-MdmProjectEntity-result" parameterType = "masterData.entity.MdmProjectEntity">
select
<include refid="MdmProjectEntity_Base_Column_List" />
from mdm_project
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> or id = #{id} </if>
<if test="documentRule != null and documentRule != ''"> or document_rule = #{documentRule} </if>
<if test="documentRuleNum != null"> or document_rule_num = #{documentRuleNum} </if>
<if test="projectCode != null and projectCode != ''"> or project_code = #{projectCode} </if>
<if test="projectName != null and projectName != ''"> or project_name = #{projectName} </if>
<if test="projectBillType != null and projectBillType != ''"> or project_bill_type = #{projectBillType} </if>
<if test="projectMemo != null and projectMemo != ''"> or project_memo = #{projectMemo} </if>
<if test="projectCurrtype != null and projectCurrtype != ''"> or project_currtype = #{projectCurrtype} </if>
<if test="projectDutier != null and projectDutier != ''"> or project_dutier = #{projectDutier} </if>
<if test="projectDutyDept != null and projectDutyDept != ''"> or project_duty_dept = #{projectDutyDept} </if>
<if test="projectOrg != null and projectOrg != ''"> or project_org = #{projectOrg} </if>
<if test="projectParentpro != null and projectParentpro != ''"> or project_parentpro = #{projectParentpro} </if>
<if test="projectShName != null and projectShName != ''"> or project_sh_name = #{projectShName} </if>
<if test="dataStatus != null and dataStatus != ''"> or data_status = #{dataStatus} </if>
<if test="addStatus != null and addStatus != ''"> or add_status = #{addStatus} </if>
<if test="updateStatus != null and updateStatus != ''"> or update_status = #{updateStatus} </if>
<if test="deleteStatus != null and deleteStatus != ''"> or delete_status = #{deleteStatus} </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>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "masterData.entity.MdmProjectEntity" keyProperty="id" useGeneratedKeys="true">
insert into mdm_project(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="documentRule != null and documentRule != ''"> document_rule , </if>
<if test="documentRuleNum != null"> document_rule_num , </if>
<if test="projectCode != null and projectCode != ''"> project_code , </if>
<if test="projectName != null and projectName != ''"> project_name , </if>
<if test="projectBillType != null and projectBillType != ''"> project_bill_type , </if>
<if test="projectMemo != null and projectMemo != ''"> project_memo , </if>
<if test="projectCurrtype != null and projectCurrtype != ''"> project_currtype , </if>
<if test="projectDutier != null and projectDutier != ''"> project_dutier , </if>
<if test="projectDutyDept != null and projectDutyDept != ''"> project_duty_dept , </if>
<if test="projectOrg != null and projectOrg != ''"> project_org , </if>
<if test="projectParentpro != null and projectParentpro != ''"> project_parentpro , </if>
<if test="projectShName != null and projectShName != ''"> project_sh_name , </if>
<if test="dataStatus != null and dataStatus != ''"> data_status , </if>
<if test="addStatus != null and addStatus != ''"> add_status , </if>
<if test="updateStatus != null and updateStatus != ''"> update_status , </if>
<if test="deleteStatus != null and deleteStatus != ''"> delete_status , </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="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="documentRule != null and documentRule != ''"> #{documentRule} ,</if>
<if test="documentRuleNum != null"> #{documentRuleNum} ,</if>
<if test="projectCode != null and projectCode != ''"> #{projectCode} ,</if>
<if test="projectName != null and projectName != ''"> #{projectName} ,</if>
<if test="projectBillType != null and projectBillType != ''"> #{projectBillType} ,</if>
<if test="projectMemo != null and projectMemo != ''"> #{projectMemo} ,</if>
<if test="projectCurrtype != null and projectCurrtype != ''"> #{projectCurrtype} ,</if>
<if test="projectDutier != null and projectDutier != ''"> #{projectDutier} ,</if>
<if test="projectDutyDept != null and projectDutyDept != ''"> #{projectDutyDept} ,</if>
<if test="projectOrg != null and projectOrg != ''"> #{projectOrg} ,</if>
<if test="projectParentpro != null and projectParentpro != ''"> #{projectParentpro} ,</if>
<if test="projectShName != null and projectShName != ''"> #{projectShName} ,</if>
<if test="dataStatus != null and dataStatus != ''"> #{dataStatus} ,</if>
<if test="addStatus != null and addStatus != ''"> #{addStatus} ,</if>
<if test="updateStatus != null and updateStatus != ''"> #{updateStatus} ,</if>
<if test="deleteStatus != null and deleteStatus != ''"> #{deleteStatus} ,</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="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_project a WHERE a.sts = 'Y' ),</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mdm_project(document_rule, document_rule_num, project_code, project_name, project_bill_type, project_memo, project_currtype, project_dutier, project_duty_dept, project_org, project_parentpro, project_sh_name, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.documentRule},#{entity.documentRuleNum},#{entity.projectCode},#{entity.projectName},#{entity.projectBillType},#{entity.projectMemo},#{entity.projectCurrtype},#{entity.projectDutier},#{entity.projectDutyDept},#{entity.projectOrg},#{entity.projectParentpro},#{entity.projectShName},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{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" keyProperty="id" useGeneratedKeys="true">
insert into mdm_project(document_rule, document_rule_num, project_code, project_name, project_bill_type, project_memo, project_currtype, project_dutier, project_duty_dept, project_org, project_parentpro, project_sh_name, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.documentRule},#{entity.documentRuleNum},#{entity.projectCode},#{entity.projectName},#{entity.projectBillType},#{entity.projectMemo},#{entity.projectCurrtype},#{entity.projectDutier},#{entity.projectDutyDept},#{entity.projectOrg},#{entity.projectParentpro},#{entity.projectShName},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{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
document_rule = values(document_rule),
document_rule_num = values(document_rule_num),
project_code = values(project_code),
project_name = values(project_name),
project_bill_type = values(project_bill_type),
project_memo = values(project_memo),
project_currtype = values(project_currtype),
project_dutier = values(project_dutier),
project_duty_dept = values(project_duty_dept),
project_org = values(project_org),
project_parentpro = values(project_parentpro),
project_sh_name = values(project_sh_name),
data_status = values(data_status),
add_status = values(add_status),
update_status = values(update_status),
delete_status = values(delete_status),
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 = "masterData.entity.MdmProjectEntity" >
update mdm_project set
<trim suffix="" suffixOverrides=",">
<if test="documentRule != null and documentRule != ''"> document_rule = #{documentRule},</if>
<if test="documentRuleNum != null"> document_rule_num = #{documentRuleNum},</if>
<if test="projectCode != null and projectCode != ''"> project_code = #{projectCode},</if>
<if test="projectName != null and projectName != ''"> project_name = #{projectName},</if>
<if test="projectBillType != null and projectBillType != ''"> project_bill_type = #{projectBillType},</if>
<if test="projectMemo != null and projectMemo != ''"> project_memo = #{projectMemo},</if>
<if test="projectCurrtype != null and projectCurrtype != ''"> project_currtype = #{projectCurrtype},</if>
<if test="projectDutier != null and projectDutier != ''"> project_dutier = #{projectDutier},</if>
<if test="projectDutyDept != null and projectDutyDept != ''"> project_duty_dept = #{projectDutyDept},</if>
<if test="projectOrg != null and projectOrg != ''"> project_org = #{projectOrg},</if>
<if test="projectParentpro != null and projectParentpro != ''"> project_parentpro = #{projectParentpro},</if>
<if test="projectShName != null and projectShName != ''"> project_sh_name = #{projectShName},</if>
<if test="dataStatus != null and dataStatus != ''"> data_status = #{dataStatus},</if>
<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>
<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 = "masterData.entity.MdmProjectEntity" >
update mdm_project set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "masterData.entity.MdmProjectEntity" >
update mdm_project 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="documentRule != null and documentRule != ''"> and document_rule = #{documentRule} </if>
<if test="documentRuleNum != null"> and document_rule_num = #{documentRuleNum} </if>
<if test="projectCode != null and projectCode != ''"> and project_code = #{projectCode} </if>
<if test="projectName != null and projectName != ''"> and project_name = #{projectName} </if>
<if test="projectBillType != null and projectBillType != ''"> and project_bill_type = #{projectBillType} </if>
<if test="projectMemo != null and projectMemo != ''"> and project_memo = #{projectMemo} </if>
<if test="projectCurrtype != null and projectCurrtype != ''"> and project_currtype = #{projectCurrtype} </if>
<if test="projectDutier != null and projectDutier != ''"> and project_dutier = #{projectDutier} </if>
<if test="projectDutyDept != null and projectDutyDept != ''"> and project_duty_dept = #{projectDutyDept} </if>
<if test="projectOrg != null and projectOrg != ''"> and project_org = #{projectOrg} </if>
<if test="projectParentpro != null and projectParentpro != ''"> and project_parentpro = #{projectParentpro} </if>
<if test="projectShName != null and projectShName != ''"> and project_sh_name = #{projectShName} </if>
<if test="dataStatus != null and dataStatus != ''"> and data_status = #{dataStatus} </if>
<if test="addStatus != null and addStatus != ''"> and add_status = #{addStatus} </if>
<if test="updateStatus != null and updateStatus != ''"> and update_status = #{updateStatus} </if>
<if test="deleteStatus != null and deleteStatus != ''"> and delete_status = #{deleteStatus} </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_project where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,64 @@
package com.hzya.frame.plugin.masterData.project.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.sysnew.comparison.masterData.service.impl.MasterDataProjectServiceImpl;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 项目档案(MdmProject)表服务接口
*
* @author makejava
* @since 2024-06-07 18:29:23
*/
public class MdmProjectPluginInitializer extends PluginBaseEntity{
Logger logger = LoggerFactory.getLogger(MdmProjectPluginInitializer.class);
@Autowired
private MasterDataProjectServiceImpl masterDataProjectService;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "MdmProjectPlugin";
}
@Override
public String getPluginName() {
return "MdmProjectPlugin插件";
}
@Override
public String getPluginLabel() {
return "MdmProjectPlugin";
}
@Override
public String getPluginType() {
return "1";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {
logger.info("=====开始执行主数据档案项目档案同步=======");
JsonResultEntity jsonResultEntity = masterDataProjectService.queryProjectArchives(requestJson);
return jsonResultEntity;
}catch (Exception e){
logger.info("======执行主数据档案项目档案同步失败:{}",e.getMessage());
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,12 @@
package masterData.service;
import masterData.entity.MdmProjectEntity;
import com.hzya.frame.basedao.service.IBaseService;
/**
* 项目档案(MdmProject)表服务接口
*
* @author makejava
* @since 2024-06-07 18:29:23
*/
public interface IMdmProjectService extends IBaseService<MdmProjectEntity, String>{
}

View File

@ -0,0 +1,25 @@
package masterData.service.impl;
import masterData.entity.MdmProjectEntity;
import masterData.dao.IMdmProjectDao;
import masterData.service.IMdmProjectService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
/**
* 项目档案(MdmProject)表服务实现类
*
* @author makejava
* @since 2024-06-07 18:29:23
*/
public class MdmProjectServiceImpl extends BaseService<MdmProjectEntity, String> implements IMdmProjectService {
private IMdmProjectDao mdmProjectDao;
@Autowired
public void setMdmProjectDao(IMdmProjectDao dao) {
this.mdmProjectDao = dao;
this.dao = dao;
}
}

View File

@ -20,7 +20,15 @@ public class MdmModuleSourceEntity extends BaseEntity {
private String sourceCode;
/** 公司id */
private String companyId;
private String pluginCode;//插件编码
public String getPluginCode() {
return pluginCode;
}
public void setPluginCode(String pluginCode) {
this.pluginCode = pluginCode;
}
public String getMdmId() {
return mdmId;

View File

@ -132,12 +132,11 @@
</select>
<!-- 根据数据来源内类型是插件的应用类型做分组 -->
<select id="MdmModuleSourceentityGroupByType" resultMap="get-MdmModuleSourceEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity">
select
source_type as sourceType,source_name as sourceName,source_code as sourceCode
from mdm_module_source
where source_type='1' and sts='Y'
group by source_type,source_name,source_code
<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>
<!--新增所有列-->

View File

@ -110,13 +110,4 @@ public interface IComparisonDao extends IBaseDao<ComparisonEntity, String> {
* **/
List<ComparisonEntity> queryComparisonBymdmIdFileds(ComparisonEntity comparison);
/**
*
* @content 根据数据来源内类型是插件的应用类型做分组
* @Param
* @Return
* @Author hecan
* @Date 2024/6/4 17:41
* **/
List<ComparisonEntity> queryModuleSource();
}

View File

@ -81,10 +81,4 @@ public class ComparisonDaoImpl extends MybatisGenericDao<ComparisonEntity, Strin
return list;
}
//根据数据来源内类型是插件的应用类型做分组
@Override
public List<ComparisonEntity> queryModuleSource() {
List<ComparisonEntity> list =(List<ComparisonEntity>) super.selectList(getSqlIdPrifx() + "queryModuleSource","");
return list;
}
}

View File

@ -32,7 +32,7 @@ public class ComparisonEntity extends BaseEntity {
private String rulePrefix;//规则前缀 CK-yyyyMMdd-0001中的CK
private String ruleMiddle;//规则中间 CK-yyyyMMdd-0001中的yyyyMMdd
private String ruleSuffix;//规则后缀 CK-yyyyMMdd-0001中的0001
private int ruleSuffix;//规则后缀 CK-yyyyMMdd-0001中的0001
private String mId;//mdm_module的id
private String dbId;//mdm_module_db的id
@ -100,11 +100,11 @@ public class ComparisonEntity extends BaseEntity {
this.ruleMiddle = ruleMiddle;
}
public String getRuleSuffix() {
public int getRuleSuffix() {
return ruleSuffix;
}
public void setRuleSuffix(String ruleSuffix) {
public void setRuleSuffix(int ruleSuffix) {
this.ruleSuffix = ruleSuffix;
}

View File

@ -35,7 +35,7 @@
left join mdm_module_db moddb on m.id=moddb.mdm_id
left join mdm_module_db_fileds filed
on filed.mdm_id=m.id and filed.db_id=moddb.id
where m.mdm_code= #{mdmCode}
where m.mdm_code= #{mdmCode} and (moddb.db_type='1' or moddb.db_type='2')
</select>
<!--根据主数据编码查询mdm_module的数据-->
@ -61,7 +61,7 @@
update_type as updateType,show_type as showType, query_type as queryType,
list_type as listType, view_type as viewType,mdm_id as mId,db_id as dbId
from mdm_module_db_fileds
where mdm_id= #{mId} and sts='Y'
where db_id= #{dbId} and sts='Y'
</select>
<!--根据mdm_module的id和mdm_module_db的id查询单据规则-->
@ -74,21 +74,14 @@
<select id="queryComparisonRule" resultMap="get-ComparisonEntity-result"
parameterType="com.hzya.frame.sysnew.comparison.entity.ComparisonEntity">
select
concat(#{rulePrefix},'-',date_format(NOW(),#{ruleMiddle}),'-',ifnull(max(substring_index(document_rule,'-',-1)),'0')+1) as documentRule,
concat(#{rulePrefix},'-',date_format(NOW(),#{ruleMiddle}),'-',LPAD((ifnull(max(substring_index(document_rule,'-',-1)+0),'0')+1),${ruleSuffix},'0')) as documentRule,
substring_index(
(concat(#{rulePrefix},'-',date_format(NOW(),#{ruleMiddle}),'-',ifnull(max(substring_index(document_rule,'-',-1)),'0')+1)),'-',-1
(concat(#{rulePrefix},'-',date_format(NOW(),#{ruleMiddle}),'-',LPAD((ifnull(max(substring_index(document_rule,'-',-1)+0),'0')+1),${ruleSuffix},'0'))),'-',-1
)
as documentRuleNum
from ${dbName} where document_rule like concat(#{rulePrefix},'-',date_format(NOW(),#{ruleMiddle}),'-','%');
</select>
<!--根据数据来源内类型是插件的应用类型做分组-->
<select id="queryModuleSource" resultMap="get-ComparisonEntity-result"
parameterType="com.hzya.frame.sysnew.comparison.entity.ComparisonEntity">
select source_type,source_name,source_code from mdm_module_source group by source_type,source_name,source_code
</select>
<!--新增档案数据-->
<insert id="saveComparison" parameterType = "java.util.Map">
insert into ${dbName}

View File

@ -0,0 +1,23 @@
package com.hzya.frame.sysnew.comparison.masterData.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import java.util.HashMap;
import java.util.List;
public interface IMasterDataDao extends IBaseService<ComparisonEntity, String> {
/**
*
* @content 查询U8C档案
* @Param
* @Return
* @Author hecan
* @Date 2024/6/6 11:56
* **/
@DS("swu8c")
List<HashMap<String, Object>> queryArchives(String str);
}

View File

@ -0,0 +1,31 @@
package com.hzya.frame.sysnew.comparison.masterData.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.execsql.service.IExecSqlService;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import com.hzya.frame.sysnew.comparison.masterData.dao.IMasterDataDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
@Repository(value = "masterDataDaoImpl")
public class MasterDataDaoImpl extends BaseService<ComparisonEntity, String> implements IMasterDataDao {
@Autowired
private IExecSqlService execSqlService;
@DS("swu8c")
@Override
public List<HashMap<String, Object>> queryArchives(String str) {
try {
List<HashMap<String, Object>> hashMaps = execSqlService.execSelectSql(str, "");
return hashMaps;
}catch (Exception e){
logger.info("U8C主数据档案用户档案没有需要同步中台的数据");
return null;
}
}
}

View File

@ -0,0 +1,19 @@
package com.hzya.frame.sysnew.comparison.masterData.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
public interface IMasterDataOrgsService extends IBaseService<ComparisonEntity, String> {
/**
*
* @content 查询组织档案
* @Param
* @Return
* @Author hecan
* @Date 2024/6/4 16:57
* **/
JsonResultEntity queryOrgsArchives(JSONObject jsonObject);
}

View File

@ -0,0 +1,19 @@
package com.hzya.frame.sysnew.comparison.masterData.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
public interface IMasterDataProjectService extends IBaseService<ComparisonEntity, String> {
/**
*
* @content 查询项目档案
* @Param
* @Return
* @Author hecan
* @Date 2024/6/6 16:10
* **/
JsonResultEntity queryProjectArchives(JSONObject jsonObject);
}

View File

@ -0,0 +1,138 @@
package com.hzya.frame.sysnew.comparison.masterData.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.dateutil.DateUtil;
import com.hzya.frame.mdm.mdmModuleSource.dao.impl.MdmModuleSourceDaoImpl;
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import com.hzya.frame.sysnew.comparison.masterData.dao.impl.MasterDataDaoImpl;
import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataOrgsService;
import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataProjectService;
import com.hzya.frame.sysnew.comparison.service.impl.ComparisonServiceImpl;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@Service("masterDataOrgsServiceImpl")
public class MasterDataOrgsServiceImpl extends BaseService<ComparisonEntity, String> implements IMasterDataOrgsService {
@Autowired
private MasterDataDaoImpl masterDataDaoImpl;
@Autowired
private ComparisonServiceImpl comparisonServiceimpl;
@Autowired
private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl;
private String ts = "";
//查询用户档案并同步中台
@Override
public JsonResultEntity queryOrgsArchives(JSONObject json) {
JSONObject jsonObject = json.getJSONObject("jsonStr");
//查询主数据来源表根据来源类型为插件得进行分类获取来源名称和编码
List<MdmModuleSourceEntity> list = mdmModuleSourceDaoImpl.MdmModuleSourceentityGroupByType();
if (CollectionUtils.isEmpty(list)) {
logger.info("数据来源表中没有类型为插件得数据,无法获取来源名称和来源编码");
return BaseResult.getFailureMessageEntity("数据来源表无插件类型");
}
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
//此处应该根据来源编码进行case 暂时测试使用U8C
switch (mdmModuleSourceEntity.getPluginCode()) {
case "MdmOrgPlugin":
if (null == ts || "".equals(ts)) {
ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
}
ts = "'" + ts + "'";
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("select pk_corp as id,unitcode as org_code,unitname as org_name,");
stringBuffer.append("saleaddr as org_address,countryarea as org_countryzone,memo as org_memo,");
stringBuffer.append("industry as org_ncindustry,fathercorp as org_fatherorg,legalbodycode as org_principal,");
stringBuffer.append("phone1 as org_tel from bd_corp where dr='0' and ts>"+ts);
try {
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchives(stringBuffer.toString());
logger.info("查询出来的值为:{}",hashMaps);
if (null != hashMaps && hashMaps.size() > 0) {
ParametricAssembly(mdmModuleSourceEntity,hashMaps,"10001");
} else {
logger.info("U8C主数据档案组织档案没有需要同步中台的数据");
return null;
}
} catch (Exception e) {
logger.info("查询主数据档案组织档案错误:{}", e.getMessage());
}
break;
default:
break;
}
}
return BaseResult.getSuccessMessageEntity("组织档案同步成功");
}
//查询档案参数组装
private void ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List<HashMap<String, Object>> hashMaps,String mdmCode){
for (HashMap<String, Object> hashMap : hashMaps) {
JSONObject jsonObjectUser = new JSONObject();
JSONObject jsonStr = new JSONObject();
jsonObjectUser.put("id", hashMap.get("id"));
jsonObjectUser.put("mdmCode", mdmCode);
jsonStr.put("jsonStr", jsonObjectUser);
//先查询编码和名称查询是否存在
JsonResultEntity jsonResultEntity = comparisonServiceimpl.queryEntityPage(jsonStr);
Object attribute = jsonResultEntity.getAttribute();
logger.info("得到的attribute值为{}", attribute);
JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute);
JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list");
//如果jsonArrayList为null说明没有值在表中不存在
if (jsonArrayList == null || jsonArrayList.size() == 0) {
//将查询出来得数据调用通用接口新增保存到表中
JSONObject main = new JSONObject();
for(String key:hashMap.keySet()) {
main.put(key, hashMap.get(key));
}
jsonObjectUser.put("main", main);
jsonObjectUser.put("sourceName",mdmModuleSourceEntity.getSourceName());
jsonObjectUser.put("code",mdmModuleSourceEntity.getSourceCode());
jsonObjectUser.put("optionName", "数智中台");
jsonStr.put("jsonStr", jsonObjectUser);
try {
comparisonServiceimpl.saveEntity(jsonStr);
} catch (Exception e) {
logger.info("U8C主数据档案新增档案失败,失败原因:{}",e.getMessage());
}
} else {
for (Object o : jsonArrayList) {
JSONObject jsonObjectUpdate = JSON.parseObject(String.valueOf(o));
String id = jsonObjectUpdate.getString("id");
JSONObject main = new JSONObject();
for(String key:hashMap.keySet()) {
main.put(key, hashMap.get(key));
main.put("id",id);
}
jsonObjectUser.put("main", main);
jsonObjectUser.put("sourceName",mdmModuleSourceEntity.getSourceName());
jsonObjectUser.put("code",mdmModuleSourceEntity.getSourceCode());
jsonObjectUser.put("optionName", "数智中台");
jsonStr.put("jsonStr", jsonObjectUser);
try {
comparisonServiceimpl.updateEntity(jsonStr);
} catch (Exception e) {
logger.info("U8C主数据档案更新档案失败,失败原因:{}", e.getMessage());
}
}
}
}
}
}

View File

@ -0,0 +1,132 @@
package com.hzya.frame.sysnew.comparison.masterData.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.dateutil.DateUtil;
import com.hzya.frame.mdm.mdmModuleSource.dao.impl.MdmModuleSourceDaoImpl;
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import com.hzya.frame.sysnew.comparison.masterData.dao.impl.MasterDataDaoImpl;
import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataProjectService;
import com.hzya.frame.sysnew.comparison.service.impl.ComparisonServiceImpl;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@Service("masterDataProjectServiceImpl")
public class MasterDataProjectServiceImpl extends BaseService<ComparisonEntity, String> implements IMasterDataProjectService {
@Autowired
private MasterDataDaoImpl masterDataDaoImpl;
@Autowired
private ComparisonServiceImpl comparisonServiceimpl;
@Autowired
private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl;
private String ts = "";
//同步项目档案
public JsonResultEntity queryProjectArchives(JSONObject json){
JSONObject jsonObject = json.getJSONObject("jsonStr");
//查询主数据来源表根据来源类型为插件得进行分类获取来源名称和编码
List<MdmModuleSourceEntity> list = mdmModuleSourceDaoImpl.MdmModuleSourceentityGroupByType();
if (CollectionUtils.isEmpty(list)) {
logger.info("数据来源表中没有类型为插件得数据,无法获取来源名称和来源编码");
return BaseResult.getFailureMessageEntity("数据来源表无插件类型");
}
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
//此处应该根据来源编码进行case 暂时测试使用U8C
switch (mdmModuleSourceEntity.getPluginCode()) {
case "MdmProjectPlugin":
if (null == ts || "".equals(ts)) {
ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
}
ts = "'" + ts + "'";
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("select pk_jobbasfil as id,jobcode as project_code, jobname as project_name from bd_jobbasfil where dr='0' and ts>" + ts);
try {
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchives(stringBuffer.toString());
logger.info("查询出来的值为:{}",hashMaps);
if (null != hashMaps && hashMaps.size() > 0) {
ParametricAssembly(mdmModuleSourceEntity,hashMaps,"10002");
} else {
logger.info("U8C主数据档案项目档案没有需要同步中台的数据");
return null;
}
} catch (Exception e) {
logger.info("查询主数据档案项目档案错误:{}", e.getMessage());
}
break;
default:
break;
}
}
return BaseResult.getSuccessMessageEntity("项目档案同步成功");
}
//查询档案参数组装
public JsonResultEntity ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List<HashMap<String, Object>> hashMaps,String mdmCode){
for (HashMap<String, Object> hashMap : hashMaps) {
JSONObject jsonObjectUser = new JSONObject();
JSONObject jsonStr = new JSONObject();
jsonObjectUser.put("id", hashMap.get("id"));
jsonObjectUser.put("mdmCode", mdmCode);
jsonStr.put("jsonStr", jsonObjectUser);
//先查询编码和名称查询是否存在
JsonResultEntity jsonResultEntity = comparisonServiceimpl.queryEntityPage(jsonStr);
Object attribute = jsonResultEntity.getAttribute();
logger.info("得到的attribute值为{}", attribute);
JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute);
JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list");
//如果jsonArrayList为null说明没有值在表中不存在
if (jsonArrayList == null || jsonArrayList.size() == 0) {
//将查询出来得数据调用通用接口新增保存到表中
JSONObject main = new JSONObject();
for(String key:hashMap.keySet()) {
main.put(key, hashMap.get(key));
}
jsonObjectUser.put("main", main);
jsonObjectUser.put("sourceName",mdmModuleSourceEntity.getSourceName());
jsonObjectUser.put("code",mdmModuleSourceEntity.getSourceCode());
jsonObjectUser.put("optionName", "数智中台");
jsonStr.put("jsonStr", jsonObjectUser);
try {
comparisonServiceimpl.saveEntity(jsonStr);
} catch (Exception e) {
logger.info("U8C主数据档案新增用户档案失败,失败原因:{}",e.getMessage());
}
} else {
for (Object o : jsonArrayList) {
JSONObject jsonObjectUpdate = JSON.parseObject(String.valueOf(o));
String id = jsonObjectUpdate.getString("id");
JSONObject main = new JSONObject();
for(String key:hashMap.keySet()) {
main.put(key, hashMap.get(key));
main.put("id",id);
}
jsonObjectUser.put("main", main);
jsonObjectUser.put("sourceName",mdmModuleSourceEntity.getSourceName());
jsonObjectUser.put("code",mdmModuleSourceEntity.getSourceCode());
jsonObjectUser.put("optionName", "数智中台");
jsonStr.put("jsonStr", jsonObjectUser);
try {
comparisonServiceimpl.updateEntity(jsonStr);
} catch (Exception e) {
logger.info("U8C主数据档案更新用户档案失败,失败原因:{}", e.getMessage());
}
}
}
}
return null;
}
}

View File

@ -6,16 +6,21 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
import com.hzya.frame.mdm.service.impl.MdmServiceCache;
import com.hzya.frame.sysnew.comparison.controlsLog.dao.impl.ControlsLogDaoImpl;
import com.hzya.frame.sysnew.comparison.dao.IComparisonDao;
import com.hzya.frame.sysnew.comparison.dao.IComparisonDetailsDao;
import com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import com.hzya.frame.sysnew.comparison.service.IComparisonService;
import com.hzya.frame.sysnew.generalData.dao.IGeneralDataDao;
import com.hzya.frame.uuid.UUIDUtils;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.apache.ivy.Main;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sun.java2d.pipe.AAShapePipe;
@ -30,6 +35,12 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
@Autowired
private IComparisonDetailsDao comparisonDetailsDao;
@Autowired
private ControlsLogDaoImpl controlsLogDaoimpl;
@Autowired
private MdmServiceCache mdmServiceCache;
@Autowired
public void setGeneralDataDao(IComparisonDao dao) {
this.comparisonDao = dao;
@ -53,7 +64,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
//根据主数据编码查询表名称字段名称等信息 10001
//comparisonEntities = comparisonDao.queryComparison(comparisonEntity);
comparisonEntities=getComparisonEntity(comparisonEntity);
//comparisonEntities=getComparisonEntity(comparisonEntity);
comparisonEntities=getComparisonEntityCache(comparisonEntity,"main");
}catch (Exception e){
logger.info("根据主数据编码查询信息错误:{}",e.getMessage());
return BaseResult.getFailureMessageEntity("查询失败");
@ -95,6 +107,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
if (!checkStr(jsonObject.getString("mdmCode"))) {
return BaseResult.getFailureMessageEntity("主数据编码为空");
}
if (!checkStr(jsonObject.getString("optionName"))) {
return BaseResult.getFailureMessageEntity("操作人为空");
}
/*if (!checkStr(jsonObject.getString("rulePrefix"))) {
return BaseResult.getFailureMessageEntity("规则为空");
}*/
@ -105,7 +120,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
//根据主数据编码查询表名称字段名称等信息 10001
// comparisonEntities = comparisonDao.queryComparison(comparisonEntity);
comparisonEntities=getComparisonEntity(comparisonEntity);
//comparisonEntities=getComparisonEntity(comparisonEntity);
comparisonEntities=getComparisonEntityCache(comparisonEntity,"main");
}catch (Exception e){
logger.info("根据主数据编码查询信息错误:{}",e.getMessage());
return BaseResult.getFailureMessageEntity("保存失败");
@ -119,20 +135,27 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
if (comparisonEntities != null && comparisonEntities.size() > 0) {
map=spliceMainMap(comparisonEntities,jsonObjectMain,map,comparisonEntity);
mapDetails=spliceDetailMap(comparisonEntities,mapDetails,comparisonDetailsEntity,jsonArray);
String uuid = UUIDUtils.getUUID();
map.put("id", uuid);
String uuid=null;
if(jsonObjectMain.getString("id")==null){
uuid = UUIDUtils.getUUID();
map.put("id", uuid);
}else{
uuid = jsonObjectMain.getString("id");
map.put("id", jsonObjectMain.getString("id"));
}
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
map.put("org_id", "0");
map.put("create_time", new Date());
map.put("modify_time", new Date());
map.put("sts", "Y");
map.put("data_status","Y");//新增状态
map.put("add_status","0");//新增状态
map.put("update_status","1");//修改状态
map.put("delete_status","1");//删除状态
ComparisonEntity comparisonEntityRule = comparisonEntities.get(0);
//查询单据规则
try {
ComparisonEntity comparisonEntityRule = comparisonEntities.get(0);
comparisonEntityRule= comparisonDao.queryComparisonById(comparisonEntityRule);
String documentRule =comparisonEntityRule.getDocumentRule();; //"KH-2024-05-30-1";
logger.info("通用数据保存接口中根据mId查询出来的单据规则为:{}",documentRule);
@ -143,7 +166,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
String ruleDate = documentRule.substring(documentRule.indexOf("-") + 1, documentRule.lastIndexOf("-"));
String ruleMiddle = getRuleDate(ruleDate);
//获取规则后缀
String ruleSuffix= documentRule.substring(documentRule.lastIndexOf("-")+1);
String ruleSuffixLength= documentRule.substring(documentRule.lastIndexOf("-")+1);
int ruleSuffix = ruleSuffixLength.length();
//生成单据规则
comparisonEntity.setRulePrefix(rulePrefix);
comparisonEntity.setRuleMiddle(ruleMiddle);
@ -168,7 +192,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
ComparisonEntity comparisonEntityOne = comparisonDao.saveComparison(comparisonEntity);
//保存子表数据
if (mapDetails != null && mapDetails.size() > 0) {
mapDetails.put("id", UUIDUtils.getUUID());
String uuidDetail = UUIDUtils.getUUID();
mapDetails.put("id", uuidDetail);
mapDetails.put("formmain_id", uuid);
mapDetails.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
mapDetails.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
@ -176,11 +201,17 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
mapDetails.put("create_time", new Date());
mapDetails.put("modify_time", new Date());
mapDetails.put("sts", "Y");
mapDetails.put("data_status","Y");//新增状态
comparisonDetailsEntity.setMapDetails(mapDetails);
ComparisonDetailsEntity comparisonDetailsEntityOne = comparisonDetailsDao.saveComparisonDetails(comparisonDetailsEntity);
comparisonEntityOne.setComparisonDetailsEntity(comparisonDetailsEntityOne);
//comparisonEntityOne.setComparisonDetailsEntity(comparisonDetailsEntityOne);
map.put("details",mapDetails);
//保存操作日志
controlsLogDaoimpl.saveControlsLog(uuidDetail,jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
}
return BaseResult.getSuccessMessageEntity("保存成功", comparisonEntityOne);
//保存操作日志
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
return BaseResult.getSuccessMessageEntity("保存成功", map);
} catch (Exception e) {
logger.info("保存通用数据时候错误:{}", e.getMessage());
return BaseResult.getFailureMessageEntity("保存失败");
@ -200,6 +231,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
if (!checkStr(jsonObject.getString("mdmCode"))) {
return BaseResult.getFailureMessageEntity("主数据编码为空");
}
if (!checkStr(jsonObject.getString("optionName"))) {
return BaseResult.getFailureMessageEntity("操作人为空");
}
ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class);
ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity();
JSONObject jsonObjectMain=jsonObject.getJSONObject("main");//获取主表数据
@ -212,7 +246,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
try {
// comparisonEntities = comparisonDao.queryComparison(comparisonEntity);
comparisonEntities=getComparisonEntity(comparisonEntity);
//comparisonEntities=getComparisonEntity(comparisonEntity);
comparisonEntities=getComparisonEntityCache(comparisonEntity,"main");
}catch (Exception e){
logger.info("根据主数据编码查询信息错误:{}",e.getMessage());
return BaseResult.getFailureMessageEntity("更新失败");
@ -221,7 +256,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
Map<String,Object> mapDetails=new HashMap<>();//将子表数据存到map中
if(comparisonEntities !=null && comparisonEntities.size()>0) {
map=spliceMainMap(comparisonEntities,jsonObjectMain,map,comparisonEntity);
mapDetails=spliceDetailMap(comparisonEntities,map,comparisonDetailsEntity,jsonArray);
mapDetails=spliceDetailMap(comparisonEntities,mapDetails,comparisonDetailsEntity,jsonArray);
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
map.put("org_id", "0");
@ -256,7 +291,11 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
comparisonDetailsEntity.setFormmainId(jsonObjectMain.getString("id"));
comparisonDetailsEntity.setMapDetails(mapDetails);
comparisonDetailsDao.updateComparisonDetailsByType(comparisonDetailsEntity);
//保存操作日志
controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
}
//保存操作日志
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
return BaseResult.getSuccessMessageEntity("更新成功", integer);
}else{
return BaseResult.getFailureMessageEntity("更新失败");
@ -290,7 +329,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
try {
// comparisonEntities = comparisonDao.queryComparison(comparisonEntity);
comparisonEntities=getComparisonEntity(comparisonEntity);
//comparisonEntities=getComparisonEntity(comparisonEntity);
comparisonEntities=getComparisonEntityCache(comparisonEntity,"main");
}catch (Exception e){
logger.info("根据主数据编码查询信息错误:{}",e.getMessage());
return BaseResult.getFailureMessageEntity("删除失败");
@ -321,7 +361,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
comparisonDetailsEntity.setFormmainId(jsonObjectMain.getString("id"));
comparisonDetailsEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
comparisonDetailsDao.deleteComparisonDetails(comparisonDetailsEntity);
controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
}
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
return BaseResult.getSuccessMessageEntity("删除成功",integer);
}else{
return BaseResult.getFailureMessageEntity("删除失败","请查看id是否在表中存在");
@ -390,6 +432,92 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
return mapDetails;
}
//根据主数据编码获取主表和明细表表名称表字段信息
public List<ComparisonEntity> getComparisonEntityCache(ComparisonEntity comparison,String type){
List<ComparisonEntity> comparisonEntities = new ArrayList<>();
//根据主数据编号获取模板主表
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(Long.valueOf(comparison.getMdmCode()));
//根据模板主表id获取模版表数据
if(mdmModuleEntity!=null){
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId());
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
if(CollectionUtils.isNotEmpty(mdmModuleDbEntities)){
for (MdmModuleDbEntity moduleDbEntity : mdmModuleDbEntities) {
switch (type){
case "main":
//获取主表和明细表的字段信息
if(moduleDbEntity.getDbType().equals("1") || moduleDbEntity.getDbType().equals("2")){
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity=new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId());
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity);
if(CollectionUtils.isNotEmpty(mdmModuleDbFiledsEntities)){
for (MdmModuleDbFiledsEntity moduleDbFiledsEntity : mdmModuleDbFiledsEntities) {
if (moduleDbFiledsEntity.getDbId().equals(moduleDbEntity.getId())) {
ComparisonEntity comparisonEntityFile = new ComparisonEntity();
comparisonEntityFile.setChName(moduleDbFiledsEntity.getChName());
comparisonEntityFile.setEnName(moduleDbFiledsEntity.getEnName());
comparisonEntityFile.setFiledType(moduleDbFiledsEntity.getFiledType());
comparisonEntityFile.setAddType(moduleDbFiledsEntity.getAddType());
comparisonEntityFile.setUpdateType(moduleDbFiledsEntity.getUpdateType());
comparisonEntityFile.setShowType(moduleDbFiledsEntity.getShowType());
comparisonEntityFile.setQueryType(moduleDbFiledsEntity.getQueryType());
comparisonEntityFile.setListType(moduleDbFiledsEntity.getListType());
comparisonEntityFile.setViewType(moduleDbFiledsEntity.getViewType());
comparisonEntityFile.setDbName(moduleDbEntity.getDbName());
comparisonEntityFile.setDbType(moduleDbEntity.getDbType());
comparisonEntityFile.setDbId(moduleDbEntity.getId());
comparisonEntityFile.setmId(mdmModuleEntity.getId());
comparisonEntityFile.setMdmName(mdmModuleEntity.getMdmName());
comparisonEntityFile.setMdmCode(String.valueOf(mdmModuleEntity.getMdmCode()));
comparisonEntities.add(comparisonEntityFile);
}
}
}
}
break;
case "option":
//获取主表和明细表的字段信息
if(moduleDbEntity.getDbType().equals("3")){
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity=new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity.setDbId(moduleDbEntity.getId());
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity);
if(CollectionUtils.isNotEmpty(mdmModuleDbFiledsEntities)){
for (MdmModuleDbFiledsEntity moduleDbFiledsEntity : mdmModuleDbFiledsEntities) {
if (moduleDbFiledsEntity.getDbId().equals(moduleDbEntity.getId())) {
ComparisonEntity comparisonEntityFile = new ComparisonEntity();
comparisonEntityFile.setChName(moduleDbFiledsEntity.getChName());
comparisonEntityFile.setEnName(moduleDbFiledsEntity.getEnName());
comparisonEntityFile.setFiledType(moduleDbFiledsEntity.getFiledType());
comparisonEntityFile.setAddType(moduleDbFiledsEntity.getAddType());
comparisonEntityFile.setUpdateType(moduleDbFiledsEntity.getUpdateType());
comparisonEntityFile.setShowType(moduleDbFiledsEntity.getShowType());
comparisonEntityFile.setQueryType(moduleDbFiledsEntity.getQueryType());
comparisonEntityFile.setListType(moduleDbFiledsEntity.getListType());
comparisonEntityFile.setViewType(moduleDbFiledsEntity.getViewType());
comparisonEntityFile.setDbName(moduleDbEntity.getDbName());
comparisonEntityFile.setDbType(moduleDbEntity.getDbType());
comparisonEntityFile.setDbId(moduleDbEntity.getId());
comparisonEntityFile.setmId(mdmModuleEntity.getId());
comparisonEntityFile.setMdmName(mdmModuleEntity.getMdmName());
comparisonEntityFile.setMdmCode(String.valueOf(mdmModuleEntity.getMdmCode()));
comparisonEntities.add(comparisonEntityFile);
}
}
}
}
break;
default:
break;
}
}
}
return comparisonEntities;
}
return null;
}
//根据主数据编码获取数据表名称字段名称等
public List<ComparisonEntity> getComparisonEntity(ComparisonEntity comparisonEntity) {
List<ComparisonEntity> comparisonEntities = new ArrayList<>();
@ -398,7 +526,38 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
if (comparisonEntityModule != null) {
//根据mdm_module得id查询mdm_module_db得数据
List<ComparisonEntity> comparisonEntitiesModuleDb = comparisonDao.queryComparisonBymdmId(comparisonEntityModule);
//根据mdm_module得id查询mdm_module_db_fileds得数据
if(CollectionUtils.isNotEmpty(comparisonEntitiesModuleDb)) {
for (ComparisonEntity comparison : comparisonEntitiesModuleDb) {
//查询出主表和明细表信息
if(comparison.getDbType().equals("1")||comparison.getDbType().equals("2")) {
//根据mdm_module_db的id查询对应表的字段
List<ComparisonEntity> comparisonEntitiesFiles = comparisonDao.queryComparisonBymdmIdFileds(comparison);
if (CollectionUtils.isNotEmpty(comparisonEntitiesFiles)) {
for (ComparisonEntity comparisonEntitiesFile : comparisonEntitiesFiles) {
ComparisonEntity comparisonEntityFile = new ComparisonEntity();
comparisonEntityFile.setChName(comparisonEntitiesFile.getChName());
comparisonEntityFile.setEnName(comparisonEntitiesFile.getEnName());
comparisonEntityFile.setFiledType(comparisonEntitiesFile.getFiledType());
comparisonEntityFile.setAddType(comparisonEntitiesFile.getAddType());
comparisonEntityFile.setUpdateType(comparisonEntitiesFile.getUpdateType());
comparisonEntityFile.setShowType(comparisonEntitiesFile.getShowType());
comparisonEntityFile.setQueryType(comparisonEntitiesFile.getQueryType());
comparisonEntityFile.setListType(comparisonEntitiesFile.getListType());
comparisonEntityFile.setViewType(comparisonEntitiesFile.getViewType());
comparisonEntityFile.setDbName(comparison.getDbName());
comparisonEntityFile.setDbType(comparison.getDbType());
comparisonEntityFile.setDbId(comparison.getDbId());
comparisonEntityFile.setmId(comparisonEntitiesFile.getmId());
comparisonEntityFile.setMdmName(comparisonEntityModule.getMdmName());
comparisonEntityFile.setMdmCode(comparisonEntityModule.getMdmCode());
comparisonEntities.add(comparisonEntityFile);
}
}
}
}
}
/* //根据mdm_module得id查询mdm_module_db_fileds得数据
List<ComparisonEntity> comparisonEntitiesFiles = comparisonDao.queryComparisonBymdmIdFileds(comparisonEntityModule);
for (ComparisonEntity comparison : comparisonEntitiesModuleDb) {
for (ComparisonEntity comparisonEntitiesFile : comparisonEntitiesFiles) {
@ -422,22 +581,10 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
comparisonEntities.add(comparisonEntityFile);
}
}
}
}*/
return comparisonEntities;
}
return null;
}
//查询数据来源 根据数据来源内类型是插件的应用类型做分组
public List<ComparisonEntity> getComparisonEntityFiles(){
List<ComparisonEntity> comparisonEntities = comparisonDao.queryModuleSource();
if(CollectionUtils.isNotEmpty(comparisonEntities)){
for (ComparisonEntity comparisonEntity : comparisonEntities) {
//根据来源类型获取档案数据 比如U8C
}
}
return null;
}
}