KnowledgeSubjectDictMapper.xml
2.13 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
<?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.meishu.mapper.KnowledgeSubjectDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.meishu.model.KnowledgeSubjectDictDO">
<id column="id" property="id" />
<result column="create_date" property="createTime" />
<result column="update_date" property="updateTime" />
<result column="create_date" property="deleteTime" />
<result column="subject_name" property="subjectName" />
<result column="subject_type" property="subjectType" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
create_date,
id, subject_name, subject_type
</sql>
<select id="getSubjectAdminister" resultType="com.meishu.model.AdministerDO">
SELECT
t2.*
FROM
administer_subject_mapping t
LEFT JOIN administer t2 ON t.administer_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
<if test="subjectId!=null and subjectId !=''">
AND t.subject_id = #{subjectId}
</if>
<if test="userName !=null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
</select>
<select id="getAdministerSubjects" resultType="com.meishu.model.KnowledgeSubjectDictDO">
SELECT
t2.*
FROM
administer_subject_mapping t
LEFT JOIN knowledge_subject_dict t2 ON t.subject_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.administer_id = #{userId}
<if test="subjectName!=null and subjectName !=''">
and t2.subject_name like concat('%',#{subjectName} ,'%')
</if>
<if test="subjectType!=null and subjectType!=''">
and t2.subject_type = #{subjectType}
</if>
</select>
</mapper>