mitao
2024-04-30 ab4ea7b8f10c9b66aed9c2ea161a08b25c3851a7
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
<?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.sinata.shop.modular.mall.dao.MemMerchantMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.sinata.shop.modular.mall.model.MemMerchant">
        <id column="id" property="id" />
        <result column="create_time" property="createTime" />
        <result column="merchant_name" property="merchantName" />
        <result column="linkman" property="linkman" />
        <result column="link_phone" property="linkPhone" />
        <result column="user_id" property="userId" />
        <result column="business_license" property="businessLicense" />
        <result column="other_details" property="otherDetails" />
        <result column="apply_des" property="applyDes" />
        <result column="state" property="state" />
        <result column="audit_state" property="auditState" />
        <result column="audit_time" property="auditTime" />
        <result column="audit_mark" property="auditMark" />
        <result column="is_delete" property="isDelete" />
        <result column="grade_id" property="gradeId" />
        <result column="logo" property="logo" />
        <result column="im_account" property="imAccount" />
        <result column="im_password" property="imPassword" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, create_time, merchant_name, linkman, link_phone, user_id, business_license, other_details, apply_des, state, audit_state, audit_time, audit_mark, is_delete, grade_id, logo, im_account, im_password
    </sql>
 
 
    <select id="queryMerchantList" resultType="com.sinata.shop.modular.mall.model.MemMerchant">
        SELECT
        * ,(select GROUP_CONCAT(name) from my_store_service where FIND_IN_SET(id,mem_merchant.service_ids)) serviceName
        ,(select CONCAT(province_name,city_name,county_name) from sys_area_city where id = mem_merchant.city_id) cityName
        ,( SELECT  count(DISTINCT goods_id) FROM `mall_goods_sku`  WHERE merchant_id = mem_merchant.id  )number
        FROM
        mem_merchant
        where  is_delete = 0
        <if test="merchantName !=null and merchantName !=''">
            and  merchant_name like CONCAT('%',#{merchantName},'%')
        </if>
        <if test="level !=null">
            and  city_id  = #{level}
        </if>
        <if test="beginTime !=null and endTime !=null and beginTime !='' and endTime !=''">
            and   start_time > #{beginTime} and start_time &lt; #{endTime}
        </if>
 
        ORDER BY id desc
    </select>
</mapper>