Browse Source

1.6校外导师

Crazy 2 weeks ago
parent
commit
a78a3152f6

+ 3 - 6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/supervisorSelectionSetting/supervisorSelectionSettingController.java

@@ -1,12 +1,11 @@
 package cn.iocoder.yudao.module.system.controller.admin.supervisorSelectionSetting;
 
-import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
 import cn.iocoder.yudao.module.system.controller.admin.studentSelectionProject.vo.studentSelectionProjectSaveReqVO;
-import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
+
 import cn.iocoder.yudao.module.system.service.permission.PermissionService;
 import cn.iocoder.yudao.module.system.service.studentSelectionProject.studentSelectionProjectService;
 import cn.iocoder.yudao.module.system.service.user.AdminUserService;
-import org.apache.ibatis.annotations.Param;
+
 import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
 import org.springframework.validation.annotation.Validated;
@@ -15,11 +14,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.Operation;
 
-import javax.validation.constraints.*;
 import javax.validation.*;
 import javax.servlet.http.*;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
+
 import java.util.*;
 import java.io.IOException;
 

+ 3 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/supervisorSelectionSetting/vo/supervisorSelectionSettingRespVO.java

@@ -65,6 +65,9 @@ public class supervisorSelectionSettingRespVO {
     @Schema(description = "选择状态")
     private  Integer selectType;
 
+    @Schema(description = "合作导师")
+    private String workSupervisor;
+
 
 
 }

+ 3 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/supervisorSelectionSetting/supervisorSelectionSettingDO.java

@@ -88,4 +88,7 @@ public class supervisorSelectionSettingDO extends BaseDO {
     @TableField(exist = false)
     private  Integer selectType;
 
+    @TableField(exist = false)
+    private String workSupervisor;
+
 }

+ 1 - 13
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/supervisorSelectionSetting/supervisorSelectionSettingMapper.java

@@ -44,19 +44,7 @@ public interface supervisorSelectionSettingMapper extends BaseMapperX<supervisor
         return selectPage(reqVO,mpjLambdaWrapperX);
     }
 
-    default supervisorSelectionSettingDO getSettingBySupervisorIdAndProjectId(@Param("supervisorId") Long supervisorId,@Param("projectId") Integer projectId){
-        MPJLambdaWrapperX<supervisorSelectionSettingDO> mpjLambdaWrapperX = new MPJLambdaWrapperX<>();
-        mpjLambdaWrapperX
-                .selectAll(supervisorSelectionSettingDO.class)
-                .leftJoin(AdminUserDO.class, AdminUserDO::getId, supervisorSelectionSettingDO::getSupervisorId)
-                .selectAs(AdminUserDO::getNickname,supervisorSelectionSettingDO::getSupervisorName)//导师姓名
-                .selectAs(AdminUserDO::getUserType,supervisorSelectionSettingDO::getUserType)//导师类型
-                .selectAs(AdminUserDO::getTitle,supervisorSelectionSettingDO::getTitle)//导师职称
-                .selectAs(AdminUserDO::getMajor,supervisorSelectionSettingDO::getMajor)//导师研究方向
-                .eqIfExists(supervisorSelectionSettingDO::getSupervisorId,supervisorId)
-                .eqIfExists(supervisorSelectionSettingDO::getProjectId,projectId);
-        return selectOne(mpjLambdaWrapperX);
-    }
+     supervisorSelectionSettingDO getSettingBySupervisorIdAndProjectId(@Param("supervisorId") Long supervisorId,@Param("projectId") Integer projectId);
 
 //    @Select("SELECT * FROM supervisor_selection_setting WHERE supervisor_id = #{supervisorId} AND project_id = #{projectId} AND deleted =0")
 //    supervisorSelectionSettingDO getSettingBySupervisorIdAndProjectId(@Param("supervisorId") Long supervisorId,@Param("projectId") Integer projectId);

+ 29 - 7
yudao-module-system/yudao-module-system-biz/src/main/resources/Mapper/supervisorSelectionSetting/supervisorSelectionSettingMapper.xml

@@ -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>