| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 | 
							- <?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.GroupDao">
 
-     <select id="getListBySection" parameterType="java.util.List" resultType="com.welampiot.dto.GroupDTO">
 
-         select id,name from `group`
 
-         <if test="sectionList != null and !sectionList.isEmpty()">
 
-             where sectionid in
 
-             <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
 
-                 #{vo}
 
-             </foreach>
 
-         </if>
 
-     </select>
 
-     <select id="getListByVO" parameterType="com.welampiot.vo.GroupVO" resultType="com.welampiot.dto.GroupDTO">
 
-         select g.id,g.name,g.number,g.sectionid as sectionId,g.areaid as areaId,g.type,g.value,g.lampid as lampId,
 
-         (select count(id) from lampinfo where find_in_set(id,g.lampid)) as lampCount,g.onLight,g.offLight,g.day_or_night,g.patrolinterval as patrolInterval,g.devType,s.name as section,p.name as policy,
 
-         <choose>
 
-             <when test="version == 1">
 
-                 gl.english_name as area
 
-             </when>
 
-             <when test="version == 2">
 
-                 gl.ru_name as area
 
-             </when>
 
-             <otherwise>
 
-                 gl.chinese_name as area
 
-             </otherwise>
 
-         </choose>
 
-         from `group` as g
 
-         left join section s on g.sectionid = s.id
 
-         left join global_location gl on gl.id = s.pid
 
-         left join policy p on g.value = p.id
 
-         where 1=1
 
-         <if test="sectionList != null and !sectionList.isEmpty()">
 
-             and g.sectionid in
 
-             <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
 
-                 #{vo}
 
-             </foreach>
 
-         </if>
 
-         <if test="devType != null">
 
-             and g.devType = #{devType}
 
-         </if>
 
-         <if test="keyword != null">
 
-             and g.name like '%#{keyword}%'
 
-         </if>
 
-         order by g.name asc
 
-         <if test="offset != null and limit != null">
 
-             limit #{offset},#{limit}
 
-         </if>
 
-     </select>
 
-     <select id="getCountByVO" parameterType="com.welampiot.dto.GroupDTO" resultType="Integer">
 
-         select count(*)
 
-         from `group` as g
 
-         where 1=1
 
-         <if test="sectionList != null and !sectionList.isEmpty()">
 
-             and g.sectionid in
 
-             <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
 
-                 #{vo}
 
-             </foreach>
 
-         </if>
 
-         <if test="devType != null">
 
-             and g.devType = #{devType}
 
-         </if>
 
-         <if test="keyword != null">
 
-             and g.name like '%#{keyword}%'
 
-         </if>
 
-     </select>
 
-     <select id="getDetailByVO" parameterType="com.welampiot.vo.GroupVO" resultType="com.welampiot.dto.GroupDTO">
 
-         select
 
-         g.name,g.number,g.id,g.areaid as areaId,g.sectionid as sectionId,(select count(id) from lampinfo where find_in_set(id,g.lampid)) as lampCount,g.type,g.value,s.name as section,g.lampid as lampId,
 
-         <choose>
 
-             <when test="version == 1">
 
-                 gl.english_name as area
 
-             </when>
 
-             <when test="version == 2">
 
-                 gl.ru_name as area
 
-             </when>
 
-             <otherwise>
 
-                 gl.chinese_name as area
 
-             </otherwise>
 
-         </choose>
 
-         from `group` as g
 
-         left join section s on g.sectionid = s.id
 
-         left join global_location gl on gl.id = s.pid
 
-         where g.id=#{id}
 
-         <if test="sectionList != null and !sectionList.isEmpty()">
 
-             and g.sectionid in
 
-             <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
 
-                 #{vo}
 
-             </foreach>
 
-         </if>
 
-         limit 1
 
-     </select>
 
-     <insert id="add" parameterType="com.welampiot.dto.GroupDTO" useGeneratedKeys="true" keyProperty="id"
 
-     >
 
-         insert into `group` (name,number,lampid,areaid,sectionid,lampcount,createtime,devType,updatetime
 
-         )
 
-         values
 
