huminmin
2 天以前 522b9cd4cd7f38f88fe77cb9b9f2c5f7197eed29
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
<?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.measuringinstrumentledger.mapper.SparePartsRequisitionRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord">
        <id column="id" property="id" />
        <result column="source_type" property="sourceType" />
        <result column="source_id" property="sourceId" />
        <result column="device_ledger_id" property="deviceLedgerId" />
        <result column="spare_parts_id" property="sparePartsId" />
        <result column="quantity" property="quantity" />
        <result column="create_user" property="createUser" />
        <result column="tenant_id" property="tenantId" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>
 
 
    <select id="listPage" resultType="com.ruoyi.measuringinstrumentledger.dto.SparePartsRequisitionRecordDto">
        select sprr.*,sp.name as sparePartsName, dl.device_name as deviceName, su.nick_name as operator
        from spare_parts_requisition_record sprr
        left join spare_parts sp on sp.id = sprr.spare_parts_id
        left join device_ledger dl on dl.id = sprr.device_ledger_id
        left join sys_user su on su.user_id = sprr.create_user
        <where>
            <if test="params.sparePartsName != null and params.sparePartsName != ''">
                and sp.name like concat('%',#{params.sparePartsName},'%')
            </if>
 
            <if test="params.sourceType != null and params.sourceType != ''">
                and sprr.source_type = #{params.sourceType}
            </if>
        </where>
    </select>
</mapper>