<?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 a.undertaker_type = #{query.undertakerType} and a.undertaker_user_id = #{query.userId}
|
<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>
|