puzhibing
2023-08-04 c5cb162b5cbdb589e97290fba3ac3e9241ec48d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?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.dsh.course.mapper.StoreMapper">
 
    <select id="listAll" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
        select t1.*,t2.name userName,t2.phone userPhone from t_store t1 left join sys_user t2 on t1.storeStaffId = t2.id
        where 1=1
        <if test="provinceCode !=null and provinceCode !=''">
            and t1.provinceCode = #{provinceCode}
        </if>
        <if test="cityCode !=null and cityCode !=''">
            and t1.cityCode = #{cityCode}
        </if>
        <if test="name !=null and name !=''">
            and t2.name like concat("%",#{name},"%")
        </if>
        <if test="phone !=null and phone !=''">
            and t2.phone like concat("%",#{phone},"%")
        </if>
        <if test="shopName !=null and shopName !=''">
            and t1.name like concat("%",#{shopName},"%")
        </if>
    </select>
    <select id="queryProvince" resultType="map">
        select * from (
        select provinceCode as code, province as name from t_store where state = 1
         <if test="null != cityCode and '' != cityCode">
             and cityCode = #{cityCode}
         </if>
         group by provinceCode
        ) as aa order by aa.code
    </select>
 
 
    <select id="queryCity" resultType="map">
        select * from (
        select cityCode as code, city as name from t_store where state = 1 and provinceCode = #{provinceCode}
        <if test="null != cityCode and '' != cityCode">
            and cityCode = #{cityCode}
        </if>
        group by cityCode
        ) as aa order by aa.code
    </select>
    <select id="queryListOfpage" resultType="java.util.Map">
        SELECT id, cityManagerId, province, city, `name`
        from t_store
        where 1=1
        <if test="provinceCode != null">
            and provinceCode = #{provinceCode}
        </if>
        <if test="cityCode != null">
            and cityCode = #{cityCode}
        </if>
        <if test="cityManagerId != null">
            and cityManagerId = #{cityManagerId}
        </if>
        <if test="storeName != null and storeName != ' '">
            and `name` like CONCAT('%',#{storeName},'%')
        </if>
    </select>
</mapper>