wl_management/src/main/resources/mapper/flow/FlowStartMapper.xml
2020-10-25 22:21:22 +08:00

106 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.FlowStartMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.flow.entity.FlowStart">
<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="cycle_type" property="cycleType"/>
<result column="start_time" property="startTime"/>
<result column="end_time" property="endTime"/>
<result column="group_ids" property="groupIds"/>
<result column="name" property="name"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, cycle_type AS cycleType, start_time AS startTime, end_time AS endTime, group_ids AS groupIds, name AS name
</sql>
<select id="selectFlowStartById" resultType="FlowStart" >
select * from lz_flow_start where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertFlowStart" parameterType="FlowStart" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow_start(
<if test="cycleType != null">cycle_type, </if>
<if test="startTime != null">start_time, </if>
<if test="endTime != null">end_time, </if>
<if test="groupIds != null">group_ids, </if>
<if test="name != null">name, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="cycleType != null">#{ cycleType}, </if>
<if test="startTime != null">#{ startTime}, </if>
<if test="endTime != null">#{ endTime}, </if>
<if test="groupIds != null">#{ groupIds}, </if>
<if test="name != null">#{ name}, </if>
0,
now(),
now()
)
</insert>
<update id="updateFlowStartById" parameterType="FlowStart" >
update
lz_flow_start
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="cycleType != null">cycle_type = #{cycleType},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="groupIds != null">group_ids = #{groupIds},</if>
<if test="name != null">name = #{name}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverFlowStartById" parameterType="FlowStart" >
update
lz_flow_start
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
cycle_type = #{cycleType},
start_time = #{startTime},
end_time = #{endTime},
group_ids = #{groupIds},
name = #{name}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteFlowStartById" parameterType="java.lang.Long">
update lz_flow_start set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectListByTime" resultType="com.lz.modules.flow.entity.FlowStart">
select * from lz_flow_start where is_delete = 0
<if test="cycleType != null">
AND cycle_type = #{cycleType}
</if>
<if test="name !=null and name !=''">
and name LIKE CONCAT('%',#{name},'%')
</if>
</select>
<select id="selectFlowStartByName" resultType="FlowStart" >
select * from lz_flow_start where name=#{name} and is_delete = 0 limit 1
</select>
</mapper>