|
@@ -1,87 +1,47 @@
|
|
|
package com.yonge.cooleshow.admin.controller;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-
|
|
|
+import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.HomeworkSearch;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.CourseScheduleEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.CourseHomeworkService;
|
|
|
import com.yonge.cooleshow.biz.dal.support.PageUtil;
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.CourseHomeworkDetailVo;
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo;
|
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import com.yonge.cooleshow.common.page.PageInfo;
|
|
|
-import com.yonge.toolset.utils.string.StringUtil;
|
|
|
-import io.swagger.annotations.*;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo;
|
|
|
-import com.yonge.cooleshow.biz.dal.dto.search.CourseHomeworkSearch;
|
|
|
-import com.yonge.cooleshow.biz.dal.entity.CourseHomework;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.CourseHomeworkService;
|
|
|
-
|
|
|
@RestController
|
|
|
-@RequestMapping("/courseHomework")
|
|
|
+@RequestMapping("/homework")
|
|
|
@Api(value = "课程作业表", tags = "课程作业表")
|
|
|
public class CourseHomeworkController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private CourseHomeworkService courseHomeworkService;
|
|
|
|
|
|
- /**
|
|
|
- * 查询单条
|
|
|
- */
|
|
|
- @GetMapping("/detail/{id}")
|
|
|
- @ApiOperation(value = "详情", notes = "传入id")
|
|
|
- public HttpResponseResult<CourseHomeworkVo> detail(@PathVariable("id") Long id) {
|
|
|
- return succeed(courseHomeworkService.detail(id));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询分页
|
|
|
- */
|
|
|
- @PostMapping("/page")
|
|
|
- @ApiOperation(value = "查询分页", notes = "传入courseHomeworkSearch")
|
|
|
- public HttpResponseResult<PageInfo<CourseHomeworkVo>> page(@RequestBody HomeworkSearch query) {
|
|
|
- IPage<CourseHomeworkVo> pages = courseHomeworkService.selectPage(PageUtil.getPage(query), query);
|
|
|
- return succeed(PageUtil.pageInfo(pages));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增
|
|
|
- */
|
|
|
- @PostMapping("/save")
|
|
|
- @ApiOperation(value = "新增", notes = "传入courseHomework")
|
|
|
- public HttpResponseResult save(@Valid @RequestBody CourseHomework courseHomework) {
|
|
|
- return status(courseHomeworkService.save(courseHomework));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 修改
|
|
|
- */
|
|
|
- @PostMapping("/update")
|
|
|
- @ApiOperation(value = "修改", notes = "传入courseHomework")
|
|
|
- public HttpResponseResult update(@Valid @RequestBody CourseHomework courseHomework) {
|
|
|
- return status(courseHomeworkService.updateById(courseHomework));
|
|
|
+
|
|
|
+ @ApiOperation(value = "课后作业-列表", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
|
|
+ @PostMapping(value = "/list", consumes = "application/json", produces = "application/json")
|
|
|
+ public HttpResponseResult<PageInfo<CourseHomeworkVo>> list(@Valid @RequestBody HomeworkSearch query) {
|
|
|
+ query.setDecorate(YesOrNoEnum.YES);
|
|
|
+ query.setCourseStatus(CourseScheduleEnum.COMPLETE);
|
|
|
+ query.setCourseType(CourseScheduleEnum.PRACTICE);
|
|
|
+ return succeed(PageUtil.pageInfo(courseHomeworkService.selectPage(PageUtil.getPage(query),query)));
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增或修改
|
|
|
- */
|
|
|
- @PostMapping("/submit")
|
|
|
- @ApiOperation(value = "新增或修改", notes = "传入courseHomework")
|
|
|
- public HttpResponseResult submit(@Valid @RequestBody CourseHomework courseHomework) {
|
|
|
- return status(courseHomeworkService.saveOrUpdate(courseHomework));
|
|
|
- }
|
|
|
|
|
|
- /**
|
|
|
- * 删除
|
|
|
- */
|
|
|
- @PostMapping("/remove")
|
|
|
- @ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
- public HttpResponseResult remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
- if (StringUtil.isEmpty(ids)) {
|
|
|
- return failed("参数不能为空");
|
|
|
- }
|
|
|
- return status(courseHomeworkService.removeByIds(StringUtil.toLongList(ids)));
|
|
|
+
|
|
|
+ @ApiOperation(value = "首页-我的课程-课程详情(陪练课)-课后作业信息详情",notes = "传入课程编号ID")
|
|
|
+ @GetMapping(value = "/detail/{courseId}")
|
|
|
+ public HttpResponseResult<CourseHomeworkDetailVo> detail(@ApiParam(value = "课程编号ID", required = true)
|
|
|
+ @PathVariable("courseId") Long courseId) {
|
|
|
+ return succeed(courseHomeworkService.getCourseHomeworkDetailByCourseId(courseId));
|
|
|
}
|
|
|
}
|