|
@@ -1,34 +1,21 @@
|
|
package com.yonge.cooleshow.teacher.controller;
|
|
package com.yonge.cooleshow.teacher.controller;
|
|
|
|
|
|
|
|
+import com.yonge.cooleshow.biz.dal.dto.req.TeacherSetReq;
|
|
import com.yonge.cooleshow.biz.dal.vo.TeacherHomeVo;
|
|
import com.yonge.cooleshow.biz.dal.vo.TeacherHomeVo;
|
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
|
-
|
|
|
|
-import java.util.List;
|
|
|
|
-
|
|
|
|
-import javax.validation.Valid;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
-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.RequestParam;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
-import com.yonge.cooleshow.biz.dal.dao.SubjectDao;
|
|
|
|
import com.yonge.cooleshow.biz.dal.entity.Teacher;
|
|
import com.yonge.cooleshow.biz.dal.entity.Teacher;
|
|
import com.yonge.cooleshow.biz.dal.service.TeacherService;
|
|
import com.yonge.cooleshow.biz.dal.service.TeacherService;
|
|
-import com.yonge.cooleshow.biz.dal.support.Condition;
|
|
|
|
-import com.yonge.cooleshow.biz.dal.support.Query;
|
|
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
-import com.yonge.toolset.utils.string.StringUtil;
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/Teacher")
|
|
@RequestMapping("/Teacher")
|
|
@@ -41,9 +28,6 @@ public class TeacherController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private SysUserFeignService sysUserFeignService;
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private SubjectDao subjectDao;
|
|
|
|
-
|
|
|
|
@ApiOperation(value = "根据教师编号查询教师基本信息")
|
|
@ApiOperation(value = "根据教师编号查询教师基本信息")
|
|
@GetMapping("/queryUserInfo")
|
|
@GetMapping("/queryUserInfo")
|
|
public HttpResponseResult<TeacherHomeVo> queryUserInfo() {
|
|
public HttpResponseResult<TeacherHomeVo> queryUserInfo() {
|
|
@@ -51,10 +35,10 @@ public class TeacherController extends BaseController {
|
|
if (user == null) {
|
|
if (user == null) {
|
|
return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
}
|
|
}
|
|
- Teacher teacher = teacherService.detail1(user.getId());
|
|
|
|
|
|
+ Teacher teacher = teacherService.getById(user.getId());
|
|
TeacherHomeVo teacherHomeVo = new TeacherHomeVo();
|
|
TeacherHomeVo teacherHomeVo = new TeacherHomeVo();
|
|
teacherHomeVo.setHeardUrl(user.getAvatar());
|
|
teacherHomeVo.setHeardUrl(user.getAvatar());
|
|
- teacherHomeVo.setName(user.getUsername());
|
|
|
|
|
|
+ teacherHomeVo.setUsername(user.getUsername());
|
|
//todo 老师授课信息
|
|
//todo 老师授课信息
|
|
teacherHomeVo.setStarGrade(1);
|
|
teacherHomeVo.setStarGrade(1);
|
|
teacherHomeVo.setFansNum(1);
|
|
teacherHomeVo.setFansNum(1);
|
|
@@ -76,84 +60,41 @@ public class TeacherController extends BaseController {
|
|
return HttpResponseResult.succeed(true);
|
|
return HttpResponseResult.succeed(true);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 查询单条
|
|
|
|
- */
|
|
|
|
- @GetMapping("/detail")
|
|
|
|
- @ApiOperation(value = "详情", notes = "传入teacher")
|
|
|
|
- public HttpResponseResult<Teacher> detail(Teacher teacher) {
|
|
|
|
- Teacher detail = teacherService.getOne(Condition.getQueryWrapper(teacher));
|
|
|
|
|
|
+ @GetMapping("/getSetDetail")
|
|
|
|
+ @ApiOperation(value = "获取设置详情")
|
|
|
|
+ public HttpResponseResult<TeacherVo> getSetDetail() {
|
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
|
+ if (user == null) {
|
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
|
+ }
|
|
|
|
+ TeacherVo detail = teacherService.getSetDetail(user.getId());
|
|
return succeed(detail);
|
|
return succeed(detail);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 查询单条
|
|
|
|
- */
|
|
|
|
- @GetMapping("/detail1")
|
|
|
|
- @ApiOperation(value = "详情", notes = "传入teacher")
|
|
|
|
- public HttpResponseResult<Teacher> detail1(Teacher teacher) {
|
|
|
|
- return succeed(teacherService.detail1(teacher.getUserId()));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 查询集合
|
|
|
|
- */
|
|
|
|
- @GetMapping("/list")
|
|
|
|
- @ApiOperation(value = "查询集合", notes = "传入teacher")
|
|
|
|
- public HttpResponseResult<List<Teacher>> list(Teacher teacher) {
|
|
|
|
- List<Teacher> list = teacherService.list();
|
|
|
|
- return succeed(list);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 查询分页
|
|
|
|
- */
|
|
|
|
- @GetMapping("/page")
|
|
|
|
- @ApiOperation(value = "查询分页", notes = "传入teacher")
|
|
|
|
- public HttpResponseResult<IPage<Teacher>> page(Teacher teacher, Query query) {
|
|
|
|
- IPage<Teacher> pages = teacherService.selectPage(Condition.getPage(query), teacher);
|
|
|
|
- return succeed(pages);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 新增
|
|
|
|
- */
|
|
|
|
- @PostMapping("/save")
|
|
|
|
- @ApiOperation(value = "新增", notes = "传入teacher")
|
|
|
|
- public HttpResponseResult save(@Valid @RequestBody Teacher teacher) {
|
|
|
|
- return status(teacherService.save(teacher));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 修改
|
|
|
|
- */
|
|
|
|
- @PostMapping("/update")
|
|
|
|
- @ApiOperation(value = "修改", notes = "传入teacher")
|
|
|
|
- public HttpResponseResult update(@Valid @RequestBody Teacher teacher) {
|
|
|
|
- return status(teacherService.updateById(teacher));
|
|
|
|
- }
|
|
|
|
|
|
+ @PostMapping("/submitSetDetail")
|
|
|
|
+ @ApiOperation(value = "修改设置信息", notes = "传入teacher")
|
|
|
|
+ public HttpResponseResult<TeacherVo> submitSetDetail(@RequestBody TeacherSetReq setReq) {
|
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
|
+ if (user == null) {
|
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
|
+ }
|
|
|
|
+ //设置
|
|
|
|
+ teacherService.submitSetDetail(setReq,user.getId());
|
|
|
|
|
|
- /**
|
|
|
|
- * 新增或修改
|
|
|
|
- */
|
|
|
|
- @PostMapping("/submit")
|
|
|
|
- @ApiOperation(value = "新增或修改", notes = "传入teacher")
|
|
|
|
- public HttpResponseResult submit(@RequestBody Teacher teacher) {
|
|
|
|
- return status(teacherService.saveOrUpdate(teacher));
|
|
|
|
|
|
+ return succeed(teacherService.getSetDetail(user.getId()));
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 删除
|
|
|
|
- */
|
|
|
|
- @PostMapping("/remove")
|
|
|
|
- @ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
|
- public HttpResponseResult remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
|
- if (StringUtil.isEmpty(ids)) {
|
|
|
|
- return failed("参数不能为空");
|
|
|
|
|
|
+ @PostMapping("/updatePassword")
|
|
|
|
+ @ApiOperation(value = "修改密码", notes = "传入teacher")
|
|
|
|
+ public HttpResponseResult<TeacherVo> updatePassword(@RequestBody TeacherSetReq setReq) {
|
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
|
+ if (user == null) {
|
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
}
|
|
}
|
|
- return status(teacherService.removeByIds(StringUtil.toLongList(ids)));
|
|
|
|
- }
|
|
|
|
|
|
+ //设置
|
|
|
|
+ teacherService.submitSetDetail(setReq,user.getId());
|
|
|
|
|
|
|
|
+ return succeed(teacherService.getSetDetail(user.getId()));
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|