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
<?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.system.dao.MyDoctorMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.sinata.shop.modular.system.model.MyDoctor">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="avatar" property="avatar" />
        <result column="phone" property="phone" />
        <result column="sex" property="sex" />
        <result column="join_time" property="joinTime" />
        <result column="city_id" property="cityId" />
        <result column="technique" property="technique" />
        <result column="position" property="position" />
        <result column="remark" property="remark" />
        <result column="merchant_id" property="merchantId" />
        <result column="create_time" property="createTime" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, avatar, phone, sex, join_time, city_id, technique, position, remark, merchant_id, create_time
    </sql>
 
 
    <select id="queryMyDoctorList" resultType="com.sinata.shop.modular.system.model.MyDoctor">
        select *,TIMESTAMPDIFF(YEAR,work_time,NOW()) workTimeNum,
        (select GROUP_CONCAT(merchant_name) from mem_merchant where FIND_IN_SET(id,merchant_id))  merchantName
        ,(select CONCAT(province_name,city_name,county_name) from sys_area_city where id = city_id) cityName
        from my_doctor where is_delete = 0
        <if test="beginTime !=null and endTime !=null and beginTime !='' and endTime !=''">
            and   create_time > #{beginTime} and create_time &lt; #{endTime}
        </if>
        <if test="condition !=null and condition !=''">
            and  name like CONCAT('%',#{condition},'%')
        </if>
        <if test="cityId !=null">
            and  find_in_set( #{cityId},merchant_id)
        </if>
        <if test="sex !=null">
            and  sex  = #{sex}
        </if>
        <if test="workTime !=null">
            and  TIMESTAMPDIFF(YEAR,work_time,NOW()) = #{workTime}
        </if>
        order by id desc
 
    </select>
 
</mapper>