cloud-server-activity/src/main/resources/mapper/BenefitsVideoClassificationMapper.xml
@@ -2,5 +2,32 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dsh.activity.mapper.BenefitsVideoClassificationMapper">
    <update id="changeState">
        update t_benefits_video_classification set
        state = #{type}
        <where>
            <if test="ids != null and ids.size()>0">
                AND t_benefits_video_classification.id IN
                <foreach collection="ids" separator="," item="id" open="(" close=")">
                    #{id}
                </foreach>
            </if>
        </where>
    </update>
    <select id="listAll" resultType="com.dsh.activity.model.TQueryBenefitsVO">
        select t1.*,COUNT(t2.id) AS `count`,t2.courseId courseId from t_benefits_video_classification t1
        left join t_benefits_videos t2 on t1.id = t2.benefitsVideoClassificationId
        <where>
            <if test="query.position!=null and query.position!= ''">
                and t1.position = #{query.position}
            </if>
            <if test="query.name!=null and query.name!= ''">
                and t1.name like concat('%',#{query.name},'%')
            </if>
            AND (t2.id IS NULL OR t2.state != 3 OR t2.state != 2)
        </where>
        GROUP BY t1.id
        order by t1.sort DESC
    </select>
</mapper>