HdUserController.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package com.ruoyi.web.controller;
  2. import java.util.Arrays;
  3. import java.util.List;
  4. import javax.servlet.http.HttpServletResponse;
  5. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  6. import org.springframework.security.access.prepost.PreAuthorize;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.PostMapping;
  10. import org.springframework.web.bind.annotation.PutMapping;
  11. import org.springframework.web.bind.annotation.DeleteMapping;
  12. import org.springframework.web.bind.annotation.PathVariable;
  13. import org.springframework.web.bind.annotation.RequestBody;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RestController;
  16. import com.ruoyi.common.annotation.Log;
  17. import com.ruoyi.common.core.controller.BaseController;
  18. import com.ruoyi.common.core.domain.AjaxResult;
  19. import com.ruoyi.common.enums.BusinessType;
  20. import com.ruoyi.web.domain.HdUser;
  21. import com.ruoyi.web.service.IHdUserService;
  22. import com.ruoyi.common.utils.poi.ExcelUtil;
  23. import com.ruoyi.common.core.page.TableDataInfo;
  24. /**
  25. * 活动信息-用户Controller
  26. *
  27. * @author shenzx
  28. * @date 2025-08-25
  29. */
  30. @RestController
  31. @RequestMapping("/hd/user")
  32. public class HdUserController extends BaseController
  33. {
  34. @Autowired
  35. private IHdUserService hdUserService;
  36. /**
  37. * 查询活动信息-用户列表
  38. */
  39. @PreAuthorize("@ss.hasPermi('hd:user:list')")
  40. @GetMapping("/list")
  41. public TableDataInfo list(HdUser hdUser)
  42. {
  43. startPage();
  44. QueryWrapper<HdUser> queryWrapper = new QueryWrapper<>();
  45. queryWrapper.setEntity(hdUser);
  46. List<HdUser> hdUserList = hdUserService.list(queryWrapper);
  47. return getDataTable(hdUserList);
  48. }
  49. /**
  50. * 导出活动信息-用户列表
  51. */
  52. @PreAuthorize("@ss.hasPermi('hd:user:export')")
  53. @Log(title = "活动信息-用户", businessType = BusinessType.EXPORT)
  54. @PostMapping("/export")
  55. public void export(HttpServletResponse response, HdUser hdUser)
  56. {
  57. QueryWrapper<HdUser> queryWrapper = new QueryWrapper<>();
  58. queryWrapper.setEntity(hdUser);
  59. List<HdUser> list = hdUserService.list(queryWrapper);
  60. ExcelUtil<HdUser> util = new ExcelUtil<>(HdUser.class);
  61. util.exportExcel(response, list, "活动信息-用户数据");
  62. }
  63. /**
  64. * 获取活动信息-用户详细信息
  65. */
  66. @PreAuthorize("@ss.hasPermi('hd:user:query')")
  67. @GetMapping(value = "/{fid}")
  68. public AjaxResult getInfo(@PathVariable("fid") Long fid)
  69. {
  70. return success(hdUserService.getById(fid));
  71. }
  72. /**
  73. * 新增活动信息-用户
  74. */
  75. @PreAuthorize("@ss.hasPermi('hd:user:add')")
  76. @Log(title = "活动信息-用户", businessType = BusinessType.INSERT)
  77. @PostMapping
  78. public AjaxResult add(@RequestBody HdUser hdUser)
  79. {
  80. hdUserService.save(hdUser);
  81. return success(hdUser);
  82. }
  83. /**
  84. * 修改活动信息-用户
  85. */
  86. @PreAuthorize("@ss.hasPermi('hd:user:edit')")
  87. @Log(title = "活动信息-用户", businessType = BusinessType.UPDATE)
  88. @PutMapping
  89. public AjaxResult edit(@RequestBody HdUser hdUser)
  90. {
  91. hdUserService.updateById(hdUser);
  92. return success(hdUser);
  93. }
  94. /**
  95. * 删除活动信息-用户
  96. */
  97. @PreAuthorize("@ss.hasPermi('hd:user:remove')")
  98. @Log(title = "活动信息-用户", businessType = BusinessType.DELETE)
  99. @DeleteMapping("/{fids}")
  100. public AjaxResult remove(@PathVariable Long[] fids)
  101. {
  102. return toAjax(hdUserService.removeByIds(Arrays.asList(fids)));
  103. }
  104. }