- 添加了会计科目、财务单据、日记账凭证等领域的实体类、控制器、服务接口、Mapper接口和XML映射文件 - 实现了基本的CRUD操作,包括查询、新增、修改和删除 - 优化了数据校验和批量删除逻辑
99 lines
2.9 KiB
Java
99 lines
2.9 KiB
Java
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.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.WmsAccountVo;
|
|
import com.klp.domain.bo.WmsAccountBo;
|
|
import com.klp.service.IWmsAccountService;
|
|
|
|
/**
|
|
* 会计科目
|
|
*
|
|
* @author klp
|
|
* @date 2025-08-13
|
|
*/
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/klp/account")
|
|
public class WmsAccountController extends BaseController {
|
|
|
|
private final IWmsAccountService iWmsAccountService;
|
|
|
|
/**
|
|
* 查询会计科目列表
|
|
*/
|
|
@GetMapping("/list")
|
|
public R<List<WmsAccountVo>> list(WmsAccountBo bo) {
|
|
List<WmsAccountVo> list = iWmsAccountService.queryList(bo);
|
|
return R.ok(list);
|
|
}
|
|
|
|
/**
|
|
* 导出会计科目列表
|
|
*/
|
|
@Log(title = "会计科目", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(WmsAccountBo bo, HttpServletResponse response) {
|
|
List<WmsAccountVo> list = iWmsAccountService.queryList(bo);
|
|
ExcelUtil.exportExcel(list, "会计科目", WmsAccountVo.class, response);
|
|
}
|
|
|
|
/**
|
|
* 获取会计科目详细信息
|
|
*
|
|
* @param accountId 主键
|
|
*/
|
|
@GetMapping("/{accountId}")
|
|
public R<WmsAccountVo> getInfo(@NotNull(message = "主键不能为空")
|
|
@PathVariable Long accountId) {
|
|
return R.ok(iWmsAccountService.queryById(accountId));
|
|
}
|
|
|
|
/**
|
|
* 新增会计科目
|
|
*/
|
|
@Log(title = "会计科目", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping()
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsAccountBo bo) {
|
|
return toAjax(iWmsAccountService.insertByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 修改会计科目
|
|
*/
|
|
@Log(title = "会计科目", businessType = BusinessType.UPDATE)
|
|
@RepeatSubmit()
|
|
@PutMapping()
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsAccountBo bo) {
|
|
return toAjax(iWmsAccountService.updateByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 删除会计科目
|
|
*
|
|
* @param accountIds 主键串
|
|
*/
|
|
@Log(title = "会计科目", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{accountIds}")
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
@PathVariable Long[] accountIds) {
|
|
return toAjax(iWmsAccountService.deleteWithValidByIds(Arrays.asList(accountIds), true));
|
|
}
|
|
}
|