StaffBeisenSourseMapper.xml
4.94 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?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.com.glsx.dj.mindworkplate.mapper.StaffBeisenSourseMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.StaffBeisenSourse" >
<!--
WARNING - @mbg.generated
-->
<result column="course_title" property="courseTitle" jdbcType="VARCHAR" />
<result column="course_id" property="courseId" jdbcType="VARCHAR" />
<result column="course_status" property="courseStatus" jdbcType="VARCHAR" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
<result column="catalog_name" property="catalogName" jdbcType="CHAR" />
<result column="recommend_status" property="recommendStatus" jdbcType="VARCHAR" />
<result column="total_chapter" property="totalChapter" jdbcType="INTEGER" />
<result column="total_duration" property="totalDuration" jdbcType="DECIMAL" />
<result column="course_file_type" property="courseFileType" jdbcType="VARCHAR" />
<result column="publish_time" property="publishTime" jdbcType="TIMESTAMP" />
<result column="tag_name" property="tagName" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
-->
course_title, course_id, course_status, created_by, created_date, updated_by, total_credit,
updated_date, deleted_flag,catalog_name,recommend_status,total_chapter,total_duration,course_file_type, publish_time
</sql>
<update id="batchSaveOrUpdate">
INSERT INTO staff_beisen_course (
course_title, course_id, course_status,
created_by, created_date, updated_by, updated_date, deleted_flag,catalog_name,
course_file_type, recommend_status, total_duration, total_chapter, total_credit, publish_time
)
VALUES
<foreach collection="entityList" item="item" separator=",">
(#{item.courseTitle}, #{item.courseId}, #{item.courseStatus},
#{item.createdBy}, #{item.createdDate}, #{item.updatedBy}, #{item.updatedDate}, #{item.deletedFlag},#{item.catalogName},
#{item.courseFileType},#{item.recommendStatus},#{item.totalDuration},#{item.totalChapter},#{item.totalCredit},#{item.publishTime}
)
</foreach>
ON DUPLICATE KEY UPDATE
course_status = VALUES(course_status),
catalog_name = VALUES(catalog_name),
course_title = VALUES(course_title),
updated_by = VALUES(updated_by),
updated_date = VALUES(updated_date),
course_file_type = VALUES(course_file_type),
recommend_status = VALUES(recommend_status),
total_duration = VALUES(total_duration),
total_chapter = VALUES(total_chapter),
total_credit = VALUES(total_credit),
publish_time = VALUES(publish_time)
</update>
<select id="findStaffTagCoursePage" parameterType="cn.com.glsx.dj.mindworkplate.model.course.CourseSearchReuqestDTO"
resultMap="BaseResultMap">
select
bc.*,
group_concat(distinct bct.tag_name) as tag_name
from staff_beisen_course bc
left join staff_beisen_course_tag bct on bct.course_id = bc.course_id and bct.deleted_flag = "N"
where 1=1
and bc.deleted_flag = "N"
and bc.course_status=40
<if test="condition.courseName != null">
and bc.course_title like concat('%',#{condition.courseName},'%')
</if>
<if test="condition.courseIds != null and condition.courseIds.size() > 0">
and bc.course_id in
<foreach collection="condition.courseIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="condition.tagSearch != null and condition.tagSearch != ''">
and exists (
select 1 from staff_beisen_course_tag bct_filter
where bct_filter.course_id = bc.course_id
and bct_filter.deleted_flag = "N"
and bct_filter.tag_name like concat('%',#{condition.tagSearch},'%')
)
</if>
<if test="condition.categoryName != null and condition.categoryName != ''">
and bc.catalog_name = #{condition.categoryName}
</if>
<if test="condition.publishTimeStart != null">
and bc.publish_time >= #{condition.publishTimeStart}
</if>
<if test="condition.publishTimeEnd != null">
and bc.publish_time < #{condition.publishTimeEnd}
</if>
group by bc.course_id
</select>
<select id="findStaffTagCourseByCondition" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from staff_beisen_course
where 1=1
<if test="condition.ids!=null and condition.ids.size>0">
<foreach collection="condition.ids" item="item" separator=",">
and course_id=#{item}
</foreach>
</if>
</select>
</mapper>