gongchunyi
21 小时以前 cebef271a105494b4e4e5c09f2d12636d620304c
src/main/resources/mapper/production/ProductBomMapper.xml
@@ -5,7 +5,7 @@
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.production.pojo.ProductBom">
        <id column="id" property="id"/>
        <result column="product_model_id" property="productModelId"/>
        <result column="dict_code" property="dictCode"/>
        <result column="bom_no" property="bomNo"/>
        <result column="remark" property="remark"/>
        <result column="version" property="version"/>
@@ -15,34 +15,33 @@
        <result column="update_user" property="updateUser"/>
        <result column="tenant_id" property="tenantId"/>
    </resultMap>
    <select id="listPage" resultType="com.ruoyi.production.dto.ProductBomDto">
        select * from (select pb.*,
        pm.model productModelName,
        p.product_name productName
        from product_bom pb
        left join product_model pm on pb.product_model_id = pm.id
        left join product p on pm.product_id = p.id)A
        where 1=1
        <if test="c.productModelName != null">
            and productModelName = #{c.productModelName}
        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.productName != null">
            and productName = #{c.productName}
        <if test="c.bomNo != null and c.bomNo != ''">
            AND pm.bom_no = #{c.bomNo}
        </if>
        <if test="c.bomNo != null">
            and bom_no = #{c.bomNo}
        </if>
        <if test="c.version != null">
            and version = #{c.version}
        <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.*,
               pm.model productModelName,
               p.product_name productName
               pms.model       AS productModelName,
               pm.product_name AS productName
        from product_bom pb
                 left join product_model pm on pb.product_model_id = pm.id
                 left join product p on pm.product_id = p.id
                 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>