74 lines
2.2 KiB
Java
74 lines
2.2 KiB
Java
package com.hivekion.team.controller;
|
|
|
|
import com.hivekion.baseData.controller.BaseController;
|
|
import com.hivekion.common.entity.PagedResultVo;
|
|
import com.hivekion.common.entity.ResponseData;
|
|
import com.hivekion.common.uuid.IdUtils;
|
|
import com.hivekion.team.entity.Teaminfo;
|
|
import com.hivekion.team.service.ITeaminfoService;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import java.util.List;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
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;
|
|
|
|
/**
|
|
* <p>
|
|
* 前端控制器
|
|
* </p>
|
|
*
|
|
* @author liDongYu
|
|
* @since 2025-09-08
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/team")
|
|
public class TeaminfoController extends BaseController {
|
|
|
|
@Resource
|
|
private ITeaminfoService teaminfoService;
|
|
|
|
/**
|
|
* 查询想定列表
|
|
*
|
|
* @return 查询结果
|
|
*/
|
|
@ApiOperation(value = "分页查询房间列表", notes = "")
|
|
@GetMapping("/list")
|
|
public PagedResultVo<Teaminfo> list(Teaminfo search) {
|
|
|
|
//设置开始索引
|
|
search.setStart(search.getPageSize() * (search.getPageNum() - 1));
|
|
//查询结果列表
|
|
List<Teaminfo> list = teaminfoService.list(search);
|
|
//查询总数
|
|
Long total = teaminfoService.count(search);
|
|
return list(search, list, total);
|
|
}
|
|
|
|
@PostMapping("/save")
|
|
public ResponseData<Object> save(@Validated @RequestBody Teaminfo room,
|
|
BindingResult bindingResult) {
|
|
if (bindingResult.hasErrors()) {
|
|
return bindingErrors(bindingResult);
|
|
}
|
|
if (room.getId() == null) {
|
|
room.setGuid(IdUtils.simpleUUID());
|
|
}
|
|
teaminfoService.saveOrUpdate(room);
|
|
return ResponseData.success(room);
|
|
}
|
|
|
|
@GetMapping("/remove/{id}")
|
|
public ResponseData<Void> remove(@PathVariable("id") Integer id) {
|
|
teaminfoService.removeById(id);
|
|
return ResponseData.success(null);
|
|
}
|
|
}
|