|
|
@@ -0,0 +1,97 @@
|
|
|
+package com.xjrsoft.module.ledger.controller;
|
|
|
+
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.xjrsoft.common.model.result.RT;
|
|
|
+import com.xjrsoft.common.page.ConventPage;
|
|
|
+import com.xjrsoft.common.page.PageOutput;
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.ledger.dto.AddLedgerConfigDto;
|
|
|
+import com.xjrsoft.module.ledger.dto.LedgerConfigPageDto;
|
|
|
+import com.xjrsoft.module.ledger.dto.UpdateLedgerConfigDto;
|
|
|
+import com.xjrsoft.module.ledger.entity.LedgerConfig;
|
|
|
+import com.xjrsoft.module.ledger.service.ILedgerConfigService;
|
|
|
+import com.xjrsoft.module.ledger.vo.LedgerConfigPageVo;
|
|
|
+import com.xjrsoft.module.ledger.vo.LedgerConfigVo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+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.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+* @title: 台账配置表
|
|
|
+* @Author dzx
|
|
|
+* @Date: 2024-03-06
|
|
|
+* @Version 1.0
|
|
|
+*/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/ledger" + "/ledgerConfig")
|
|
|
+@Api(value = "/ledger" + "/ledgerConfig",tags = "台账配置表代码")
|
|
|
+@AllArgsConstructor
|
|
|
+public class LedgerConfigController {
|
|
|
+
|
|
|
+
|
|
|
+ private final ILedgerConfigService ledgerConfigService;
|
|
|
+
|
|
|
+ @GetMapping(value = "/page")
|
|
|
+ @ApiOperation(value="台账配置表列表(分页)")
|
|
|
+ @SaCheckPermission("ledgerconfig:detail")
|
|
|
+ public RT<PageOutput<LedgerConfigPageVo>> page(@Valid LedgerConfigPageDto dto){
|
|
|
+
|
|
|
+ LambdaQueryWrapper<LedgerConfig> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.orderByDesc(LedgerConfig::getId).select(LedgerConfig.class,x -> VoToColumnUtil.fieldsToColumns(LedgerConfigPageVo.class).contains(x.getProperty()));
|
|
|
+ IPage<LedgerConfig> page = ledgerConfigService.page(ConventPage.getPage(dto), queryWrapper);
|
|
|
+ PageOutput<LedgerConfigPageVo> pageOutput = ConventPage.getPageOutput(page, LedgerConfigPageVo.class);
|
|
|
+ return RT.ok(pageOutput);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/info")
|
|
|
+ @ApiOperation(value="根据id查询台账配置表信息")
|
|
|
+ @SaCheckPermission("ledgerconfig:detail")
|
|
|
+ public RT<LedgerConfigVo> info(@RequestParam Long id){
|
|
|
+ LedgerConfig ledgerConfig = ledgerConfigService.getById(id);
|
|
|
+ if (ledgerConfig == null) {
|
|
|
+ return RT.error("找不到此数据!");
|
|
|
+ }
|
|
|
+ return RT.ok(BeanUtil.toBean(ledgerConfig, LedgerConfigVo.class));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping
|
|
|
+ @ApiOperation(value = "新增台账配置表")
|
|
|
+ @SaCheckPermission("ledgerconfig:add")
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody AddLedgerConfigDto dto){
|
|
|
+ LedgerConfig ledgerConfig = BeanUtil.toBean(dto, LedgerConfig.class);
|
|
|
+ boolean isSuccess = ledgerConfigService.save(ledgerConfig);
|
|
|
+ return RT.ok(isSuccess);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping
|
|
|
+ @ApiOperation(value = "修改台账配置表")
|
|
|
+ @SaCheckPermission("ledgerconfig:edit")
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody UpdateLedgerConfigDto dto){
|
|
|
+
|
|
|
+ LedgerConfig ledgerConfig = BeanUtil.toBean(dto, LedgerConfig.class);
|
|
|
+ return RT.ok(ledgerConfigService.updateById(ledgerConfig));
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping
|
|
|
+ @ApiOperation(value = "删除台账配置表")
|
|
|
+ @SaCheckPermission("ledgerconfig:delete")
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
+ return RT.ok(ledgerConfigService.removeBatchByIds(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|