package com.iailab.module.data.arc.controller.admin; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageResult; import com.iailab.module.data.arc.entity.ArcSettingEntity; import com.iailab.module.data.arc.service.ArcSettingService; import com.iailab.module.data.arc.vo.ArcSettingPageReqVO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; import java.util.Map; import java.util.UUID; import static com.iailab.framework.common.pojo.CommonResult.success; @Tag(name = "数据归档设置") @RestController @RequestMapping("/data/arc/setting") @Validated public class ArcSettingController { @Autowired private ArcSettingService arcSettingService; @GetMapping("page") public CommonResult> page(@Valid ArcSettingPageReqVO reqVO) { PageResult page = arcSettingService.queryPage(reqVO); return success(page); } @GetMapping("/list") @Operation(summary = "列表") public CommonResult> list(@Valid @RequestParam Map params) { List list = arcSettingService.list(params); return success(list); } @GetMapping("/info/{id}") public CommonResult info(@PathVariable("id") String id) { ArcSettingEntity info = arcSettingService.info(id); return success(info); } @PreAuthorize("@ss.hasPermission('data:arc:create')") @PostMapping("create") public CommonResult create(@RequestBody ArcSettingEntity arcSettingEntity) { String id = UUID.randomUUID().toString(); arcSettingEntity.setId(id); arcSettingService.add(arcSettingEntity); return success(true); } @PreAuthorize("@ss.hasPermission('data:arc:update')") @PutMapping("/update") public CommonResult update(@RequestBody ArcSettingEntity arcSettingEntity) { arcSettingService.update(arcSettingEntity); return success(true); } @PreAuthorize("@ss.hasPermission('data:arc:delete')") @DeleteMapping("/delete") public CommonResult delete(String id) { arcSettingService.delete(id); return success(true); } @PutMapping("/enable") @Operation(summary = "启用") public CommonResult enable(@RequestBody String[] ids) { arcSettingService.enableByIds(ids); return success(true); } }