puzhibing
2024-02-05 640ff18d2d7f4be02ddb7f8f75e899f05545eb98
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?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.course.mapper.TCourseMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.dsh.course.entity.TCourse">
        <id column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="type" property="type"/>
        <result column="introduce" property="introduce"/>
        <result column="coverDrawing" property="coverDrawing"/>
        <result column="introductionDrawing" property="introductionDrawing"/>
        <result column="courseVideo" property="courseVideo"/>
        <result column="state" property="state"/>
        <result column="insertTime" property="insertTime"/>
    </resultMap>
    <update id="changeState">
        update t_course set
        state = #{state}
        <where>
            <if test="ids != null and ids.size()>0">
                AND t_course.id IN
                <foreach collection="ids" separator="," item="id" open="(" close=")">
                    #{id}
                </foreach>
            </if>
        </where>
    </update>
 
    <select id="queryCourseList" resultType="map">
        select id, type, name, introduce, coverDrawing, state from t_course where state != 3
        <if test="null != item.name and '' != item.name">
            and name like CONCAT('%', #{item.name}, '%')
        </if>
        <if test="null != item.courseType">
            and type = #{item.courseType}
        </if>
        order by insertTime desc
    </select>
 
    <select id="getCourseByCourseIds" resultType="com.dsh.course.model.vo.TQueryBenefitsVideosVO">
        select * from t_course
        <where>
            <if test="query.name != null and query.name != ''">
                AND t_course.name LIKE concat('%',#{query.name},'%')
            </if>
            <if test="query.type != null and query.type != '' ">
                AND t_course.type = #{query.type}
            </if>
            <if test="query.state != null and query.state != '' ">
                AND t_course.state = #{query.state}
            </if>
            <if test="query.coursIds != null and query.coursIds.size()>0">
                AND t_course.id IN
                <foreach collection="query.coursIds" separator="," item="coursId" open="(" close=")">
                    #{coursId}
                </foreach>
            </if>
        </where>
    </select>
</mapper>