| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?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.welampiot.dao.ElectricModuleDao">
- <insert id="add" parameterType="com.welampiot.dto.ElectricModuleDTO" useGeneratedKeys="true" keyProperty="id"
- >
- insert into electric_module(type,address,box_id
- )
- values
- (#{type},#{address},#{boxId}
- )
- </insert>
- <update id="update" parameterType="com.welampiot.dto.ElectricModuleDTO"
- >
- update electric_module
- set
- type=#{type},
- address=#{address},
- box_id=#{boxId}
- where id = #{id}
- </update>
- <select id="getListByBoxId" resultType="com.welampiot.dto.ElectricModuleDTO" parameterType="int">
- select address,id,box_id as boxId,type from electric_module where box_id = #{boxId}
- </select>
- <select id="getDetailsById" resultType="com.welampiot.dto.ElectricModuleDTO" parameterType="int">
- select address,id,box_id as boxId,type from electric_module where id = #{id}
- </select>
- <delete id="deleteByBoxId" parameterType="int">
- delete from electric_module where box_id=#{boxId}
- </delete>
- <select id="getModuleAddressById" resultType="ElectricModuleDTO">
- select e.id,e.address
- from electric_module e
- where e.box_id = #{boxId} and e.type = 0
- </select>
- <select id="getAirSwitchAddressById" resultType="AirSwitchInfoDTO">
- select a.address
- from air_switch_info a
- where a.module_id = #{moduleId}
- </select>
- <update id="updateElectricBoxStatusById" parameterType="AirSwitchInfoDTO">
- update air_switch_info a
- set
- a.`status` = #{status}
- where a.module_id = #{moduleId}
- </update>
- <select id="getModuleAddressByAirIds" resultType="ElectricModuleDTO">
- SELECT (em.id) AS id,em.address
- FROM electric_module em
- LEFT JOIN air_switch_info a
- ON em.id = a.module_id
- <if test="airIds != null and !airIds.isEmpty()">
- WHERE a.id IN
- <foreach collection="airIds" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- GROUP BY id
- </select>
- </mapper>
|