Pu Zhibing
2 天以前 949bf4798368d0fce115993427e03758d4b3c897
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TSiteMapper.xml
@@ -47,8 +47,8 @@
        </where>
        order by o.id desc
    </select>
    <select id="query" resultType="TSite">
        select
        id as id,
@@ -88,4 +88,28 @@
            </otherwise>
        </choose>
    </select>
    <select id="getCompanySiteList" resultType="java.util.Map">
        SELECT * FROM (SELECT uu.`name` as insertUser,IFNULL(ls.num,0) as lineNum,ss.* FROM t_site as ss
        RIGHT JOIN (select * from sys_user  where id=#{id}) as uu on uu.id = ss.insertUserId
        LEFT JOIN (SELECT COUNT(a.id) as num,siteId FROM t_line_site a left join t_line b on (a.lineId = b.id) where b.state != 3 GROUP BY a.siteId) as ls on ls.siteId = ss.id) as o
        <where>
            o.state != 3
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
                AND (o.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
            </if>
            <if test="name != null and name != ''">
                and o.name LIKE CONCAT('%',#{name},'%')
            </if>
            <if test="insertUser != null and insertUser != ''">
                and o.insertUser LIKE CONCAT('%',#{insertUser},'%')
            </if>
            <if test="city != null and city != ''">
                and (o.province LIKE CONCAT('%',#{city},'%') or o.city LIKE CONCAT('%',#{city},'%') or o.district LIKE CONCAT('%',#{city},'%'))
            </if>
            <if test="state != null and state != ''">
                and o.state = #{state}
            </if>
        </where>
        order by o.id desc
    </select>
</mapper>