添加三维课程相关管理接口
This commit is contained in:
parent
421d5c36c0
commit
5babfecb4c
@ -5,9 +5,9 @@ import club.joylink.rtss.vo.client.PageVO;
|
|||||||
import club.joylink.rtss.vo.draft.Lesson3DQueryVO;
|
import club.joylink.rtss.vo.draft.Lesson3DQueryVO;
|
||||||
import club.joylink.rtss.vo.draft.Lesson3DVO;
|
import club.joylink.rtss.vo.draft.Lesson3DVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/lesson3d")
|
@RequestMapping("/api/lesson3d")
|
||||||
@ -21,4 +21,33 @@ public class Lesson3dController {
|
|||||||
return this.lesson3DService.pagingQuery(queryVO);
|
return this.lesson3DService.pagingQuery(queryVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public List<Lesson3DVO> queryListBy(Lesson3DQueryVO queryVO) {
|
||||||
|
return this.lesson3DService.queryBy(queryVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path = "/{id}")
|
||||||
|
public Lesson3DVO getById(@PathVariable Long id) {
|
||||||
|
Lesson3DVO param = this.lesson3DService.getById(id);
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上线
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
@PutMapping("/{id}/online")
|
||||||
|
public void online(@PathVariable Long id) {
|
||||||
|
this.lesson3DService.online(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下线
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
@PutMapping("/{id}/offline")
|
||||||
|
public void offline(@PathVariable Long id) {
|
||||||
|
this.lesson3DService.offline(id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,18 @@ import club.joylink.rtss.vo.client.PageVO;
|
|||||||
import club.joylink.rtss.vo.draft.Lesson3DQueryVO;
|
import club.joylink.rtss.vo.draft.Lesson3DQueryVO;
|
||||||
import club.joylink.rtss.vo.draft.Lesson3DVO;
|
import club.joylink.rtss.vo.draft.Lesson3DVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface Lesson3DService {
|
public interface Lesson3DService {
|
||||||
void publish(Lesson3DVO vo);
|
void publish(Lesson3DVO vo);
|
||||||
|
|
||||||
PageVO<Lesson3DVO> pagingQuery(Lesson3DQueryVO queryVO);
|
PageVO<Lesson3DVO> pagingQuery(Lesson3DQueryVO queryVO);
|
||||||
|
|
||||||
|
List<Lesson3DVO> queryBy(Lesson3DQueryVO queryVO);
|
||||||
|
|
||||||
|
Lesson3DVO getById(Long id);
|
||||||
|
|
||||||
|
void online(Long id);
|
||||||
|
|
||||||
|
void offline(Long id);
|
||||||
}
|
}
|
||||||
|
@ -44,16 +44,65 @@ public class Lesson3DServiceImpl implements Lesson3DService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageVO<Lesson3DVO> pagingQuery(Lesson3DQueryVO queryVO) {
|
public PageVO<Lesson3DVO> pagingQuery(Lesson3DQueryVO queryVO) {
|
||||||
|
Lesson3dExample example = this.buildExampleByQueryVo(queryVO);
|
||||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||||
|
Page<Lesson3d> lesson3ds = (Page<Lesson3d>) this.lesson3dDAO.selectByExample(example);
|
||||||
|
return PageVO.convert(lesson3ds, Lesson3DVO.convertPublish2VOList(lesson3ds.getResult()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Lesson3DVO> queryBy(Lesson3DQueryVO queryVO) {
|
||||||
|
Lesson3dExample example = this.buildExampleByQueryVo(queryVO);
|
||||||
|
List<Lesson3d> lesson3ds = this.lesson3dDAO.selectByExample(example);
|
||||||
|
return Lesson3DVO.convertPublish2VOList(lesson3ds);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Lesson3dExample buildExampleByQueryVo(Lesson3DQueryVO queryVO) {
|
||||||
Lesson3dExample example = new Lesson3dExample();
|
Lesson3dExample example = new Lesson3dExample();
|
||||||
Lesson3dExample.Criteria criteria = example.createCriteria().andStateEqualTo(StatusEnum.Valid.getCode());
|
Lesson3dExample.Criteria criteria = example.createCriteria()
|
||||||
|
.andStateEqualTo(StatusEnum.Valid.getCode());
|
||||||
if (StringUtils.hasText(queryVO.getName())) {
|
if (StringUtils.hasText(queryVO.getName())) {
|
||||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||||
}
|
}
|
||||||
if (StringUtils.hasText(queryVO.getType())) {
|
if (StringUtils.hasText(queryVO.getType())) {
|
||||||
criteria.andTypeLike(String.format("%%%s%%", queryVO.getType()));
|
criteria.andTypeLike(String.format("%%%s%%", queryVO.getType()));
|
||||||
}
|
}
|
||||||
Page<Lesson3d> lesson3ds = (Page<Lesson3d>) this.lesson3dDAO.selectByExample(example);
|
return example;
|
||||||
return PageVO.convert(lesson3ds, Lesson3DVO.convertPublish2VOList(lesson3ds.getResult()));
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Lesson3DVO getById(Long id) {
|
||||||
|
Lesson3d lesson3d = this.lesson3dDAO.selectByPrimaryKey(id);
|
||||||
|
return new Lesson3DVO(lesson3d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void online(Long id) {
|
||||||
|
Lesson3dExample example = new Lesson3dExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andIdEqualTo(id);
|
||||||
|
List<Lesson3d> list = this.lesson3dDAO.selectByExample(example);
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
Lesson3d lesson3d = list.get(0);
|
||||||
|
if (!StatusEnum.Valid.getCode().equals(lesson3d.getState())) {
|
||||||
|
lesson3d.setState(StatusEnum.Valid.getCode());
|
||||||
|
this.lesson3dDAO.updateByPrimaryKey(lesson3d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void offline(Long id) {
|
||||||
|
Lesson3dExample example = new Lesson3dExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andIdEqualTo(id);
|
||||||
|
List<Lesson3d> list = this.lesson3dDAO.selectByExample(example);
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
Lesson3d lesson3d = list.get(0);
|
||||||
|
if (!StatusEnum.Invalid.getCode().equals(lesson3d.getState())) {
|
||||||
|
lesson3d.setState(StatusEnum.Invalid.getCode());
|
||||||
|
this.lesson3dDAO.updateByPrimaryKey(lesson3d);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user