228 lines
8.4 KiB
XML
228 lines
8.4 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.bonus.base.mapper.TbDeviceMapper">
|
||
|
|
<resultMap id="BaseResultMap" type="com.bonus.base.domain.TbDevice">
|
||
|
|
<!--@mbg.generated-->
|
||
|
|
<!--@Table tb_device-->
|
||
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||
|
|
<result column="dev_type" jdbcType="VARCHAR" property="devType" />
|
||
|
|
<result column="dev_code" jdbcType="VARCHAR" property="devCode" />
|
||
|
|
<result column="dev_name" jdbcType="VARCHAR" property="devName" />
|
||
|
|
<result column="bd_id" jdbcType="BIGINT" property="bdId" />
|
||
|
|
<result column="config_id" jdbcType="BIGINT" property="configId" />
|
||
|
|
<result column="dev_status" jdbcType="INTEGER" property="devStatus" />
|
||
|
|
<result column="dev_warn" jdbcType="INTEGER" property="devWarn" />
|
||
|
|
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
|
||
|
|
<result column="logo_url" jdbcType="VARCHAR" property="logoUrl" />
|
||
|
|
</resultMap>
|
||
|
|
<sql id="Base_Column_List">
|
||
|
|
<!--@mbg.generated-->
|
||
|
|
id, dev_type, dev_code, dev_name, bd_id, config_id, dev_status, dev_warn, del_flag,
|
||
|
|
logo_url
|
||
|
|
</sql>
|
||
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||
|
|
<!--@mbg.generated-->
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List" />
|
||
|
|
from tb_device
|
||
|
|
where id = #{id,jdbcType=BIGINT}
|
||
|
|
</select>
|
||
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||
|
|
update tb_device set del_flag = 1
|
||
|
|
where id = #{id,jdbcType=BIGINT}
|
||
|
|
</delete>
|
||
|
|
<insert id="insert" parameterType="com.bonus.base.domain.TbDevice">
|
||
|
|
<!--@mbg.generated-->
|
||
|
|
insert into tb_device (id, dev_type, dev_code,
|
||
|
|
dev_name, bd_id, config_id,
|
||
|
|
dev_status, dev_warn, del_flag,
|
||
|
|
logo_url)
|
||
|
|
values (#{id,jdbcType=BIGINT}, #{devType,jdbcType=VARCHAR}, #{devCode,jdbcType=VARCHAR},
|
||
|
|
#{devName,jdbcType=VARCHAR}, #{bdId,jdbcType=BIGINT}, #{configId,jdbcType=BIGINT},
|
||
|
|
#{devStatus,jdbcType=INTEGER}, #{devWarn,jdbcType=INTEGER}, #{delFlag,jdbcType=INTEGER},
|
||
|
|
#{logoUrl,jdbcType=VARCHAR})
|
||
|
|
</insert>
|
||
|
|
<insert id="insertSelective" parameterType="com.bonus.base.domain.TbDevice">
|
||
|
|
<!--@mbg.generated-->
|
||
|
|
insert into tb_device
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="id != null">
|
||
|
|
id,
|
||
|
|
</if>
|
||
|
|
<if test="devType != null and devType != ''">
|
||
|
|
dev_type,
|
||
|
|
</if>
|
||
|
|
<if test="devCode != null and devCode != ''">
|
||
|
|
dev_code,
|
||
|
|
</if>
|
||
|
|
<if test="devName != null and devName != ''">
|
||
|
|
dev_name,
|
||
|
|
</if>
|
||
|
|
<if test="bdId != null">
|
||
|
|
bd_id,
|
||
|
|
</if>
|
||
|
|
<if test="configId != null">
|
||
|
|
config_id,
|
||
|
|
</if>
|
||
|
|
<if test="devStatus != null">
|
||
|
|
dev_status,
|
||
|
|
</if>
|
||
|
|
<if test="devWarn != null">
|
||
|
|
dev_warn,
|
||
|
|
</if>
|
||
|
|
del_flag,
|
||
|
|
<if test="logoUrl != null and logoUrl != ''">
|
||
|
|
logo_url,
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="id != null">
|
||
|
|
#{id,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="devType != null and devType != ''">
|
||
|
|
#{devType,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="devCode != null and devCode != ''">
|
||
|
|
#{devCode,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="devName != null and devName != ''">
|
||
|
|
#{devName,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="bdId != null">
|
||
|
|
#{bdId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="configId != null">
|
||
|
|
#{configId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="devStatus != null">
|
||
|
|
#{devStatus,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="devWarn != null">
|
||
|
|
#{devWarn,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
0,
|
||
|
|
<if test="logoUrl != null and logoUrl != ''">
|
||
|
|
#{logoUrl,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.base.domain.TbDevice">
|
||
|
|
<!--@mbg.generated-->
|
||
|
|
update tb_device
|
||
|
|
<set>
|
||
|
|
<if test="devType != null and devType != ''">
|
||
|
|
dev_type = #{devType,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="devCode != null and devCode != ''">
|
||
|
|
dev_code = #{devCode,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="devName != null and devName != ''">
|
||
|
|
dev_name = #{devName,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="bdId != null">
|
||
|
|
bd_id = #{bdId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="configId != null">
|
||
|
|
config_id = #{configId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="devStatus != null">
|
||
|
|
dev_status = #{devStatus,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="devWarn != null">
|
||
|
|
dev_warn = #{devWarn,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="delFlag != null">
|
||
|
|
del_flag = #{delFlag,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="logoUrl != null and logoUrl != ''">
|
||
|
|
logo_url = #{logoUrl,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
</set>
|
||
|
|
where id = #{id,jdbcType=BIGINT}
|
||
|
|
</update>
|
||
|
|
<update id="updateByPrimaryKey" parameterType="com.bonus.base.domain.TbDevice">
|
||
|
|
<!--@mbg.generated-->
|
||
|
|
update tb_device
|
||
|
|
set dev_type = #{devType,jdbcType=VARCHAR},
|
||
|
|
dev_code = #{devCode,jdbcType=VARCHAR},
|
||
|
|
dev_name = #{devName,jdbcType=VARCHAR},
|
||
|
|
bd_id = #{bdId,jdbcType=BIGINT},
|
||
|
|
config_id = #{configId,jdbcType=BIGINT},
|
||
|
|
dev_status = #{devStatus,jdbcType=INTEGER},
|
||
|
|
dev_warn = #{devWarn,jdbcType=INTEGER},
|
||
|
|
del_flag = #{delFlag,jdbcType=INTEGER},
|
||
|
|
logo_url = #{logoUrl,jdbcType=VARCHAR}
|
||
|
|
where id = #{id,jdbcType=BIGINT}
|
||
|
|
</update>
|
||
|
|
<select id="getAll" resultMap="BaseResultMap">
|
||
|
|
<!--@mbg.generated-->
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from tb_device
|
||
|
|
where del_flag = 0
|
||
|
|
</select>
|
||
|
|
<select id="selectByDevCode" resultType="com.bonus.base.domain.TbDevice">
|
||
|
|
select * from tb_device where dev_code = #{devCode}
|
||
|
|
</select>
|
||
|
|
<update id="updateBatch" parameterType="java.util.List">
|
||
|
|
<!--@mbg.generated-->
|
||
|
|
update tb_device
|
||
|
|
<trim prefix="set" suffixOverrides=",">
|
||
|
|
<trim prefix="dev_type = case" suffix="end,">
|
||
|
|
<foreach collection="list" index="index" item="item">
|
||
|
|
when id = #{item.id,jdbcType=BIGINT} then #{item.devType,jdbcType=VARCHAR}
|
||
|
|
</foreach>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="dev_code = case" suffix="end,">
|
||
|
|
<foreach collection="list" index="index" item="item">
|
||
|
|
when id = #{item.id,jdbcType=BIGINT} then #{item.devCode,jdbcType=VARCHAR}
|
||
|
|
</foreach>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="dev_name = case" suffix="end,">
|
||
|
|
<foreach collection="list" index="index" item="item">
|
||
|
|
when id = #{item.id,jdbcType=BIGINT} then #{item.devName,jdbcType=VARCHAR}
|
||
|
|
</foreach>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="bd_id = case" suffix="end,">
|
||
|
|
<foreach collection="list" index="index" item="item">
|
||
|
|
when id = #{item.id,jdbcType=BIGINT} then #{item.bdId,jdbcType=BIGINT}
|
||
|
|
</foreach>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="config_id = case" suffix="end,">
|
||
|
|
<foreach collection="list" index="index" item="item">
|
||
|
|
when id = #{item.id,jdbcType=BIGINT} then #{item.configId,jdbcType=BIGINT}
|
||
|
|
</foreach>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="dev_status = case" suffix="end,">
|
||
|
|
<foreach collection="list" index="index" item="item">
|
||
|
|
when id = #{item.id,jdbcType=BIGINT} then #{item.devStatus,jdbcType=INTEGER}
|
||
|
|
</foreach>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="dev_warn = case" suffix="end,">
|
||
|
|
<foreach collection="list" index="index" item="item">
|
||
|
|
when id = #{item.id,jdbcType=BIGINT} then #{item.devWarn,jdbcType=INTEGER}
|
||
|
|
</foreach>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="del_flag = case" suffix="end,">
|
||
|
|
<foreach collection="list" index="index" item="item">
|
||
|
|
when id = #{item.id,jdbcType=BIGINT} then #{item.delFlag,jdbcType=INTEGER}
|
||
|
|
</foreach>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="logo_url = case" suffix="end,">
|
||
|
|
<foreach collection="list" index="index" item="item">
|
||
|
|
when id = #{item.id,jdbcType=BIGINT} then #{item.logoUrl,jdbcType=VARCHAR}
|
||
|
|
</foreach>
|
||
|
|
</trim>
|
||
|
|
</trim>
|
||
|
|
where id in
|
||
|
|
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||
|
|
#{item.id,jdbcType=BIGINT}
|
||
|
|
</foreach>
|
||
|
|
</update>
|
||
|
|
<delete id="deleteByPrimaryKeyIn">
|
||
|
|
delete from tb_device where id in
|
||
|
|
<foreach close=")" collection="list" item="id" open="(" separator=", ">
|
||
|
|
#{id,jdbcType=BIGINT}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
</mapper>
|