1
phpcjl
2024-12-20 d51a8cfa10c34d9c1e7d6b4726d31e75ecee5dc6
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
<?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.ruoyi.other.mapper.TechnicianMapper">
    <select id="selectTechnicianListByShopId" resultType="com.ruoyi.other.vo.TechnicianVO">
        SELECT
            tt.id,
            tt.`name`,
            tt.introduction,
            tt.home_picture,
            COUNT(tts.id) AS serviceCount,
            AVG( IFNULL(ttsc.score,0) ) AS score
        FROM
            t_technician tt
                LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id and tts.`status` != 0
                LEFT JOIN t_technician_score ttsc ON ttsc.technician_id = tt.id
        WHERE
          tt.`status` = 2
          AND tt.del_flag = 0
          AND tt.shop_id = #{shopId}
        <if test="name != null and name != ''">
            AND tt.`name` LIKE concat('%', #{name}, '%')
        </if>
        GROUP BY
            tt.id,
            tt.`name`,
            tt.introduction,
            tt.home_picture
    </select>
    <select id="selectTechnicianDetail" resultType="com.ruoyi.other.vo.TechnicianDetailVO">
        SELECT
            tt.id,
            tt.subscribe_status,
            tt.`name`,
            tt.introduction,
            tt.home_picture,
            COUNT(DISTINCT tts.id) AS serviceCount,
            AVG(ttsc.score) AS score,
            tt.info_picture
        FROM
            t_technician tt
                LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id
                LEFT JOIN t_technician_score ttsc ON ttsc.technician_id = tt.id
        WHERE
          tt.`status` = 2
          AND tt.del_flag = 0
          AND tt.id = #{technicianId}
        GROUP BY
            tt.id,
            tt.subscribe_status,
            tt.`name`,
            tt.introduction,
            tt.home_picture,
            tt.introduction,
            tt.info_picture
    </select>
</mapper>