zss
2023-08-21 82fbcce60ae86965441ae045df1f864d10005d35
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
<?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 r.id,
        im.code materialCode,
        r.code reportCode,
        i.code inspectionCode,
        im.name materialName,
        r.conclusion ,
        r.status ,
        r.approver ,
        check_time,
        u.name
        from lims_laboratory.report r
        join lims_laboratory.inspection i on r.inspection_id = i.id
        join lims_laboratory.user u on i.user_id = u.id
        join lims_laboratory.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>
        order by r.id
    </select>
 
</mapper>