| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 | <?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.SectionDao">    <select id="getAllList" resultType="com.welampiot.dto.SectionDTO">        select id,name from section    </select>    <select id="getListByPid" parameterType="java.lang.Integer" resultType="com.welampiot.dto.SectionDTO">        select id,name from section        where pid = #{pid,jdbcType=INTEGER}    </select>    <select id="getListByPidList" parameterType="java.util.List" resultType="com.welampiot.dto.SectionDTO">        select id,name from section        where pid in        <foreach item="item" collection="pidList" open="(" separator="," close=")">            #{item}        </foreach>    </select>    <select id="getListByIdList" parameterType="java.util.List" resultType="com.welampiot.dto.SectionDTO">        select id,name,pid,lampcount as lampCount,lamp_pole_count as lampPoleCount from section        <if test="idList != null and !idList.isEmpty()">            where id in            <foreach item="item" collection="idList" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <select id="getOneById" parameterType="int" resultType="com.welampiot.dto.SectionDTO">        select id,name,pid from section where id = #{id}    </select>    <select id="getPidBySectionList" resultType="sectionDTO">        SELECT DISTINCT s.pid        FROM section s        <if test="sectionList != null and !sectionList.isEmpty()">            WHERE s.id IN            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <select id="getListByVO" parameterType="com.welampiot.vo.SectionVO" resultType="com.welampiot.dto.SectionDTO">        select a.id,a.name,a.pid        <choose>            <when test="version == 1">                ,b.english_name as area            </when>            <when test="version == 2">                ,b.ru_name as area            </when>            <otherwise>                ,b.chinese_name as area            </otherwise>        </choose>        from section a        left join global_location as b on b.id = a.pid        <if test="idList != null and !idList.isEmpty()">            where a.id in            <foreach item="item" collection="idList" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <select id="getSectionListByDTO" resultType="sectionDTO">        SELECT s.id,s.`name`        FROM section s        WHERE s.pid = #{pid}        <if test="sectionList != null and !sectionList.isEmpty()">            AND s.id IN            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <insert id="addSectionData" parameterType="SectionDTO" keyProperty="id" useGeneratedKeys="true">        insert into section(pid,`name`,createtime,timezone)        values (#{pid},#{name},#{createTime},#{timezone})    </insert>    <select id="checkNameRepeated" resultType="Integer">        select            count(*)        from section s        where s.pid = #{pid} and s.name = #{name}        <if test="id != null and id != 0">            and s.id != #{id}        </if>    </select>    <update id="updateSectionData" parameterType="SectionDTO">        update section s        set            s.name = #{name}        where s.id = #{id}    </update>    <select id="getSectionPidById" resultType="Integer">        select s.pid        from section s        where s.id = #{id}    </select>    <delete id="deleteSectionDataById">        delete        from section        where id = #{id};    </delete>    <select id="getAllSectionList" resultType="SectionDTO">        SELECT s.id,s.name,s.pid        FROM section s    </select>    <select id="getAllSectionListByPid" resultType="SectionDTO">        select s.id,s.name,s.pid        from section s        left join global_location a on s.pid = a.id        left join global_location c on a.pid = c.id        left join global_location p on c.pid = p.id        left join global_location g on p.pid = g.id        where g.id = #{id}    </select></mapper>
 |