<?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.sundot.airport.ledger.mapper.LedgerTrainingIssueMapper">

    <resultMap id="BaseResultMap" type="com.sundot.airport.ledger.domain.LedgerTrainingIssue">
        <id property="id" column="id" />
        <result property="recordDate" column="record_date" />
        <result property="ledgerContent" column="ledger_content" />
        <result property="specificProblem" column="specific_problem" />
        <result property="handler" column="handler" />
        <result property="teamName" column="team_name" />
        <result property="recheckProblem" column="recheck_problem" />
        <result property="isRectified" column="is_rectified" />
        <result property="importBatch" column="import_batch" />
        <result property="sourceType" column="source_type" />
        <result property="createBy" column="create_by" />
        <result property="createTime" column="create_time" />
        <result property="updateBy" column="update_by" />
        <result property="updateTime" column="update_time" />
    </resultMap>

    <sql id="selectVo">
        SELECT id, record_date, ledger_content, specific_problem, handler, team_name,
               recheck_problem, is_rectified, import_batch, source_type,
               create_by, create_time, update_by, update_time
        FROM ledger_training_issue
        WHERE del_flag = '0'
    </sql>

    <select id="selectList" parameterType="com.sundot.airport.ledger.domain.LedgerTrainingIssue" resultMap="BaseResultMap">
        <include refid="selectVo"/>
        <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
        <if test="handler != null and handler != ''">AND handler LIKE CONCAT('%', #{handler}, '%')</if>
        <if test="isRectified != null and isRectified != ''">AND is_rectified = #{isRectified}</if>
        <if test="params != null and params.beginTime != null and params.beginTime != ''">
            AND record_date &gt;= #{params.beginTime}
        </if>
        <if test="params != null and params.endTime != null and params.endTime != ''">
            AND record_date &lt;= #{params.endTime}
        </if>
        ORDER BY id DESC
    </select>

</mapper>
