gongchunyi
5 小时以前 bc116c55a44bc344e5575b5bdd4c2591bc0475aa
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
<?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.production.mapper.ProductBomMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.production.pojo.ProductBom">
        <id column="id" property="id"/>
        <result column="dict_code" property="dictCode"/>
        <result column="bom_no" property="bomNo"/>
        <result column="remark" property="remark"/>
        <result column="version" property="version"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="create_user" property="createUser"/>
        <result column="update_user" property="updateUser"/>
        <result column="tenant_id" property="tenantId"/>
    </resultMap>
 
    <select id="listPage" resultType="com.ruoyi.production.dto.ProductBomDto">
        SELECT
        pm.*,
        sdd.dict_label AS dictLabel
        FROM product_bom pm
        LEFT JOIN sys_dict_data sdd ON sdd.dict_code = pm.dict_code
        WHERE 1=1
        <if test="c.dictCode != null">
            AND pm.dict_code = #{c.dictCode}
        </if>
        <if test="c.bomNo != null and c.bomNo != ''">
            AND pm.bom_no = #{c.bomNo}
        </if>
        <if test="c.version != null and c.version != ''">
            AND pm.version = #{c.version}
        </if>
    </select>
 
    <select id="getById" resultType="com.ruoyi.production.dto.ProductBomDto">
        select pb.*,
               pms.model       AS productModelName,
               pm.product_name AS productName
        from product_bom pb
                 left join product_material_sku pms on pb.product_model_id = pms.id
                 left join product_material pm on pms.product_id = pm.id
        where pb.id = #{id}
    </select>
 
</mapper>