无关风月
2025-05-08 9486766c806fe1d9e082b2fd02ea1cc558f1b443
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?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.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>