TblContractFrameworkMapper.xml
2.8 KB
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
<?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.lframework.xingyun.sc.mappers.ContractFrameworkMapper">
    <resultMap id="ContractFramework" type="com.lframework.xingyun.sc.entity.ContractFramework">
        <id column="id" property="id"/>
        <result column="code" property="code"/>
        <result column="customer_id" property="customerId"/>
        <result column="company" property="company"/>
        <result column="has_framework_agreement" property="hasFrameworkAgreement"/>
        <result column="material_type_id" property="materialTypeId"/>
        <result column="validity_time" property="validityTime"/>
        <result column="create_by_id" property="createById"/>
        <result column="create_by" property="createBy"/>
        <result column="update_by_id" property="updateById"/>
        <result column="update_by" property="updateBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>
    <sql id="ContractFramework_sql">
        SELECT
            tb.id,
            tb.code,
            tb.customer_id,
            tb.company,
            tb.has_framework_agreement,
            tb.material_type_id,
            tb.validity_time,
            tb.create_by_id,
            tb.create_by,
            tb.update_by_id,
            tb.update_by,
            tb.create_time,
            tb.update_time
        FROM tbl_contract_framework AS tb
    </sql>
    <select id="query" resultMap="ContractFramework">
        <include refid="ContractFramework_sql"/>
        <where>
            <if test="vo.code != null and vo.code != ''">
                AND tb.code like CONCAT('%', #{vo.code}, '%')
            </if>
            <if test="vo.customerId != null and vo.customerId != ''">
                AND tb.customer_id = #{vo.customerId}
            </if>
            <if test="vo.company != null and vo.company != ''">
                AND tb.company = #{vo.company}
            </if>
            <if test="vo.hasFrameworkAgreement != null">
                AND tb.has_framework_agreement = #{vo.hasFrameworkAgreement}
            </if>
            <if test="vo.materialTypeId != null and vo.materialTypeId != ''">
                AND tb.material_type_id = #{materialTypeId}
            </if>
            <if test="vo.validityTime != null">
                AND tb.validity_time = #{vo.validityTime}
            </if>
            <if test="vo.validityTimeStart != null">
                AND tb.validity_time >= #{vo.validityTimeStart}
            </if>
            <if test="vo.validityTimeEnd != null">
                AND tb.validity_time <= #{vo.validityTimeEnd}
            </if>
        </where>
    </select>
</mapper>