TblContractFrameworkMapper.xml 2.8 KB
<?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 &gt;= #{vo.validityTimeStart}
            </if>
            <if test="vo.validityTimeEnd != null">
                AND tb.validity_time &lt;= #{vo.validityTimeEnd}
            </if>
        </where>
    </select>
</mapper>