主数据修改,数据源切换
This commit is contained in:
parent
e223dbd22d
commit
4f30c7f8fb
|
@ -25,6 +25,8 @@ public class MdmDto {
|
|||
private String id;
|
||||
//id
|
||||
private String fieldId;
|
||||
//id
|
||||
private String dbId;
|
||||
//3、新增4、修改 5、查看
|
||||
private String showType;
|
||||
//分页
|
||||
|
@ -222,5 +224,13 @@ public class MdmDto {
|
|||
public void setFieldId(String fieldId) {
|
||||
this.fieldId = fieldId;
|
||||
}
|
||||
|
||||
public String getDbId() {
|
||||
return dbId;
|
||||
}
|
||||
|
||||
public void setDbId(String dbId) {
|
||||
this.dbId = dbId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -391,14 +391,12 @@ where id = #{id}
|
|||
</when>
|
||||
</choose>
|
||||
PRIMARY KEY (`sorts`,`id`) USING BTREE
|
||||
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = #{tableRemark}
|
||||
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4
|
||||
<if test="tableRemark != null and tableRemark != ''"> COMMENT = #{tableRemark} </if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--通过ID获取数据 -->
|
||||
<select id="alterTable" resultType="java.lang.Integer">
|
||||
ALTER TABLE ${tableName}
|
||||
|
@ -464,14 +462,14 @@ where id = #{id}
|
|||
<when test="filedType == '1'.toString()">
|
||||
<choose>
|
||||
<when test="dataType == '1'.toString()">
|
||||
MODIFY COLUMN ${enName} bigint(${filedLength}) DEFAULT NULL COMMENT
|
||||
add COLUMN ${enName} bigint(${filedLength}) DEFAULT NULL COMMENT
|
||||
#{chName}
|
||||
</when>
|
||||
<when test="dataType == '3'.toString()">
|
||||
drop COLUMN ${enName}
|
||||
</when>
|
||||
<otherwise>
|
||||
add COLUMN ${enName} bigint(${filedLength}) DEFAULT NULL COMMENT
|
||||
MODIFY COLUMN ${enName} bigint(${filedLength}) DEFAULT NULL COMMENT
|
||||
#{chName}
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
@ -479,14 +477,14 @@ where id = #{id}
|
|||
<when test="filedType == '3'.toString()">
|
||||
<choose>
|
||||
<when test="dataType == '1'.toString()">
|
||||
MODIFY COLUMN ${enName} varchar(${filedLength}) DEFAULT NULL
|
||||
add COLUMN ${enName} varchar(${filedLength}) DEFAULT NULL
|
||||
COMMENT #{chName}
|
||||
</when>
|
||||
<when test="dataType == '3'.toString()">
|
||||
drop COLUMN ${enName}
|
||||
</when>
|
||||
<otherwise>
|
||||
add COLUMN ${enName} varchar(${filedLength}) DEFAULT NULL COMMENT
|
||||
MODIFY COLUMN ${enName} varchar(${filedLength}) DEFAULT NULL COMMENT
|
||||
#{chName}
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
@ -495,14 +493,14 @@ where id = #{id}
|
|||
<when test="filedType == '2'.toString()">
|
||||
<choose>
|
||||
<when test="dataType == '1'.toString()">
|
||||
MODIFY COLUMN ${enName} decimal(${filedLength}) DEFAULT NULL COMMENT
|
||||
add COLUMN ${enName} decimal(${filedLength}) DEFAULT NULL COMMENT
|
||||
#{chName}
|
||||
</when>
|
||||
<when test="dataType == '3'.toString()">
|
||||
drop COLUMN ${enName}
|
||||
</when>
|
||||
<otherwise>
|
||||
add COLUMN ${enName} decimal(${filedLength}) DEFAULT NULL COMMENT
|
||||
MODIFY COLUMN ${enName} decimal(${filedLength}) DEFAULT NULL COMMENT
|
||||
#{chName}
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
@ -510,13 +508,13 @@ where id = #{id}
|
|||
<when test="filedType == '4'.toString()">
|
||||
<choose>
|
||||
<when test="dataType == '1'.toString()">
|
||||
MODIFY COLUMN ${enName} datetime DEFAULT NULL COMMENT #{chName}
|
||||
add COLUMN ${enName} datetime DEFAULT NULL COMMENT #{chName}
|
||||
</when>
|
||||
<when test="dataType == '3'.toString()">
|
||||
drop COLUMN ${enName}
|
||||
</when>
|
||||
<otherwise>
|
||||
add COLUMN ${enName} datetime DEFAULT NULL COMMENT #{chName}
|
||||
MODIFY COLUMN ${enName} datetime DEFAULT NULL COMMENT #{chName}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
|
|
|
@ -122,6 +122,14 @@ public interface IMdmModuleService extends IBaseService<MdmModuleEntity, String>
|
|||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity queryMdmDbField(JSONObject jsonObject);
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 主数据-数据源-数据表字段明细
|
||||
* @Date 11:43 上午 2024/6/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity queryMdmDbFieldDetail(JSONObject jsonObject);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -342,4 +350,42 @@ public interface IMdmModuleService extends IBaseService<MdmModuleEntity, String>
|
|||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity queryMdmDistributeLogPage(JSONObject jsonObject);
|
||||
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 主数据-数据源-服务获取(只获取主表)
|
||||
* @Date 11:43 上午 2024/6/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity queryMdmService(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 主数据-数据源-服务字段获取(只获取主表)
|
||||
* @Date 11:43 上午 2024/6/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity queryMdmServiceField(JSONObject jsonObject);
|
||||
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 主数据-分发-只获取主表
|
||||
* @Date 11:43 上午 2024/6/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity queryMdmMainDB(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 主数据-数据源-只获取主表字段
|
||||
* @Date 11:43 上午 2024/6/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity queryMdmMainDBField(JSONObject jsonObject);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -45,6 +45,8 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
|
|||
private String companyId;
|
||||
/** 数据类型 1、新增 2、修改 */
|
||||
private String dataType;
|
||||
/** 类型 1、主表 2、明细 3、操作日志 4、下发日志 */
|
||||
private String dbType;
|
||||
/**
|
||||
* roletype
|
||||
*/
|
||||
|
@ -208,5 +210,13 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
|
|||
public void setFieldType(String fieldType) {
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
public String getDbType() {
|
||||
return dbType;
|
||||
}
|
||||
|
||||
public void setDbType(String dbType) {
|
||||
this.dbType = dbType;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -293,5 +293,7 @@ update mdm_module_db_fileds_rule set sts= 'N' ,modify_time = #{modify_time},mod
|
|||
and sts='Y'
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.hzya.frame.basedao.dao.IBaseDao;
|
|||
* 主数据功能应用分发表(mdm_module_distribute: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-03 08:47:33
|
||||
* @since 2024-06-14 10:06:36
|
||||
*/
|
||||
public interface IMdmModuleDistributeDao extends IBaseDao<MdmModuleDistributeEntity, String> {
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
|||
* 主数据功能应用分发表(MdmModuleDistribute)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-03 08:47:33
|
||||
* @since 2024-06-14 10:06:36
|
||||
*/
|
||||
@Repository(value = "MdmModuleDistributeDaoImpl")
|
||||
public class MdmModuleDistributeDaoImpl extends MybatisGenericDao<MdmModuleDistributeEntity, String> implements IMdmModuleDistributeDao{
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.hzya.frame.web.entity.BaseEntity;
|
|||
* 主数据功能应用分发表(MdmModuleDistribute)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-03 08:47:33
|
||||
* @since 2024-06-14 10:06:36
|
||||
*/
|
||||
public class MdmModuleDistributeEntity extends BaseEntity {
|
||||
|
||||
|
@ -25,8 +25,11 @@ public class MdmModuleDistributeEntity extends BaseEntity {
|
|||
private String deleteApi;
|
||||
/** 启用停用 0、停用1、启用 */
|
||||
private String enabledState;
|
||||
/** 主表ID */
|
||||
private String dbId;
|
||||
/** 公司id */
|
||||
private String companyId;
|
||||
|
||||
private List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities;
|
||||
|
||||
public String getMdmId() {
|
||||
|
@ -77,6 +80,14 @@ public class MdmModuleDistributeEntity extends BaseEntity {
|
|||
this.enabledState = enabledState;
|
||||
}
|
||||
|
||||
public String getDbId() {
|
||||
return dbId;
|
||||
}
|
||||
|
||||
public void setDbId(String dbId) {
|
||||
this.dbId = dbId;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<result property="addApi" column="add_api" jdbcType="VARCHAR"/>
|
||||
<result property="deleteApi" column="delete_api" jdbcType="VARCHAR"/>
|
||||
<result property="enabledState" column="enabled_state" jdbcType="VARCHAR"/>
|
||||
<result property="dbId" column="db_id" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
|
@ -28,6 +29,7 @@
|
|||
,add_api
|
||||
,delete_api
|
||||
,enabled_state
|
||||
,db_id
|
||||
,sorts
|
||||
,create_user_id
|
||||
,create_time
|
||||
|
@ -37,6 +39,13 @@
|
|||
,org_id
|
||||
,company_id
|
||||
</sql>
|
||||
|
||||
<!--通过ID获取数据 -->
|
||||
<select id="entity_get" resultMap="get-MdmModuleDistributeEntity-result">
|
||||
select
|
||||
<include refid="MdmModuleDistributeEntity_Base_Column_List" />
|
||||
from mdm_module_distribute where id = #{ id } and sts='Y'
|
||||
</select>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-MdmModuleDistributeEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity">
|
||||
select
|
||||
|
@ -50,6 +59,7 @@
|
|||
<if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if>
|
||||
<if test="deleteApi != null and deleteApi != ''"> and delete_api = #{deleteApi} </if>
|
||||
<if test="enabledState != null and enabledState != ''"> and enabled_state = #{enabledState} </if>
|
||||
<if test="dbId != null and dbId != ''"> and db_id = #{dbId} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
|
@ -75,6 +85,7 @@
|
|||
<if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if>
|
||||
<if test="deleteApi != null and deleteApi != ''"> and delete_api = #{deleteApi} </if>
|
||||
<if test="enabledState != null and enabledState != ''"> and enabled_state = #{enabledState} </if>
|
||||
<if test="dbId != null and dbId != ''"> and db_id = #{dbId} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
|
@ -102,6 +113,7 @@
|
|||
<if test="addApi != null and addApi != ''"> and add_api like concat('%',#{addApi},'%') </if>
|
||||
<if test="deleteApi != null and deleteApi != ''"> and delete_api like concat('%',#{deleteApi},'%') </if>
|
||||
<if test="enabledState != null and enabledState != ''"> and enabled_state like concat('%',#{enabledState},'%') </if>
|
||||
<if test="dbId != null and dbId != ''"> and db_id like concat('%',#{dbId},'%') </if>
|
||||
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
||||
|
@ -129,6 +141,7 @@
|
|||
<if test="addApi != null and addApi != ''"> or add_api = #{addApi} </if>
|
||||
<if test="deleteApi != null and deleteApi != ''"> or delete_api = #{deleteApi} </if>
|
||||
<if test="enabledState != null and enabledState != ''"> or enabled_state = #{enabledState} </if>
|
||||
<if test="dbId != null and dbId != ''"> or db_id = #{dbId} </if>
|
||||
<if test="sorts != null"> or sorts = #{sorts} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> or create_time = #{create_time} </if>
|
||||
|
@ -144,7 +157,7 @@
|
|||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity" >
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity" >
|
||||
insert into mdm_module_distribute(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
|
@ -154,6 +167,7 @@
|
|||
<if test="addApi != null and addApi != ''"> add_api , </if>
|
||||
<if test="deleteApi != null and deleteApi != ''"> delete_api , </if>
|
||||
<if test="enabledState != null and enabledState != ''"> enabled_state , </if>
|
||||
<if test="dbId != null and dbId != ''"> db_id , </if>
|
||||
<if test="sorts != null"> sorts , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
|
@ -162,6 +176,7 @@
|
|||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="companyId != null and companyId != ''"> company_id , </if>
|
||||
<if test="sorts == null ">sorts,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
|
@ -173,6 +188,7 @@
|
|||
<if test="addApi != null and addApi != ''"> #{addApi} ,</if>
|
||||
<if test="deleteApi != null and deleteApi != ''"> #{deleteApi} ,</if>
|
||||
<if test="enabledState != null and enabledState != ''"> #{enabledState} ,</if>
|
||||
<if test="dbId != null and dbId != ''"> #{dbId} ,</if>
|
||||
<if test="sorts != null"> #{sorts} ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
|
||||
<if test="create_time != null"> #{create_time} ,</if>
|
||||
|
@ -181,24 +197,25 @@
|
|||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute a WHERE a.sts = 'Y' ),</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" >
|
||||
insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
|
||||
<insert id="entityInsertBatch" >
|
||||
insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
|
||||
(#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" >
|
||||
insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
|
||||
<insert id="entityInsertOrUpdateBatch" >
|
||||
insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
|
||||
(#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
mdm_id = values(mdm_id),
|
||||
|
@ -207,6 +224,7 @@
|
|||
add_api = values(add_api),
|
||||
delete_api = values(delete_api),
|
||||
enabled_state = values(enabled_state),
|
||||
db_id = values(db_id),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
|
@ -224,6 +242,7 @@ update mdm_module_distribute set
|
|||
<if test="addApi != null and addApi != ''"> add_api = #{addApi},</if>
|
||||
<if test="deleteApi != null and deleteApi != ''"> delete_api = #{deleteApi},</if>
|
||||
<if test="enabledState != null and enabledState != ''"> enabled_state = #{enabledState},</if>
|
||||
<if test="dbId != null and dbId != ''"> db_id = #{dbId},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
|
||||
|
@ -250,6 +269,7 @@ update mdm_module_distribute set sts= 'N' ,modify_time = #{modify_time},modify_
|
|||
<if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if>
|
||||
<if test="deleteApi != null and deleteApi != ''"> and delete_api = #{deleteApi} </if>
|
||||
<if test="enabledState != null and enabledState != ''"> and enabled_state = #{enabledState} </if>
|
||||
<if test="dbId != null and dbId != ''"> and db_id = #{dbId} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService;
|
|||
* 主数据功能应用分发表(MdmModuleDistribute)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-03 08:47:33
|
||||
* @since 2024-06-14 10:06:36
|
||||
*/
|
||||
public interface IMdmModuleDistributeService extends IBaseService<MdmModuleDistributeEntity, String>{
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService;
|
|||
* 主数据功能应用分发表(MdmModuleDistribute)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-03 08:47:33
|
||||
* @since 2024-06-14 10:06:36
|
||||
*/
|
||||
@Service(value = "mdmModuleDistributeService")
|
||||
public class MdmModuleDistributeServiceImpl extends BaseService<MdmModuleDistributeEntity, String> implements IMdmModuleDistributeService {
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.hzya.frame.basedao.dao.IBaseDao;
|
|||
* 主数据功能应用分发明细表(mdm_module_distribute_detail: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-03 08:48:18
|
||||
* @since 2024-06-14 10:03:50
|
||||
*/
|
||||
public interface IMdmModuleDistributeDetailDao extends IBaseDao<MdmModuleDistributeDetailEntity, String> {
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
|||
* 主数据功能应用分发明细表(MdmModuleDistributeDetail)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-03 08:48:18
|
||||
* @since 2024-06-14 10:03:50
|
||||
*/
|
||||
@Repository(value = "MdmModuleDistributeDetailDaoImpl")
|
||||
public class MdmModuleDistributeDetailDaoImpl extends MybatisGenericDao<MdmModuleDistributeDetailEntity, String> implements IMdmModuleDistributeDetailDao{
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.hzya.frame.web.entity.BaseEntity;
|
|||
* 主数据功能应用分发明细表(MdmModuleDistributeDetail)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-03 08:48:18
|
||||
* @since 2024-06-14 10:03:50
|
||||
*/
|
||||
public class MdmModuleDistributeDetailEntity extends BaseEntity {
|
||||
|
||||
|
@ -18,12 +18,18 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity {
|
|||
private String apiId;
|
||||
/** 数据类型 1、新增2、修改3、删除 */
|
||||
private String dataType;
|
||||
/** 左括号 */
|
||||
private String leftBracket;
|
||||
/** 字段名 */
|
||||
private String filedName;
|
||||
/** 对比类型 1、等于 */
|
||||
/** 对比类型 1、等于 2、不等于 3、大于 4、小于 */
|
||||
private String compareType;
|
||||
/** 目标API字段默认值 */
|
||||
private String filedVaule;
|
||||
/** 连接符号 1\and 2\or */
|
||||
private String connectionSymbol;
|
||||
/** 右括号 */
|
||||
private String rightParenthesis;
|
||||
/** 公司id */
|
||||
private String companyId;
|
||||
|
||||
|
@ -60,6 +66,14 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity {
|
|||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getLeftBracket() {
|
||||
return leftBracket;
|
||||
}
|
||||
|
||||
public void setLeftBracket(String leftBracket) {
|
||||
this.leftBracket = leftBracket;
|
||||
}
|
||||
|
||||
public String getFiledName() {
|
||||
return filedName;
|
||||
}
|
||||
|
@ -84,6 +98,22 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity {
|
|||
this.filedVaule = filedVaule;
|
||||
}
|
||||
|
||||
public String getConnectionSymbol() {
|
||||
return connectionSymbol;
|
||||
}
|
||||
|
||||
public void setConnectionSymbol(String connectionSymbol) {
|
||||
this.connectionSymbol = connectionSymbol;
|
||||
}
|
||||
|
||||
public String getRightParenthesis() {
|
||||
return rightParenthesis;
|
||||
}
|
||||
|
||||
public void setRightParenthesis(String rightParenthesis) {
|
||||
this.rightParenthesis = rightParenthesis;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
|
|
@ -8,9 +8,12 @@
|
|||
<result property="distributeId" column="distribute_id" jdbcType="VARCHAR"/>
|
||||
<result property="apiId" column="api_id" jdbcType="VARCHAR"/>
|
||||
<result property="dataType" column="data_type" jdbcType="VARCHAR"/>
|
||||
<result property="leftBracket" column="left_bracket" jdbcType="VARCHAR"/>
|
||||
<result property="filedName" column="filed_name" jdbcType="VARCHAR"/>
|
||||
<result property="compareType" column="compare_type" jdbcType="VARCHAR"/>
|
||||
<result property="filedVaule" column="filed_vaule" jdbcType="VARCHAR"/>
|
||||
<result property="connectionSymbol" column="connection_symbol" jdbcType="VARCHAR"/>
|
||||
<result property="rightParenthesis" column="right_parenthesis" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
|
@ -27,9 +30,12 @@
|
|||
,distribute_id
|
||||
,api_id
|
||||
,data_type
|
||||
,left_bracket
|
||||
,filed_name
|
||||
,compare_type
|
||||
,filed_vaule
|
||||
,connection_symbol
|
||||
,right_parenthesis
|
||||
,sorts
|
||||
,create_user_id
|
||||
,create_time
|
||||
|
@ -39,6 +45,12 @@
|
|||
,org_id
|
||||
,company_id
|
||||
</sql>
|
||||
<!--通过ID获取数据 -->
|
||||
<select id="entity_get" resultMap="get-MdmModuleDistributeDetailEntity-result">
|
||||
select
|
||||
<include refid="MdmModuleDistributeDetailEntity_Base_Column_List" />
|
||||
from mdm_module_distribute_detail where id = #{ id } and sts='Y'
|
||||
</select>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-MdmModuleDistributeDetailEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity">
|
||||
select
|
||||
|
@ -50,9 +62,12 @@
|
|||
<if test="distributeId != null and distributeId != ''"> and distribute_id = #{distributeId} </if>
|
||||
<if test="apiId != null and apiId != ''"> and api_id = #{apiId} </if>
|
||||
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
|
||||
<if test="leftBracket != null and leftBracket != ''"> and left_bracket = #{leftBracket} </if>
|
||||
<if test="filedName != null and filedName != ''"> and filed_name = #{filedName} </if>
|
||||
<if test="compareType != null and compareType != ''"> and compare_type = #{compareType} </if>
|
||||
<if test="filedVaule != null and filedVaule != ''"> and filed_vaule = #{filedVaule} </if>
|
||||
<if test="connectionSymbol != null and connectionSymbol != ''"> and connection_symbol = #{connectionSymbol} </if>
|
||||
<if test="rightParenthesis != null and rightParenthesis != ''"> and right_parenthesis = #{rightParenthesis} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
|
@ -76,9 +91,12 @@
|
|||
<if test="distributeId != null and distributeId != ''"> and distribute_id = #{distributeId} </if>
|
||||
<if test="apiId != null and apiId != ''"> and api_id = #{apiId} </if>
|
||||
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
|
||||
<if test="leftBracket != null and leftBracket != ''"> and left_bracket = #{leftBracket} </if>
|
||||
<if test="filedName != null and filedName != ''"> and filed_name = #{filedName} </if>
|
||||
<if test="compareType != null and compareType != ''"> and compare_type = #{compareType} </if>
|
||||
<if test="filedVaule != null and filedVaule != ''"> and filed_vaule = #{filedVaule} </if>
|
||||
<if test="connectionSymbol != null and connectionSymbol != ''"> and connection_symbol = #{connectionSymbol} </if>
|
||||
<if test="rightParenthesis != null and rightParenthesis != ''"> and right_parenthesis = #{rightParenthesis} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
|
@ -104,9 +122,12 @@
|
|||
<if test="distributeId != null and distributeId != ''"> and distribute_id like concat('%',#{distributeId},'%') </if>
|
||||
<if test="apiId != null and apiId != ''"> and api_id like concat('%',#{apiId},'%') </if>
|
||||
<if test="dataType != null and dataType != ''"> and data_type like concat('%',#{dataType},'%') </if>
|
||||
<if test="leftBracket != null and leftBracket != ''"> and left_bracket like concat('%',#{leftBracket},'%') </if>
|
||||
<if test="filedName != null and filedName != ''"> and filed_name like concat('%',#{filedName},'%') </if>
|
||||
<if test="compareType != null and compareType != ''"> and compare_type like concat('%',#{compareType},'%') </if>
|
||||
<if test="filedVaule != null and filedVaule != ''"> and filed_vaule like concat('%',#{filedVaule},'%') </if>
|
||||
<if test="connectionSymbol != null and connectionSymbol != ''"> and connection_symbol like concat('%',#{connectionSymbol},'%') </if>
|
||||
<if test="rightParenthesis != null and rightParenthesis != ''"> and right_parenthesis like concat('%',#{rightParenthesis},'%') </if>
|
||||
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
||||
|
@ -132,9 +153,12 @@
|
|||
<if test="distributeId != null and distributeId != ''"> or distribute_id = #{distributeId} </if>
|
||||
<if test="apiId != null and apiId != ''"> or api_id = #{apiId} </if>
|
||||
<if test="dataType != null and dataType != ''"> or data_type = #{dataType} </if>
|
||||
<if test="leftBracket != null and leftBracket != ''"> or left_bracket = #{leftBracket} </if>
|
||||
<if test="filedName != null and filedName != ''"> or filed_name = #{filedName} </if>
|
||||
<if test="compareType != null and compareType != ''"> or compare_type = #{compareType} </if>
|
||||
<if test="filedVaule != null and filedVaule != ''"> or filed_vaule = #{filedVaule} </if>
|
||||
<if test="connectionSymbol != null and connectionSymbol != ''"> or connection_symbol = #{connectionSymbol} </if>
|
||||
<if test="rightParenthesis != null and rightParenthesis != ''"> or right_parenthesis = #{rightParenthesis} </if>
|
||||
<if test="sorts != null"> or sorts = #{sorts} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> or create_time = #{create_time} </if>
|
||||
|
@ -150,7 +174,7 @@
|
|||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity" >
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity" >
|
||||
insert into mdm_module_distribute_detail(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
|
@ -158,9 +182,12 @@
|
|||
<if test="distributeId != null and distributeId != ''"> distribute_id , </if>
|
||||
<if test="apiId != null and apiId != ''"> api_id , </if>
|
||||
<if test="dataType != null and dataType != ''"> data_type , </if>
|
||||
<if test="leftBracket != null and leftBracket != ''"> left_bracket , </if>
|
||||
<if test="filedName != null and filedName != ''"> filed_name , </if>
|
||||
<if test="compareType != null and compareType != ''"> compare_type , </if>
|
||||
<if test="filedVaule != null and filedVaule != ''"> filed_vaule , </if>
|
||||
<if test="connectionSymbol != null and connectionSymbol != ''"> connection_symbol , </if>
|
||||
<if test="rightParenthesis != null and rightParenthesis != ''"> right_parenthesis , </if>
|
||||
<if test="sorts != null"> sorts , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
|
@ -169,6 +196,7 @@
|
|||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="companyId != null and companyId != ''"> company_id , </if>
|
||||
<if test="sorts == null ">sorts,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
|
@ -178,9 +206,12 @@
|
|||
<if test="distributeId != null and distributeId != ''"> #{distributeId} ,</if>
|
||||
<if test="apiId != null and apiId != ''"> #{apiId} ,</if>
|
||||
<if test="dataType != null and dataType != ''"> #{dataType} ,</if>
|
||||
<if test="leftBracket != null and leftBracket != ''"> #{leftBracket} ,</if>
|
||||
<if test="filedName != null and filedName != ''"> #{filedName} ,</if>
|
||||
<if test="compareType != null and compareType != ''"> #{compareType} ,</if>
|
||||
<if test="filedVaule != null and filedVaule != ''"> #{filedVaule} ,</if>
|
||||
<if test="connectionSymbol != null and connectionSymbol != ''"> #{connectionSymbol} ,</if>
|
||||
<if test="rightParenthesis != null and rightParenthesis != ''"> #{rightParenthesis} ,</if>
|
||||
<if test="sorts != null"> #{sorts} ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
|
||||
<if test="create_time != null"> #{create_time} ,</if>
|
||||
|
@ -189,33 +220,37 @@
|
|||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute_detail a WHERE a.sts = 'Y' ),</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" >
|
||||
insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, filed_name, compare_type, filed_vaule, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
|
||||
<insert id="entityInsertBatch" >
|
||||
insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, left_bracket, filed_name, compare_type, filed_vaule, connection_symbol, right_parenthesis, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
|
||||
(#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.leftBracket},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.connectionSymbol},#{entity.rightParenthesis},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" >
|
||||
insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, filed_name, compare_type, filed_vaule, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
|
||||
<insert id="entityInsertOrUpdateBatch" >
|
||||
insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, left_bracket, filed_name, compare_type, filed_vaule, connection_symbol, right_parenthesis, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
|
||||
(#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.leftBracket},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.connectionSymbol},#{entity.rightParenthesis},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
mdm_id = values(mdm_id),
|
||||
distribute_id = values(distribute_id),
|
||||
api_id = values(api_id),
|
||||
data_type = values(data_type),
|
||||
left_bracket = values(left_bracket),
|
||||
filed_name = values(filed_name),
|
||||
compare_type = values(compare_type),
|
||||
filed_vaule = values(filed_vaule),
|
||||
connection_symbol = values(connection_symbol),
|
||||
right_parenthesis = values(right_parenthesis),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
|
@ -231,9 +266,12 @@ update mdm_module_distribute_detail set
|
|||
<if test="distributeId != null and distributeId != ''"> distribute_id = #{distributeId},</if>
|
||||
<if test="apiId != null and apiId != ''"> api_id = #{apiId},</if>
|
||||
<if test="dataType != null and dataType != ''"> data_type = #{dataType},</if>
|
||||
<if test="leftBracket != null and leftBracket != ''"> left_bracket = #{leftBracket},</if>
|
||||
<if test="filedName != null and filedName != ''"> filed_name = #{filedName},</if>
|
||||
<if test="compareType != null and compareType != ''"> compare_type = #{compareType},</if>
|
||||
<if test="filedVaule != null and filedVaule != ''"> filed_vaule = #{filedVaule},</if>
|
||||
<if test="connectionSymbol != null and connectionSymbol != ''"> connection_symbol = #{connectionSymbol},</if>
|
||||
<if test="rightParenthesis != null and rightParenthesis != ''"> right_parenthesis = #{rightParenthesis},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
|
||||
|
@ -258,9 +296,12 @@ update mdm_module_distribute_detail set sts= 'N' ,modify_time = #{modify_time},
|
|||
<if test="distributeId != null and distributeId != ''"> and distribute_id = #{distributeId} </if>
|
||||
<if test="apiId != null and apiId != ''"> and api_id = #{apiId} </if>
|
||||
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
|
||||
<if test="leftBracket != null and leftBracket != ''"> and left_bracket = #{leftBracket} </if>
|
||||
<if test="filedName != null and filedName != ''"> and filed_name = #{filedName} </if>
|
||||
<if test="compareType != null and compareType != ''"> and compare_type = #{compareType} </if>
|
||||
<if test="filedVaule != null and filedVaule != ''"> and filed_vaule = #{filedVaule} </if>
|
||||
<if test="connectionSymbol != null and connectionSymbol != ''"> and connection_symbol = #{connectionSymbol} </if>
|
||||
<if test="rightParenthesis != null and rightParenthesis != ''"> and right_parenthesis = #{rightParenthesis} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService;
|
|||
* 主数据功能应用分发明细表(MdmModuleDistributeDetail)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-03 08:48:18
|
||||
* @since 2024-06-14 10:03:50
|
||||
*/
|
||||
public interface IMdmModuleDistributeDetailService extends IBaseService<MdmModuleDistributeDetailEntity, String>{
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService;
|
|||
* 主数据功能应用分发明细表(MdmModuleDistributeDetail)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-03 08:48:18
|
||||
* @since 2024-06-14 10:03:50
|
||||
*/
|
||||
@Service(value = "mdmModuleDistributeDetailService")
|
||||
public class MdmModuleDistributeDetailServiceImpl extends BaseService<MdmModuleDistributeDetailEntity, String> implements IMdmModuleDistributeDetailService {
|
||||
|
|
|
@ -12,7 +12,7 @@ public class MdmModuleSourceEntity extends BaseEntity {
|
|||
|
||||
/** 主数据模版ID */
|
||||
private String mdmId;
|
||||
/** 来源类型 */
|
||||
/** 来源类型1、插件2、api */
|
||||
private String sourceType;
|
||||
/** 来源名称 */
|
||||
private String sourceName;
|
||||
|
|
|
@ -33,6 +33,11 @@
|
|||
,org_id
|
||||
,company_id
|
||||
</sql>
|
||||
<select id="entity_get" resultMap="get-MdmModuleSourceEntity-result">
|
||||
select
|
||||
<include refid="MdmModuleSourceEntity_Base_Column_List" />
|
||||
from mdm_module_source where sts = 'Y' and id = #{id}
|
||||
</select>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-MdmModuleSourceEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity">
|
||||
select
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.hzya.frame.mdm.mdmModuleView.dao;
|
||||
|
||||
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
|
||||
import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
|
||||
|
@ -11,5 +12,6 @@ import com.hzya.frame.basedao.dao.IBaseDao;
|
|||
*/
|
||||
public interface IMdmModuleViewDao extends IBaseDao<MdmModuleViewEntity, String> {
|
||||
|
||||
Integer queryUserMdm(MdmModuleViewEntity mdmModuleViewEntity);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.hzya.frame.mdm.mdmModuleView.dao.impl;
|
||||
|
||||
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
|
||||
import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity;
|
||||
import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -12,6 +13,14 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
|||
*/
|
||||
@Repository(value = "MdmModuleViewDaoImpl")
|
||||
public class MdmModuleViewDaoImpl extends MybatisGenericDao<MdmModuleViewEntity, String> implements IMdmModuleViewDao{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Integer queryUserMdm(MdmModuleViewEntity mdmModuleViewEntity) {
|
||||
Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "queryUserMdm", mdmModuleViewEntity);
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ public class MdmModuleViewEntity extends BaseEntity {
|
|||
|
||||
/** 主数据模版ID */
|
||||
private String mdmId;
|
||||
/** 显示类型 */
|
||||
/** 显示类型 1、树2、列表*/
|
||||
private String viewName;
|
||||
/** 显示字段 */
|
||||
private String viewFiled;
|
||||
|
|
|
@ -238,6 +238,14 @@ update mdm_module_view set sts= 'N' ,modify_time = #{modify_time},modify_user_i
|
|||
<delete id="entity_delete">
|
||||
delete from mdm_module_view where id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="queryUserMdm" resultType="Integer" parameterType = "com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity">
|
||||
select count(1) from mdm_module_view
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
and mdm_id = #{mdmId}
|
||||
and (view_filed = #{viewFiled} or up_id_filed = #{upIdFiled})
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ public class MdmModuleViewButtonEntity extends BaseEntity {
|
|||
private String mdmId;
|
||||
/** 视图id */
|
||||
private String viewId;
|
||||
/** 类型1、新建2、重置3、查询4、修改 5、删除 6、查看 */
|
||||
/** 类型1、新建2、重置3、查询4、修改 5、删除 6、查看 7、下发 */
|
||||
private String buttonType;
|
||||
/** 按钮值 */
|
||||
private String buttonValue;
|
||||
|
|
|
@ -16,6 +16,8 @@ public class MdmModuleViewDetailEntity extends BaseEntity {
|
|||
private String viewId;
|
||||
/** 字段 */
|
||||
private String viewFiled;
|
||||
/** 字段 */
|
||||
private String viewName;
|
||||
/** 类型1、查询2、列表3、新增4、修改 5、查看 */
|
||||
private String viewType;
|
||||
/** 公司id */
|
||||
|
@ -70,5 +72,13 @@ public class MdmModuleViewDetailEntity extends BaseEntity {
|
|||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getViewName() {
|
||||
return viewName;
|
||||
}
|
||||
|
||||
public void setViewName(String viewName) {
|
||||
this.viewName = viewName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,264 +8,56 @@ import com.hzya.frame.web.entity.JsonResultEntity;
|
|||
*/
|
||||
public interface IMdmService {
|
||||
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据列表查询接口分页
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmPage(JSONObject jsonObject);
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 主数据列表显示 树、查询条件、列表字段、按钮
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity queryMdmShow(JSONObject jsonObject);
|
||||
//
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 主数据查询所有字段
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity queryMdmShowAll(JSONObject jsonObject);
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 查询模版数据(list 或者 分页)
|
||||
* @Date 1:33 下午 2023/7/12
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity queryTemplateData(JSONObject jsonObject);
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 主数据列表显示 业务数据
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity queryMdmShowData(JSONObject jsonObject);
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据列表查询接口列表
|
||||
// * @Description 主数据业务数据
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmList(JSONObject jsonObject);
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据新增
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity addMdm(JSONObject jsonObject);
|
||||
//
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据基本信息获取
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmModule(JSONObject jsonObject);
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据基本信息修改
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity doSaveMdmModule(JSONObject jsonObject);
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置查询数据源
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmModuleDb(JSONObject jsonObject);
|
||||
////
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置查询数据源的服务
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmModuleServer(JSONObject jsonObject);
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置查询数据源字段的服务
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmModuleServerFiled(JSONObject jsonObject);
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置查询主表字段
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmModuleServerMainFiled(JSONObject jsonObject);
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置保存数据源
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity saveMdmModuleDb(JSONObject jsonObject);
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置查询显示信息
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmModuleView(JSONObject jsonObject);
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置修改显示信息
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity doSaveMdmModuleView(JSONObject jsonObject);
|
||||
////
|
||||
/////**
|
||||
//// * @param jsonObject
|
||||
//// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
//// * @Author lvleigang
|
||||
//// * @Description 主数据设置查询权限配置
|
||||
//// * @Date 9:40 上午 2023/10/18
|
||||
//// **/
|
||||
////JsonResultEntity queryMdmModuleRule(JSONObject jsonObject);
|
||||
////
|
||||
/////**
|
||||
//// * @param jsonObject
|
||||
//// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
//// * @Author lvleigang
|
||||
//// * @Description 主数据设置保存权限配置
|
||||
//// * @Date 9:40 上午 2023/10/18
|
||||
//// **/
|
||||
////JsonResultEntity doSaveMdmModuleRule(JSONObject jsonObject);
|
||||
////
|
||||
////
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置查询分发设置
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmModuleDistribute(JSONObject jsonObject);
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置保存分发设置
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity doSaveMdmModuleDistribute(JSONObject jsonObject);
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置查询数据来源
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmModuleSource(JSONObject jsonObject);
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据设置保存数据来源
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity doSaveMdmModuleSource(JSONObject jsonObject);
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 查询下发日志
|
||||
// * @Date 11:52 上午 2024/3/27
|
||||
// **/
|
||||
//JsonResultEntity querySendEntityPage(JSONObject jsonObject);
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 获取下发日志
|
||||
// * @Date 2:36 下午 2024/3/27
|
||||
// **/
|
||||
//JsonResultEntity getSendEntity(JSONObject jsonObject);
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 删除下发日志
|
||||
// * @Date 2:37 下午 2024/3/27
|
||||
// **/
|
||||
//JsonResultEntity deleteSendEntity(JSONObject jsonObject);
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 查询操作日志
|
||||
// * @Date 11:52 上午 2024/3/27
|
||||
// **/
|
||||
//JsonResultEntity queryOptionEntityPage(JSONObject jsonObject);
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 获取操作日志
|
||||
// * @Date 2:36 下午 2024/3/27
|
||||
// **/
|
||||
//JsonResultEntity getOptionEntity(JSONObject jsonObject);
|
||||
//
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 删除操作日志
|
||||
// * @Date 2:37 下午 2024/3/27
|
||||
// **/
|
||||
//JsonResultEntity deleteOptionEntity(JSONObject jsonObject);
|
||||
////
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据列表显示 树、查询条件、列表字段、按钮
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmShow(JSONObject jsonObject);
|
||||
////
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据查询所有字段
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmShowAll(JSONObject jsonObject);
|
||||
///**
|
||||
// * @Author lvleigang
|
||||
// * @Description 查询模版数据(list 或者 分页)
|
||||
// * @Date 1:33 下午 2023/7/12
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// **/
|
||||
//JsonResultEntity queryTemplateData(JSONObject jsonObject);
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据列表显示 业务数据
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmShowData(JSONObject jsonObject);
|
||||
////
|
||||
/////**
|
||||
//// * @param jsonObject
|
||||
//// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
//// * @Author lvleigang
|
||||
//// * @Description 主数据业务数据
|
||||
//// * @Date 9:40 上午 2023/10/18
|
||||
//// **/
|
||||
////JsonResultEntity queryMdmShowDistribute(JSONObject jsonObject);
|
||||
//JsonResultEntity queryMdmShowDistribute(JSONObject jsonObject);
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 主数据业务数据树结构
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity queryMdmShowTreeData(JSONObject jsonObject);
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
|
@ -273,67 +65,59 @@ public interface IMdmService {
|
|||
// * @Description 主数据业务数据树结构
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmShowTreeData(JSONObject jsonObject);
|
||||
/////**
|
||||
//// * @param jsonObject
|
||||
//// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
//// * @Author lvleigang
|
||||
//// * @Description 主数据业务数据树结构
|
||||
//// * @Date 9:40 上午 2023/10/18
|
||||
//// **/
|
||||
////JsonResultEntity queryMdmOptionData(JSONObject jsonObject);
|
||||
////
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据详情 区分类型 新增、修改、查看
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmShowDetails(JSONObject jsonObject);
|
||||
////
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据详情数据 区分类型 新增、修改、查看
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity queryMdmShowDetailsData(JSONObject jsonObject);
|
||||
////
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据详情数据修改
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity updateMdmShowDetailsData(JSONObject jsonObject);
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据详情数据新增
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity saveMdmShowDetailsData(JSONObject jsonObject);
|
||||
//JsonResultEntity queryMdmOptionData(JSONObject jsonObject);
|
||||
//
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 主数据详情 区分类型 新增、修改、查看
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity queryMdmShowDetails(JSONObject jsonObject);
|
||||
//
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 主数据详情数据 区分类型 新增、修改、查看
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity queryMdmShowDetailsData(JSONObject jsonObject);
|
||||
//
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 主数据详情数据修改
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity updateMdmShowDetailsData(JSONObject jsonObject);
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 主数据详情数据新增
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity saveMdmShowDetailsData(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 主数据删除业务数据
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity deleteMdmShowDetailsData(JSONObject jsonObject);
|
||||
///**
|
||||
// * @param jsonObject
|
||||
// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
// * @Author lvleigang
|
||||
// * @Description 主数据删除业务数据
|
||||
// * @Description 处理分发数据
|
||||
// * @Date 9:40 上午 2023/10/18
|
||||
// **/
|
||||
//JsonResultEntity deleteMdmShowDetailsData(JSONObject jsonObject);
|
||||
/////**
|
||||
//// * @param jsonObject
|
||||
//// * @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
//// * @Author lvleigang
|
||||
//// * @Description 处理分发数据
|
||||
//// * @Date 9:40 上午 2023/10/18
|
||||
//// **/
|
||||
////JsonResultEntity doMdmDistribute(JSONObject jsonObject);
|
||||
//
|
||||
//JsonResultEntity doMdmDistribute(JSONObject jsonObject);
|
||||
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
|
||||
import com.baomidou.dynamic.datasource.exception.CannotFindDataSourceException;
|
||||
import com.hzya.frame.datasource.DataSourceUtilProperties;
|
||||
import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity;
|
||||
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationDatasourceDto;
|
||||
import com.hzya.frame.util.AESUtil;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -24,21 +24,20 @@ public class DsDataSourceUtil {
|
|||
@Resource
|
||||
private DataSource dataSource;
|
||||
|
||||
public void addDataSource(SysDataSourceEntity sysDataSourceVo) throws Exception {
|
||||
public void addDataSource(SysApplicationDatabaseEntity sysDataSourceVo) throws Exception {
|
||||
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
|
||||
JSONObject defaultDataSourceProperties = new JSONObject();
|
||||
defaultDataSourceProperties.put("datasource_code", sysDataSourceVo.getSourceCode());
|
||||
defaultDataSourceProperties.put("source_url", sysDataSourceVo.getSourceUrl());
|
||||
defaultDataSourceProperties.put("source_type", sysDataSourceVo.getSourceTypeName());
|
||||
defaultDataSourceProperties.put("login_name", sysDataSourceVo.getLoginName());
|
||||
defaultDataSourceProperties.put("password", sysDataSourceVo.getPassword());
|
||||
defaultDataSourceProperties.put("password", AESUtil.decrypt(sysDataSourceVo.getPassword()));
|
||||
defaultDataSourceProperties.put("db_name", sysDataSourceVo.getDbName());
|
||||
logger.info("***初始化数据源-{}:*********", sysDataSourceVo.getSourceName());
|
||||
DruidDataSource dataSource = createDefaultDataSource(defaultDataSourceProperties);
|
||||
ds.addDataSource(sysDataSourceVo.getSourceCode(), dataSource);
|
||||
logger.info("***初始化数据源-{}成功:*********", sysDataSourceVo.getSourceName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code
|
||||
* @return boolean
|
||||
|
@ -57,16 +56,16 @@ public class DsDataSourceUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param sysDataSourceVo
|
||||
* @param sysApplicationDatabaseEntity
|
||||
* @return boolean
|
||||
* @Author lvleigang
|
||||
* @Description 修改数据源
|
||||
* @Date 11:40 上午 2023/9/6
|
||||
**/
|
||||
public void editDataSource(SysDataSourceEntity sysDataSourceVo) throws Exception {
|
||||
public void editDataSource(SysApplicationDatabaseEntity sysApplicationDatabaseEntity) throws Exception {
|
||||
//先删除后添加
|
||||
removeDataSource(sysDataSourceVo.getSourceCode());
|
||||
addDataSource(sysDataSourceVo);
|
||||
removeDataSource(sysApplicationDatabaseEntity.getSourceCode());
|
||||
addDataSource(sysApplicationDatabaseEntity);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
package com.hzya.frame.sys.dataSource.dao;
|
||||
|
||||
import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据源表(sys_data_source: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-09-05 16:07:01
|
||||
*/
|
||||
public interface ISysDataSourceDao extends IBaseDao<SysDataSourceEntity, String> {
|
||||
|
||||
List<SysDataSourceVo> queryVoList(SysDataSourceEntity entity);
|
||||
int queryVoList_COUNT(SysDataSourceEntity entity);
|
||||
|
||||
Integer entity_count_not_id(SysDataSourceEntity checkEntity);
|
||||
|
||||
List<SysDataSourceVo> queryDSBase(SysDataSourceEntity entity);
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
package com.hzya.frame.sys.dataSource.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity;
|
||||
import com.hzya.frame.sys.dataSource.dao.ISysDataSourceDao;
|
||||
import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据源表(SysDataSource)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-09-05 16:07:03
|
||||
*/
|
||||
@Repository(value = "SysDataSourceDaoImpl")
|
||||
public class SysDataSourceDaoImpl extends MybatisGenericDao<SysDataSourceEntity, String> implements ISysDataSourceDao{
|
||||
|
||||
|
||||
@DS("master")
|
||||
@Override
|
||||
public List<SysDataSourceVo> queryVoList(SysDataSourceEntity entity) {
|
||||
List<SysDataSourceVo> o = (List<SysDataSourceVo>) super.selectList(getSqlIdPrifx() + "queryVoList", entity);
|
||||
return o;
|
||||
}
|
||||
@Override
|
||||
public int queryVoList_COUNT(SysDataSourceEntity entity) {
|
||||
int o = (int) super.selectOne(getSqlIdPrifx() + "queryVoList_COUNT", entity);
|
||||
return o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer entity_count_not_id(SysDataSourceEntity entity) {
|
||||
Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "entity_count_not_id", entity);
|
||||
return o;
|
||||
}
|
||||
|
||||
@DS("master")
|
||||
@Override
|
||||
public List<SysDataSourceVo> queryDSBase(SysDataSourceEntity entity) {
|
||||
List<SysDataSourceVo> o = (List<SysDataSourceVo>) super.selectList(getSqlIdPrifx() + "queryDSBase", entity);
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,168 +0,0 @@
|
|||
package com.hzya.frame.sys.dataSource.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
/**
|
||||
* 数据源表(SysDataSource)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-09-05 16:07:06
|
||||
*/
|
||||
public class SysDataSourceEntity extends BaseEntity {
|
||||
|
||||
/** 数据源唯一编码 */
|
||||
private String sourceCode;
|
||||
/** 数据源名称 */
|
||||
private String sourceName;
|
||||
/** ip */
|
||||
private String sourceIp;
|
||||
/** 端口 */
|
||||
private String sourcePort;
|
||||
/** 数据库名称 */
|
||||
private String dbName;
|
||||
/** 数据源类型 1oracle 2sqlsever 3mysql */
|
||||
private String sourceType;
|
||||
/** 登录名 */
|
||||
private String loginName;
|
||||
/** 密码 */
|
||||
private String password;
|
||||
/** 选择oracle下服务名称 */
|
||||
private String serviceName;
|
||||
/** 使用状态1启用0锁定 */
|
||||
private Integer useState;
|
||||
/** 数据源状态 1校验成功0校验失败 */
|
||||
private String dataState;
|
||||
|
||||
public String getSourceCode() {
|
||||
return sourceCode;
|
||||
}
|
||||
|
||||
public void setSourceCode(String sourceCode) {
|
||||
this.sourceCode = sourceCode;
|
||||
}
|
||||
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
public void setSourceName(String sourceName) {
|
||||
this.sourceName = sourceName;
|
||||
}
|
||||
|
||||
public String getSourceIp() {
|
||||
return sourceIp;
|
||||
}
|
||||
|
||||
public void setSourceIp(String sourceIp) {
|
||||
this.sourceIp = sourceIp;
|
||||
}
|
||||
|
||||
public String getSourcePort() {
|
||||
return sourcePort;
|
||||
}
|
||||
|
||||
public void setSourcePort(String sourcePort) {
|
||||
this.sourcePort = sourcePort;
|
||||
}
|
||||
|
||||
public String getDbName() {
|
||||
return dbName;
|
||||
}
|
||||
|
||||
public void setDbName(String dbName) {
|
||||
this.dbName = dbName;
|
||||
}
|
||||
|
||||
public String getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
public void setSourceType(String sourceType) {
|
||||
this.sourceType = sourceType;
|
||||
}
|
||||
|
||||
public String getLoginName() {
|
||||
return loginName;
|
||||
}
|
||||
|
||||
public void setLoginName(String loginName) {
|
||||
this.loginName = loginName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getServiceName() {
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
public void setServiceName(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
public Integer getUseState() {
|
||||
return useState;
|
||||
}
|
||||
|
||||
public void setUseState(Integer useState) {
|
||||
this.useState = useState;
|
||||
}
|
||||
public String getSourceUrl() {
|
||||
StringBuffer sourceUrl = new StringBuffer();
|
||||
if(sourceType != null){
|
||||
switch (sourceType) {
|
||||
case "1": //oracle
|
||||
//jdbc:oracle:thin:@60.204.132.91:1521:ORCL
|
||||
sourceUrl.append("jdbc:oracle:thin:@").append(sourceIp).append(":").append(sourcePort).append(":").append(serviceName);
|
||||
break;
|
||||
case "2": //sqlsever
|
||||
//jdbc:sqlserver://221.12.175.82:1433;DatabaseName=U8CLOUD;encrypt=false;trustServerCertificate=true
|
||||
sourceUrl.append("jdbc:jtds:sqlserver://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append(";encrypt=false;trustServerCertificate=true");
|
||||
break;
|
||||
case "3": //mysql
|
||||
//jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
|
||||
sourceUrl.append("jdbc:mysql://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append("?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true");
|
||||
break;
|
||||
case "4": //dm
|
||||
//jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&characterEncoding=UTF-8
|
||||
sourceUrl.append("jdbc:dm://").append(sourceIp).append(":").append(sourcePort).append("?schema=").append(dbName).append("&characterEncoding=UTF-8");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
return sourceUrl.toString();
|
||||
}
|
||||
public String getSourceTypeName() {
|
||||
String sourceTypeName = null;
|
||||
if(sourceType != null){
|
||||
switch (sourceType) {
|
||||
case "1": //oracle
|
||||
sourceTypeName = "oracle";
|
||||
break;
|
||||
case "2": //sqlsever
|
||||
sourceTypeName = "sqlServer";
|
||||
break;
|
||||
case "3": //mysql
|
||||
sourceTypeName = "mysql";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
return sourceTypeName;
|
||||
}
|
||||
|
||||
public String getDataState() {
|
||||
return dataState;
|
||||
}
|
||||
|
||||
public void setDataState(String dataState) {
|
||||
this.dataState = dataState;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,484 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.sys.dataSource.dao.impl.SysDataSourceDaoImpl">
|
||||
|
||||
<resultMap id="get-SysDataSourceEntity-result" type="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="sourceCode" column="source_code" jdbcType="VARCHAR"/>
|
||||
<result property="sourceName" column="source_name" jdbcType="VARCHAR"/>
|
||||
<result property="sourceIp" column="source_ip" jdbcType="VARCHAR"/>
|
||||
<result property="sourcePort" column="source_port" jdbcType="VARCHAR"/>
|
||||
<result property="dbName" column="db_name" jdbcType="VARCHAR"/>
|
||||
<result property="sourceType" column="source_type" jdbcType="VARCHAR"/>
|
||||
<result property="loginName" column="login_name" jdbcType="VARCHAR"/>
|
||||
<result property="password" column="password" jdbcType="VARCHAR"/>
|
||||
<result property="serviceName" column="service_name" jdbcType="VARCHAR"/>
|
||||
<result property="useState" column="use_state" jdbcType="INTEGER"/>
|
||||
<result property="dataState" column="data_state" jdbcType="INTEGER"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id="SysDataSourceEntity_Base_Column_List">
|
||||
id
|
||||
,source_code
|
||||
,source_name
|
||||
,source_ip
|
||||
,source_port
|
||||
,db_name
|
||||
,source_type
|
||||
,login_name
|
||||
,password
|
||||
,service_name
|
||||
,use_state
|
||||
,data_state
|
||||
,sorts
|
||||
,create_user_id
|
||||
,create_time
|
||||
,modify_user_id
|
||||
,modify_time
|
||||
,sts
|
||||
,org_id
|
||||
</sql>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-SysDataSourceEntity-result"
|
||||
parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
select
|
||||
<include refid="SysDataSourceEntity_Base_Column_List"/>
|
||||
from sys_data_source
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id = #{id}</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">and source_code = #{sourceCode}</if>
|
||||
<if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">and source_ip = #{sourceIp}</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">and source_port = #{sourcePort}</if>
|
||||
<if test="dbName != null and dbName != ''">and db_name = #{dbName}</if>
|
||||
<if test="sourceType != null and sourceType != ''">and source_type = #{sourceType}</if>
|
||||
<if test="loginName != null and loginName != ''">and login_name = #{loginName}</if>
|
||||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if>
|
||||
<if test="useState != null">and use_state = #{useState}</if>
|
||||
<if test="dataState != null">and data_state = #{dataState}</if>
|
||||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
|
||||
<if test="create_time != null">and create_time = #{create_time}</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if>
|
||||
<if test="modify_time != null">and modify_time = #{modify_time}</if>
|
||||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_count_not_id" resultType="Integer"
|
||||
parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
select
|
||||
count(1)
|
||||
from sys_data_source
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id != #{id}</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">and source_code = #{sourceCode}</if>
|
||||
<if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">and source_ip = #{sourceIp}</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">and source_port = #{sourcePort}</if>
|
||||
<if test="dbName != null and dbName != ''">and db_name = #{dbName}</if>
|
||||
<if test="sourceType != null and sourceType != ''">and source_type = #{sourceType}</if>
|
||||
<if test="loginName != null and loginName != ''">and login_name = #{loginName}</if>
|
||||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if>
|
||||
<if test="useState != null">and use_state = #{useState}</if>
|
||||
<if test="dataState != null">and data_state = #{dataState}</if>
|
||||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
|
||||
<if test="create_time != null">and create_time = #{create_time}</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if>
|
||||
<if test="modify_time != null">and modify_time = #{modify_time}</if>
|
||||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="entity_count" resultType="Integer"
|
||||
parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
select count(1) from sys_data_source
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id = #{id}</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">and source_code = #{sourceCode}</if>
|
||||
<if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">and source_ip = #{sourceIp}</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">and source_port = #{sourcePort}</if>
|
||||
<if test="dbName != null and dbName != ''">and db_name = #{dbName}</if>
|
||||
<if test="sourceType != null and sourceType != ''">and source_type = #{sourceType}</if>
|
||||
<if test="loginName != null and loginName != ''">and login_name = #{loginName}</if>
|
||||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if>
|
||||
<if test="useState != null">and use_state = #{useState}</if>
|
||||
<if test="dataState != null">and data_state = #{dataState}</if>
|
||||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
|
||||
<if test="create_time != null">and create_time = #{create_time}</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if>
|
||||
<if test="modify_time != null">and modify_time = #{modify_time}</if>
|
||||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-SysDataSourceEntity-result"
|
||||
parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
select
|
||||
<include refid="SysDataSourceEntity_Base_Column_List"/>
|
||||
from sys_data_source
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id like concat('%',#{id},'%')</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">and source_code like concat('%',#{sourceCode},'%')</if>
|
||||
<if test="sourceName != null and sourceName != ''">and source_name like concat('%',#{sourceName},'%')</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">and source_ip like concat('%',#{sourceIp},'%')</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">and source_port like concat('%',#{sourcePort},'%')</if>
|
||||
<if test="dbName != null and dbName != ''">and db_name like concat('%',#{dbName},'%')</if>
|
||||
<if test="sourceType != null and sourceType != ''">and source_type like concat('%',#{sourceType},'%')</if>
|
||||
<if test="loginName != null and loginName != ''">and login_name like concat('%',#{loginName},'%')</if>
|
||||
<if test="password != null and password != ''">and password like concat('%',#{password},'%')</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name like concat('%',#{serviceName},'%')
|
||||
</if>
|
||||
<if test="useState != null">and use_state like concat('%',#{useState},'%')</if>
|
||||
<if test="dataState != null">and data_state like concat('%',#{dataState},'%')</if>
|
||||
<if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id like
|
||||
concat('%',#{create_user_id},'%')
|
||||
</if>
|
||||
<if test="create_time != null">and create_time like concat('%',#{create_time},'%')</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id like
|
||||
concat('%',#{modify_user_id},'%')
|
||||
</if>
|
||||
<if test="modify_time != null">and modify_time like concat('%',#{modify_time},'%')</if>
|
||||
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="queryVoList" resultType="com.hzya.frame.sys.dataSource.entity.SysDataSourceVo"
|
||||
parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
select
|
||||
id,
|
||||
source_code as sourceCode,
|
||||
source_name as sourceName,
|
||||
source_ip as sourceIp,
|
||||
source_port as sourcePort,
|
||||
db_name as dbName,
|
||||
source_type as sourceType,
|
||||
login_name as loginName,
|
||||
password as password,
|
||||
service_name as serviceName,
|
||||
use_state as useState,
|
||||
data_state as dataState
|
||||
from sys_data_source
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id like concat('%',#{id},'%')</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">and source_code like concat('%',#{sourceCode},'%')</if>
|
||||
<if test="sourceName != null and sourceName != ''">and source_name like concat('%',#{sourceName},'%')</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">and source_ip like concat('%',#{sourceIp},'%')</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">and source_port like concat('%',#{sourcePort},'%')</if>
|
||||
<if test="dbName != null and dbName != ''">and db_name like concat('%',#{dbName},'%')</if>
|
||||
<if test="sourceType != null and sourceType != ''">and source_type like concat('%',#{sourceType},'%')</if>
|
||||
<if test="loginName != null and loginName != ''">and login_name like concat('%',#{loginName},'%')</if>
|
||||
<if test="password != null and password != ''">and password like concat('%',#{password},'%')</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name like concat('%',#{serviceName},'%')
|
||||
</if>
|
||||
<if test="useState != null">and use_state like concat('%',#{useState},'%')</if>
|
||||
<if test="dataState != null">and data_state like concat('%',#{dataState},'%')</if>
|
||||
<if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id like
|
||||
concat('%',#{create_user_id},'%')
|
||||
</if>
|
||||
<if test="create_time != null">and create_time like concat('%',#{create_time},'%')</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id like
|
||||
concat('%',#{modify_user_id},'%')
|
||||
</if>
|
||||
<if test="modify_time != null">and modify_time like concat('%',#{modify_time},'%')</if>
|
||||
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
<select id="queryDSBase" resultType="com.hzya.frame.sys.dataSource.entity.SysDataSourceVo"
|
||||
parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
select
|
||||
id,
|
||||
source_code as sourceCode,
|
||||
source_name as sourceName,
|
||||
source_ip as sourceIp,
|
||||
source_port as sourcePort,
|
||||
db_name as dbName,
|
||||
source_type as sourceType,
|
||||
login_name as loginName,
|
||||
password as password,
|
||||
service_name as serviceName,
|
||||
use_state as useState,
|
||||
data_state as dataState
|
||||
from sys_data_source
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id = #{id}</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">and source_code = #{sourceCode}</if>
|
||||
<if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">and source_ip = #{sourceIp}</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">and source_port = #{sourcePort}</if>
|
||||
<if test="dbName != null and dbName != ''">and db_name = #{dbName}</if>
|
||||
<if test="sourceType != null and sourceType != ''">and source_type = #{sourceType}</if>
|
||||
<if test="loginName != null and loginName != ''">and login_name = #{loginName}</if>
|
||||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if>
|
||||
<if test="useState != null">and use_state = #{useState}</if>
|
||||
<if test="dataState != null">and data_state = #{dataState}</if>
|
||||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
|
||||
<if test="create_time != null">and create_time = #{create_time}</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if>
|
||||
<if test="modify_time != null">and modify_time = #{modify_time}</if>
|
||||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="queryVoList_COUNT" resultType="int" parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
select
|
||||
count(*)
|
||||
from sys_data_source
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id like concat('%',#{id},'%')</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">and source_code like concat('%',#{sourceCode},'%')</if>
|
||||
<if test="sourceName != null and sourceName != ''">and source_name like concat('%',#{sourceName},'%')</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">and source_ip like concat('%',#{sourceIp},'%')</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">and source_port like concat('%',#{sourcePort},'%')</if>
|
||||
<if test="dbName != null and dbName != ''">and db_name like concat('%',#{dbName},'%')</if>
|
||||
<if test="sourceType != null and sourceType != ''">and source_type like concat('%',#{sourceType},'%')</if>
|
||||
<if test="loginName != null and loginName != ''">and login_name like concat('%',#{loginName},'%')</if>
|
||||
<if test="password != null and password != ''">and password like concat('%',#{password},'%')</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name like concat('%',#{serviceName},'%')
|
||||
</if>
|
||||
<if test="useState != null">and use_state like concat('%',#{useState},'%')</if>
|
||||
<if test="dataState != null">and data_state like concat('%',#{dataState},'%')</if>
|
||||
<if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id like
|
||||
concat('%',#{create_user_id},'%')
|
||||
</if>
|
||||
<if test="create_time != null">and create_time like concat('%',#{create_time},'%')</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id like
|
||||
concat('%',#{modify_user_id},'%')
|
||||
</if>
|
||||
<if test="modify_time != null">and modify_time like concat('%',#{modify_time},'%')</if>
|
||||
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="SysDataSourceentity_list_or" resultMap="get-SysDataSourceEntity-result"
|
||||
parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
select
|
||||
<include refid="SysDataSourceEntity_Base_Column_List"/>
|
||||
from sys_data_source
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">or id = #{id}</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">or source_code = #{sourceCode}</if>
|
||||
<if test="sourceName != null and sourceName != ''">or source_name = #{sourceName}</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">or source_ip = #{sourceIp}</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">or source_port = #{sourcePort}</if>
|
||||
<if test="dbName != null and dbName != ''">or db_name = #{dbName}</if>
|
||||
<if test="sourceType != null and sourceType != ''">or source_type = #{sourceType}</if>
|
||||
<if test="loginName != null and loginName != ''">or login_name = #{loginName}</if>
|
||||
<if test="password != null and password != ''">or password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">or service_name = #{serviceName}</if>
|
||||
<if test="useState != null">or use_state = #{useState}</if>
|
||||
<if test="dataState != null">or data_state = #{dataState}</if>
|
||||
<if test="sorts != null">or sorts = #{sorts}</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">or create_user_id = #{create_user_id}</if>
|
||||
<if test="create_time != null">or create_time = #{create_time}</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">or modify_user_id = #{modify_user_id}</if>
|
||||
<if test="modify_time != null">or modify_time = #{modify_time}</if>
|
||||
<if test="sts != null and sts != ''">or sts = #{sts}</if>
|
||||
<if test="org_id != null and org_id != ''">or org_id = #{org_id}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity" keyProperty="id"
|
||||
useGeneratedKeys="true">
|
||||
insert into sys_data_source(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''">id ,</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">source_code ,</if>
|
||||
<if test="sourceName != null and sourceName != ''">source_name ,</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">source_ip ,</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">source_port ,</if>
|
||||
<if test="dbName != null and dbName != ''">db_name ,</if>
|
||||
<if test="sourceType != null and sourceType != ''">source_type ,</if>
|
||||
<if test="loginName != null and loginName != ''">login_name ,</if>
|
||||
<if test="password != null and password != ''">password ,</if>
|
||||
<if test="serviceName != null and serviceName != ''">service_name ,</if>
|
||||
<if test="useState != null">use_state ,</if>
|
||||
<if test="dataState != null">data_state ,</if>
|
||||
<if test="sorts != null">sorts ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">create_user_id ,</if>
|
||||
<if test="create_time != null">create_time ,</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">modify_user_id ,</if>
|
||||
<if test="modify_time != null">modify_time ,</if>
|
||||
<if test="sts != null and sts != ''">sts ,</if>
|
||||
<if test="org_id != null and org_id != ''">org_id ,</if>
|
||||
<if test="sorts == null ">sorts,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''">#{id} ,</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">#{sourceCode} ,</if>
|
||||
<if test="sourceName != null and sourceName != ''">#{sourceName} ,</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">#{sourceIp} ,</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">#{sourcePort} ,</if>
|
||||
<if test="dbName != null and dbName != ''">#{dbName} ,</if>
|
||||
<if test="sourceType != null and sourceType != ''">#{sourceType} ,</if>
|
||||
<if test="loginName != null and loginName != ''">#{loginName} ,</if>
|
||||
<if test="password != null and password != ''">#{password} ,</if>
|
||||
<if test="serviceName != null and serviceName != ''">#{serviceName} ,</if>
|
||||
<if test="useState != null">#{useState} ,</if>
|
||||
<if test="dataState != null">#{dataState} ,</if>
|
||||
<if test="sorts != null">#{sorts} ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">#{create_user_id} ,</if>
|
||||
<if test="create_time != null">#{create_time} ,</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">#{modify_user_id} ,</if>
|
||||
<if test="modify_time != null">#{modify_time} ,</if>
|
||||
<if test="sts != null and sts != ''">#{sts} ,</if>
|
||||
<if test="org_id != null and org_id != ''">#{org_id} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_data_source a WHERE a.sts
|
||||
= 'Y' ),
|
||||
</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into sys_data_source(source_code, source_name, source_ip, source_port, db_name, source_type, login_name,
|
||||
password, service_name, use_state, data_state, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id,
|
||||
sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.sourceCode},#{entity.sourceName},#{entity.sourceIp},#{entity.sourcePort},#{entity.dbName},#{entity.sourceType},#{entity.loginName},#{entity.password},#{entity.serviceName},#{entity.useState},#{entity.dataState},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},
|
||||
'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into sys_data_source(source_code, source_name, source_ip, source_port, db_name, source_type, login_name,
|
||||
password, service_name, use_state, data_state, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.sourceCode},#{entity.sourceName},#{entity.sourceIp},#{entity.sourcePort},#{entity.dbName},#{entity.sourceType},#{entity.loginName},#{entity.password},#{entity.serviceName},#{entity.useState},#{entity.dataState},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
source_code = values(source_code),
|
||||
source_name = values(source_name),
|
||||
source_ip = values(source_ip),
|
||||
source_port = values(source_port),
|
||||
db_name = values(db_name),
|
||||
source_type = values(source_type),
|
||||
login_name = values(login_name),
|
||||
password = values(password),
|
||||
service_name = values(service_name),
|
||||
use_state = values(use_state),
|
||||
data_state = values(data_state),
|
||||
sorts = values(sorts),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
modify_time = values(modify_time),
|
||||
sts = values(sts),
|
||||
org_id = values(org_id)
|
||||
</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
update sys_data_source set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="sourceCode != null and sourceCode != ''">source_code = #{sourceCode},</if>
|
||||
<if test="sourceName != null and sourceName != ''">source_name = #{sourceName},</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">source_ip = #{sourceIp},</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">source_port = #{sourcePort},</if>
|
||||
<if test="dbName != null and dbName != ''">db_name = #{dbName},</if>
|
||||
<if test="sourceType != null and sourceType != ''">source_type = #{sourceType},</if>
|
||||
<if test="loginName != null and loginName != ''">login_name = #{loginName},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="serviceName != null and serviceName != ''">service_name = #{serviceName},</if>
|
||||
<if test="useState != null">use_state = #{useState},</if>
|
||||
<if test="dataState != null">data_state = #{dataState},</if>
|
||||
<if test="sorts != null">sorts = #{sorts},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null">create_time = #{create_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">modify_user_id = #{modify_user_id},</if>
|
||||
<if test="modify_time != null">modify_time = #{modify_time},</if>
|
||||
<if test="sts != null and sts != ''">sts = #{sts},</if>
|
||||
<if test="org_id != null and org_id != ''">org_id = #{org_id},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<!-- 逻辑删除 -->
|
||||
<update id="entity_logicDelete" parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
update sys_data_source set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<!-- 多条件逻辑删除 -->
|
||||
<update id="entity_logicDelete_Multi_Condition"
|
||||
parameterType="com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity">
|
||||
update sys_data_source set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id = #{id}</if>
|
||||
<if test="sourceCode != null and sourceCode != ''">and source_code = #{sourceCode}</if>
|
||||
<if test="sourceName != null and sourceName != ''">and source_name = #{sourceName}</if>
|
||||
<if test="sourceIp != null and sourceIp != ''">and source_ip = #{sourceIp}</if>
|
||||
<if test="sourcePort != null and sourcePort != ''">and source_port = #{sourcePort}</if>
|
||||
<if test="dbName != null and dbName != ''">and db_name = #{dbName}</if>
|
||||
<if test="sourceType != null and sourceType != ''">and source_type = #{sourceType}</if>
|
||||
<if test="loginName != null and loginName != ''">and login_name = #{loginName}</if>
|
||||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if>
|
||||
<if test="useState != null">and use_state = #{useState}</if>
|
||||
<if test="dataState != null">and data_state = #{dataState}</if>
|
||||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from sys_data_source where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
package com.hzya.frame.sys.dataSource.entity;
|
||||
|
||||
|
||||
import com.hzya.frame.web.exception.BaseSystemException;
|
||||
|
||||
public class SysDataSourceVo {
|
||||
|
||||
/** 主键ID */
|
||||
private String id;
|
||||
/** 数据源编码 */
|
||||
private String sourceCode;
|
||||
/** 数据源名称 */
|
||||
private String sourceName;
|
||||
/** ip */
|
||||
private String sourceIp;
|
||||
/** 端口 */
|
||||
private String sourcePort;
|
||||
/** 数据库名称 */
|
||||
private String dbName;
|
||||
/** 数据源类型 1oracle 2sqlsever 3mysql 4dm*/
|
||||
private String sourceType;
|
||||
/** 登录名 */
|
||||
private String loginName;
|
||||
/** 密码 */
|
||||
private String password;
|
||||
/** 选择oracle下服务名称 */
|
||||
private String serviceName;
|
||||
/** 使用状态1启用0锁定 */
|
||||
private Integer useState;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSourceCode() {
|
||||
return sourceCode;
|
||||
}
|
||||
|
||||
public void setSourceCode(String sourceCode) {
|
||||
this.sourceCode = sourceCode;
|
||||
}
|
||||
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
public void setSourceName(String sourceName) {
|
||||
this.sourceName = sourceName;
|
||||
}
|
||||
|
||||
public String getSourceIp() {
|
||||
return sourceIp;
|
||||
}
|
||||
|
||||
public void setSourceIp(String sourceIp) {
|
||||
this.sourceIp = sourceIp;
|
||||
}
|
||||
|
||||
public String getSourcePort() {
|
||||
return sourcePort;
|
||||
}
|
||||
|
||||
public void setSourcePort(String sourcePort) {
|
||||
this.sourcePort = sourcePort;
|
||||
}
|
||||
|
||||
public String getDbName() {
|
||||
return dbName;
|
||||
}
|
||||
|
||||
public void setDbName(String dbName) {
|
||||
this.dbName = dbName;
|
||||
}
|
||||
|
||||
public String getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
public void setSourceType(String sourceType) {
|
||||
this.sourceType = sourceType;
|
||||
}
|
||||
|
||||
public String getLoginName() {
|
||||
return loginName;
|
||||
}
|
||||
|
||||
public void setLoginName(String loginName) {
|
||||
this.loginName = loginName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getServiceName() {
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
public void setServiceName(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
public Integer getUseState() {
|
||||
return useState;
|
||||
}
|
||||
|
||||
public void setUseState(Integer useState) {
|
||||
this.useState = useState;
|
||||
}
|
||||
|
||||
public String getSourceUrl() {
|
||||
StringBuffer sourceUrl = new StringBuffer();
|
||||
switch (sourceType) {
|
||||
case "1": //oracle
|
||||
//jdbc:oracle:thin:@60.204.132.91:1521:ORCL
|
||||
sourceUrl.append("jdbc:oracle:thin:@").append(sourceIp).append(":").append(sourcePort).append(":").append(serviceName);
|
||||
break;
|
||||
case "2": //sqlsever
|
||||
//jdbc:sqlserver://221.12.175.82:1433;DatabaseName=U8CLOUD;encrypt=false;trustServerCertificate=true
|
||||
sourceUrl.append("jdbc:jtds:sqlserver://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append(";encrypt=false;trustServerCertificate=true");
|
||||
break;
|
||||
case "3": //mysql
|
||||
//jdbc:mysql://hzya.ufyct.com:9096/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false
|
||||
sourceUrl.append("jdbc:mysql://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append("?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false");
|
||||
break;
|
||||
case "4": //dm
|
||||
//jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&characterEncoding=UTF-8
|
||||
sourceUrl.append("jdbc:dm://").append(sourceIp).append(":").append(sourcePort).append("?schema=").append(dbName).append("&characterEncoding=UTF-8");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return sourceUrl.toString();
|
||||
}
|
||||
public String getSourceTypeName() {
|
||||
String sourceTypeName = null;
|
||||
switch (sourceType) {
|
||||
case "1": //oracle
|
||||
sourceTypeName = "oracle";
|
||||
break;
|
||||
case "2": //sqlsever
|
||||
sourceTypeName = "sqlServer";
|
||||
break;
|
||||
case "3": //mysql
|
||||
sourceTypeName = "mysql";
|
||||
break;
|
||||
case "4": //mysql
|
||||
sourceTypeName = "dm";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return sourceTypeName;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
package com.hzya.frame.sys.dataSource.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
/**
|
||||
* 数据源表(SysDataSource)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-09-05 16:07:10
|
||||
*/
|
||||
public interface ISysDataSourceService extends IBaseService<SysDataSourceEntity, String>{
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询列表
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
JsonResultEntity queryList(JSONObject jsonObject);
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询列表
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
JsonResultEntity queryPage(JSONObject jsonObject);
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 获取数据
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
JsonResultEntity queryEntity(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 新增数据
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
JsonResultEntity addEntity(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 修改数据
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
JsonResultEntity editEntity(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 删除数据
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
JsonResultEntity deleteEntity(JSONObject jsonObject);
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 数据源测试接口 测试当前页面数据源是否配置正确
|
||||
* @Date 2:08 下午 2023/9/23
|
||||
* @param jsonObject
|
||||
* @return
|
||||
**/
|
||||
JsonResultEntity testDatabase(JSONObject jsonObject);
|
||||
}
|
|
@ -1,256 +0,0 @@
|
|||
package com.hzya.frame.sys.dataSource.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hzya.frame.serviceUtil.DsDataSourceUtil;
|
||||
import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity;
|
||||
import com.hzya.frame.sys.dataSource.dao.ISysDataSourceDao;
|
||||
import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo;
|
||||
import com.hzya.frame.sys.dataSource.service.ISysDataSourceService;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationDatasourceDto;
|
||||
import com.hzya.frame.util.AESUtil;
|
||||
import com.hzya.frame.uuid.UUIDUtils;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.annotation.Resource;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据源表(SysDataSource)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-09-05 16:07:13
|
||||
*/
|
||||
@Service(value = "sysDataSourceService")
|
||||
public class SysDataSourceServiceImpl extends BaseService<SysDataSourceEntity, String> implements ISysDataSourceService {
|
||||
|
||||
private ISysDataSourceDao sysDataSourceDao;
|
||||
@Resource
|
||||
private DsDataSourceUtil dsDataSourceUtil;
|
||||
|
||||
@Autowired
|
||||
public void setSysDataSourceDao(ISysDataSourceDao dao) {
|
||||
this.sysDataSourceDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
/**
|
||||
* @param object
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询列表
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryList(JSONObject object) {
|
||||
SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class);
|
||||
List<SysDataSourceVo> sysDataSourceEntities = sysDataSourceDao.queryVoList(entity);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", sysDataSourceEntities);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询列表
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryPage(JSONObject object) {
|
||||
SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class);
|
||||
//判断分页
|
||||
if(entity == null || entity.getPageNum() == null || entity.getPageSize() == null){
|
||||
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
|
||||
}
|
||||
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
|
||||
List<SysDataSourceVo> sysDataSourceEntities = sysDataSourceDao.queryVoList(entity);
|
||||
if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){
|
||||
for (int i = 0; i < sysDataSourceEntities.size(); i++) {
|
||||
sysDataSourceEntities.get(i).setPassword(AESUtil.decrypt(sysDataSourceEntities.get(i).getPassword()));
|
||||
}
|
||||
}
|
||||
PageInfo pageInfo = new PageInfo(sysDataSourceEntities);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 获取数据
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryEntity(JSONObject object) {
|
||||
SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class);
|
||||
//判断分页
|
||||
if(entity == null || entity.getId() == null || "".equals(entity.getId())){
|
||||
return BaseResult.getFailureMessageEntity("请先传递请求主键");
|
||||
}
|
||||
SysDataSourceEntity sysDataSourceEntity = sysDataSourceDao.queryOne(entity);
|
||||
sysDataSourceEntity.setPassword(AESUtil.decrypt(sysDataSourceEntity.getPassword()));
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", sysDataSourceEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 新增数据
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity addEntity(JSONObject object) {
|
||||
SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class);
|
||||
if(entity == null){
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if(entity.getSourceName() == null || "".equals(entity.getSourceName())){
|
||||
return BaseResult.getFailureMessageEntity("请先输入数据源名称");
|
||||
}
|
||||
if(entity.getSourceCode() == null || "".equals(entity.getSourceCode())){
|
||||
return BaseResult.getFailureMessageEntity("请先输入数据源编码");
|
||||
}
|
||||
SysDataSourceEntity checkEntity = new SysDataSourceEntity();
|
||||
checkEntity.setSts("Y");
|
||||
checkEntity.setSourceCode(entity.getSourceCode());
|
||||
int checkCount = sysDataSourceDao.getCount(checkEntity);
|
||||
if(checkCount > 0){
|
||||
return BaseResult.getFailureMessageEntity("数据源编码已存在");
|
||||
}
|
||||
setCreate(entity);
|
||||
if(entity.getUseState() == 1){
|
||||
try {
|
||||
dsDataSourceUtil.addDataSource(entity);
|
||||
entity.setDataState("1");
|
||||
} catch (Exception e) {
|
||||
entity.setDataState("0");
|
||||
//return BaseResult.getFailureMessageEntity("初始化数据源失败,请检查数据源配置是否正确");
|
||||
}
|
||||
}
|
||||
entity.setPassword(AESUtil.encrypt(entity.getPassword()));
|
||||
sysDataSourceDao.save(entity);
|
||||
return BaseResult.getSuccessMessageEntity("保存数据源成功",entity.getId());
|
||||
}
|
||||
private void setCreate(SysDataSourceEntity entity) {
|
||||
entity.setId(UUIDUtils.getUUID());
|
||||
entity.setSts("Y");
|
||||
entity.setCreate_user_id(StpUtil.getLoginIdAsString());
|
||||
entity.setModify_user_id(StpUtil.getLoginIdAsString());
|
||||
entity.setCreate_time(new Date());
|
||||
entity.setModify_time(new Date());
|
||||
}
|
||||
/**
|
||||
* @param object
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 修改数据
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity editEntity(JSONObject object) {
|
||||
SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class);
|
||||
if(entity == null){
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if(entity.getId() == null || "".equals(entity.getId())){
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
if(entity.getSourceName() == null || "".equals(entity.getSourceName())){
|
||||
return BaseResult.getFailureMessageEntity("请先输入数据源名称");
|
||||
}
|
||||
if(entity.getSourceCode() == null || "".equals(entity.getSourceCode())){
|
||||
return BaseResult.getFailureMessageEntity("请先输入数据源编码");
|
||||
}
|
||||
SysDataSourceEntity checkEntity = new SysDataSourceEntity();
|
||||
checkEntity.setSts("Y");
|
||||
checkEntity.setId(entity.getId());
|
||||
checkEntity.setSourceCode(entity.getSourceCode());
|
||||
int checkCount = sysDataSourceDao.entity_count_not_id(checkEntity);
|
||||
if(checkCount > 0){
|
||||
return BaseResult.getFailureMessageEntity("接口编码已存在");
|
||||
}
|
||||
entity.setModify_user_id(StpUtil.getLoginIdAsString());
|
||||
entity.setModify_time(new Date());
|
||||
entity.setSts("Y");
|
||||
if(entity.getUseState() == 1){
|
||||
try {
|
||||
dsDataSourceUtil.editDataSource(entity);
|
||||
} catch (Exception e) {
|
||||
//return BaseResult.getSuccessMessageEntity("修改数据源失败,请检查数据源配置是否正确");
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
dsDataSourceUtil.removeDataSource(entity.getSourceCode());
|
||||
} catch (Exception e) {
|
||||
return BaseResult.getSuccessMessageEntity("修改数据源失败");
|
||||
}
|
||||
}
|
||||
if(entity.getPassword() != null ){
|
||||
entity.setPassword(AESUtil.encrypt(entity.getPassword()));
|
||||
}
|
||||
sysDataSourceDao.update(entity);
|
||||
return BaseResult.getSuccessMessageEntity("修改数据源成功",entity.getId());
|
||||
|
||||
}
|
||||
/**
|
||||
* @param object
|
||||
* @return
|
||||
* @Author lvleigang
|
||||
* @Description 数据源测试接口 测试当前页面数据源是否配置正确
|
||||
* @Date 2:08 下午 2023/9/23
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity testDatabase(JSONObject object) {
|
||||
SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
SysApplicationDatasourceDto sysApplicationDatasourceDto = new SysApplicationDatasourceDto();
|
||||
sysApplicationDatasourceDto.setSourceType(entity.getSourceType());
|
||||
sysApplicationDatasourceDto.setSourceUrl(entity.getSourceUrl());
|
||||
sysApplicationDatasourceDto.setLoginName(entity.getLoginName());
|
||||
sysApplicationDatasourceDto.setPassword(entity.getPassword());
|
||||
if (dsDataSourceUtil.testConnection(sysApplicationDatasourceDto)) {
|
||||
return BaseResult.getSuccessMessageEntity("测试连接数据源成功",true);
|
||||
} else {
|
||||
return BaseResult.getSuccessMessageEntity("测试连接数据源失败",false);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param object
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 删除数据
|
||||
* @Date 2:18 下午 2023/7/17
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity deleteEntity(JSONObject object) {
|
||||
SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class);
|
||||
//判断编码是否重复
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("请先填写内容");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("请先选择数据");
|
||||
}
|
||||
SysDataSourceEntity deleteEntity = sysDataSourceDao.queryOne(entity);
|
||||
//删除主表和明细表
|
||||
entity.setModify_user_id(StpUtil.getLoginIdAsString());
|
||||
entity.setModify_time(new Date());
|
||||
entity.setSts("Y");
|
||||
try {
|
||||
dsDataSourceUtil.removeDataSource(deleteEntity.getSourceCode());
|
||||
} catch (Exception e) {
|
||||
return BaseResult.getSuccessMessageEntity("删除数据源失败");
|
||||
}
|
||||
sysDataSourceDao.logicRemoveMultiCondition(entity);
|
||||
return BaseResult.getSuccessMessageEntity("删除成功");
|
||||
}
|
||||
}
|
|
@ -1,15 +1,18 @@
|
|||
package com.hzya.frame.sysnew.application.database.dao;
|
||||
|
||||
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据源表(sys_application_database: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-09-25 11:46:27
|
||||
* @since 2024-06-16 21:49:26
|
||||
*/
|
||||
public interface ISysApplicationDatabaseDao extends IBaseDao<SysApplicationDatabaseEntity, String> {
|
||||
|
||||
List<SysApplicationDatabaseEntity> queryDSBase(SysApplicationDatabaseEntity entity);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,26 @@
|
|||
package com.hzya.frame.sysnew.application.database.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
||||
import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据源表(SysApplicationDatabase)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-09-25 11:46:31
|
||||
* @since 2024-06-16 21:49:30
|
||||
*/
|
||||
@Repository(value = "SysApplicationDatabaseDaoImpl")
|
||||
public class SysApplicationDatabaseDaoImpl extends MybatisGenericDao<SysApplicationDatabaseEntity, String> implements ISysApplicationDatabaseDao{
|
||||
|
||||
@DS("master")
|
||||
@Override
|
||||
public List<SysApplicationDatabaseEntity> queryDSBase(SysApplicationDatabaseEntity entity) {
|
||||
List<SysApplicationDatabaseEntity> o = (List<SysApplicationDatabaseEntity>) super.selectList(getSqlIdPrifx() + "queryDSBase", entity);
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,22 +6,30 @@ import com.hzya.frame.web.entity.BaseEntity;
|
|||
* 数据源表(SysApplicationDatabase)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-09-25 11:46:34
|
||||
* @since 2024-06-16 21:49:31
|
||||
*/
|
||||
public class SysApplicationDatabaseEntity extends BaseEntity {
|
||||
|
||||
/** 应用id */
|
||||
private String appId;
|
||||
/** 数据源唯一编码 */
|
||||
private String sourceCode;
|
||||
/** 数据源名称 */
|
||||
private String sourceName;
|
||||
/** 数据源类型(1、oracle 2、sqlServer3、mysql) */
|
||||
private String sourceType;
|
||||
/** 实例地址 */
|
||||
private String sourceUrl;
|
||||
/** 账户 */
|
||||
/** ip */
|
||||
private String sourceIp;
|
||||
/** 端口 */
|
||||
private String sourcePort;
|
||||
/** 登录名 */
|
||||
private String loginName;
|
||||
/** 密码 */
|
||||
private String password;
|
||||
/** 库名 */
|
||||
private String dbName;
|
||||
/** 选择oracle下服务名称 */
|
||||
private String serviceName;
|
||||
/** 数据源是否启用(1、开启 2、关闭) */
|
||||
private String dbStatus;
|
||||
|
||||
|
@ -34,6 +42,22 @@ public class SysApplicationDatabaseEntity extends BaseEntity {
|
|||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getSourceCode() {
|
||||
return sourceCode;
|
||||
}
|
||||
|
||||
public void setSourceCode(String sourceCode) {
|
||||
this.sourceCode = sourceCode;
|
||||
}
|
||||
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
public void setSourceName(String sourceName) {
|
||||
this.sourceName = sourceName;
|
||||
}
|
||||
|
||||
public String getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
@ -42,12 +66,20 @@ public class SysApplicationDatabaseEntity extends BaseEntity {
|
|||
this.sourceType = sourceType;
|
||||
}
|
||||
|
||||
public String getSourceUrl() {
|
||||
return sourceUrl;
|
||||
public String getSourceIp() {
|
||||
return sourceIp;
|
||||
}
|
||||
|
||||
public void setSourceUrl(String sourceUrl) {
|
||||
this.sourceUrl = sourceUrl;
|
||||
public void setSourceIp(String sourceIp) {
|
||||
this.sourceIp = sourceIp;
|
||||
}
|
||||
|
||||
public String getSourcePort() {
|
||||
return sourcePort;
|
||||
}
|
||||
|
||||
public void setSourcePort(String sourcePort) {
|
||||
this.sourcePort = sourcePort;
|
||||
}
|
||||
|
||||
public String getLoginName() {
|
||||
|
@ -74,6 +106,14 @@ public class SysApplicationDatabaseEntity extends BaseEntity {
|
|||
this.dbName = dbName;
|
||||
}
|
||||
|
||||
public String getServiceName() {
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
public void setServiceName(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
public String getDbStatus() {
|
||||
return dbStatus;
|
||||
}
|
||||
|
@ -81,6 +121,49 @@ public class SysApplicationDatabaseEntity extends BaseEntity {
|
|||
public void setDbStatus(String dbStatus) {
|
||||
this.dbStatus = dbStatus;
|
||||
}
|
||||
public String getSourceUrl() {
|
||||
StringBuffer sourceUrl = new StringBuffer();
|
||||
if(sourceType != null){
|
||||
switch (sourceType) {
|
||||
case "1": //oracle
|
||||
//jdbc:oracle:thin:@60.204.132.91:1521:ORCL
|
||||
sourceUrl.append("jdbc:oracle:thin:@").append(sourceIp).append(":").append(sourcePort).append(":").append(serviceName);
|
||||
break;
|
||||
case "2": //sqlsever
|
||||
//jdbc:sqlserver://221.12.175.82:1433;DatabaseName=U8CLOUD;encrypt=false;trustServerCertificate=true
|
||||
sourceUrl.append("jdbc:jtds:sqlserver://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append(";encrypt=false;trustServerCertificate=true");
|
||||
break;
|
||||
case "3": //mysql
|
||||
//jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
|
||||
sourceUrl.append("jdbc:mysql://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append("?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true");
|
||||
break;
|
||||
case "4": //dm
|
||||
//jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&characterEncoding=UTF-8
|
||||
sourceUrl.append("jdbc:dm://").append(sourceIp).append(":").append(sourcePort).append("?schema=").append(dbName).append("&characterEncoding=UTF-8");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
return sourceUrl.toString();
|
||||
}
|
||||
public String getSourceTypeName() {
|
||||
String sourceTypeName = null;
|
||||
if(sourceType != null){
|
||||
switch (sourceType) {
|
||||
case "1": //oracle
|
||||
sourceTypeName = "oracle";
|
||||
break;
|
||||
case "2": //sqlsever
|
||||
sourceTypeName = "sqlServer";
|
||||
break;
|
||||
case "3": //mysql
|
||||
sourceTypeName = "mysql";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
return sourceTypeName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,44 +5,46 @@
|
|||
<resultMap id="get-SysApplicationDatabaseEntity-result" type="com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity" >
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
|
||||
<result property="sourceCode" column="source_code" jdbcType="VARCHAR"/>
|
||||
<result property="sourceName" column="source_name" jdbcType="VARCHAR"/>
|
||||
<result property="sourceType" column="source_type" jdbcType="VARCHAR"/>
|
||||
<result property="sourceUrl" column="source_url" jdbcType="VARCHAR"/>
|
||||
<result property="sourceIp" column="source_ip" jdbcType="VARCHAR"/>
|
||||
<result property="sourcePort" column="source_port" jdbcType="VARCHAR"/>
|
||||
<result property="loginName" column="login_name" jdbcType="VARCHAR"/>
|
||||
<result property="password" column="password" jdbcType="VARCHAR"/>
|
||||
<result property="dbName" column="db_name" jdbcType="VARCHAR"/>
|
||||
<result property="serviceName" column="service_name" jdbcType="VARCHAR"/>
|
||||
<result property="dbStatus" column="db_status" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "SysApplicationDatabaseEntity_Base_Column_List">
|
||||
id
|
||||
,app_id
|
||||
,source_code
|
||||
,source_name
|
||||
,source_type
|
||||
,source_url
|
||||
,source_ip
|
||||
,source_port
|
||||
,login_name
|
||||
,password
|
||||
,db_name
|
||||
,service_name
|
||||
,db_status
|
||||
,sorts
|
||||
,org_id
|
||||
,sts
|
||||
,create_time
|
||||
,create_user_id
|
||||
,modify_time
|
||||
,create_time
|
||||
,modify_user_id
|
||||
,modify_time
|
||||
,sts
|
||||
,org_id
|
||||
</sql>
|
||||
<!--通过ID获取数据 -->
|
||||
<select id="entity_get" resultMap="get-SysApplicationDatabaseEntity-result">
|
||||
select
|
||||
<include refid="SysApplicationDatabaseEntity_Base_Column_List" />
|
||||
from sys_application_database where sts = 'Y' and id = #{id}
|
||||
</select>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-SysApplicationDatabaseEntity-result" parameterType = "com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity">
|
||||
select
|
||||
|
@ -51,19 +53,23 @@
|
|||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if>
|
||||
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
|
||||
<if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if>
|
||||
<if test="sourceUrl != null and sourceUrl != ''"> and source_url = #{sourceUrl} </if>
|
||||
<if test="sourceIp != null and sourceIp != ''"> and source_ip = #{sourceIp} </if>
|
||||
<if test="sourcePort != null and sourcePort != ''"> and source_port = #{sourcePort} </if>
|
||||
<if test="loginName != null and loginName != ''"> and login_name = #{loginName} </if>
|
||||
<if test="password != null and password != ''"> and password = #{password} </if>
|
||||
<if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if>
|
||||
<if test="serviceName != null and serviceName != ''"> and service_name = #{serviceName} </if>
|
||||
<if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
|
@ -76,19 +82,23 @@
|
|||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if>
|
||||
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
|
||||
<if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if>
|
||||
<if test="sourceUrl != null and sourceUrl != ''"> and source_url = #{sourceUrl} </if>
|
||||
<if test="sourceIp != null and sourceIp != ''"> and source_ip = #{sourceIp} </if>
|
||||
<if test="sourcePort != null and sourcePort != ''"> and source_port = #{sourcePort} </if>
|
||||
<if test="loginName != null and loginName != ''"> and login_name = #{loginName} </if>
|
||||
<if test="password != null and password != ''"> and password = #{password} </if>
|
||||
<if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if>
|
||||
<if test="serviceName != null and serviceName != ''"> and service_name = #{serviceName} </if>
|
||||
<if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
|
@ -103,19 +113,23 @@
|
|||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
|
||||
<if test="appId != null and appId != ''"> and app_id like concat('%',#{appId},'%') </if>
|
||||
<if test="sourceCode != null and sourceCode != ''"> and source_code like concat('%',#{sourceCode},'%') </if>
|
||||
<if test="sourceName != null and sourceName != ''"> and source_name like concat('%',#{sourceName},'%') </if>
|
||||
<if test="sourceType != null and sourceType != ''"> and source_type like concat('%',#{sourceType},'%') </if>
|
||||
<if test="sourceUrl != null and sourceUrl != ''"> and source_url like concat('%',#{sourceUrl},'%') </if>
|
||||
<if test="sourceIp != null and sourceIp != ''"> and source_ip like concat('%',#{sourceIp},'%') </if>
|
||||
<if test="sourcePort != null and sourcePort != ''"> and source_port like concat('%',#{sourcePort},'%') </if>
|
||||
<if test="loginName != null and loginName != ''"> and login_name like concat('%',#{loginName},'%') </if>
|
||||
<if test="password != null and password != ''"> and password like concat('%',#{password},'%') </if>
|
||||
<if test="dbName != null and dbName != ''"> and db_name like concat('%',#{dbName},'%') </if>
|
||||
<if test="serviceName != null and serviceName != ''"> and service_name like concat('%',#{serviceName},'%') </if>
|
||||
<if test="dbStatus != null and dbStatus != ''"> and db_status like concat('%',#{dbStatus},'%') </if>
|
||||
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
|
||||
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
||||
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
|
||||
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
|
||||
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
|
||||
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
|
@ -130,19 +144,23 @@
|
|||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''"> or id = #{id} </if>
|
||||
<if test="appId != null and appId != ''"> or app_id = #{appId} </if>
|
||||
<if test="sourceCode != null and sourceCode != ''"> or source_code = #{sourceCode} </if>
|
||||
<if test="sourceName != null and sourceName != ''"> or source_name = #{sourceName} </if>
|
||||
<if test="sourceType != null and sourceType != ''"> or source_type = #{sourceType} </if>
|
||||
<if test="sourceUrl != null and sourceUrl != ''"> or source_url = #{sourceUrl} </if>
|
||||
<if test="sourceIp != null and sourceIp != ''"> or source_ip = #{sourceIp} </if>
|
||||
<if test="sourcePort != null and sourcePort != ''"> or source_port = #{sourcePort} </if>
|
||||
<if test="loginName != null and loginName != ''"> or login_name = #{loginName} </if>
|
||||
<if test="password != null and password != ''"> or password = #{password} </if>
|
||||
<if test="dbName != null and dbName != ''"> or db_name = #{dbName} </if>
|
||||
<if test="serviceName != null and serviceName != ''"> or service_name = #{serviceName} </if>
|
||||
<if test="dbStatus != null and dbStatus != ''"> or db_status = #{dbStatus} </if>
|
||||
<if test="sorts != null"> or sorts = #{sorts} </if>
|
||||
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
|
||||
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
|
||||
<if test="create_time != null"> or create_time = #{create_time} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
|
||||
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> or create_time = #{create_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
|
||||
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
|
||||
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
|
||||
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
|
@ -155,19 +173,23 @@
|
|||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
<if test="appId != null and appId != ''"> app_id , </if>
|
||||
<if test="sourceCode != null and sourceCode != ''"> source_code , </if>
|
||||
<if test="sourceName != null and sourceName != ''"> source_name , </if>
|
||||
<if test="sourceType != null and sourceType != ''"> source_type , </if>
|
||||
<if test="sourceUrl != null and sourceUrl != ''"> source_url , </if>
|
||||
<if test="sourceIp != null and sourceIp != ''"> source_ip , </if>
|
||||
<if test="sourcePort != null and sourcePort != ''"> source_port , </if>
|
||||
<if test="loginName != null and loginName != ''"> login_name , </if>
|
||||
<if test="password != null and password != ''"> password , </if>
|
||||
<if test="dbName != null and dbName != ''"> db_name , </if>
|
||||
<if test="serviceName != null and serviceName != ''"> service_name , </if>
|
||||
<if test="dbStatus != null and dbStatus != ''"> db_status , </if>
|
||||
<if test="sorts != null"> sorts , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="modify_time != null"> modify_time , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
|
||||
<if test="modify_time != null"> modify_time , </if>
|
||||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="sorts == null ">sorts,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
|
@ -175,19 +197,23 @@
|
|||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> #{id} ,</if>
|
||||
<if test="appId != null and appId != ''"> #{appId} ,</if>
|
||||
<if test="sourceCode != null and sourceCode != ''"> #{sourceCode} ,</if>
|
||||
<if test="sourceName != null and sourceName != ''"> #{sourceName} ,</if>
|
||||
<if test="sourceType != null and sourceType != ''"> #{sourceType} ,</if>
|
||||
<if test="sourceUrl != null and sourceUrl != ''"> #{sourceUrl} ,</if>
|
||||
<if test="sourceIp != null and sourceIp != ''"> #{sourceIp} ,</if>
|
||||
<if test="sourcePort != null and sourcePort != ''"> #{sourcePort} ,</if>
|
||||
<if test="loginName != null and loginName != ''"> #{loginName} ,</if>
|
||||
<if test="password != null and password != ''"> #{password} ,</if>
|
||||
<if test="dbName != null and dbName != ''"> #{dbName} ,</if>
|
||||
<if test="serviceName != null and serviceName != ''"> #{serviceName} ,</if>
|
||||
<if test="dbStatus != null and dbStatus != ''"> #{dbStatus} ,</if>
|
||||
<if test="sorts != null"> #{sorts} ,</if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
|
||||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||
<if test="create_time != null"> #{create_time} ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
|
||||
<if test="modify_time != null"> #{modify_time} ,</if>
|
||||
<if test="create_time != null"> #{create_time} ,</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
|
||||
<if test="modify_time != null"> #{modify_time} ,</if>
|
||||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_database a WHERE a.sts = 'Y' ),</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
|
@ -195,52 +221,58 @@
|
|||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into sys_application_database(app_id, source_type, source_url, login_name, password, db_name, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts)
|
||||
insert into sys_application_database(app_id, source_code, source_name, source_type, source_ip, source_port, login_name, password, db_name, service_name, db_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.appId},#{entity.sourceType},#{entity.sourceUrl},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y')
|
||||
(#{entity.appId},#{entity.sourceCode},#{entity.sourceName},#{entity.sourceType},#{entity.sourceIp},#{entity.sourcePort},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.serviceName},#{entity.dbStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, 'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into sys_application_database(app_id, source_type, source_url, login_name, password, db_name, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id)
|
||||
insert into sys_application_database(app_id, source_code, source_name, source_type, source_ip, source_port, login_name, password, db_name, service_name, db_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.appId},#{entity.sourceType},#{entity.sourceUrl},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id})
|
||||
(#{entity.appId},#{entity.sourceCode},#{entity.sourceName},#{entity.sourceType},#{entity.sourceIp},#{entity.sourcePort},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.serviceName},#{entity.dbStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
app_id = values(app_id),
|
||||
source_code = values(source_code),
|
||||
source_name = values(source_name),
|
||||
source_type = values(source_type),
|
||||
source_url = values(source_url),
|
||||
source_ip = values(source_ip),
|
||||
source_port = values(source_port),
|
||||
login_name = values(login_name),
|
||||
password = values(password),
|
||||
db_name = values(db_name),
|
||||
service_name = values(service_name),
|
||||
db_status = values(db_status),
|
||||
sorts = values(sorts),
|
||||
org_id = values(org_id),
|
||||
sts = values(sts),
|
||||
create_time = values(create_time),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
modify_time = values(modify_time),
|
||||
modify_user_id = values(modify_user_id)</insert>
|
||||
sts = values(sts),
|
||||
org_id = values(org_id)</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity" >
|
||||
update sys_application_database set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="appId != null and appId != ''"> app_id = #{appId},</if>
|
||||
<if test="sourceCode != null and sourceCode != ''"> source_code = #{sourceCode},</if>
|
||||
<if test="sourceName != null and sourceName != ''"> source_name = #{sourceName},</if>
|
||||
<if test="sourceType != null and sourceType != ''"> source_type = #{sourceType},</if>
|
||||
<if test="sourceUrl != null and sourceUrl != ''"> source_url = #{sourceUrl},</if>
|
||||
<if test="sourceIp != null and sourceIp != ''"> source_ip = #{sourceIp},</if>
|
||||
<if test="sourcePort != null and sourcePort != ''"> source_port = #{sourcePort},</if>
|
||||
<if test="loginName != null and loginName != ''"> login_name = #{loginName},</if>
|
||||
<if test="password != null and password != ''"> password = #{password},</if>
|
||||
<if test="dbName != null and dbName != ''"> db_name = #{dbName},</if>
|
||||
<if test="serviceName != null and serviceName != ''"> service_name = #{serviceName},</if>
|
||||
<if test="dbStatus != null and dbStatus != ''"> db_status = #{dbStatus},</if>
|
||||
<if test="sorts != null"> sorts = #{sorts},</if>
|
||||
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
|
||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
|
||||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
@ -255,21 +287,52 @@ update sys_application_database set sts= 'N' ,modify_time = #{modify_time},modi
|
|||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if>
|
||||
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
|
||||
<if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if>
|
||||
<if test="sourceUrl != null and sourceUrl != ''"> and source_url = #{sourceUrl} </if>
|
||||
<if test="sourceIp != null and sourceIp != ''"> and source_ip = #{sourceIp} </if>
|
||||
<if test="sourcePort != null and sourcePort != ''"> and source_port = #{sourcePort} </if>
|
||||
<if test="loginName != null and loginName != ''"> and login_name = #{loginName} </if>
|
||||
<if test="password != null and password != ''"> and password = #{password} </if>
|
||||
<if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if>
|
||||
<if test="serviceName != null and serviceName != ''"> and service_name = #{serviceName} </if>
|
||||
<if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from sys_application_database where id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="queryDSBase" resultMap="get-SysApplicationDatabaseEntity-result" parameterType = "com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity">
|
||||
select
|
||||
<include refid="SysApplicationDatabaseEntity_Base_Column_List" />
|
||||
from sys_application_database
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="sourceCode != null and sourceCode != ''"> and source_code = #{sourceCode} </if>
|
||||
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
|
||||
<if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType} </if>
|
||||
<if test="sourceIp != null and sourceIp != ''"> and source_ip = #{sourceIp} </if>
|
||||
<if test="sourcePort != null and sourcePort != ''"> and source_port = #{sourcePort} </if>
|
||||
<if test="loginName != null and loginName != ''"> and login_name = #{loginName} </if>
|
||||
<if test="password != null and password != ''"> and password = #{password} </if>
|
||||
<if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if>
|
||||
<if test="serviceName != null and serviceName != ''"> and service_name = #{serviceName} </if>
|
||||
<if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService;
|
|||
* 数据源表(SysApplicationDatabase)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-09-25 11:46:39
|
||||
* @since 2024-06-16 21:49:32
|
||||
*/
|
||||
public interface ISysApplicationDatabaseService extends IBaseService<SysApplicationDatabaseEntity, String>{
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService;
|
|||
* 数据源表(SysApplicationDatabase)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-09-25 11:46:42
|
||||
* @since 2024-06-16 21:49:33
|
||||
*/
|
||||
@Service(value = "sysApplicationDatabaseService")
|
||||
public class SysApplicationDatabaseServiceImpl extends BaseService<SysApplicationDatabaseEntity, String> implements ISysApplicationDatabaseService {
|
||||
|
|
|
@ -551,14 +551,19 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
**/
|
||||
@Override
|
||||
public JsonResultEntity testDatabase(JSONObject object) {
|
||||
SysApplicationDatasourceDto entity = getData("jsonStr", object, SysApplicationDatasourceDto.class);
|
||||
SysApplicationDatabaseEntity entity = getData("jsonStr", object, SysApplicationDatabaseEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
if (dsDataSourceUtil.testConnection(entity)) {
|
||||
return BaseResult.getSuccessMessageEntity("测试连接数据源成功");
|
||||
SysApplicationDatasourceDto sysApplicationDatasourceDto = new SysApplicationDatasourceDto();
|
||||
sysApplicationDatasourceDto.setSourceType(entity.getSourceType());
|
||||
sysApplicationDatasourceDto.setSourceUrl(entity.getSourceUrl());
|
||||
sysApplicationDatasourceDto.setLoginName(entity.getLoginName());
|
||||
sysApplicationDatasourceDto.setPassword(entity.getPassword());
|
||||
if (dsDataSourceUtil.testConnection(sysApplicationDatasourceDto)) {
|
||||
return BaseResult.getSuccessMessageEntity("测试连接数据源成功",true);
|
||||
} else {
|
||||
return BaseResult.getFailureMessageEntity("测试连接数据源失败,请检查数据源配置是否正确");
|
||||
return BaseResult.getSuccessMessageEntity("测试连接数据源失败",false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,7 +578,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
sysApplicationDatabaseDao.logicRemoveMultiCondition(detailEntity);
|
||||
SysApplicationDatabaseEntity databaseEntity = entity.getDatabaseEntity();
|
||||
if (databaseEntity != null) {
|
||||
databaseEntity.setAppId(entity.getId());
|
||||
databaseEntity.setPassword(AESUtil.encrypt(databaseEntity.getPassword()));
|
||||
databaseEntity.setSts("Y");
|
||||
databaseEntity.setSts("Y");
|
||||
databaseEntity.setDbStatus(entity.getDbStatus());
|
||||
databaseEntity.setModify_user_id(StpUtil.getLoginIdAsString());
|
||||
|
@ -581,6 +587,19 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
if (databaseEntity.getId() != null && !"".equals(databaseEntity.getId())) {
|
||||
//修改
|
||||
sysApplicationDatabaseDao.update(databaseEntity);
|
||||
if("1".equals(databaseEntity.getDbStatus())){
|
||||
try {
|
||||
dsDataSourceUtil.editDataSource(databaseEntity);
|
||||
} catch (Exception e) {
|
||||
//return BaseResult.getSuccessMessageEntity("修改数据源失败,请检查数据源配置是否正确");
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
dsDataSourceUtil.removeDataSource(databaseEntity.getSourceCode());
|
||||
} catch (Exception e) {
|
||||
//return BaseResult.getSuccessMessageEntity("修改数据源失败");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//新增
|
||||
databaseEntity.setId(UUIDUtils.getUUID());
|
||||
|
@ -1442,6 +1461,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
|
||||
if (list != null && list.size() > 0) {
|
||||
sysApplicationDatabaseEntity = list.get(0);
|
||||
sysApplicationDatabaseEntity.setPassword(AESUtil.decrypt(sysApplicationDatabaseEntity.getPassword()));
|
||||
} else {
|
||||
sysApplicationDatabaseEntity = null;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.hzya.frame.sysnew.login.impl;
|
|||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.login.ILoginService;
|
||||
import com.hzya.frame.sysnew.organ.dao.ISysOrganDao;
|
||||
import com.hzya.frame.sysnew.organ.entity.SysOrganEntity;
|
||||
|
@ -37,6 +39,8 @@ public class LoginServiceImpl implements ILoginService {
|
|||
@Resource
|
||||
private ISysOrganDao sysOrganDao;
|
||||
|
||||
@Resource
|
||||
private ISysApplicationDao sysApplicationDao;
|
||||
@Resource
|
||||
private InterfaceCache interfaceCache;
|
||||
/**
|
||||
|
@ -111,6 +115,9 @@ public class LoginServiceImpl implements ILoginService {
|
|||
res.put("token", token);
|
||||
res.put("userInfo", sysUserEntity);
|
||||
res.put("company", sysOrganEntities);
|
||||
|
||||
|
||||
//切换数据源查询
|
||||
return BaseResult.getSuccessMessageEntity("登录成功", res);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@ import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
|
|||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.exception.CannotFindDataSourceException;
|
||||
import com.hzya.frame.datasource.DataSourceUtilProperties;
|
||||
import com.hzya.frame.sys.dataSource.dao.ISysDataSourceDao;
|
||||
import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity;
|
||||
import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo;
|
||||
import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao;
|
||||
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
||||
import com.hzya.frame.util.AESUtil;
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
import com.hzya.frame.web.exception.BaseSystemException;
|
||||
|
@ -38,7 +37,7 @@ public class AopDynamicRoutingDataSourceInit {
|
|||
@Resource
|
||||
private DataSource dataSource;
|
||||
@Resource
|
||||
private ISysDataSourceDao sysDataSourceDao;
|
||||
private ISysApplicationDatabaseDao sysApplicationDatabaseDao;
|
||||
|
||||
|
||||
@Before("@annotation(dsAnnotation)")
|
||||
|
@ -64,12 +63,12 @@ public class AopDynamicRoutingDataSourceInit {
|
|||
dsDatasource = ds.getDataSource(dsValue);
|
||||
} catch (CannotFindDataSourceException exception) {
|
||||
//logger.info("beforeDynamicRoutingDataSourceInitMethod:根据ds获取dsDatasource失败!异常信息:" + "exception.getMessage()" + " 执行初始化数据源:" + dsValue);
|
||||
SysDataSourceEntity entity = new SysDataSourceEntity();
|
||||
SysApplicationDatabaseEntity entity = new SysApplicationDatabaseEntity();
|
||||
entity.setSts("Y");
|
||||
entity.setUseState(1);
|
||||
entity.setDataState("1");
|
||||
entity.setDbStatus("1");
|
||||
entity.setSourceCode(dsValue);
|
||||
List<SysDataSourceVo> sysDataSourceEntities = sysDataSourceDao.queryDSBase(entity);
|
||||
entity.setDataSourceCode("master");
|
||||
List<SysApplicationDatabaseEntity> sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(entity);
|
||||
//logger.info("beforeDynamicRoutingDataSourceInitMethod:根据dsValue获取数据源信息查询结果 sysDataSourceEntities.size:" + sysDataSourceEntities.size());
|
||||
if (sysDataSourceEntities != null && sysDataSourceEntities.size() > 0) {
|
||||
for (int i = 0; i < sysDataSourceEntities.size(); i++) {
|
||||
|
|
Loading…
Reference in New Issue