package com.klp.controller; import java.util.List; import java.util.Arrays; import lombok.RequiredArgsConstructor; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.*; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import com.klp.common.annotation.RepeatSubmit; import com.klp.common.annotation.Log; import com.klp.common.core.controller.BaseController; import com.klp.common.core.domain.PageQuery; import com.klp.common.core.domain.R; import com.klp.common.core.validate.AddGroup; import com.klp.common.core.validate.EditGroup; import com.klp.common.enums.BusinessType; import com.klp.common.utils.poi.ExcelUtil; import com.klp.domain.vo.WmsOtherIncomeVo; import com.klp.domain.bo.WmsOtherIncomeBo; import com.klp.service.IWmsOtherIncomeService; import com.klp.common.core.page.TableDataInfo; /** * 其他收支 * * @author Joshi * @date 2025-09-26 */ @Validated @RequiredArgsConstructor @RestController @RequestMapping("/klp/otherIncome") public class WmsOtherIncomeController extends BaseController { private final IWmsOtherIncomeService iWmsOtherIncomeService; /** * 查询其他收支列表 */ @GetMapping("/list") public TableDataInfo list(WmsOtherIncomeBo bo, PageQuery pageQuery) { return iWmsOtherIncomeService.queryPageList(bo, pageQuery); } /** * 导出其他收支列表 */ @Log(title = "其他收支", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(WmsOtherIncomeBo bo, HttpServletResponse response) { List list = iWmsOtherIncomeService.queryList(bo); ExcelUtil.exportExcel(list, "其他收支", WmsOtherIncomeVo.class, response); } /** * 获取其他收支详细信息 * * @param otherIncomeId 主键 */ @GetMapping("/{otherIncomeId}") public R getInfo(@NotNull(message = "主键不能为空") @PathVariable Long otherIncomeId) { return R.ok(iWmsOtherIncomeService.queryById(otherIncomeId)); } /** * 新增其他收支 */ @Log(title = "其他收支", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() public R add(@Validated(AddGroup.class) @RequestBody WmsOtherIncomeBo bo) { return toAjax(iWmsOtherIncomeService.insertByBo(bo)); } /** * 修改其他收支 */ @Log(title = "其他收支", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping() public R edit(@Validated(EditGroup.class) @RequestBody WmsOtherIncomeBo bo) { return toAjax(iWmsOtherIncomeService.updateByBo(bo)); } /** * 删除其他收支 * * @param otherIncomeIds 主键串 */ @Log(title = "其他收支", businessType = BusinessType.DELETE) @DeleteMapping("/{otherIncomeIds}") public R remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] otherIncomeIds) { return toAjax(iWmsOtherIncomeService.deleteWithValidByIds(Arrays.asList(otherIncomeIds), true)); } }