CourseDictDAO.xml
1.45 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
<?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.zhongzhi.dao.CourseDictDAO">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.zhongzhi.model.CourseDictDO">
<id column="id" property="id"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delete_time" property="deleteTime"/>
<result column="course_name" property="courseName"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_time,
update_time,
delete_time,
id, course_name, vod_cnt
</sql>
<select id="courses" parameterType="string" resultType="com.zhongzhi.vo.course.CoursesVO">
SELECT
t.id,
t.course_name,
t3.cnt as vodCnt
FROM
course_dict t
LEFT JOIN ( SELECT t2.course_id, count( 1 ) AS cnt FROM vod_dict t2 WHERE t2.delete_time IS NULL GROUP BY t2.course_id ) t3 ON t.id = t3.course_id
WHERE
t.delete_time IS NULL
<if test="courseName != null and courseName != ''">
and t.course_name like concat('%', #{courseName}, '%')
</if>
and t.year_id =#{yearId}
</select>
</mapper>