瀏覽代碼

职高对口升学 专业类别

jinxia.mo 1 周之前
父節點
當前提交
8e667e4fa7
共有 1 個文件被更改,包括 22 次插入11 次删除
  1. 22 11
      ie-admin/src/main/java/com/ruoyi/web/controller/front/UserController.java

+ 22 - 11
ie-admin/src/main/java/com/ruoyi/web/controller/front/UserController.java

@@ -63,8 +63,9 @@ public class UserController extends BaseController {
     private final IDzAgentService agentService;
     private final ISysDeptService deptService;
     private final IDzTeacherService dzTeacherService;
+    private final IDzSubjectService dzSubjectService;
 
-    public UserController(IDzControlService dzControlService, SysLoginService loginService, ISysUserService userService, SysPermissionService permissionService, TokenService tokenService, CommService commService, ISysConfigService configService, IDzCardsService dzCardsService, IDzSchoolService dzSchoolService, IDzClassesService dzClassesService, DzSchoolMapper dzSchoolMapper, DzClassesMapper dzClassesMapper, IDzAgentService agentService, ISysDeptService deptService, IDzTeacherService dzTeacherService) {
+    public UserController(IDzControlService dzControlService, SysLoginService loginService, ISysUserService userService, SysPermissionService permissionService, TokenService tokenService, CommService commService, ISysConfigService configService, IDzCardsService dzCardsService, IDzSchoolService dzSchoolService, IDzClassesService dzClassesService, DzSchoolMapper dzSchoolMapper, DzClassesMapper dzClassesMapper, IDzAgentService agentService, ISysDeptService deptService, IDzTeacherService dzTeacherService, IDzSubjectService dzSubjectService) {
         this.dzControlService = dzControlService;
         this.loginService = loginService;
         this.userService = userService;
@@ -80,6 +81,7 @@ public class UserController extends BaseController {
         this.agentService = agentService;
         this.deptService = deptService;
         this.dzTeacherService = dzTeacherService;
+        this.dzSubjectService = dzSubjectService;
     }
 
     @GetMapping(value = "provinces")
@@ -123,17 +125,26 @@ public class UserController extends BaseController {
     @ApiOperation("专业类别列表")
     public AjaxResult examMajor(@RequestParam String location, @RequestParam ExamType examType)
     {
-        List<JSONObject> list = new ArrayList<>();
-        if(ExamType.VHS.equals(examType)) {
-            JSONObject o = new JSONObject();
-            o.put("dictValue", 1);
-            o.put("dictLabel", "农林类");
-            list.add(o);
-            o = new JSONObject();
-            o.put("dictValue", 2);
-            o.put("dictLabel", "养殖类");
-            list.add(o);
+        if (StringUtils.isBlank(location) || null ==examType) {
+            examType = VistorContextHolder.getExamType();
+            location = VistorContextHolder.getLocation();
         }
+        // 构建查询条件
+        DzSubject cond = new DzSubject();
+        cond.setLocations(location);
+        cond.setExamTypes(examType.name());
+
+        // 查询科目列表
+        List<DzSubject> subjectList = dzSubjectService.selectDzSubjectList(cond);
+
+        // 转换为返回格式
+        List<JSONObject> list = subjectList.stream().map(subject -> {
+            JSONObject o = new JSONObject();
+            o.put("dictValue", subject.getSubjectId());
+            o.put("dictLabel", subject.getSubjectName());
+            return o;
+        }).collect(Collectors.toList());
+
         return AjaxResult.success(list);
     }