CostShareLevelController.java 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package com.imed.costaccount.web;
  2. import com.imed.costaccount.common.util.Result;
  3. import com.imed.costaccount.model.User;
  4. import com.imed.costaccount.model.dto.CostShareLevelEditDto;
  5. import com.imed.costaccount.model.dto.CostShareLevelSaveDto;
  6. import com.imed.costaccount.model.vo.CostShareLevelVO;
  7. import com.imed.costaccount.service.CostShareLevelService;
  8. import com.imed.costaccount.utils.PageUtils;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import org.apache.shiro.SecurityUtils;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.*;
  14. import javax.validation.Valid;
  15. import java.util.Arrays;
  16. import java.util.List;
  17. /**
  18. * 分摊层级对照表
  19. *
  20. * @author KCYG
  21. * @date 2021-07-27 14:19:09
  22. */
  23. @RestController
  24. @RequestMapping("/costAccount/costsharelevel")
  25. @Api(tags = "分摊层级相关操作")
  26. public class CostShareLevelController {
  27. @Autowired
  28. private CostShareLevelService costShareLevelService;
  29. /**
  30. * 分页查询列表
  31. */
  32. @GetMapping("/list")
  33. @ApiOperation("分页查询分摊层级数据")
  34. public Result list(@RequestParam(defaultValue = "1", value = "current") Integer current,
  35. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
  36. @RequestParam(value = "name", required = false) String name){
  37. User user = (User) SecurityUtils.getSubject().getPrincipal();
  38. Long hospId = user.getHospId();
  39. PageUtils pageUtils= costShareLevelService.queryList(current,pageSize,name,hospId);
  40. return Result.ok(pageUtils);
  41. }
  42. // /**
  43. // * 信息
  44. // */
  45. // @RequestMapping("/info/{id}")
  46. // public Result info(@PathVariable("id") Integer id){
  47. // CostShareLevel costShareLevel = costShareLevelService.getById(id);
  48. // return Result.ok(costShareLevel);
  49. // }
  50. @GetMapping("/getAll")
  51. @ApiOperation("查询所有分摊层级数据")
  52. public Result getAll(){
  53. User user = (User) SecurityUtils.getSubject().getPrincipal();
  54. Long hospId = user.getHospId();
  55. List<CostShareLevelVO> costShareLevelVOList = costShareLevelService.getAll(hospId);
  56. return Result.ok(costShareLevelVOList);
  57. }
  58. /**
  59. * 保存
  60. */
  61. @PostMapping("/save")
  62. @ApiOperation("保存分摊层级数据")
  63. public Result save(@RequestBody @Valid CostShareLevelSaveDto costShareLevelSaveDto){
  64. costShareLevelService.addCostShareLevel(costShareLevelSaveDto);
  65. return Result.ok();
  66. }
  67. /**
  68. * 修改
  69. */
  70. @PostMapping("/update")
  71. @ApiOperation("修改分摊层级数据")
  72. public Result update(@RequestBody CostShareLevelEditDto costShareLevelEditDto){
  73. costShareLevelService.updateByCostShareLevel(costShareLevelEditDto);
  74. return Result.ok();
  75. }
  76. /**
  77. * 删除
  78. */
  79. @PostMapping("/delete")
  80. @ApiOperation("删除分摊层级数据")
  81. public Result delete(@RequestBody Integer[] ids){
  82. costShareLevelService.removeByIds(Arrays.asList(ids));
  83. return Result.ok();
  84. }
  85. }