<?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.LedgerDailyTrainingMapper">

    <resultMap id="BaseResultMap" type="com.sundot.airport.ledger.domain.LedgerDailyTraining">
        <id property="id" column="id" />
        <result property="recordDate" column="record_date" />
        <result property="teamName" column="team_name" />
        <result property="responsibleTeacher" column="responsible_teacher" />
        <result property="responsibleLeader" column="responsible_leader" />
        <result property="hours" column="hours" />
        <result property="projectName" column="project_name" />
        <result property="trainingContent" column="training_content" />
        <result property="trainer" column="trainer" />
        <result property="trainingLocation" column="training_location" />
        <result property="participantCount" column="participant_count" />
        <result property="isCompleted" column="is_completed" />
        <result property="remark" column="remark" />
        <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, team_name, responsible_teacher, responsible_leader, hours,
               project_name, training_content, trainer, training_location, participant_count,
               is_completed, remark, import_batch, source_type, create_by, create_time, update_by, update_time
        FROM ledger_daily_training
        WHERE del_flag = '0'
    </sql>

    <select id="selectList" parameterType="com.sundot.airport.ledger.domain.LedgerDailyTraining" resultMap="BaseResultMap">
        <include refid="selectVo"/>
        <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
        <if test="projectName != null and projectName != ''">AND project_name LIKE CONCAT('%', #{projectName}, '%')</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>
