123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?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.bz.smart_city.dao.DeviceCommandTaskMapper">
- <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.DeviceCommandTask">
- <!--@mbg.generated-->
- <!--@Table sc_device_command_task-->
- <id column="id" property="id" />
- <result column="device_command_id" property="deviceCommandId" />
- <result column="name" property="name" />
- <result column="status" property="status" />
- <result column="date_create" property="dateCreate" />
- <result column="date_update" property="dateUpdate" />
- <result column="create_by" property="createBy" />
- <result column="update_by" property="updateBy" />
- </resultMap>
- <sql id="Base_Column_List">
- <!--@mbg.generated-->
- id, device_command_id, `name`, `status`, date_create, date_update, create_by, update_by
- </sql>
- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bz.smart_city.entity.DeviceCommandTask" useGeneratedKeys="true">
- <!--@mbg.generated-->
- insert into sc_device_command_task
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="deviceCommandId != null">
- device_command_id,
- </if>
- <if test="name != null">
- `name`,
- </if>
- <if test="status != null">
- `status`,
- </if>
- <if test="dateCreate != null">
- date_create,
- </if>
- <if test="dateUpdate != null">
- date_update,
- </if>
- <if test="createBy != null">
- create_by,
- </if>
- <if test="updateBy != null">
- update_by,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="deviceCommandId != null">
- #{deviceCommandId},
- </if>
- <if test="name != null">
- #{name},
- </if>
- <if test="status != null">
- #{status},
- </if>
- <if test="dateCreate != null">
- #{dateCreate},
- </if>
- <if test="dateUpdate != null">
- #{dateUpdate},
- </if>
- <if test="createBy != null">
- #{createBy},
- </if>
- <if test="updateBy != null">
- #{updateBy},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.bz.smart_city.entity.DeviceCommandTask">
- <!--@mbg.generated-->
- update sc_device_command_task
- <set>
- <if test="deviceCommandId != null">
- device_command_id = #{deviceCommandId},
- </if>
- <if test="name != null">
- `name` = #{name},
- </if>
- <if test="status != null">
- `status` = #{status},
- </if>
- <if test="dateCreate != null">
- date_create = #{dateCreate},
- </if>
- <if test="dateUpdate != null">
- date_update = #{dateUpdate},
- </if>
- <if test="createBy != null">
- create_by = #{createBy},
- </if>
- <if test="updateBy != null">
- update_by = #{updateBy},
- </if>
- </set>
- where id = #{id}
- </update>
- <select id="getList" resultType="com.bz.smart_city.dto.DeviceCommandDto">
- select
- ct.name,c.
- *,
- sd.device_no,
- sdt.equipment_type,sdt.model,sdm.name manufacturer_name
- from sc_device_command_task ct
- left join sc_device_command c on(c.id = ct.device_command_id)
- left join sc_device sd on(sd.id = c.device_id)
- left join sc_device_type sdt on (sdt.id = sd.device_type)
- left join sc_device_manufacturer sdm on (sdm.id = sd.manufacturer_id)
- where ct.status = 1 and sd.status = 1
- <if test="siteId != null"> and c.site_id = #{siteId}</if>
- <if test="deviceNo != null and deviceNo != ''"> AND sd.device_no LIKE concat('%',#{deviceNo},'%')</if>
- <if test="name != null and name != ''"> AND ct.name LIKE concat('%',#{name},'%')</if>
- <if test="commandType != null"> and c.command_type = #{commandType}</if>
- <if test="commandStatus != null"> and c.command_status = #{commandStatus}</if>
- <if test="customerIds != null and customerIds.size() != 0">
- and sd.customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach>
- </if>
- order by ct.date_create desc
- </select>
- </mapper>
|