wl_management/src/main/resources/mapper/flow/FlowApprovalRoleMapper.xml
2020-10-26 11:51:05 +08:00

133 lines
4.7 KiB
XML

<?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.lz.modules.flow.dao.FlowApprovalRoleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.flow.entity.FlowApprovalRole">
<id column="id" property="id"/>
<result column="is_delete" property="isDelete"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="approval_id" property="approvalId"/>
<result column="type" property="type"/>
<result column="role_id" property="roleId"/>
<result column="flow_id" property="flowId"/>
<result column="step_type" property="stepType"/>
<result column="step_index" property="stepIndex"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, approval_id AS approvalId, type AS type, role_id AS roleId, flow_id AS flowId, step_type AS stepType, step_index AS stepIndex
</sql>
<select id="selectFlowApprovalRoleById" resultType="FlowApprovalRole" >
select * from lz_flow_approval_role where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertFlowApprovalRole" parameterType="FlowApprovalRole" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow_approval_role(
<if test="approvalId != null">approval_id, </if>
<if test="type != null">type, </if>
<if test="roleId != null">role_id, </if>
<if test="flowId != null">flow_id, </if>
<if test="stepType != null">step_type, </if>
<if test="stepIndex != null">step_index, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="approvalId != null">#{ approvalId}, </if>
<if test="type != null">#{ type}, </if>
<if test="roleId != null">#{ roleId}, </if>
<if test="flowId != null">#{ flowId}, </if>
<if test="stepType != null">#{ stepType}, </if>
<if test="stepIndex != null">#{ stepIndex}, </if>
0,
now(),
now()
)
</insert>
<update id="updateFlowApprovalRoleById" parameterType="FlowApprovalRole" >
update
lz_flow_approval_role
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="approvalId != null">approval_id = #{approvalId},</if>
<if test="type != null">type = #{type},</if>
<if test="roleId != null">role_id = #{roleId},</if>
<if test="flowId != null">flow_id = #{flowId},</if>
<if test="stepType != null">step_type = #{stepType},</if>
<if test="stepIndex != null">step_index = #{stepIndex}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverFlowApprovalRoleById" parameterType="FlowApprovalRole" >
update
lz_flow_approval_role
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
approval_id = #{approvalId},
type = #{type},
role_id = #{roleId},
flow_id = #{flowId},
step_type = #{stepType},
step_index = #{stepIndex}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteFlowApprovalRoleById" parameterType="java.lang.Long">
update lz_flow_approval_role set is_delete = 1 where id=#{id} limit 1
</update>
<insert id="insertFlowApprovalRoles" parameterType="FlowApprovalRole" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow_approval_role(
approval_id,
type,
role_id,
flow_id,
step_type,
step_index,
is_delete
)values
<foreach collection="list" item="item" separator=",">(
#{ item.approvalId},
#{ item.type},
#{ item.roleId},
#{ item.flowId},
#{ item.stepType},
#{ item.stepIndex},
0
)
</foreach>
;
</insert>
<select id="selectFlowApprovalRoleList" resultType="com.lz.modules.flow.entity.FlowApprovalRole">
select * from lz_flow_approval_role where flow_id in
<foreach collection="flowIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by step_index asc
</select>
</mapper>