-         (#{name},#{number},#{lampId},#{areaId},#{sectionId},#{lampCount},#{createTime},#{devType},#{updateTime}
 
-         )
 
-     </insert>
 
-     <select id="checkData" resultType="Integer" parameterType="com.welampiot.dto.GroupDTO">
 
-         select count(id) from `group`
 
-         where 1=1
 
-         <if test="sectionId != null">
 
-             and sectionid = #{sectionId}
 
-         </if>
 
-         <if test="name != null">
 
-             and name = #{name}
 
-         </if>
 
-         <if test="number != null">
 
-             and number = #{number}
 
-         </if>
 
-         <if test="id != null">
 
-             and id != #{id}
 
-         </if>
 
-     </select>
 
-     <update id="update" parameterType="com.welampiot.dto.GroupDTO" useGeneratedKeys="true" keyProperty="id"
 
-     >
 
-         update `group` set
 
-         name = #{name},
 
-         number = #{number},
 
-         lampid = #{lampId},
 
-         areaid = #{areaId},
 
-         sectionid = #{sectionId},
 
-         lampcount = #{lampCount},
 
-         devType = #{devType},
 
-         updatetime = #{updateTime}
 
-         where id = #{id}
 
-     </update>
 
-     <delete id="deleteById">
 
-         delete from `group` where id=#{id};
 
-     </delete>
 
-     
 
-     <select id="getGroupListByDTO" resultType="GroupDTO">
 
-         select g.name,g.id,g.value,g.type,g.offLight,g.onLight,g.updatetime as updateTime,g.lampcount as lampCount,g.color_temp as colarTemp,s.timezone
 
-         from `group` g
 
-         left join section s on g.sectionid = s.id
 
-         where 1=1
 
-         <if test="keyword != null and keyword != ''">
 
-             and g.name like '%${keyword}%'
 
-         </if>
 
-         <if test="sectionList != null and !sectionList.isEmpty()">
 
-             and g.sectionid in
 
-             <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
 
-                 #{dto}
 
-             </foreach>
 
-         </if>
 
-         <choose>
 
-             <when test="devType == 0">
 
-                 and g.devType = 0
 
-             </when>
 
-             <when test="devType == 1">
 
-                 and g.devType = 1
 
-             </when>
 
-         </choose>
 
-     </select>
 
-     <select id="findPolicyNameByValue" resultType="String">
 
-         select p.name
 
-         from policy p
 
-         where p.id = #{id}
 
-     </select>
 
-     <select id="getGroupTotalByDTO" resultType="Integer">
 
-         select count(g.id)
 
-         from `group` g
 
-         where 1=1
 
-         <if test="sectionList != null and !sectionList.isEmpty()">
 
-             and g.sectionid in
 
-             <foreach collection="sectionList" item="item" open="(" separator="," close=")">
 
-                 #{item}
 
-             </foreach>
 
-         </if>
 
-         <if test="areaId != null and areaId != 0">
 
-             and g.areaid = #{areaId}
 
-         </if>
 
-     </select>
 
-     <select id="getGroupDTOById" resultType="GroupDTO">
 
-         select
 
-             g.id,
 
-             g.lampid as lampId,
 
-             g.devType,
 
-             g.patrolinterval as patrolInterval,
 
-             g.type,
 
-             g.value
 
-         from `group` g
 
-         where g.id = #{id}
 
-     </select>
 
-     <update id="updateGroupLampId" parameterType="GroupDTO">
 
-         update
 
-             `group` g
 
-         set
 
-             g.lampid = #{lampId}
 
-         where
 
-             g.id = #{id}
 
-     </update>
 
-     <select id="getListByIds" resultType="GroupDTO">
 
-         select id,lampid,number from `group`
 
-         <trim prefix="where" suffixOverrides="and|or">
 
-             <if test="ids !=null">
 
-                 id in
 
-                 <foreach collection="ids" open="(" close=")" item="id" separator=",">
 
-                     #{id}
 
-                 </foreach>
 
-             </if>
 
-         </trim>
 
-     </select>
 
- </mapper>
 
 
  |