|
@@ -1,12 +1,34 @@
|
|
|
<?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.iocoder.yudao.module.system.dal.mysql.supervisorSelectionSetting.supervisorSelectionSettingMapper">
|
|
|
+ <select id="getSettingBySupervisorIdAndProjectId" resultType="cn.iocoder.yudao.module.system.dal.dataobject.supervisorSelectionSetting.supervisorSelectionSettingDO">
|
|
|
+ SELECT
|
|
|
+ s.*,
|
|
|
+ su_supervisor.nickname AS supervisorName,
|
|
|
+ su_supervisor.user_type AS userType,
|
|
|
+ su_supervisor.title AS title,
|
|
|
+ su_supervisor.major AS major,
|
|
|
+ CASE
|
|
|
+ WHEN su_supervisor.user_type = 5 AND su_supervisor.supervisor_id IS NOT NULL AND su_supervisor.supervisor_id != 0 THEN su_internalSupervisor.nickname
|
|
|
+ WHEN su_supervisor.user_type = 3 AND su_supervisor.external_supervisor_id IS NOT NULL AND su_supervisor.external_supervisor_id != 0 THEN su_externalSupervisor.nickname
|
|
|
+ ELSE NULL
|
|
|
+ END AS workSupervisor
|
|
|
+ FROM
|
|
|
+ supervisor_selection_setting s
|
|
|
+ LEFT JOIN
|
|
|
+ system_users su_supervisor ON s.supervisor_id = su_supervisor.id
|
|
|
+ -- 是校外的时候,这个连接的su_internalSupervisor代表校内导师
|
|
|
+ LEFT JOIN system_users su_internalSupervisor ON su_supervisor.supervisor_id = su_internalSupervisor.id
|
|
|
+ -- -- 是校内的时候,这个连接的su_externalSupervisor代表校外导师
|
|
|
+ LEFT JOIN system_users su_externalSupervisor ON su_supervisor.external_supervisor_id = su_externalSupervisor.id
|
|
|
|
|
|
- <!--
|
|
|
- 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
|
- 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
|
- 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
|
- 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
|
- -->
|
|
|
-
|
|
|
+ <where>
|
|
|
+ <if test="supervisorId != null">
|
|
|
+ AND s.supervisor_id = #{supervisorId}
|
|
|
+ </if>
|
|
|
+ <if test="projectId != null">
|
|
|
+ AND s.project_id = #{projectId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
</mapper>
|