zss
昨天 0b0268ba1ff1b94070e6b50a6d5a502d4e7597f2
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
<?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.ruoyi.safe.mapper.SafeHazardRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.safe.pojo.SafeHazardRecord">
        <id column="id" property="id" />
        <result column="material_record_code" property="materialRecordCode" />
        <result column="safe_hazard_id" property="safeHazardId" />
        <result column="apply_user_id" property="applyUserId" />
        <result column="apply_time" property="applyTime" />
        <result column="apply_qty" property="applyQty" />
        <result column="apply_purpose" property="applyPurpose" />
        <result column="return_user_id" property="returnUserId" />
        <result column="return_time" property="returnTime" />
        <result column="return_remark" property="returnRemark" />
        <result column="create_time" property="createTime" />
        <result column="create_user" property="createUser" />
        <result column="update_time" property="updateTime" />
        <result column="update_user" property="updateUser" />
        <result column="tenant_id" property="tenantId" />
    </resultMap>
    <select id="pageSafeHazardRecord" resultType="com.ruoyi.safe.dto.SafeHazardRecordDto">
        select shr.*,
               su1.nick_name applyUserName,
               su2.nick_name returnUserName,
               sh.name,
               sh.code,
               sh.type,
               sh.risk_level,
               sh.location
               from safe_hazard_record shr
        left join sys_user su1 on shr.apply_user_id = su1.user_id
        left join sys_user su2 on shr.return_user_id = su2.user_id
        left join safe_hazard sh on shr.safe_hazard_id = sh.id
        where 1=1
        <if test="c.materialRecordCode != null and c.materialRecordCode != ''">
            and shr.material_record_code like concat('%', #{c.materialRecordCode}, '%')
        </if>
         <if test="c.name != null and c.name != ''">
            and sh.name like concat('%', #{c.name}, '%')
        </if>
        <if test="c.code != null and c.code != ''">
            and sh.code like concat('%', #{c.code}, '%')
        </if>
        <if test="c.type != null and c.type != ''">
            and sh.type like concat('%', #{c.type}, '%')
        </if>
        <if test="c.riskLevel != null and c.riskLevel != ''">
            and sh.risk_level like concat('%', #{c.riskLevel}, '%')
        </if>
    </select>
 
</mapper>