Browse Source

行政直播课创建或修改时校验是否有班级

tags/正式3.9.0
雍文秀 1 year ago
parent
commit
9ebc3868f9

+ 21
- 1
slive/src/main/java/com/xhkjedu/slive/controller/xz/XzController.java View File

63
         if (DatesUtil.dateNan(xz.getBegindate()) || DatesUtil.dateNan(xz.getEnddate())) {
63
         if (DatesUtil.dateNan(xz.getBegindate()) || DatesUtil.dateNan(xz.getEnddate())) {
64
             return new ResultVo(1, "日期格式不正确");
64
             return new ResultVo(1, "日期格式不正确");
65
         }
65
         }
66
-        return xzService.saveXz(xz);
66
+        ResultVo vo = xzService.saveXz(xz);
67
+        if (vo.getCode() == 0) {
68
+            xzService.checkClass(xz.getSchoolid(), xz.getGradeid());
69
+        }
70
+        return vo;
67
     }
71
     }
68
 
72
 
69
     /**
73
     /**
80
         return new ResultVo(0, "修改成功");
84
         return new ResultVo(0, "修改成功");
81
     }
85
     }
82
 
86
 
87
+    /**
88
+     * @Description 校验班级
89
+     * @Param [xz]
90
+     * @Author ywx
91
+     * @Date 2023/6/1 16:15
92
+     * @return com.xhkjedu.vo.ResultVo
93
+     **/
94
+    @PostMapping("/cc")
95
+    public ResultVo checkClass(@RequestBody LXz xz) {
96
+        Integer schoolid = xz.getSchoolid();
97
+        Integer gradeid = xz.getGradeid();
98
+        N_Utils.validation(new Object[]{schoolid, "学校id", 1, gradeid, "年级id", 1});
99
+        xzService.checkClass(schoolid, gradeid);
100
+        return new ResultVo(0, "校验班级成功");
101
+    }
102
+
83
     /**
103
     /**
84
      * @Description 行政直播详细信息
104
      * @Description 行政直播详细信息
85
      * @Param [xz]
105
      * @Param [xz]

+ 16
- 0
slive/src/main/java/com/xhkjedu/slive/service/xz/XzService.java View File

122
         }
122
         }
123
     }
123
     }
124
 
124
 
125
+    /**
126
+     * @Description 校验学校当前年份指定年级下是否有行政班和提高班
127
+     * @Param [schoolid, gradeid]
128
+     * @Author ywx
129
+     * @Date 2023/6/1 15:45
130
+     * @return void
131
+     **/
132
+    public void checkClass(Integer schoolid, Integer gradeid) {
133
+        List<XzClassVo> list = classMapper.listClassByXzid(schoolid, gradeid);
134
+        if (N_Utils.isListEmpty(list)) {
135
+            throw new MissingParametersException("该年级下没有班级,请添加班级后再进行下一步");
136
+        }
137
+    }
138
+
125
     /**
139
     /**
126
      * @Description 修改行政直播
140
      * @Description 修改行政直播
127
      * @Param [xz]
141
      * @Param [xz]
130
      * @Date 2022/3/30 14:16
144
      * @Date 2022/3/30 14:16
131
      **/
145
      **/
132
     public void updateXz(LXz xz) {
146
     public void updateXz(LXz xz) {
147
+        LXz lXz = xzMapper.selectByPrimaryKey(xz.getXzid());
148
+        checkClass(lXz.getSchoolid(), lXz.getGradeid());
133
         xzMapper.updateByPrimaryKeySelective(xz);
149
         xzMapper.updateByPrimaryKeySelective(xz);
134
     }
150
     }
135
 
151
 

Loading…
Cancel
Save