<?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.iocoder.yudao.module.jx.mapper.DriveSchoolDailyManagementMapper">

    <resultMap type="cn.iocoder.yudao.module.jx.domain.DriveSchoolDailyManagement" id="DriveSchoolDailyManagementResult">
        <result property="id"    column="id"    />
        <result property="logName"    column="log_name"    />
        <result property="completionStatus"    column="completion_status"    />
        <result property="completionCover"    column="completion_cover"    />
        <result property="relatedDocuments"    column="related_documents"    />
        <result property="managerLog"    column="manager_log"    />
        <result property="instructorLog"    column="instructor_log"    />
        <result property="permissionControl"    column="permission_control"    />
        <result property="createTime"    column="create_time"    />
        <result property="creator"    column="creator"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updater"    column="updater"    />
        <result property="deptId"    column="dept_id"    />
        <result property="logType"    column="log_type"    />
    </resultMap>

    <sql id="selectDriveSchoolDailyManagementVo">
        select id, log_name, completion_status, completion_cover, related_documents, manager_log, instructor_log, permission_control, create_time, creator, update_time, updater, dept_id, log_type from drive_school_daily_management
    </sql>

    <select id="selectDriveSchoolDailyManagementList" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolDailyManagement" resultMap="DriveSchoolDailyManagementResult">
        <include refid="selectDriveSchoolDailyManagementVo"/>
        <where>
            deleted = 0
            <if test="entity.logName != null  and entity.logName != ''"> and log_name like concat('%', #{entity.logName}, '%')</if>
            <if test="entity.completionStatus != null  and entity.completionStatus != ''"> and completion_status = #{entity.completionStatus}</if>
            <if test="entity.completionCover != null  and entity.completionCover != ''"> and completion_cover = #{entity.completionCover}</if>
            <if test="entity.relatedDocuments != null  and entity.relatedDocuments != ''"> and related_documents = #{entity.relatedDocuments}</if>
            <if test="entity.managerLog != null  and entity.managerLog != ''"> and manager_log = #{entity.managerLog}</if>
            <if test="entity.instructorLog != null  and entity.instructorLog != ''"> and instructor_log = #{entity.instructorLog}</if>
            <if test="entity.permissionControl != null  and entity.permissionControl != ''"> and permission_control = #{entity.permissionControl}</if>
            <if test="entity.deptId != null "> and dept_id = #{entity.deptId}</if>
            <if test="entity.logType != null "> and log_type = #{entity.logType}</if>
        </where>
    </select>

    <select id="selectDriveSchoolDailyManagementById" parameterType="Long" resultMap="DriveSchoolDailyManagementResult">
        <include refid="selectDriveSchoolDailyManagementVo"/>
        where id = #{id}
    </select>

    <insert id="insertDriveSchoolDailyManagement" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolDailyManagement" useGeneratedKeys="true" keyProperty="id">
        insert into drive_school_daily_management
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="logName != null and logName != ''">log_name,</if>
            <if test="completionStatus != null">completion_status,</if>
            <if test="completionCover != null">completion_cover,</if>
            <if test="relatedDocuments != null">related_documents,</if>
            <if test="managerLog != null">manager_log,</if>
            <if test="instructorLog != null">instructor_log,</if>
            <if test="permissionControl != null">permission_control,</if>
            <if test="createTime != null">create_time,</if>
            <if test="creator != null">creator,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updater != null">updater,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="logType != null">log_type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="logName != null and logName != ''">#{logName},</if>
            <if test="completionStatus != null">#{completionStatus},</if>
            <if test="completionCover != null">#{completionCover},</if>
            <if test="relatedDocuments != null">#{relatedDocuments},</if>
            <if test="managerLog != null">#{managerLog},</if>
            <if test="instructorLog != null">#{instructorLog},</if>
            <if test="permissionControl != null">#{permissionControl},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="creator != null">#{creator},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updater != null">#{updater},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="logType != null">#{logType},</if>
         </trim>
    </insert>

    <update id="updateDriveSchoolDailyManagement" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolDailyManagement">
        update drive_school_daily_management
        <trim prefix="SET" suffixOverrides=",">
            <if test="logName != null and logName != ''">log_name = #{logName},</if>
            <if test="completionStatus != null">completion_status = #{completionStatus},</if>
            <if test="completionCover != null">completion_cover = #{completionCover},</if>
            <if test="relatedDocuments != null">related_documents = #{relatedDocuments},</if>
            <if test="managerLog != null">manager_log = #{managerLog},</if>
            <if test="instructorLog != null">instructor_log = #{instructorLog},</if>
            <if test="permissionControl != null">permission_control = #{permissionControl},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="creator != null">creator = #{creator},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updater != null">updater = #{updater},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="logType != null">log_type = #{logType},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDriveSchoolDailyManagementById" parameterType="Long">
        delete from drive_school_daily_management where id = #{id}
    </delete>

    <delete id="deleteDriveSchoolDailyManagementByIds" parameterType="String">
        delete from drive_school_daily_management where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
