|
|
@@ -0,0 +1,93 @@
|
|
|
+package com.mokamrp.privates.controller.pangu;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.mokamrp.privates.constant.Constants;
|
|
|
+import com.mokamrp.privates.constant.HttpStatus;
|
|
|
+import com.mokamrp.privates.controller.BaseController;
|
|
|
+import com.mokamrp.privates.entity.AddHandle;
|
|
|
+import com.mokamrp.privates.entity.DelHandle;
|
|
|
+import com.mokamrp.privates.entity.ResHandle;
|
|
|
+import com.mokamrp.privates.entity.pangu.FosterwxTeachingVideoHandle;
|
|
|
+import com.mokamrp.privates.help.AjaxResult;
|
|
|
+import com.mokamrp.privates.interceptor.AuthUser;
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTeachingVideo;
|
|
|
+import com.mokamrp.privates.mapper.pojo.User;
|
|
|
+import com.mokamrp.privates.service.pangu.FosterwxTeachingVideoService;
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author leon
|
|
|
+ * @since 2021-09-14
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/pangu/fosterwxTeachingVideo")
|
|
|
+public class FosterwxTeachingVideoController extends BaseController<FosterwxTeachingVideo> {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public FosterwxTeachingVideoService fosterwxTeachingVideoService;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * @fast
|
|
|
+ * 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
|
|
|
+ * 如果需要定制化,需要将BaseController中对应的方法复制到当前控制器,然后进行修改
|
|
|
+ */
|
|
|
+
|
|
|
+ @PostMapping("/list")
|
|
|
+ public Object list(@Valid @RequestBody FosterwxTeachingVideoHandle handle, BindingResult bindingResult) {
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
+ }
|
|
|
+ ResHandle<List<FosterwxTeachingVideo>> res = fosterwxTeachingVideoService.getList(handle);
|
|
|
+ return AjaxResult.success(res);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/delPro")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Object delPro(@RequestBody DelHandle<T> delHandle, @AuthUser User user) {
|
|
|
+ fosterwxTeachingVideoService.update(new FosterwxTeachingVideo() {{
|
|
|
+ setDelFlg(0);
|
|
|
+ setUpdateAt(LocalDateTime.now());
|
|
|
+ setUpdateUid(user.getId());
|
|
|
+ }}, new LambdaQueryWrapper<FosterwxTeachingVideo>().in(FosterwxTeachingVideo::getId, Arrays.asList(delHandle.getIds().split(","))));
|
|
|
+
|
|
|
+ return AjaxResult.success("删除成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/addPro")
|
|
|
+ public Object add(@Valid @RequestBody AddHandle<FosterwxTeachingVideo> addHandle, @AuthUser User user, BindingResult bindingResult) {
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
+ }
|
|
|
+ this.onInsert(addHandle.getRaw());
|
|
|
+ addHandle.getRaw().setUpdateUid(user.getId());
|
|
|
+ addHandle.getRaw().setCreateUid(user.getId());
|
|
|
+ addHandle.getRaw().setCreateName(user.getName());
|
|
|
+ Boolean res = service.save(addHandle.getRaw());
|
|
|
+ if (res) {
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error("新增失败", res);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|