luofl
2025-02-23 9ff71e0d63c963f2c2c48facdf2336c558ba7100
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
<?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.panzhihua.sangeshenbian.dao.MessageNotificationMapper">
 
    
    <select id="list" resultType="com.panzhihua.sangeshenbian.model.entity.MessageNotification">
        select
            a.id,
            a.title,
            b.name as undertakerUser,
            a.phone,
            d.name as department,
            e.name as `position`,
            DATE_FORMAT(a.response_time, '%Y-%m-%d')as responseTime,
            if(a.prompt_type = 1, '临期提醒', '超时提醒') as promptType,
            if(a.read_status = 0, '未读', '已读') as readStatus
        from sgsb_message_notification a
        left join sys_user b on (a.undertaker_user_id = b.id)
        left join sgsb_system_user c on (a.phone = c.phone)
        left join sgsb_department d on (c.department_id = d.id)
        left join sgsb_position e on (c.position_id = e.id)
        where 1=1
        <if test="query.title != null and query.title != ''">
            and a.title like concat('%', #{query.title}, '%')
        </if>
        <if test="query.undertakerUser != null and query.undertakerUser != ''">
            and b.name like concat('%', #{query.undertakerUser}, '%')
        </if>
        <if test="query.phone != null and query.phone != ''">
            and a.phone like concat('%', #{query.phone}, '%')
        </if>
        <if test="query.departmentId != null">
            and c.department_id = #{query.department}
        </if>
        <if test="query.positionId != null">
            and c.position_id = #{query.position}
        </if>
        order by a.read_status asc, a.create_time desc
    </select>
</mapper>