智慧农业后台管理
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
<?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,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
        where
        <if test="inventory.strainId !=null and inventory.strainId != '' ">
            inventory.strain_id = #{inventory.strainId} AND
        </if>
              bdb.code = "lossReason" AND inventory.is_deleted = 0 ORDER BY inventory.create_time DESC
    </select>
 
</mapper>