<?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.gkhy.safePlatform.specialWork.repository.ApprovalRuleStepRepository" >
|
<resultMap id="BaseResultMap" type="com.gkhy.safePlatform.specialWork.entity.ApprovalRuleStep" >
|
<id column="step_id" property="stepId" jdbcType="BIGINT" />
|
<result column="rule_id" property="ruleId" jdbcType="BIGINT"/>
|
<result column="step_name" property="stepName" jdbcType="VARCHAR"/>
|
<result column="status" property="status" jdbcType="TINYINT"/>
|
<result column="step_serial" property="stepSerial" jdbcType="INTEGER"/>
|
<result column="enable_order" property="enableOrder" jdbcType="BOOLEAN"/>
|
<result column="type" property="type" jdbcType="TINYINT"/>
|
<result column="continue_time" property="continueTime" jdbcType="INTEGER"/>
|
<result column="continue_time_unit" property="continueTimeUnit" jdbcType="TINYINT"/>
|
<result column="pre_step_id" property="preStepId" jdbcType="BIGINT"/>
|
<result column="next_step_id" property="nextStepId" jdbcType="BIGINT"/>
|
<result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP"/>
|
<result column="gmt_modified" property="gmtModified" jdbcType="TIMESTAMP"/>
|
<result column="create_uid" property="createUid" jdbcType="BIGINT"/>
|
<result column="create_uname" property="createUname" jdbcType="VARCHAR"/>
|
<result column="modified_uname" property="modifiedUname" jdbcType="VARCHAR"/>
|
<result column="modified_uid" property="modifiedUid" jdbcType="BIGINT"/>
|
<result column="audit_type" property="auditType" jdbcType="TINYINT"/>
|
|
|
|
</resultMap>
|
<sql id="all_Column_List" >
|
<!-- -->
|
step_id,rule_id,step_name,status,step_serial,enable_order,type,continue_time,continue_time_unit,pre_step_id,next_step_id,gmt_create,gmt_modified,create_uid,create_uname,modified_uname,modified_uid, audit_type
|
</sql>
|
<sql id="base_table_name">approval_rule_step</sql>
|
<select id="listByConditions" resultMap="BaseResultMap"
|
parameterType="com.gkhy.safePlatform.specialWork.model.query.db.ApprovalRuleStepListDbQuery">
|
select <include refid="all_Column_List"></include> from <include refid="base_table_name"></include>
|
<where>
|
<if test="query.ruleId != null and query.ruleId > 0">
|
and rule_id = #{query.ruleId}
|
</if>
|
<if test="query.status != null">
|
and status = #{query.status}
|
</if>
|
<if test="query.type != null">
|
and type = #{query.type}
|
</if>
|
<if test="query.stepName != null and query.stepName != ''">
|
and step_name like concat('%',#{query.stepName},'%')
|
</if>
|
</where>
|
</select>
|
|
<select id="listByRuleId" resultMap="BaseResultMap">
|
select step_id,rule_id,step_name,status,step_serial,enable_order,type,continue_time,continue_time_unit,pre_step_id,next_step_id,audit_type from <include refid="base_table_name"></include>
|
where rule_id = #{ruleId} and status = #{status} order by step_serial asc
|
</select>
|
|
|
<!--批量删除层级-根据主键-->
|
<update id="updateStatusByStepIds" >
|
update <include refid="base_table_name"></include>
|
set status = #{status}
|
where
|
step_id in
|
<foreach collection="stepIds" item="stepId" open="(" close=")" separator=",">
|
#{stepId}
|
</foreach>
|
</update>
|
<!--删除层级-单挑-->
|
<update id="updateStatusByStepId" >
|
update <include refid="base_table_name"></include>
|
set status = #{status}
|
where
|
step_id = #{stepId}
|
</update>
|
|
<!--批量删除层级-根据规则ids-->
|
<update id="updateStatusByRuleIds" >
|
update <include refid="base_table_name"></include>
|
set status = #{status}
|
where
|
rule_id in
|
<foreach collection="ruleIds" item="ruleId" open="(" close=")" separator=",">
|
#{ruleId}
|
</foreach>
|
</update>
|
|
<!--删除层级-根据规则id-->
|
<update id="updateStatusByRuleId" >
|
update <include refid="base_table_name"></include>
|
set status = #{status}
|
where
|
rule_id = #{ruleId}
|
</update>
|
|
<select id="getStepById" resultMap="BaseResultMap">
|
select <include refid="all_Column_List"></include> from <include refid="base_table_name"></include>
|
where step_id = #{stepId} and status = #{status}
|
</select>
|
|
<!--批量删除层级-根据规则ids-->
|
<update id="updateStatusByRuleIdAndNotInIds" >
|
update <include refid="base_table_name"></include>
|
set status = #{status}
|
where
|
rule_id = #{ruleId}
|
and step_id not in
|
<foreach collection="idList" item="id" open="(" close=")" separator=",">
|
#{id}
|
</foreach>
|
</update>
|
<!--根据规则获取层级id集合-->
|
<select id="listStepIdByRuleId" resultType="java.lang.Long">
|
select step_id from <include refid="base_table_name"></include>
|
where rule_id = #{ruleId} and status = #{status}
|
</select>
|
|
<update id="updateStepAndEmptyPreStepId"
|
parameterType="com.gkhy.safePlatform.specialWork.entity.ApprovalRuleUnit" >
|
update
|
approval_rule_step
|
<trim suffixOverrides=",">
|
<if test="ruleId != null">
|
set rule_id = #{ruleId},
|
</if>
|
<if test="stepName != null and stepName != '' ">
|
step_name = #{stepName},
|
</if>
|
<if test="status != null">
|
status = #{status},
|
</if>
|
<if test="stepSerial != null">
|
step_serial = #{stepSerial},
|
</if>
|
<if test="enableOrder != null">
|
enable_order = #{enableOrder},
|
</if>
|
<if test="type != null">
|
type = #{type},
|
</if>
|
<if test="continueTime != null">
|
continue_time = #{continueTime},
|
</if>
|
<if test="continueTime != null">
|
continue_time_unit = #{continueTime},
|
</if>
|
|
pre_step_id = null,
|
|
<if test="nextStepId != null">
|
next_step_id = #{nextStepId},
|
</if>
|
<if test="modifiedUname != null">
|
modified_uname = #{modifiedUname},
|
</if>
|
<if test="gmtModified != null">
|
gmt_modified = #{gmtModified},
|
</if>
|
<if test="modifiedUid != null">
|
modified_uid = #{modifiedUid},
|
</if>
|
</trim>
|
where step_id = #{stepId}
|
</update>
|
|
<update id="updateBatchStep" parameterType="java.util.List">
|
<foreach collection="list" item="step" index="index" open="" close="" separator=";">
|
update approval_rule_step
|
<set>
|
<if test="step.ruleId != null">
|
rule_id = #{step.ruleId},
|
</if>
|
<if test="step.stepName != null and step.stepName != '' ">
|
step_name = #{step.stepName},
|
</if>
|
<if test="step.status != null">
|
status = #{step.status},
|
</if>
|
<if test="step.stepSerial != null">
|
step_serial = #{step.stepSerial},
|
</if>
|
<if test="step.enableOrder != null">
|
enable_order = #{step.enableOrder},
|
</if>
|
<if test="step.personType != null">
|
person_type = #{step.personType},
|
</if>
|
<if test="step.approvalType != null">
|
approval_type = #{step.approvalType},
|
</if>
|
<if test="step.contentType != null">
|
content_type = #{step.contentType},
|
</if>
|
<if test="step.continueTime != null">
|
continue_time = #{step.continueTime},
|
</if>
|
<if test="step.continueTimeUnit != null">
|
continue_time_unit = #{step.continueTimeUnit},
|
</if>
|
<if test="step.preStepId == null">
|
pre_step_id = null,
|
</if>
|
<if test="step.preStepId != null">
|
pre_step_id = #{step.preStepId},
|
</if>
|
<if test="step.nextStepId != null">
|
next_step_id = #{step.nextStepId},
|
</if>
|
<if test="step.modifiedUname != null">
|
modified_uname = #{step.modifiedUname},
|
</if>
|
<if test="step.gmtModified != null">
|
gmt_modified = #{step.gmtModified},
|
</if>
|
<if test="step.modifiedUid != null">
|
modified_uid = #{step.modifiedUid},
|
</if>
|
<if test="step.auditType != null">
|
audit_type = #{step.auditType},
|
</if>
|
</set>
|
where step_id = #{step.stepId}
|
</foreach>
|
|
</update>
|
|
<insert id="saveStepList" >
|
insert into
|
approval_rule_step
|
<trim prefix="(" suffix=") values" suffixOverrides=",">
|
step_id,
|
step_name,
|
rule_id,
|
status,
|
step_serial,
|
enable_order,
|
person_type,
|
approval_type,
|
content_type,
|
continue_time,
|
continue_time_unit,
|
pre_step_id,
|
next_step_id,
|
gmt_create,
|
gmt_modified,
|
create_uid,
|
create_uname,
|
modified_uid,
|
modified_uname,
|
audit_type
|
</trim>
|
<foreach collection="list" item="stand" separator=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
#{stand.stepId},
|
#{stand.stepName},
|
#{stand.ruleId},
|
#{stand.status},
|
#{stand.stepSerial},
|
#{stand.enableOrder},
|
#{stand.personType},
|
#{stand.approvalType},
|
#{stand.contentType},
|
#{stand.continueTime},
|
#{stand.continueTimeUnit},
|
#{stand.preStepId},
|
#{stand.nextStepId},
|
#{stand.gmtCreate},
|
#{stand.gmtModified},
|
#{stand.createUid},
|
#{stand.createUname},
|
#{stand.modifiedUid},
|
#{stand.modifiedUname},
|
#{stand.auditType}
|
</trim>
|
</foreach>
|
</insert>
|
</mapper>
|