|
|
@@ -0,0 +1,102 @@
|
|
|
+package com.xjrsoft.module.asset.controller;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.xjrsoft.common.constant.GlobalConstant;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
+import com.xjrsoft.common.page.ConventPage;
|
|
|
+import com.xjrsoft.common.page.PageOutput;
|
|
|
+import com.xjrsoft.common.model.result.RT;
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.asset.dto.AddWfAssetManageDto;
|
|
|
+import com.xjrsoft.module.asset.dto.UpdateWfAssetManageDto;
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+
|
|
|
+import com.xjrsoft.module.asset.dto.WfAssetManagePageDto;
|
|
|
+import com.xjrsoft.module.asset.entity.WfAssetManage;
|
|
|
+import com.xjrsoft.module.asset.service.IWfAssetManageService;
|
|
|
+import com.xjrsoft.module.asset.vo.WfAssetManagePageVo;
|
|
|
+
|
|
|
+import com.xjrsoft.module.asset.vo.WfAssetManageVo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+* @title: 资产管理
|
|
|
+* @Author dzx
|
|
|
+* @Date: 2024-03-28
|
|
|
+* @Version 1.0
|
|
|
+*/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/asset" + "/wfAssetManage")
|
|
|
+@Api(value = "/asset" + "/wfAssetManage",tags = "资产管理代码")
|
|
|
+@AllArgsConstructor
|
|
|
+public class WfAssetManageController {
|
|
|
+
|
|
|
+
|
|
|
+ private final IWfAssetManageService wfAssetManageService;
|
|
|
+
|
|
|
+ @GetMapping(value = "/page")
|
|
|
+ @ApiOperation(value="资产管理列表(分页)")
|
|
|
+ @SaCheckPermission("wfassetmanage:detail")
|
|
|
+ public RT<PageOutput<WfAssetManagePageVo>> page(@Valid WfAssetManagePageDto dto){
|
|
|
+
|
|
|
+ LambdaQueryWrapper<WfAssetManage> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper
|
|
|
+ .orderByDesc(WfAssetManage::getId)
|
|
|
+ .select(WfAssetManage.class,x -> VoToColumnUtil.fieldsToColumns(WfAssetManagePageVo.class).contains(x.getProperty()));
|
|
|
+ IPage<WfAssetManage> page = wfAssetManageService.page(ConventPage.getPage(dto), queryWrapper);
|
|
|
+ PageOutput<WfAssetManagePageVo> pageOutput = ConventPage.getPageOutput(page, WfAssetManagePageVo.class);
|
|
|
+ return RT.ok(pageOutput);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/info")
|
|
|
+ @ApiOperation(value="根据id查询资产管理信息")
|
|
|
+ @SaCheckPermission("wfassetmanage:detail")
|
|
|
+ public RT<WfAssetManageVo> info(@RequestParam Long id){
|
|
|
+ WfAssetManage wfAssetManage = wfAssetManageService.getById(id);
|
|
|
+ if (wfAssetManage == null) {
|
|
|
+ return RT.error("找不到此数据!");
|
|
|
+ }
|
|
|
+ return RT.ok(BeanUtil.toBean(wfAssetManage, WfAssetManageVo.class));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping
|
|
|
+ @ApiOperation(value = "新增资产管理")
|
|
|
+ @SaCheckPermission("wfassetmanage:add")
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody AddWfAssetManageDto dto){
|
|
|
+ WfAssetManage wfAssetManage = BeanUtil.toBean(dto, WfAssetManage.class);
|
|
|
+ boolean isSuccess = wfAssetManageService.save(wfAssetManage);
|
|
|
+ return RT.ok(isSuccess);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping
|
|
|
+ @ApiOperation(value = "修改资产管理")
|
|
|
+ @SaCheckPermission("wfassetmanage:edit")
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody UpdateWfAssetManageDto dto){
|
|
|
+
|
|
|
+ WfAssetManage wfAssetManage = BeanUtil.toBean(dto, WfAssetManage.class);
|
|
|
+ return RT.ok(wfAssetManageService.updateById(wfAssetManage));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping
|
|
|
+ @ApiOperation(value = "删除资产管理")
|
|
|
+ @SaCheckPermission("wfassetmanage:delete")
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
+ return RT.ok(wfAssetManageService.removeBatchByIds(ids));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|