| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?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="cn.oleauto.config.mapper.ConfigDeviceMapper">
-
- <resultMap type="ConfigDevice" id="ConfigDeviceResult">
- <result property="id" column="id" />
- <result property="name" column="name" />
- <result property="configChannelId" column="config_channel_id" />
- <result property="ilk" column="ilk" />
- <result property="configDeviceId" column="config_device_id" />
- <result property="remark" column="remark" />
- <association property="configChannel" javaType="ConfigChannel" resultMap="ConfigChannelResult" />
- </resultMap>
- <resultMap type="ConfigChannel" id="ConfigChannelResult">
- <result property="id" column="config_channel_id" />
- <result property="name" column="config_channel_name" />
- </resultMap>
- <sql id="selectConfigDeviceVoGen">
- select id, name, config_channel_id, ilk, config_device_id, remark from config_device d
- </sql>
- <sql id="selectConfigDeviceVo">
- select d.id, d.name, d.config_channel_id, d.ilk, d.config_device_id, d.remark,
- c.name config_channel_name
- from config_device d
- LEFT JOIN config_channel c on d.config_channel_id = c.id
- </sql>
- <select id="selectConfigDeviceList" parameterType="ConfigDevice" resultMap="ConfigDeviceResult">
- <include refid="selectConfigDeviceVo"/>
- <where>
- <if test="name != null and name != ''"> and d.name like concat('%', #{name}, '%')</if>
- <if test="configChannelId != null "> and d.config_channel_id = #{configChannelId}</if>
- <if test="ilk != null and ilk != ''"> and d.ilk = #{ilk}</if>
- <if test="configDeviceId != null "> and d.config_device_id = #{configDeviceId}</if>
- </where>
- </select>
-
- <select id="selectConfigDeviceById" parameterType="Long" resultMap="ConfigDeviceResult">
- <include refid="selectConfigDeviceVo"/>
- where d.id = #{id}
- </select>
- <insert id="insertConfigDevice" parameterType="ConfigDevice" useGeneratedKeys="true" keyProperty="id">
- insert into config_device
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="name != null and name != ''">name,</if>
- <if test="configChannelId != null">config_channel_id,</if>
- <if test="ilk != null and ilk != ''">ilk,</if>
- <if test="configDeviceId != null">config_device_id,</if>
- <if test="remark != null and remark != ''">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="name != null and name != ''">#{name},</if>
- <if test="configChannelId != null">#{configChannelId},</if>
- <if test="ilk != null and ilk != ''">#{ilk},</if>
- <if test="configDeviceId != null">#{configDeviceId},</if>
- <if test="remark != null and remark != ''">#{remark},</if>
- </trim>
- </insert>
- <update id="updateConfigDevice" parameterType="ConfigDevice">
- update config_device
- <trim prefix="SET" suffixOverrides=",">
- <if test="name != null and name != ''">name = #{name},</if>
- <if test="configChannelId != null">config_channel_id = #{configChannelId},</if>
- <if test="ilk != null and ilk != ''">ilk = #{ilk},</if>
- <if test="configDeviceId != null">config_device_id = #{configDeviceId},</if>
- <if test="remark != null and remark != ''">remark = #{remark},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteConfigDeviceById" parameterType="Long">
- delete from config_device where id = #{id}
- </delete>
- <delete id="deleteConfigDeviceByIds" parameterType="String">
- delete from config_device where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|