| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 | <?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.LightStripGroupDao">        <select id="getLightStripGroupByDTO" resultType="LightStripGroupDTO">        select            <choose>                <when test="version == 0">                    gl.chinese_name as area,                </when>                <when test="version == 1">                    gl.english_name as area,                </when>                <otherwise>                    gl.ru_name as area,                </otherwise>            </choose>            l.id,l.name,l.number,l.lightcount as lightCount,l.type,l.value,s.name as section,lsp.name as policyName,lsp.id as policyId        from light_strip_group l left join lamp_pole lp on l.sectionid = lp.sectionid                                 left join light_strip_dev lsd on lp.id = lsd.lamp_pole_id                                 left join light_strip_policy lsp on lsd.policyid = lsp.id                                 left join section s on lp.sectionid = s.id                                 left join global_location gl on s.pid = gl.id        where 1=1            <if test="sectionList != null and !sectionList.isEmpty()">                and lp.sectionid in                <foreach collection="sectionList" item="dto" open="(" separator="," close=")">                    #{dto}                </foreach>            </if>            <if test="areaId != null and areaId != 0">                and l.areaid = #{areaId}            </if>            <if test="sectionId != null and sectionId != 0">                and l.sectionid = #{sectionId}            </if>            <if test="keyword != null and keyword != ''">                and (l.number like '%${keyword}%' or l.name like '%${keyword}%')            </if>            order by convert(l.name using gbk) desc,l.number asc            <if test="page >= 0 and count > 0">                limit #{page},#{count}            </if>    </select>    <select id="getLightStripPolicyData" resultType="LightStripPolicyDTO">        select l.id,l.type        from light_strip_policy l        where l.id = #{policyId}    </select>        <select id="getLightStripGroupDetailsById" resultType="LightStripGroupDTO">        select            <choose>                <when test="version == 0">                    gl.chinese_name as area,                </when>                <when test="version == 1">                    gl.english_name as area,                </when>                <otherwise>                    gl.ru_name as area,                </otherwise>            </choose>            l.areaid as areaId,l.sectionid as sectionId,s.name as section,l.number,l.lightcount as lightCount,l.type,l.value        from light_strip_group l left join section s on l.sectionid = s.id                                 left join global_location gl on s.pid = gl.id        where l.id = #{id}    </select>    <select id="getLightStripPolicyName" resultType="String">        select l.name        from light_strip_policy l        where l.id = #{policyId}    </select>    <insert id="addLightStripGroupData" parameterType="LightStripGroupDTO" keyProperty="id" useGeneratedKeys="true">        insert into light_strip_group(areaid,sectionid,name,number,        <if test="lightStripIds != null and lightStripIds != ''">            light_strip_ids,        </if>        createtime,updatetime)        values (#{areaId},#{sectionId},#{name},#{number},                <if test="lightStripIds != null and lightStripIds != ''">                    #{lightStripIds},                </if>                #{createTime},#{updateTime})    </insert>    <select id="getLightStripGroupById" resultType="LightStripGroupDTO">        select l.id,l.type,l.value        from light_strip_group l        where l.id = #{id}    </select>    <update id="updateLightStripGroupData" parameterType="LightStripGroupDTO">        update            light_strip_group l        set            l.areaid = #{areaId},            l.sectionid = #{sectionId},            l.name = #{name},            <if test="lightStripIds != null and lightStripIds != ''">                l.light_strip_ids = #{lightStripIds},            </if>            l.number = #{number},            l.updatetime = #{updateTime}        where            l.id = #{id}    </update>    <select id="checkLightStripGroupData" resultType="Integer">        select            count(*)        from light_strip_group l        where 1=1        <if test="sectionId != null and sectionId != 0">            and l.sectionid= #{sectionId}        </if>        <if test="name != null and name != ''">            and l.name = #{name}        </if>        <if test="number != null and number != ''">            and l.number = #{number}        </if>        <if test="id != null and id != 0">            and l.id != #{id}        </if>    </select>    <delete id="deleteLightStripGroupDataByIds">        delete        from light_strip_group        where id in        <foreach collection="ids" item="item" open="(" separator="," close=")">            #{item}        </foreach>    </delete></mapper>
 |