LaboratorySessionMappingMapper.xml
3.25 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
<?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.LaboratorySessionMappingMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.meishu.model.LaboratorySessionMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="sessions_dict_id" property="sessionsDictId" />
<result column="laboratory_dict_id" property="laboratoryDictId" />
<result column="start_date" property="startDate" />
<result column="register_start_date" property="registerStartDate" />
<result column="register_end_date" property="registerEndDate" />
<result column="grade" property="grade" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, sessions_dict_id, laboratory_dict_id, start_date, register_start_date, register_end_date, grade
</sql>
<select id="getLaboratorySessionList"
resultType="com.meishu.vo.laboratorySession.LaboratorySessionMappingVO">
select
lsm.*,
ld.laboratory_name as laboratoryName,
ld.max_num as maxNum
from laboratory_session_mapping lsm
left join laboratory_dict ld on ld.id = lsm.laboratory_dict_id
where lsm.start_date = #{startDate}
and lsm.delete_date is null
and ld.delete_date is null
GROUP BY lsm.laboratory_dict_id
</select>
<select id="getOneById" resultType="com.meishu.vo.laboratorySession.LaboratorySessionMappingVO">
select
lsm.*,
ld.laboratory_name as laboratoryName
from laboratory_session_mapping lsm
left join laboratory_dict ld on ld.id = lsm.laboratory_dict_id
left join sessions_dict sd on sd.id = lsm.sessions_dict_id
where lsm.id = #{id}
and lsm.delete_date is null
and ld.delete_date is null
and sd.delete_date is null
</select>
<select id="getLaboratorySessionDate" resultType="com.meishu.model.LaboratorySessionMappingDO">
select
lsm.*
from laboratory_session_mapping lsm
left join laboratory_dict ld on ld.id = lsm.laboratory_dict_id
where ld.laboratory_type = #{laboratoryType}
and lsm.delete_date is null
and ld.delete_date is null
group by lsm.start_date
</select>
<select id="getList" resultType="com.meishu.model.LaboratorySessionMappingDO">
SELECT
lsm.*
FROM
laboratory_session_mapping lsm
LEFT JOIN classes_dict cd ON cd.grade = lsm.grade
LEFT JOIN classes_user_mapping cum ON cum.classes_id = cd.id
WHERE
cum.user_id = #{studentId}
AND start_date = #{startDate}
and sessions_dict_id = #{sessionsDictId}
AND cd.delete_date IS NULL
AND cum.delete_date IS NULL
AND lsm.delete_date IS NULL
</select>
</mapper>