nxdt-system/bonus-modules/bonus-flowable/src/main/resources/mapper/FlowMapper.xml

127 lines
5.1 KiB
XML
Raw Normal View History

2025-01-16 16:16:53 +08:00
<?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.bonus.flowable.mapper.FlowMapper">
<insert id="insertBasicInfo">
insert into nxdt_ii.pt_flow_process (definition_key, examine_name, examine_type, business_type,
examine_mark)
value (#{deployId}, #{flowName}, #{flowType}, #{flowBusinessType}, #{instructions})
</insert>
<insert id="insertLinkInfo">
insert into nxdt_ii.lk_pro_examine_configuration(pro_id, examine_id, business_type)
value (#{proId}, #{deployId}, #{flowBusinessType})
</insert>
<update id="updateBasicInfo">
update nxdt_ii.pt_flow_process
set examine_name = #{flowName},
examine_type = #{flowType},
business_type = #{flowBusinessType},
examine_mark = #{instructions}
where definition_key = #{deployId}
</update>
<delete id="delLinkInfo">
delete from nxdt_ii.lk_pro_examine_configuration
where examine_id = #{deployId}
</delete>
<delete id="delInfo">
update nxdt_ii.pt_flow_process set is_active = '0' where definition_key = #{flowKey};
</delete>
<delete id="delLinkInfo1">
delete from nxdt_ii.lk_pro_examine_configuration where examine_id = #{flowKey}
</delete>
<select id="list" resultType="com.bonus.flowable.domain.FlowEntity">
SELECT
rp.id_ as id,
rp.deployment_id_ as deploymentId,
rd.category_ as category,
rp.key_ as flowKey,
rp.version_ as version,
rp.suspension_state_ as suspensionState,
rd.deploy_time_ as deploymentTime,
pfp.examine_name as name,
if(pfp.examine_type = '1','专用审批流','通用审批流') as flowType,
sdd.dict_label as flowBusinessType,
pfp.examine_mark as instructions,
ppi.pro_name as proName,
ppi.pro_id as proId
FROM
ACT_RE_PROCDEF rp
LEFT JOIN ACT_RE_DEPLOYMENT rd ON rp.deployment_id_ = rd.id_
left join nxdt_ii.pt_flow_process pfp on rp.key_ = pfp.definition_key
left join nxdt_ii.lk_pro_examine_configuration lpec on pfp.definition_key = lpec.examine_id
left join nxdt_ii.pt_project_info ppi on lpec.pro_id = ppi.pro_id
left join nxdt_ii.sys_dict_data sdd on sdd.dict_value = pfp.business_type and sdd.dict_type = 'sys_approval_type'
<where>
rp.deployment_id_ IN (
SELECT d.deployment_id_
FROM ACT_RE_PROCDEF d
INNER JOIN (
SELECT key_, MAX(version_) AS max_version
FROM ACT_RE_PROCDEF
GROUP BY key_
) m ON d.key_ = m.key_ AND d.version_ = m.max_version
)
<!-- 动态添加名称过滤条件 -->
<if test="name != null and name != ''">
and pfp.examine_name like concat('%', #{name}, '%')
</if>
</where>
order by rd.deploy_time_ desc
</select>
<select id="getUserList" resultType="com.bonus.common.entity.SysUser">
select u.user_id as userId,
u.dept_id as deptId,
u.user_name as userName,
u.nick_name as nickName,
u.email,
u.avatar,
u.phonenumber,
u.id_card as idCard,
u.password,
u.sex,
u.status,
u.del_flag as delFlag,
u.login_ip as loginIp,
u.login_date as loginDate,
u.user_type as userType,
u.create_by as createBy,
u.create_time as createTime,
u.remark,
u.parent_uuid as parentUuid,
d.dept_id as deptId,
d.parent_id as parentId,
d.ancestors,
d.dept_name as deptName,
d.order_num as orderNum,
d.leader,
d.status as deptStatus,
r.role_id as roleId,
r.role_name as roleName,
r.role_key as roleKey,
r.role_sort as roleSort,
r.data_scope as dataScope,
r.status as roleStatus,
u.login_type as loginType
from nxdt_ii.sys_user u
left join nxdt_ii.sys_dept d on u.dept_id = d.dept_id
left join nxdt_ii.sys_user_role ur on u.user_id = ur.user_id
left join nxdt_ii.sys_role r on r.role_id = ur.role_id
where u.del_flag = '0'
</select>
<select id="checkIsExistFlowName" resultType="java.lang.Integer">
select count(1)
from nxdt_ii.pt_flow_process
where examine_name = #{flowName} and is_active = '1'
</select>
<select id="getDeployIdList" resultType="com.bonus.flowable.domain.FlowSaveXml">
select
deployment_id_ as deployId,
KEY_ as flowKey
from act_re_procdef
where NAME_ = (select NAME_ from act_re_procdef where deployment_id_ = #{deployId})
</select>
</mapper>