package com.dsh.course.controller;
|
|
import com.dsh.course.entity.CancelledClasses;
|
import com.dsh.course.feignclient.account.AppUserClient;
|
import com.dsh.course.feignclient.account.CoachClient;
|
import com.dsh.course.feignclient.other.StoreClient;
|
import com.dsh.course.model.CancelClassesQuery;
|
import com.dsh.course.model.CancelClassesVO;
|
import com.dsh.course.service.CancelledClassesService;
|
import org.checkerframework.checker.units.qual.A;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
|
/**
|
* @author zhibing.pu
|
* @Date 2023/8/12 3:47
|
*/
|
@RestController
|
@RequestMapping("")
|
public class CancelledClassesController {
|
|
@Autowired
|
private CancelledClassesService cancelledClassesService;
|
@Autowired
|
private StoreClient storeClient;
|
@Autowired
|
private AppUserClient appUserClient;
|
@Autowired
|
private CoachClient coachClient;
|
/**
|
* 获取消课记录
|
*/
|
@ResponseBody
|
@PostMapping("/cancelledClasses/listAll")
|
public List<CancelClassesVO> listAll(@RequestBody CancelClassesQuery query){
|
List<CancelClassesVO> result = cancelledClassesService.listAll(query);
|
for (CancelClassesVO cancelClassesVO : result) {
|
cancelClassesVO.setStoreName(storeClient.queryStoreById(cancelClassesVO.getStoreId()).getName());
|
cancelClassesVO.setStudentName(appUserClient.queryAppUser(cancelClassesVO.getStudentId()).getName());
|
cancelClassesVO.setCoachName(coachClient.queryCoachById(cancelClassesVO.getCoachId()).getName());
|
}
|
return result;
|
}
|
|
/**
|
* 添加数据
|
* @param cancelledClasses
|
*/
|
@ResponseBody
|
@PostMapping("/cancelledClasses/addCancelledClasses")
|
public void addCancelledClasses(@RequestBody CancelledClasses cancelledClasses){
|
cancelledClassesService.save(cancelledClasses);
|
}
|
|
}
|