UnlimitedGuaranteeLetterMapper.xml 2.62 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.UnlimitedGuaranteeLetterMapper">

    <resultMap id="UnlimitedGuaranteeLetter" type="com.lframework.xingyun.sc.entity.UnlimitedGuaranteeLetter">
        <id column="id" property="id"/>
        <result column="ordering_unit" property="orderingUnit"/>
        <result column="ordering_unit_name" property="orderingUnitName"/>
        <result column="sign_date" property="signDate"/>
        <result column="remark" property="remark"/>
        <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="UnlimitedGuaranteeLetter_sql">
        SELECT
            tb.id,
            tb.ordering_unit,
            cu.name AS ordering_unit_name,
            tb.sign_date,
            tb.remark,
            tb.create_by_id,
            tb.create_by,
            tb.update_by_id,
            tb.update_by,
            tb.create_time,
            tb.update_time
        FROM unlimited_guarantee_letter AS tb
        left join base_data_customer as cu on cu.id = tb.ordering_unit
    </sql>

    <select id="query" resultMap="UnlimitedGuaranteeLetter">
        <include refid="UnlimitedGuaranteeLetter_sql"/>
        <where>
            <if test="vo.orderingUnit != null and vo.orderingUnit != ''">
                AND tb.ordering_unit = #{vo.orderingUnit}
            </if>
            <if test="vo.orderingUnitName != null and vo.orderingUnitName != ''">
                AND cu.name LIKE CONCAT('%', #{vo.orderingUnitName}, '%')
            </if>
            <if test="vo.signDateStart != null and vo.signDateStart != ''">
                AND tb.sign_date >= #{vo.signDateStart}
            </if>
            <if test="vo.signDateEnd != null and vo.signDateEnd != ''">
                <![CDATA[
               AND tb.sign_date <= #{vo.signDateEnd}
                ]]>
            </if>
        </where>
        ORDER BY tb.create_time DESC
    </select>

    <select id="findById" resultType="com.lframework.xingyun.sc.entity.UnlimitedGuaranteeLetter">
        <include refid="UnlimitedGuaranteeLetter_sql"/>
        <where>
            <if test="id != null and id != ''">
                AND tb.id = #{id}
            </if>
        </where>
    </select>
</mapper>