package com.ruoyi.web.controller.api; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import java.util.List; import java.util.Arrays; import com.ruoyi.app.domain.TbFamilyEvents; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import com.ruoyi.common.utils.StringUtils; import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.app.domain.TbFamilyGarden; import com.ruoyi.app.service.ITbFamilyGardenService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 家族园地 * * @author liuhj * @date 2020-10-14 */ @Api(value = "家族园地", tags = "家族园地") @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/garden" ) public class TbFamilyGardenController extends BaseController { private final ITbFamilyGardenService iTbFamilyGardenService; /** * 查询家族园地列表 */ @ApiOperation("查询家族园地列表") @PreAuthorize("@ss.hasPermi('system:garden:list')") @GetMapping("/list") public TableDataInfo list(TbFamilyGarden tbFamilyGarden) { startPage(); List list = iTbFamilyGardenService.queryList(tbFamilyGarden); return getDataTable(list); } /** * 导出家族园地列表 */ @ApiOperation("导出家族园地列表") @PreAuthorize("@ss.hasPermi('system:garden:export')" ) @Log(title = "家族园地" , businessType = BusinessType.EXPORT) @GetMapping("/export" ) public AjaxResult export(TbFamilyGarden tbFamilyGarden) { LambdaQueryWrapper lqw = new LambdaQueryWrapper(tbFamilyGarden); List list = iTbFamilyGardenService.list(lqw); ExcelUtil util = new ExcelUtil(TbFamilyGarden. class); return util.exportExcel(list, "garden" ); } /** * 获取家族园地详细信息 */ @ApiOperation("获取家族园地详细信息") @PreAuthorize("@ss.hasPermi('system:garden:query')" ) @GetMapping(value = "/{id}" ) public AjaxResult getInfo(@PathVariable("id" ) Long id) { return AjaxResult.success(iTbFamilyGardenService.getById(id)); } /** * 新增家族园地 */ @ApiOperation("新增家族园地") @PreAuthorize("@ss.hasPermi('system:garden:add')" ) @Log(title = "家族园地" , businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TbFamilyGarden tbFamilyGarden) { return toAjax(iTbFamilyGardenService.save(tbFamilyGarden) ? 1 : 0); } /** * 修改家族园地 */ @ApiOperation("修改家族园地") @PreAuthorize("@ss.hasPermi('system:garden:edit')" ) @Log(title = "家族园地" , businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TbFamilyGarden tbFamilyGarden) { return toAjax(iTbFamilyGardenService.updateById(tbFamilyGarden) ? 1 : 0); } /** * 删除家族园地 */ @ApiOperation("删除家族园地") @PreAuthorize("@ss.hasPermi('system:garden:remove')" ) @Log(title = "家族园地" , businessType = BusinessType.DELETE) @DeleteMapping("/{ids}" ) public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(iTbFamilyGardenService.removeByIds(Arrays.asList(ids)) ? 1 : 0); } }