BdglPartyController.java 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. package com.supervision.web.controller.grassrootsregistration;
  2. import java.util.List;
  3. import com.supervision.common.core.domain.entity.SysDept;
  4. import com.supervision.common.core.domain.entity.SysRole;
  5. import com.supervision.common.core.domain.model.LoginUser;
  6. import com.supervision.common.utils.StringUtils;
  7. import com.supervision.grassrootsregistration.resultVo.SysDeptDto;
  8. import com.supervision.peopleManage.domain.BdglPeople;
  9. import com.supervision.peopleManage.service.IBdglPeopleService;
  10. import com.supervision.system.mapper.SysUserMapper;
  11. import com.supervision.system.service.ISysDeptService;
  12. import io.swagger.models.auth.In;
  13. import org.springframework.security.access.prepost.PreAuthorize;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.GetMapping;
  16. import org.springframework.web.bind.annotation.PostMapping;
  17. import org.springframework.web.bind.annotation.PutMapping;
  18. import org.springframework.web.bind.annotation.DeleteMapping;
  19. import org.springframework.web.bind.annotation.PathVariable;
  20. import org.springframework.web.bind.annotation.RequestBody;
  21. import org.springframework.web.bind.annotation.RequestMapping;
  22. import org.springframework.web.bind.annotation.RestController;
  23. import com.supervision.common.annotation.Log;
  24. import com.supervision.common.core.controller.BaseController;
  25. import com.supervision.common.core.domain.AjaxResult;
  26. import com.supervision.common.enums.BusinessType;
  27. import com.supervision.grassrootsregistration .domain.BdglParty;
  28. import com.supervision.grassrootsregistration .service.IBdglPartyService;
  29. import com.supervision.common.utils.poi.ExcelUtil;
  30. import com.supervision.common.core.page.TableDataInfo;
  31. /**
  32. * 党支部会议登记本Controller
  33. *
  34. * @author supervision
  35. * @date 2022-02-26
  36. */
  37. @RestController
  38. @RequestMapping("/grassrootsregistration/bdglparty")
  39. public class BdglPartyController extends BaseController
  40. {
  41. @Autowired
  42. private IBdglPartyService bdglPartyService;
  43. @Autowired
  44. private IBdglPeopleService bdglPeopleService;
  45. @Autowired
  46. private ISysDeptService sysDeptService;
  47. @Autowired
  48. private SysUserMapper userMapper;
  49. /**
  50. * 查询党支部会议登记本列表
  51. */
  52. @PreAuthorize("@ss.hasPermi('grassrootsregistration:bdglparty:list')")
  53. @GetMapping("/list")
  54. public TableDataInfo list(BdglParty bdglParty)
  55. {
  56. LoginUser loginUser = getLoginUser();
  57. List<SysRole> sysRoles = userMapper.selectRole(loginUser.getUserId());
  58. String role = CommonsController.getRole(sysRoles);
  59. //判断当前角色是否是最高权限 不是返回当前部门数据
  60. if(!role.equals("admin")){
  61. bdglParty.setUnitId(Integer.parseInt(loginUser.getDeptId().toString()));
  62. }
  63. startPage();
  64. List<BdglParty> list = bdglPartyService.selectBdglPartyList(bdglParty);
  65. return getDataTable(list);
  66. }
  67. /**
  68. * 领导查询党支部会议登记本
  69. */
  70. @PreAuthorize("@ss.hasPermi('grassrootsregistration:bdglpartys:list')")
  71. @GetMapping("/getPartyList")
  72. public TableDataInfo getPartyList(String year)
  73. {
  74. if (StringUtils.isNotEmpty(year)){
  75. startPage();
  76. List<SysDeptDto> list = bdglPartyService.getPartyList(year);
  77. return getDataTable(list);
  78. }
  79. List<List<SysDeptDto>> list = sysDeptService.getMeetRecordsList();
  80. return getDataTable(list);
  81. }
  82. /**
  83. * 领导查询党支部会议登记本列表
  84. */
  85. @PreAuthorize("@ss.hasPermi('grassrootsregistration:bdglpartys:list')")
  86. @GetMapping("/getPartyOnUnitList")
  87. public TableDataInfo getPartyOnUnitList(Integer unitId,String year)
  88. {
  89. startPage();
  90. List<BdglParty> list = bdglPartyService.getPartyOnUnitList(unitId,year);
  91. return getDataTable(list);
  92. }
  93. /**
  94. * 导出党支部会议登记本列表
  95. */
  96. @PreAuthorize("@ss.hasPermi('grassrootsregistration:bdglparty:export')")
  97. @Log(title = "党支部会议登记本", businessType = BusinessType.EXPORT)
  98. @GetMapping("/export")
  99. public AjaxResult export(BdglParty bdglParty)
  100. {
  101. List<BdglParty> list = bdglPartyService.selectBdglPartyList(bdglParty);
  102. ExcelUtil<BdglParty> util = new ExcelUtil<BdglParty>(BdglParty.class);
  103. return util.exportExcel(list, "党支部会议登记本数据");
  104. }
  105. /**
  106. * 获取党支部会议登记本详细信息
  107. */
  108. @PreAuthorize("@ss.hasAnyPermi('grassrootsregistration:bdglparty:query,grassrootsregistration:bdglpartys:query')")
  109. @GetMapping(value = "/{id}")
  110. public AjaxResult getInfo(@PathVariable("id") Integer id)
  111. {
  112. return AjaxResult.success(bdglPartyService.selectBdglPartyById(id));
  113. }
  114. /**
  115. * 新增党支部会议登记本
  116. */
  117. @PreAuthorize("@ss.hasPermi('grassrootsregistration:bdglparty:add')")
  118. @Log(title = "党支部会议登记本", businessType = BusinessType.INSERT)
  119. @PostMapping
  120. public AjaxResult add(@RequestBody BdglParty bdglParty)
  121. {
  122. return toAjax(bdglPartyService.insertBdglParty(bdglParty));
  123. }
  124. /**
  125. * 修改党支部会议登记本
  126. */
  127. @PreAuthorize("@ss.hasPermi('grassrootsregistration:bdglparty:edit')")
  128. @Log(title = "党支部会议登记本", businessType = BusinessType.UPDATE)
  129. @PutMapping
  130. public AjaxResult edit(@RequestBody BdglParty bdglParty)
  131. {
  132. return toAjax(bdglPartyService.updateBdglParty(bdglParty));
  133. }
  134. /**
  135. * 删除党支部会议登记本
  136. */
  137. @PreAuthorize("@ss.hasPermi('grassrootsregistration:bdglparty:remove')")
  138. @Log(title = "党支部会议登记本", businessType = BusinessType.DELETE)
  139. @DeleteMapping("/{ids}")
  140. public AjaxResult remove(@PathVariable Integer[] ids)
  141. {
  142. return toAjax(bdglPartyService.deleteBdglPartyByIds(ids));
  143. }
  144. }