| | |
| | | |
| | | <resultMap id="ProductMaterialSkuResultMap" type="com.ruoyi.production.pojo.ProductMaterialSku"> |
| | | <id property="id" column="id"/> |
| | | <result property="materialId" column="material_id"/> |
| | | <result property="productId" column="product_id"/> |
| | | <result property="identifierCode" column="identifier_code"/> |
| | | <result property="materialCode" column="material_code"/> |
| | | <result property="specification" column="specification"/> |
| | | <result property="model" column="model"/> |
| | | <result property="supplyType" column="supply_type"/> |
| | | <result property="originatorName" column="originator_name"/> |
| | | <result property="originatorOrg" column="originator_org"/> |
| | |
| | | |
| | | <select id="selectSkuWithMaterialPage" resultType="com.ruoyi.production.dto.ProductMaterialSkuDto"> |
| | | SELECT |
| | | sku.id AS skuId, |
| | | sku.material_id AS materialId, |
| | | sku.id AS id, |
| | | sku.product_id AS productId, |
| | | sku.material_code AS materialCode, |
| | | sku.specification AS specification, |
| | | sku.model AS model, |
| | | sku.supply_type AS supplyType, |
| | | m.material_name AS materialName, |
| | | m.base_unit AS baseUnit |
| | | m.product_name AS productName, |
| | | m.unit AS unit |
| | | FROM product_material_sku sku |
| | | LEFT JOIN product_material m ON sku.material_id = m.id |
| | | LEFT JOIN product_material m ON sku.product_id = m.id |
| | | <where> |
| | | <if test="dto.materialId != null"> |
| | | AND sku.material_id = #{dto.materialId} |
| | | <if test="dto.productId != null"> |
| | | AND sku.product_id = #{dto.productId} |
| | | </if> |
| | | <if test="dto.specification != null and dto.specification != ''"> |
| | | AND sku.specification LIKE CONCAT('%', #{dto.specification}, '%') |
| | | <if test="dto.model != null and dto.model != ''"> |
| | | AND sku.model LIKE CONCAT('%', #{dto.model}, '%') |
| | | </if> |
| | | <if test="dto.materialCode != null and dto.materialCode != ''"> |
| | | AND sku.material_code LIKE CONCAT('%', #{dto.materialCode}, '%') |
| | | </if> |
| | | |
| | | <if test="type != null and type == 1 and dto.materialName != null and dto.materialName != ''"> |
| | | AND m.material_name LIKE CONCAT('%', #{dto.materialName}, '%') |
| | | <if test="type != null and type == 1 and dto.productName != null and dto.productName != ''"> |
| | | AND m.product_name LIKE CONCAT('%', #{dto.productName}, '%') |
| | | </if> |
| | | </where> |
| | | ORDER BY sku.id ASC |