cqdevicemgt/sgzb-modules/sgzb-material/src/main/resources/mapper/app/BmFlowRelationMapper.xml

328 lines
12 KiB
XML
Raw Normal View History

2024-08-08 14:57:05 +08:00
<?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.bonus.sgzb.app.mapper.BmFlowRelationMapper">
<resultMap id="BaseResultMap" type="com.bonus.sgzb.base.api.domain.BmFlowRelation">
<!--@Table bm_flow_relation-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="flow_id" jdbcType="INTEGER" property="flowId" />
<result column="company_id" jdbcType="INTEGER" property="companyId" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="order" jdbcType="INTEGER" property="order" />
<result column="task_type" jdbcType="INTEGER" property="taskType" />
<result column="task_status" jdbcType="VARCHAR" property="taskStatus" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, flow_id, company_id, `status`, `order`, task_type, task_status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from bm_flow_relation
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAllByPrimaryKeys" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from bm_flow_relation
<where>
`status` = '1'
<if test="flowId != null">
and flow_id = #{flowId,jdbcType=INTEGER}
</if>
<if test="companyId != null">
and company_id = #{companyId,jdbcType=INTEGER}
</if>
<if test="taskType != null and taskType != ''">
and task_type = #{taskType,jdbcType=VARCHAR}
</if>
</where>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from bm_flow_relation
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.base.api.domain.BmFlowRelation" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into bm_flow_relation (flow_id, company_id, `status`,
`order`, task_type)
values (#{flowId,jdbcType=INTEGER}, #{companyId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{order,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.base.api.domain.BmFlowRelation" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into bm_flow_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="flowId != null">
flow_id,
</if>
<if test="companyId != null and companyId != ''">
company_id,
</if>
<if test="status != null and status != ''">
`status`,
</if>
<if test="order != null and order != ''">
`order`,
</if>
<if test="taskType != null and taskType != ''">
task_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="flowId != null">
#{flowId,jdbcType=INTEGER},
</if>
<if test="companyId != null and companyId != ''">
#{companyId,jdbcType=VARCHAR},
</if>
<if test="status != null and status != ''">
#{status,jdbcType=VARCHAR},
</if>
<if test="order != null and order != ''">
#{order,jdbcType=VARCHAR},
</if>
<if test="taskType != null and taskType != ''">
#{taskType,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.sgzb.base.api.domain.BmFlowRelation">
<!--@mbg.generated-->
update bm_flow_relation
<set>
<if test="flowId != null">
flow_id = #{flowId,jdbcType=INTEGER},
</if>
<if test="companyId != null and companyId != ''">
company_id = #{companyId,jdbcType=VARCHAR},
</if>
<if test="status != null and status != ''">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="order != null and order != ''">
`order` = #{order,jdbcType=VARCHAR},
</if>
<if test="taskType != null and taskType != ''">
task_type = #{taskType,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bonus.sgzb.base.api.domain.BmFlowRelation">
<!--@mbg.generated-->
update bm_flow_relation
set flow_id = #{flowId,jdbcType=INTEGER},
company_id = #{companyId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
`order` = #{order,jdbcType=VARCHAR},
task_type = #{taskType,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update bm_flow_relation
<trim prefix="set" suffixOverrides=",">
<trim prefix="flow_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.flowId,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="company_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.companyId,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="`order` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.order,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="task_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.taskType,jdbcType=VARCHAR}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update bm_flow_relation
<trim prefix="set" suffixOverrides=",">
<trim prefix="flow_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.flowId != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.flowId,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="company_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.companyId != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.companyId,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.status != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="`order` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.order != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.order,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="task_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.taskType != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.taskType,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
insert into bm_flow_relation
(flow_id, company_id, `status`, `order`, task_type)
values
<foreach collection="list" item="item" separator=",">
(#{item.flowId,jdbcType=INTEGER}, #{item.companyId,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR},
#{item.order,jdbcType=VARCHAR}, #{item.taskType,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.base.api.domain.BmFlowRelation" useGeneratedKeys="true">
insert into bm_flow_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
flow_id,
company_id,
`status`,
`order`,
task_type,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{flowId,jdbcType=INTEGER},
#{companyId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR},
#{order,jdbcType=VARCHAR},
#{taskType,jdbcType=VARCHAR},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
flow_id = #{flowId,jdbcType=INTEGER},
company_id = #{companyId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
`order` = #{order,jdbcType=VARCHAR},
task_type = #{taskType,jdbcType=VARCHAR},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.base.api.domain.BmFlowRelation" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into bm_flow_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="flowId != null">
flow_id,
</if>
<if test="companyId != null and companyId != ''">
company_id,
</if>
<if test="status != null and status != ''">
`status`,
</if>
<if test="order != null and order != ''">
`order`,
</if>
<if test="taskType != null and taskType != ''">
task_type,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="flowId != null">
#{flowId,jdbcType=INTEGER},
</if>
<if test="companyId != null and companyId != ''">
#{companyId,jdbcType=VARCHAR},
</if>
<if test="status != null and status != ''">
#{status,jdbcType=VARCHAR},
</if>
<if test="order != null and order != ''">
#{order,jdbcType=VARCHAR},
</if>
<if test="taskType != null and taskType != ''">
#{taskType,jdbcType=VARCHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
<if test="flowId != null">
flow_id = #{flowId,jdbcType=INTEGER},
</if>
<if test="companyId != null and companyId != ''">
company_id = #{companyId,jdbcType=VARCHAR},
</if>
<if test="status != null and status != ''">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="order != null and order != ''">
`order` = #{order,jdbcType=VARCHAR},
</if>
<if test="taskType != null and taskType != ''">
task_type = #{taskType,jdbcType=VARCHAR},
</if>
</trim>
</insert>
</mapper>