DistributionSalesmanController.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. package com.zhongzheng.controller.distribution;
  2. import com.zhongzheng.common.annotation.Log;
  3. import com.zhongzheng.common.core.controller.BaseController;
  4. import com.zhongzheng.common.core.domain.AjaxResult;
  5. import com.zhongzheng.common.core.page.TableDataInfo;
  6. import com.zhongzheng.common.enums.BusinessType;
  7. import com.zhongzheng.common.utils.poi.ExcelUtil;
  8. import com.zhongzheng.modules.distribution.bo.DistributionSalesmanAddBo;
  9. import com.zhongzheng.modules.distribution.bo.DistributionSalesmanEditBo;
  10. import com.zhongzheng.modules.distribution.bo.DistributionSalesmanQueryBo;
  11. import com.zhongzheng.modules.distribution.service.IDistributionSalesmanService;
  12. import com.zhongzheng.modules.distribution.vo.DistributionSalesmanVo;
  13. import io.swagger.annotations.Api;
  14. import io.swagger.annotations.ApiOperation;
  15. import lombok.RequiredArgsConstructor;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.security.access.prepost.PreAuthorize;
  18. import org.springframework.web.bind.annotation.*;
  19. import java.util.Arrays;
  20. import java.util.List;
  21. /**
  22. * 【请填写功能名称】Controller
  23. *
  24. * @author ruoyi
  25. * @date 2023-03-06
  26. */
  27. @Api(value = "【请填写功能名称】控制器", tags = {"【请填写功能名称】管理"})
  28. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  29. @RestController
  30. @RequestMapping("/system/salesman")
  31. public class DistributionSalesmanController extends BaseController {
  32. private final IDistributionSalesmanService iDistributionSalesmanService;
  33. /**
  34. * 查询【请填写功能名称】列表
  35. */
  36. @ApiOperation("查询【请填写功能名称】列表")
  37. @PreAuthorize("@ss.hasPermi('system:salesman:list')")
  38. @GetMapping("/list")
  39. public TableDataInfo<DistributionSalesmanVo> list(DistributionSalesmanQueryBo bo) {
  40. startPage();
  41. List<DistributionSalesmanVo> list = iDistributionSalesmanService.queryList(bo);
  42. return getDataTable(list);
  43. }
  44. /**
  45. * 导出【请填写功能名称】列表
  46. */
  47. @ApiOperation("导出【请填写功能名称】列表")
  48. @PreAuthorize("@ss.hasPermi('system:salesman:export')")
  49. @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
  50. @GetMapping("/export")
  51. public AjaxResult<DistributionSalesmanVo> export(DistributionSalesmanQueryBo bo) {
  52. List<DistributionSalesmanVo> list = iDistributionSalesmanService.queryList(bo);
  53. ExcelUtil<DistributionSalesmanVo> util = new ExcelUtil<DistributionSalesmanVo>(DistributionSalesmanVo.class);
  54. return util.exportExcel(list, "【请填写功能名称】");
  55. }
  56. /**
  57. * 获取【请填写功能名称】详细信息
  58. */
  59. @ApiOperation("获取【请填写功能名称】详细信息")
  60. @PreAuthorize("@ss.hasPermi('system:salesman:query')")
  61. @GetMapping("/{salesmanId}")
  62. public AjaxResult<DistributionSalesmanVo> getInfo(@PathVariable("salesmanId" ) Long salesmanId) {
  63. return AjaxResult.success(iDistributionSalesmanService.queryById(salesmanId));
  64. }
  65. /**
  66. * 新增【请填写功能名称】
  67. */
  68. @ApiOperation("新增【请填写功能名称】")
  69. @PreAuthorize("@ss.hasPermi('system:salesman:add')")
  70. @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
  71. @PostMapping()
  72. public AjaxResult<Void> add(@RequestBody DistributionSalesmanAddBo bo) {
  73. return toAjax(iDistributionSalesmanService.insertByAddBo(bo) ? 1 : 0);
  74. }
  75. /**
  76. * 修改【请填写功能名称】
  77. */
  78. @ApiOperation("修改【请填写功能名称】")
  79. @PreAuthorize("@ss.hasPermi('system:salesman:edit')")
  80. @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
  81. @PutMapping()
  82. public AjaxResult<Void> edit(@RequestBody DistributionSalesmanEditBo bo) {
  83. return toAjax(iDistributionSalesmanService.updateByEditBo(bo) ? 1 : 0);
  84. }
  85. /**
  86. * 删除【请填写功能名称】
  87. */
  88. @ApiOperation("删除【请填写功能名称】")
  89. @PreAuthorize("@ss.hasPermi('system:salesman:remove')")
  90. @Log(title = "【请填写功能名称】" , businessType = BusinessType.DELETE)
  91. @DeleteMapping("/{salesmanIds}")
  92. public AjaxResult<Void> remove(@PathVariable Long[] salesmanIds) {
  93. return toAjax(iDistributionSalesmanService.deleteWithValidByIds(Arrays.asList(salesmanIds), true) ? 1 : 0);
  94. }
  95. }