提交 | 用户 | 时间
|
8c1646
|
1 |
package com.iailab.module.data.plan.item.controller.admin; |
潘 |
2 |
|
ed4f78
|
3 |
import com.iailab.framework.apilog.core.annotation.ApiAccessLog; |
8c1646
|
4 |
import com.iailab.framework.common.pojo.CommonResult; |
潘 |
5 |
import com.iailab.framework.common.pojo.PageResult; |
|
6 |
import com.iailab.framework.common.util.object.BeanUtils; |
|
7 |
import com.iailab.framework.common.util.object.ConvertUtils; |
ed4f78
|
8 |
import com.iailab.framework.excel.core.util.ExcelUtils; |
潘 |
9 |
import com.iailab.module.data.api.dto.ApiPointValueQueryDTO; |
8c1646
|
10 |
import com.iailab.module.data.plan.item.entity.PlanItemEntity; |
潘 |
11 |
import com.iailab.module.data.plan.item.service.PlanItemService; |
|
12 |
import com.iailab.module.data.plan.item.vo.PlanItemPageReqVO; |
|
13 |
import com.iailab.module.data.plan.item.vo.PlanItemRespVO; |
|
14 |
import com.iailab.module.data.plan.item.vo.PlanItemSaveReqVO; |
ed4f78
|
15 |
import com.iailab.module.data.point.vo.PointValueExportVO; |
8c1646
|
16 |
import io.swagger.v3.oas.annotations.Operation; |
潘 |
17 |
import io.swagger.v3.oas.annotations.Parameter; |
|
18 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
19 |
import org.springframework.beans.factory.annotation.Autowired; |
|
20 |
import org.springframework.security.access.prepost.PreAuthorize; |
|
21 |
import org.springframework.validation.annotation.Validated; |
|
22 |
import org.springframework.web.bind.annotation.*; |
|
23 |
|
ed4f78
|
24 |
import javax.servlet.http.HttpServletResponse; |
8c1646
|
25 |
import javax.validation.Valid; |
潘 |
26 |
|
ed4f78
|
27 |
import java.io.IOException; |
潘 |
28 |
import java.text.ParseException; |
|
29 |
import java.text.SimpleDateFormat; |
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.Date; |
8c1646
|
32 |
import java.util.List; |
4be7d8
|
33 |
import java.util.Map; |
8c1646
|
34 |
|
ed4f78
|
35 |
import static com.iailab.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
8c1646
|
36 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
潘 |
37 |
|
|
38 |
/** |
|
39 |
* @author PanZhibao |
|
40 |
* @Description |
|
41 |
* @createTime 2024年11月01日 |
|
42 |
*/ |
|
43 |
@Tag(name = "数据平台 - 计划数据项") |
|
44 |
@RestController |
|
45 |
@RequestMapping("/data/plan-item") |
|
46 |
@Validated |
|
47 |
public class PlanItemController { |
|
48 |
|
|
49 |
@Autowired |
|
50 |
private PlanItemService planItemService; |
|
51 |
|
|
52 |
@GetMapping("/page") |
|
53 |
@Operation(summary = "获取计划项列表", description = "用于【计划项】界面") |
|
54 |
@PreAuthorize("@ss.hasPermission('data:plan-item:query')") |
|
55 |
public CommonResult<PageResult<PlanItemRespVO>> page(PlanItemPageReqVO reqVO) { |
|
56 |
PageResult<PlanItemEntity> page = planItemService.page(reqVO); |
|
57 |
PageResult<PlanItemRespVO> result = BeanUtils.toBean(page, PlanItemRespVO.class); |
|
58 |
return success(result); |
|
59 |
} |
|
60 |
|
|
61 |
@PostMapping("/create") |
|
62 |
@Operation(summary = "创建计划项") |
|
63 |
@PreAuthorize("@ss.hasPermission('data:plan-item:create')") |
|
64 |
public CommonResult<Boolean> create(@Valid @RequestBody PlanItemSaveReqVO createReqVO) { |
|
65 |
planItemService.create(createReqVO); |
|
66 |
return success(true); |
|
67 |
} |
|
68 |
|
|
69 |
@PutMapping("/update") |
|
70 |
@Operation(summary = "修改计划项") |
|
71 |
@PreAuthorize("@ss.hasPermission('data:plan-item:update')") |
|
72 |
public CommonResult<Boolean> update(@Valid @RequestBody PlanItemSaveReqVO updateReqVO) { |
|
73 |
planItemService.update(updateReqVO); |
|
74 |
return success(true); |
|
75 |
} |
|
76 |
|
|
77 |
@DeleteMapping("/delete") |
|
78 |
@Operation(summary = "删除计划项") |
|
79 |
@Parameter(name = "id", description = "计划项编号", required= true, example = "1024") |
|
80 |
@PreAuthorize("@ss.hasPermission('data:plan-item:delete')") |
|
81 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
|
82 |
planItemService.delete(id); |
|
83 |
return success(true); |
|
84 |
} |
|
85 |
|
|
86 |
@GetMapping("/get") |
|
87 |
@Operation(summary = "获取计划项信息") |
|
88 |
@PreAuthorize("@ss.hasPermission('data:plan-item:query')") |
|
89 |
public CommonResult<PlanItemRespVO> get(@RequestParam("id") String id) { |
|
90 |
PlanItemEntity entity = planItemService.get(id); |
|
91 |
PlanItemRespVO respVO = BeanUtils.toBean(entity, PlanItemRespVO.class); |
|
92 |
return success(respVO); |
|
93 |
} |
|
94 |
|
|
95 |
@GetMapping("/list") |
|
96 |
@Operation(summary = "获取计划项列表", description = "用于【计划项】界面") |
|
97 |
@PreAuthorize("@ss.hasPermission('data:plan-item:query')") |
4be7d8
|
98 |
public CommonResult<List<PlanItemRespVO>> getList(@RequestParam Map<String, Object> params) { |
潘 |
99 |
List<PlanItemEntity> list = planItemService.list(params); |
8c1646
|
100 |
return success(ConvertUtils.sourceToTarget(list, PlanItemRespVO.class)); |
潘 |
101 |
} |
|
102 |
} |