“zhuo”
2023-08-10 805248000274ad1bd010ec4a7ed6b2821be87d23
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
57
<?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.yuanchu.limslaboratory.mapper.ReportMapper">
 
    <!--查询检验报告-->
    <select id="selectAllReport" resultType="com.yuanchu.limslaboratory.pojo.vo.ReportVo">select im.code materialCode,
        r.code reportCode,
        i.code inspectionCode,
        r.approver approver,
        r.status status,
        r.conclusion conclusion,
        u.name name
        from report r
        join inspection i on r.inspection_id = i.id
        join user u on i.user_id = u.id
        join inspection_material im on i.id = im.inspection_id
        <where>
            r.state = 1
            <if test="status != null">
                and r.status = #{status}
            </if>
            <if test="name != null and name != ''">
                and im.code like concat('%', #{name}, '%')
                or i.code like concat('%', #{name}, '%')
                or r.code like concat('%', #{name}, '%')
            </if>
        </where>
    </select>
 
    <!--查询报告审核-->
    <select id="selectAllReportAuditing" resultType="com.yuanchu.limslaboratory.pojo.vo.ReportAuditingVo">
        select im.code materialCode,
        r.code reportCode,
        im.name materialName,
        r.status status,
        r.approver approver,
        DATE_FORMAT(r.`create_time`, '%Y-%m-%d') submitTime,
        DATE_FORMAT(r.`check_time`, '%Y-%m-%d') checkTime
        from report r
        join inspection i on r.inspection_id = i.id
        join inspection_material im on i.id = im.inspection_id
        <where>
            r.state = 1
            <if test="status == null">
                and r.status in (0, 1)
            </if>
            <if test="status != null">
                and r.status = #{status}
            </if>
            <if test="name != null and name != ''">
                and im.code like concat('%', #{name}, '%')
                or i.code like concat('%', #{name}, '%')
                or im.name like concat('%', #{name}, '%')
            </if>
        </where>
    </select>
</mapper>