gongchunyi
4 小时以前 91acbe8b56194bbd834b1169b5578de8a5ed442c
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
<?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.ProductMaterialSkuMapper">
 
    <resultMap id="ProductMaterialSkuResultMap" type="com.ruoyi.production.pojo.ProductMaterialSku">
        <id property="id" column="id"/>
        <result property="productId" column="product_id"/>
        <result property="identifierCode" column="identifier_code"/>
        <result property="materialCode" column="material_code"/>
        <result property="model" column="model"/>
        <result property="supplyType" column="supply_type"/>
        <result property="originatorName" column="originator_name"/>
        <result property="originatorOrg" column="originator_org"/>
        <result property="formInstanceId" column="form_instance_id"/>
        <result property="formModifiedTime" column="form_modified_time"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>
 
    <select id="selectSkuWithMaterialPage" resultType="com.ruoyi.production.dto.ProductMaterialSkuDto">
        SELECT
        sku.id AS id,
        sku.product_id AS productId,
        sku.material_code AS materialCode,
        sku.model AS model,
        sku.supply_type AS supplyType,
        m.product_name AS productName,
        m.unit AS unit
        FROM product_material_sku sku
        LEFT JOIN product_material m ON sku.product_id = m.id
        <where>
            <if test="dto.productId != null">
                AND sku.product_id = #{dto.productId}
            </if>
            <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.productName != null and dto.productName != ''">
                AND m.product_name LIKE CONCAT('%', #{dto.productName}, '%')
            </if>
        </where>
        ORDER BY sku.id ASC
    </select>
 
</mapper>