智慧农业后台管理
tangzy
2022-05-13 585863b324f5c30601df1c1418ee733854e89a15
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
<?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.stockrecord.mapper.StockrecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="stockrecordResultMap" type="org.springblade.modules.stockrecord.entity.Stockrecord">
        <result column="id" property="id"/>
        <result column="stock_id1" property="stockId1"/>
        <result column="amount1" property="amount1"/>
        <result column="time1" property="time1"/>
        <result column="type1" property="type1"/>
        <result column="operator1" property="operator1"/>
        <result column="spn1" property="spn1"/>
        <result column="stock_type1" property="stockType1"/>
        <result column="picture1" property="picture1"/>
        <result column="remarks1" property="remarks1"/>
    </resultMap>
 
 
    <select id="selectStockrecordPage" resultMap="stockrecordResultMap">
        select * from sys_stockrecord where is_deleted = 0
    </select>
    <select id="seletList" resultType="org.springblade.modules.stock.vo.StockVO">
        SELECT st.*,
        stf.type as stype,
        stf.factory_name as factoryName,
        d.dict_value as dic1,
        c.dict_value as dic2
        FROM `sys_stock` st
        LEFT JOIN sys_stockfactory stf ON st.stock_id = stf.id
        LEFT JOIN (SELECT dict_key,dict_value FROM blade_dict_biz WHERE `code`='stockSpecs1' AND is_deleted=0) d ON
        d.dict_key=st.specs_value1
        LEFT JOIN (SELECT dict_key,dict_value FROM blade_dict_biz WHERE `code`='stockSpecs2' AND is_deleted=0) c ON
        c.dict_key=st.specs_value2
        WHERE st.is_deleted = 0
        <if test="stock.stype!=null and stock.stype != ''">
            and stf.type = #{stock.stype}
        </if>
        <if test="stock.specsValue1!=null and stock.specsValue1 != ''">
            and st.specs_value1 = #{stock.specsValue1}
        </if>
        <if test="stock.specsValue2!=null and stock.specsValue2 != ''">
            and st.specs_value2 = #{stock.specsValue2}
        </if>
        <if test="stock.type!=null and stock.type!= ''">
            and st.type = #{stock.type}
        </if>
        <if test="stock.state!=null and stock.state!= ''">
            and st.state = #{stock.state}
        </if>
    </select>
 
</mapper>