ProfileTpController.java 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. package com.zhongzheng.controller.base;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import com.zhongzheng.modules.base.bo.ProfileTpAddBo;
  5. import com.zhongzheng.modules.base.bo.ProfileTpEditBo;
  6. import com.zhongzheng.modules.base.bo.ProfileTpQueryBo;
  7. import com.zhongzheng.modules.base.service.IProfileTpService;
  8. import com.zhongzheng.modules.base.vo.ProfileTpVo;
  9. import lombok.RequiredArgsConstructor;
  10. import org.springframework.security.access.prepost.PreAuthorize;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.web.bind.annotation.GetMapping;
  13. import org.springframework.web.bind.annotation.PostMapping;
  14. import org.springframework.web.bind.annotation.PutMapping;
  15. import org.springframework.web.bind.annotation.DeleteMapping;
  16. import org.springframework.web.bind.annotation.PathVariable;
  17. import org.springframework.web.bind.annotation.RequestBody;
  18. import org.springframework.web.bind.annotation.RequestMapping;
  19. import org.springframework.web.bind.annotation.RestController;
  20. import com.zhongzheng.common.annotation.Log;
  21. import com.zhongzheng.common.core.controller.BaseController;
  22. import com.zhongzheng.common.core.domain.AjaxResult;
  23. import com.zhongzheng.common.enums.BusinessType;
  24. import com.zhongzheng.common.utils.poi.ExcelUtil;
  25. import com.zhongzheng.common.core.page.TableDataInfo;
  26. import io.swagger.annotations.Api;
  27. import io.swagger.annotations.ApiOperation;
  28. /**
  29. * 资料模板Controller
  30. *
  31. * @author hjl
  32. * @date 2021-11-19
  33. */
  34. @Api(value = "资料模板控制器", tags = {"资料模板管理"})
  35. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  36. @RestController
  37. @RequestMapping("/base/profile/tp")
  38. public class ProfileTpController extends BaseController {
  39. private final IProfileTpService iProfileTpService;
  40. /**
  41. * 查询资料模板列表
  42. */
  43. @ApiOperation("查询资料模板列表")
  44. @PreAuthorize("@ss.hasPermi('system:tp:list')")
  45. @GetMapping("/list")
  46. public TableDataInfo<ProfileTpVo> list(ProfileTpQueryBo bo) {
  47. startPage();
  48. List<ProfileTpVo> list = iProfileTpService.selectListByBo(bo);
  49. return getDataTable(list);
  50. }
  51. /**
  52. * 获取所有使用商品ID
  53. */
  54. @ApiOperation("获取所有使用商品ID")
  55. @PreAuthorize("@ss.hasPermi('system:tp:list')")
  56. @GetMapping("/goods_list")
  57. public AjaxResult<List<String>> goods_list(ProfileTpQueryBo bo) {
  58. List<String> list = iProfileTpService.selectAllUseGoods(bo);
  59. return AjaxResult.success(list);
  60. }
  61. /**
  62. * 导出资料模板列表
  63. */
  64. /* @ApiOperation("导出资料模板列表")
  65. @PreAuthorize("@ss.hasPermi('system:tp:export')")
  66. @Log(title = "资料模板", businessType = BusinessType.EXPORT)
  67. @GetMapping("/export")
  68. public AjaxResult<ProfileTpVo> export(ProfileTpQueryBo bo) {
  69. List<ProfileTpVo> list = iProfileTpService.queryList(bo);
  70. ExcelUtil<ProfileTpVo> util = new ExcelUtil<ProfileTpVo>(ProfileTpVo.class);
  71. return util.exportExcel(list, "资料模板");
  72. }*/
  73. /**
  74. * 获取资料模板详细信息
  75. */
  76. @ApiOperation("获取资料模板详细信息")
  77. @PreAuthorize("@ss.hasPermi('system:tp:query')")
  78. @GetMapping("/{profileTpId}")
  79. public AjaxResult<ProfileTpVo> getInfo(@PathVariable("profileTpId" ) Long profileTpId) {
  80. return AjaxResult.success(iProfileTpService.queryById(profileTpId));
  81. }
  82. /**
  83. * 新增资料模板
  84. */
  85. @ApiOperation("新增资料模板")
  86. @PreAuthorize("@ss.hasPermi('system:tp:add')")
  87. @Log(title = "资料模板", businessType = BusinessType.INSERT)
  88. @PostMapping()
  89. public AjaxResult<Void> add(@RequestBody ProfileTpAddBo bo) {
  90. return toAjax(iProfileTpService.insertByAddBo(bo) ? 1 : 0);
  91. }
  92. /**
  93. * 修改资料模板
  94. */
  95. @ApiOperation("修改资料模板")
  96. @PreAuthorize("@ss.hasPermi('system:tp:edit')")
  97. @Log(title = "资料模板", businessType = BusinessType.UPDATE)
  98. @PostMapping("/edit")
  99. public AjaxResult<Void> edit(@RequestBody ProfileTpEditBo bo) {
  100. return toAjax(iProfileTpService.updateByEditBo(bo) ? 1 : 0);
  101. }
  102. /**
  103. * 删除资料模板
  104. */
  105. /* @ApiOperation("删除资料模板")
  106. @PreAuthorize("@ss.hasPermi('system:tp:remove')")
  107. @Log(title = "资料模板" , businessType = BusinessType.DELETE)
  108. @DeleteMapping("/{profileTpIds}")
  109. public AjaxResult<Void> remove(@PathVariable Long[] profileTpIds) {
  110. return toAjax(iProfileTpService.deleteWithValidByIds(Arrays.asList(profileTpIds), true) ? 1 : 0);
  111. }*/
  112. }