forked from sd_delivery/delivery
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.9 KiB
103 lines
3.9 KiB
3 years ago
|
<?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.ccsens.delivery.persist.dao.RecordHealthDao">
|
||
|
|
||
|
|
||
|
<select id="backQueryMaterialOrder" resultType="com.ccsens.delivery.bean.vo.HealthVo$BackQueryHealthVo">
|
||
|
SELECT
|
||
|
h.*,
|
||
|
if(a1.`name` is null, h.college_name,a1.`name`) as collegeName,
|
||
|
if(a3.`name` is null, h.stu_class_name,a3.`name`) as stuClassName
|
||
|
FROM
|
||
|
(
|
||
|
SELECT
|
||
|
h.id,
|
||
|
u.`name`,
|
||
|
u.number,
|
||
|
u.phone,
|
||
|
u.grade,
|
||
|
h.submit_time as submitTime,
|
||
|
if(h.id is null, 0, 1) as `status`,
|
||
|
u.college_id as collegeId,
|
||
|
u.college_name,
|
||
|
u.stu_class_id as stuClassId,
|
||
|
u.stu_class_name,
|
||
|
h.visit_path as imgPath,
|
||
|
h.colour,
|
||
|
h.star,
|
||
|
h.positive
|
||
|
FROM
|
||
|
(
|
||
|
SELECT
|
||
|
*
|
||
|
FROM
|
||
|
t_sys_user_info u
|
||
|
WHERE
|
||
|
u.rec_status = 0
|
||
|
and u.post = #{param.post}
|
||
|
<if test="param.name != null and param.name != ''">
|
||
|
and u.name like CONCAT('%',#{param.name},'%')
|
||
|
</if>
|
||
|
<if test="param.number != null and param.number != ''">
|
||
|
and u.number = #{param.number}
|
||
|
</if>
|
||
|
<if test="param.phone != null and param.phone != ''">
|
||
|
and u.phone = #{param.phone}
|
||
|
</if>
|
||
|
<if test="param.collegeId != null">
|
||
|
and u.college_id = #{param.collegeId}
|
||
|
</if>
|
||
|
<if test="param.stuClassId != null">
|
||
|
and u.stu_class_id = #{param.stuClassId}
|
||
|
</if>
|
||
|
<if test="param.grade != null and param.grade != ''">
|
||
|
and u.grade = #{param.grade}
|
||
|
</if>
|
||
|
)u
|
||
|
LEFT JOIN (
|
||
|
SELECT
|
||
|
*
|
||
|
FROM
|
||
|
(
|
||
|
SELECT
|
||
|
DISTINCT
|
||
|
h.*,
|
||
|
f.visit_path
|
||
|
FROM
|
||
|
t_record_health h
|
||
|
LEFT JOIN t_file_commit f on h.file_id = f.id and f.rec_status = 0
|
||
|
WHERE
|
||
|
h.`type` = #{param.type}
|
||
|
<if test="param.submitTime != null">
|
||
|
and FROM_UNIXTIME(h.submit_time / 1000,'%Y-%m-%d') = FROM_UNIXTIME(#{params.submitTime} / 1000,'%Y-%m-%d')
|
||
|
</if>
|
||
|
AND h.rec_status = 0
|
||
|
ORDER BY h.submit_time desc
|
||
|
)a
|
||
|
GROUP BY user_id
|
||
|
) h on h.user_id = u.user_id
|
||
|
<where>
|
||
|
<if test="param.status != null and param.status == 0">
|
||
|
and h.id is null
|
||
|
</if>
|
||
|
<if test="param.status == null or param.status == 1">
|
||
|
<if test="param.status != null and param.status == 1">
|
||
|
and h.id is not null
|
||
|
</if>
|
||
|
<if test="param.colour != null">
|
||
|
and h.colour = #{param.colour}
|
||
|
</if>
|
||
|
<if test="param.star != null">
|
||
|
and h.star = #{param.star}
|
||
|
</if>
|
||
|
<if test="param.positive != null">
|
||
|
and h.positive = #{param.positive}
|
||
|
</if>
|
||
|
</if>
|
||
|
</where>
|
||
|
)h
|
||
|
LEFT JOIN t_sys_area a1 on h.collegeId = a1.id and a1.rec_status = 0
|
||
|
LEFT JOIN t_sys_area a3 on h.stuClassId = a3.id and a3.rec_status = 0
|
||
|
order by h.submitTime desc
|
||
|
</select>
|
||
|
</mapper>
|