wl_management/src/main/resources/mapper/flow/FlowChartRoleMapper.xml

88 lines
3.1 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.FlowChartRoleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.flow.entity.FlowChartRole">
<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="chart_id" property="chartId"/>
<result column="role_id" property="roleId"/>
<result column="type" property="type"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, chart_id AS chartId, role_id AS roleId, type AS type
</sql>
<select id="selectFlowChartRoleById" resultType="FlowChartRole" >
select * from lz_flow_chart_role where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertFlowChartRole" parameterType="FlowChartRole" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow_chart_role(
<if test="chartId != null">chart_id, </if>
<if test="roleId != null">role_id, </if>
<if test="type != null">type, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="chartId != null">#{ chartId}, </if>
<if test="roleId != null">#{ roleId}, </if>
<if test="type != null">#{ type}, </if>
0,
now(),
now()
)
</insert>
<update id="updateFlowChartRoleById" parameterType="FlowChartRole" >
update
lz_flow_chart_role
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="chartId != null">chart_id = #{chartId},</if>
<if test="roleId != null">role_id = #{roleId},</if>
<if test="type != null">type = #{type}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverFlowChartRoleById" parameterType="FlowChartRole" >
update
lz_flow_chart_role
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
chart_id = #{chartId},
role_id = #{roleId},
type = #{type}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteFlowChartRoleById" parameterType="java.lang.Long">
update lz_flow_chart_role set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectFlowChartRolesByChartIdAndType" resultType="FlowChartRole" >
select * from lz_flow_chart_role where chart_id=#{id} and is_delete = 0 and type = #{type}
</select>
</mapper>