package com.dsh.account.controller;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.dsh.account.entity.Coach;
|
import com.dsh.account.service.CoachService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
|
@RestController
|
@RequestMapping("")
|
public class CoachController {
|
|
@Autowired
|
private CoachService service;
|
|
/**
|
* 根据门店
|
* @param id
|
* @return
|
*/
|
@ResponseBody
|
@PostMapping("/coach/queryCoachById")
|
public Coach queryCoachById(@RequestBody Integer id){
|
try {
|
return service.getById(id);
|
}catch (Exception e){
|
e.printStackTrace();
|
return null;
|
}
|
}
|
|
|
/**
|
* 获取城市下的所有教练
|
* @param cityCode
|
* @return
|
*/
|
@ResponseBody
|
@PostMapping("/coach/queryCoachByCity")
|
public List<Coach> queryCoachByCity(@RequestBody String cityCode){
|
return service.list(new QueryWrapper<Coach>().eq("cityCode", cityCode).eq("state", 1));
|
}
|
}
|