package com.dsh.account.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.dsh.account.entity.Referee; import com.dsh.account.model.RefereeList; import com.dsh.account.service.IRefereeService; import org.springframework.beans.factory.annotation.Autowired; 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.RestController; import java.util.Date; import java.util.Map; /** * @author zhibing.pu * @Date 2024/3/1 14:28 */ @RestController @RequestMapping("") public class RefereeController { @Autowired private IRefereeService refereeService; /** * 获取裁判管理列表 * @param refereeList * @return */ @PostMapping("/referee/getRefereeList") public Map getRefereeList(@RequestBody RefereeList refereeList){ return refereeService.getRefereeList(refereeList); } /** * 添加裁判 * @param referee */ @PostMapping("/referee/addReferee") public void addReferee(@RequestBody Referee referee){ referee.setState(1); referee.setCreateTime(new Date()); refereeService.save(referee); } /** * 根据id获取数据 * @param id * @return */ @PostMapping("/referee/getRefereeById") public Referee getRefereeById(@RequestBody Integer id){ return refereeService.getById(id); } /** * 根据电话号码查询 * @param phone * @return */ @PostMapping("/referee/getRefereeByPhone") public Referee getRefereeByPhone(@RequestBody String phone){ return refereeService.getOne(new QueryWrapper() .eq("phone", phone).ne("state", 3)); } /** * 修改裁判数据 * @param referee */ @PostMapping("/referee/editReferee") public void editReferee(@RequestBody Referee referee){ refereeService.updateById(referee); } }