智慧农业后台管理
guoshilong
2022-09-17 eab652f2f1c596c839013172a472bf88466f0c83
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
<?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="org.springblade.modules.InventoryLoss.mapper.InventoryMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="inventoryResultMap" type="org.springblade.modules.InventoryLoss.vo.InventoryVO">
        <result column="id" property="id"/>
        <result column="strain_name" property="strainName"/>
        <result column="dict_value" property="reasonName"/>
    </resultMap>
 
 
    <select id="selectSalePage" resultMap="inventoryResultMap">
        select inventory.*,
               strain.strain_name,mach.machining_type AS proName,bdb.dict_value
        from sys_inventory inventory
        LEFT JOIN sys_strain strain on inventory.strain_id = strain.id
        LEFT JOIN blade_dict_biz bdb ON inventory.reason = bdb.dict_key
        LEFT JOIN sys_land land ON land.id = inventory.land_id
        LEFT JOIN sys_process_inv inv ON inv.id = inventory.prod_id
        LEFT JOIN sys_machining mach ON mach.id = inv.product_id
        where
        1=1
        <if test="inventory.farmId != null and inventory.farmId !=''">
            AND (land.farm_id = #{inventory.farmId} OR inv.fps_id = #{inventory.farmId})
        </if>
            AND bdb.code = "lossReason"
            AND inventory.is_deleted = 0
            ORDER BY inventory.create_time DESC
    </select>
 
</mapper>