AccountLogMapper.xml 1.85 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="cn.com.polysoft.template.dao.SoaAccountLogMapper" >

    <select id="getByBillRecordId" resultType="cn.com.polysoft.template.entity.SoaAccountLogEntity">
        <!--select a.* from soa_account_log a left join treaty_soa_info b on a.account_no = b.account_no-->
        <!--<where>-->
            <!--<if test="recordId != null and recordId != ''">-->
                <!--and b.record_id = #{recordId}-->
            <!--</if>-->
            <!--<if test="batchId != null and batchId != ''">-->
                <!--and b.batch_id = #{batchId}-->
            <!--</if>-->
            <!--<if test="createTimeStart != null and createTimeStart != ''">-->
                <!--and a.creat_time >= #{createTimeStart}-->
            <!--</if>-->
            <!--<if test="createTimeEnd != null and createTimeEnd != ''">-->
                <!--and a.creat_time &lt;= #{createTimeEnd}-->
            <!--</if>-->
        <!--</where>-->
        <!--order by a.creat_time desc-->
        SELECT
          a.*
        FROM
          soa_account_log a
        WHERE
         a.account_no = (
            SELECT
            t.account_no
            FROM
            treaty_soa_info t
            WHERE
            t.record_id = #{recordId}
            )
            AND a.batch_id = #{batchId}
            <if test="createTimeStart != null and createTimeStart != ''">
                and to_date(a.creat_time,'yyyy-MM-dd') >= to_date(#{createTimeStart},'yyyy-MM-dd')
            </if>
            <if test="createTimeEnd != null and createTimeEnd != ''">
                and to_date(a.creat_time,'yyyy-MM-dd') &lt;= to_date(#{createTimeEnd},'yyyy-MM-dd')
            </if>
            order by a.creat_time desc
    </select>
</mapper>