Bang Hu
2 天以前 2b0b64182263d922b946ec898070e59b602382dc
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?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.webmanage.mapper.ProductPricingMapper">
 
    <!-- 基础结果映射 -->
    <resultMap id="BaseResultMap" type="com.webmanage.entity.ProductPricing">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="suite_name" property="suiteName" jdbcType="VARCHAR"/>
        <result column="sales_form" property="salesForm" jdbcType="VARCHAR"/>
        <result column="customer_type" property="customerType" jdbcType="VARCHAR"/>
        <result column="account_limit" property="accountLimit" jdbcType="VARCHAR"/>
        <result column="concurrent_nodes" property="concurrentNodes" jdbcType="VARCHAR"/>
        <result column="price_type" property="priceType" jdbcType="VARCHAR"/>
        <result column="price_unit" property="priceUnit" jdbcType="VARCHAR"/>
        <result column="points_price" property="pointsPrice" jdbcType="DECIMAL"/>
        <result column="currency_price" property="currencyPrice" jdbcType="DECIMAL"/>
        <result column="is_active" property="isActive" jdbcType="BOOLEAN"/>
        <result column="product_id" property="productId" jdbcType="VARCHAR"/>
        <result column="product_name" property="productName" jdbcType="VARCHAR"/>
        <result column="provider_id" property="providerId" jdbcType="VARCHAR"/>
        <result column="provider_name" property="providerName" jdbcType="VARCHAR"/>
        <result column="description" property="description" jdbcType="VARCHAR"/>
        <result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/>
        <result column="updated_at" property="updatedAt" jdbcType="TIMESTAMP"/>
        <result column="created_by" property="createdBy" jdbcType="BIGINT"/>
        <result column="updated_by" property="updatedBy" jdbcType="BIGINT"/>
        <result column="deleted" property="deleted" jdbcType="INTEGER"/>
    </resultMap>
 
    <!-- 基础字段 -->
    <sql id="Base_Column_List">
        id, suite_name, sales_form, customer_type, account_limit, concurrent_nodes, 
        price_type, price_unit, points_price,currency_price, is_active, product_id, product_name, provider_id,
        provider_name, description, created_at, updated_at, created_by, updated_by, deleted
    </sql>
 
    <!-- 分页查询产品定价列表 -->
    <select id="selectProductPricingPage" resultMap="BaseResultMap">
        SELECT 
        <include refid="Base_Column_List"/>
        FROM tb_product_pricing
        WHERE deleted = 0
        <if test="productId != null">
            AND product_id = #{productId}
        </if>
        ORDER BY created_at DESC
    </select>
 
    <!-- 根据产品ID查询定价列表 -->
    <select id="selectByProductId" resultMap="BaseResultMap">
        SELECT 
        <include refid="Base_Column_List"/>
        FROM tb_product_pricing
        WHERE deleted = 0 AND product_id = #{productId}
        ORDER BY created_at DESC
    </select>
 
    <!-- 根据条件查询产品定价 -->
    <select id="selectByCondition" resultMap="BaseResultMap">
        SELECT 
        <include refid="Base_Column_List"/>
        FROM tb_product_pricing
        WHERE deleted = 0
        <if test="suiteName != null and suiteName != ''">
            AND suite_name LIKE CONCAT('%', #{suiteName}, '%')
        </if>
        <if test="salesForm != null and salesForm != ''">
            AND sales_form = #{salesForm}
        </if>
        <if test="customerType != null and customerType != ''">
            AND customer_type = #{customerType}
        </if>
        <if test="priceType != null and priceType != ''">
            AND price_type = #{priceType}
        </if>
        <if test="isActive != null">
            AND is_active = #{isActive}
        </if>
        ORDER BY created_at DESC
    </select>
 
</mapper>