VodSubjectTreeMappingMapper.xml 2.49 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="com.meishu.mapper.VodSubjectTreeMappingMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.meishu.model.VodSubjectTreeMappingDO">
        <id column="id" property="id" />
        <result column="create_date" property="createTime" />
        <result column="update_date" property="updateTime" />
        <result column="delete_date" property="deleteTime" />
        <result column="vod_id" property="vodId" />
        <result column="tree_id" property="treeId" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, vod_id, tree_id
    </sql>

    <select id="getAllNoAuthenVods" resultType="com.meishu.vo.subject.GetAllNoAuthenVodsVO">
        SELECT
            t2.id,
            t2.vod_name,
            t2.vod_type,
            t3.user_name,
            t2.update_date
        FROM
            vod_subject_tree_mapping t
            LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
            LEFT JOIN administer t3 ON t2.administer_id = t3.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t.tree_id = #{treeId}
            <if test="vodType!=null amd vodType =''">
                AND t2.vod_type = #{vodType}
            </if>
            AND t2.STATUS = #{status}
    </select>

    <select id="getTreeVodCount" resultType="integer">
        SELECT
            count(1)
        FROM
            vod_related t
            LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            <if test="treeId !=null and treeId !=''">
                AND t.tree_id = #{treeId}
            </if>
            <if test="userId !=null and userId !=''">
                AND t2.teacher_id = #{userId}
            </if>
            <if test="shareStatus !=null and shareStatus !=''">
                AND t2.share_status = #{shareStatus}
            </if>
            <if test="subject!=null and subject !=''">
                AND t2.subject = #{subject}
            </if>
            <if test="checkStatus==2">
                AND t2.check_status = 2
            </if>
            <if test="checkStatus==1">
                AND (t2.check_status = 1 or t2.check_status = 3 )
            </if>
    </select>

</mapper>