package com.by4cloud.platformx.business.controller; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.by4cloud.platformx.business.dto.ZBJTStatisticDTO; import com.by4cloud.platformx.business.entity.ZbStatisticZxyw; import com.by4cloud.platformx.business.service.ZbStatisticZxywService; import com.by4cloud.platformx.common.core.util.R; import com.by4cloud.platformx.common.excel.annotation.ResponseExcel; import com.by4cloud.platformx.common.log.annotation.SysLog; import com.by4cloud.platformx.common.security.annotation.Inner; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springdoc.core.annotations.ParameterObject; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 专项业务 * * @author syt * @date 2026-11-12 10:29:31 */ @RestController @RequiredArgsConstructor @RequestMapping("/zbStatisticZxyw" ) @Tag(description = "zbStatisticZxyw" , name = "专项业务管理" ) @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class ZbStatisticZxywController { private final ZbStatisticZxywService zbStatisticZxywService; /** * 分页查询 * @param page 分页对象 * @param zbStatisticZxyw 专项业务 * @return */ @Operation(summary = "分页查询" , description = "分页查询" ) @GetMapping("/page" ) @PreAuthorize("@pms.hasPermission('bueiness_zbStatisticZxyw_view')" ) public R getZbStatisticZxywPage(@ParameterObject Page page, @ParameterObject ZbStatisticZxyw zbStatisticZxyw) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); wrapper.eq(StrUtil.isNotBlank(zbStatisticZxyw.getStatYm()), ZbStatisticZxyw::getStatYm,zbStatisticZxyw.getStatYm()); // wrapper.orderByAsc(ZbStatisticZxyw::getSort); return R.ok(zbStatisticZxywService.pageByScope(page, wrapper)); } /** * 通过id查询专项业务 * @param id id * @return R */ @Operation(summary = "通过id查询" , description = "通过id查询" ) @GetMapping("/{id}" ) @PreAuthorize("@pms.hasPermission('bueiness_zbStatisticZxyw_view')" ) public R getById(@PathVariable("id" ) Long id) { return R.ok(zbStatisticZxywService.getById(id)); } /** * 新增专项业务 * @param zbStatisticZxyw 专项业务 * @return R */ @Operation(summary = "新增专项业务" , description = "新增专项业务" ) @SysLog("新增专项业务" ) @PostMapping @PreAuthorize("@pms.hasPermission('bueiness_zbStatisticZxyw_add')" ) public R save(@RequestBody ZbStatisticZxyw zbStatisticZxyw) { return R.ok(zbStatisticZxywService.save(zbStatisticZxyw)); } /** * 修改专项业务 * @param zbStatisticZxyw 专项业务 * @return R */ @Operation(summary = "修改专项业务" , description = "修改专项业务" ) @SysLog("修改专项业务" ) @PutMapping @PreAuthorize("@pms.hasPermission('bueiness_zbStatisticZxyw_edit')" ) public R updateById(@RequestBody ZbStatisticZxyw zbStatisticZxyw) { return R.ok(zbStatisticZxywService.updateById(zbStatisticZxyw)); } /** * 通过id删除专项业务 * @param ids id列表 * @return R */ @Operation(summary = "通过id删除专项业务" , description = "通过id删除专项业务" ) @SysLog("通过id删除专项业务" ) @DeleteMapping @PreAuthorize("@pms.hasPermission('bueiness_zbStatisticZxyw_del')" ) public R removeById(@RequestBody Long[] ids) { return R.ok(zbStatisticZxywService.removeBatchByIds(CollUtil.toList(ids))); } /** * 导出excel 表格 * @param zbStatisticZxyw 查询条件 * @param ids 导出指定ID * @return excel 文件流 */ @ResponseExcel @GetMapping("/export") @PreAuthorize("@pms.hasPermission('bueiness_zbStatisticZxyw_export')" ) public List export(ZbStatisticZxyw zbStatisticZxyw, Long[] ids) { return zbStatisticZxywService.list(Wrappers.lambdaQuery(zbStatisticZxyw).in(ArrayUtil.isNotEmpty(ids), ZbStatisticZxyw::getId, ids)); } @Inner(value = false) @GetMapping("/genZxywwcqk") public R genZxywwcqk(@ParameterObject ZBJTStatisticDTO queryDTO){ return zbStatisticZxywService.genZxywwcqk(queryDTO); } }