TbFamilyGardenController.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. package com.ruoyi.web.controller.api;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import java.util.List;
  4. import java.util.Arrays;
  5. import com.ruoyi.app.domain.TbFamilyEvents;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import com.ruoyi.common.utils.StringUtils;
  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.ruoyi.common.annotation.Log;
  21. import com.ruoyi.common.core.controller.BaseController;
  22. import com.ruoyi.common.core.domain.AjaxResult;
  23. import com.ruoyi.common.enums.BusinessType;
  24. import com.ruoyi.app.domain.TbFamilyGarden;
  25. import com.ruoyi.app.service.ITbFamilyGardenService;
  26. import com.ruoyi.common.utils.poi.ExcelUtil;
  27. import com.ruoyi.common.core.page.TableDataInfo;
  28. /**
  29. * 家族园地
  30. *
  31. * @author liuhj
  32. * @date 2020-10-14
  33. */
  34. @Api(value = "家族园地", tags = "家族园地")
  35. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  36. @RestController
  37. @RequestMapping("/system/garden" )
  38. public class TbFamilyGardenController extends BaseController {
  39. private final ITbFamilyGardenService iTbFamilyGardenService;
  40. /**
  41. * 查询家族园地列表
  42. */
  43. @ApiOperation("查询家族园地列表")
  44. @PreAuthorize("@ss.hasPermi('system:garden:list')")
  45. @GetMapping("/list")
  46. public TableDataInfo list(TbFamilyGarden tbFamilyGarden)
  47. {
  48. startPage();
  49. List<TbFamilyGarden> list = iTbFamilyGardenService.queryList(tbFamilyGarden);
  50. return getDataTable(list);
  51. }
  52. /**
  53. * 导出家族园地列表
  54. */
  55. @ApiOperation("导出家族园地列表")
  56. @PreAuthorize("@ss.hasPermi('system:garden:export')" )
  57. @Log(title = "家族园地" , businessType = BusinessType.EXPORT)
  58. @GetMapping("/export" )
  59. public AjaxResult export(TbFamilyGarden tbFamilyGarden) {
  60. LambdaQueryWrapper<TbFamilyGarden> lqw = new LambdaQueryWrapper<TbFamilyGarden>(tbFamilyGarden);
  61. List<TbFamilyGarden> list = iTbFamilyGardenService.list(lqw);
  62. ExcelUtil<TbFamilyGarden> util = new ExcelUtil<TbFamilyGarden>(TbFamilyGarden. class);
  63. return util.exportExcel(list, "garden" );
  64. }
  65. /**
  66. * 获取家族园地详细信息
  67. */
  68. @ApiOperation("获取家族园地详细信息")
  69. @PreAuthorize("@ss.hasPermi('system:garden:query')" )
  70. @GetMapping(value = "/{id}" )
  71. public AjaxResult getInfo(@PathVariable("id" ) Long id) {
  72. return AjaxResult.success(iTbFamilyGardenService.getById(id));
  73. }
  74. /**
  75. * 新增家族园地
  76. */
  77. @ApiOperation("新增家族园地")
  78. @PreAuthorize("@ss.hasPermi('system:garden:add')" )
  79. @Log(title = "家族园地" , businessType = BusinessType.INSERT)
  80. @PostMapping
  81. public AjaxResult add(@RequestBody TbFamilyGarden tbFamilyGarden) {
  82. return toAjax(iTbFamilyGardenService.save(tbFamilyGarden) ? 1 : 0);
  83. }
  84. /**
  85. * 修改家族园地
  86. */
  87. @ApiOperation("修改家族园地")
  88. @PreAuthorize("@ss.hasPermi('system:garden:edit')" )
  89. @Log(title = "家族园地" , businessType = BusinessType.UPDATE)
  90. @PutMapping
  91. public AjaxResult edit(@RequestBody TbFamilyGarden tbFamilyGarden) {
  92. return toAjax(iTbFamilyGardenService.updateById(tbFamilyGarden) ? 1 : 0);
  93. }
  94. /**
  95. * 删除家族园地
  96. */
  97. @ApiOperation("删除家族园地")
  98. @PreAuthorize("@ss.hasPermi('system:garden:remove')" )
  99. @Log(title = "家族园地" , businessType = BusinessType.DELETE)
  100. @DeleteMapping("/{ids}" )
  101. public AjaxResult remove(@PathVariable Long[] ids) {
  102. return toAjax(iTbFamilyGardenService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
  103. }
  104. }