2020-10-26 16:01:20 +08:00

108 lines
3.9 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.FlowMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.flow.entity.Flow">
<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="flow_id" property="flowId"/>
<result column="opt" property="opt"/>
<result column="opt_desc" property="optDesc"/>
<result column="role_id" property="roleId"/>
<result column="chart_id" property="chartId"/>
<result column="weight" property="weight"/>
<result column="start_id" property="startId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, flow_id AS flowId, opt AS opt, opt_desc AS optDesc, role_id AS roleId, chart_id AS chartId, weight AS weight, start_id AS startId
</sql>
<select id="selectFlowById" resultType="Flow" >
select * from lz_flow where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertFlow" parameterType="Flow" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow(
<if test="flowId != null">flow_id, </if>
<if test="opt != null">opt, </if>
<if test="optDesc != null">opt_desc, </if>
<if test="roleId != null">role_id, </if>
<if test="chartId != null">chart_id, </if>
<if test="weight != null">weight, </if>
<if test="startId != null">start_id, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="flowId != null">#{ flowId}, </if>
<if test="opt != null">#{ opt}, </if>
<if test="optDesc != null">#{ optDesc}, </if>
<if test="roleId != null">#{ roleId}, </if>
<if test="chartId != null">#{ chartId}, </if>
<if test="weight != null">#{ weight}, </if>
<if test="startId != null">#{ startId}, </if>
0,
now(),
now()
)
</insert>
<update id="updateFlowById" parameterType="Flow" >
update
lz_flow
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="flowId != null">flow_id = #{flowId},</if>
<if test="opt != null">opt = #{opt},</if>
<if test="optDesc != null">opt_desc = #{optDesc},</if>
<if test="roleId != null">role_id = #{roleId},</if>
<if test="chartId != null">chart_id = #{chartId},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="startId != null">start_id = #{startId}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverFlowById" parameterType="Flow" >
update
lz_flow
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
flow_id = #{flowId},
opt = #{opt},
opt_desc = #{optDesc},
role_id = #{roleId},
chart_id = #{chartId},
weight = #{weight},
start_id = #{startId}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteFlowById" parameterType="java.lang.Long">
update lz_flow set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectByFlowId" resultType="com.lz.modules.flow.entity.Flow">
select * from lz_flow where flow_id = #{flowId} and is_delete = 0 and start_id = #{startId}
</select>
</mapper>