liyong
2 天以前 1a63cb713ae5a547109e7c22b59cb3691d99d686
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
<?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.basic.mapper.ProductModelMapper">
 
    <!-- 通用查询映射结果 -->
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.ProductModel">
        <id column="id" property="id" />
        <result column="product_id" property="productId" />
        <result column="model" property="model" />
        <result column="unit" property="unit" />
        <result column="speculative_trading_name" property="speculativeTradingName" />
        <result column="tenant_id" property="tenantId" />
        <result column="product_name" property="productName" />
        <result column="product_id" property="productId" />
    </resultMap>
    <select id="listPageProductModel" resultType="com.ruoyi.basic.pojo.ProductModel">
        select pm.*,p.product_name
        from product_model pm
        left join product p on pm.product_id = p.id
        <where>
            <if test="c.model != null || c.model != ''">
                and pm.model = like  concat('%',#{c.model},'%')
            </if>
            <if test="c.productName != null || c.productName != ''">
                and p.product_name = like  concat('%',#{c.productName},'%')
            </if>
            <if test="c.speculativeTradingName != null || c.speculativeTradingName != ''">
                and pm.speculative_trading_name like  concat('%',#{c.speculativeTradingName},'%')
            </if>
        </where>
        order by  pm.id
    </select>
 
 
</mapper>