New file |
| | |
| | | package cn.exrick.xboot.your.controller; |
| | | |
| | | import cn.exrick.xboot.core.common.utils.PageUtil; |
| | | import cn.exrick.xboot.core.common.utils.ResultUtil; |
| | | import cn.exrick.xboot.core.common.vo.PageVo; |
| | | import cn.exrick.xboot.core.common.vo.Result; |
| | | import cn.exrick.xboot.your.entity.AnnualReview; |
| | | import cn.exrick.xboot.your.service.IAnnualReviewService; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhangzeli |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @Api(tags = "年审记录管理接口") |
| | | @RequestMapping("/xboot/annualReview") |
| | | @Transactional |
| | | public class AnnualReviewController { |
| | | |
| | | @Autowired |
| | | private IAnnualReviewService iAnnualReviewService; |
| | | |
| | | @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) |
| | | @ApiOperation(value = "通过id获取") |
| | | public Result<AnnualReview> get(@PathVariable String id) { |
| | | |
| | | AnnualReview annualReview = iAnnualReviewService.getById(id); |
| | | return new ResultUtil<AnnualReview>().setData(annualReview); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getAll", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取全部数据") |
| | | public Result<List<AnnualReview>> getAll() { |
| | | |
| | | List<AnnualReview> list = iAnnualReviewService.list(); |
| | | return new ResultUtil<List<AnnualReview>>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getByPage", method = RequestMethod.GET) |
| | | @ApiOperation(value = "分页获取") |
| | | public Result<IPage<AnnualReview>> getByPage(PageVo page) { |
| | | |
| | | IPage<AnnualReview> data = iAnnualReviewService.page(PageUtil.initMpPage(page)); |
| | | return new ResultUtil<IPage<AnnualReview>>().setData(data); |
| | | } |
| | | |
| | | @RequestMapping(value = "/insertOrUpdate", method = RequestMethod.POST) |
| | | @ApiOperation(value = "编辑或更新数据") |
| | | public Result<AnnualReview> saveOrUpdate(AnnualReview annualReview) { |
| | | |
| | | if (iAnnualReviewService.saveOrUpdate(annualReview)) { |
| | | return new ResultUtil<AnnualReview>().setData(annualReview); |
| | | } |
| | | return new ResultUtil<AnnualReview>().setErrorMsg("操作失败"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/delByIds", method = RequestMethod.POST) |
| | | @ApiOperation(value = "批量通过id删除") |
| | | public Result<Object> delAllByIds(@RequestParam String[] ids) { |
| | | |
| | | for (String id : ids) { |
| | | iAnnualReviewService.removeById(id); |
| | | } |
| | | return ResultUtil.success("批量通过id删除数据成功"); |
| | | } |
| | | } |