<?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.knowledge.mapper.TCoursePushMapper">

    <resultMap type="cn.iocoder.yudao.module.knowledge.entity.TCoursePush" id="tCoursePushMap">
            <result property="id" column="id"/>
            <result property="name" column="name"/>
            <result property="fileUrl" column="file_url"/>
            <result property="createTime" column="create_time"/>
            <result property="updateTime" column="update_time"/>
            <result property="deptId" column="dept_id"/>
            <result property="identityId" column="identity_id"/>
            <result property="deleted" column="deleted"/>
    </resultMap>

    <!-- 用于select查询公用抽取的列 -->
    <sql id="columns">
        id,name,file_url,create_time,update_time,dept_id,identity_id,deleted
    </sql>

    <select id="findList" resultType="cn.iocoder.yudao.module.knowledge.entity.TCoursePush">
        select * from t_course_push where deleted = 0 and date(create_time) = curdate()
    </select>

    <select id="getPushConfig" resultType="cn.iocoder.yudao.module.knowledge.entity.TCoursePush">
        select * from t_course_push where deleted = 0 and date(create_time) = curdate() limit 1
    </select>


    <select id="findListForApp" resultType="cn.iocoder.yudao.module.knowledge.entity.TCoursePush">
        select * from t_course_push
        <where>
            deleted = 0
            and status = '1'
            <if test="params.pushTime != null">
                and push_time between #{params.pushTimeStart} and #{params.pushTime}
            </if>
        </where>
        order by push_time desc
    </select>

    <select id="selectTodayCourse" resultType="cn.iocoder.yudao.module.knowledge.entity.TCoursePush">
        select * from t_course_push where deleted = 0 and date(create_time) = curdate() limit 1
    </select>

</mapper>
