package com.iailab.module.model.mpk.controller.admin; import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.module.model.mpk.dto.MpkFileDTO; import com.iailab.module.model.mpk.dto.ProjectDTO; import com.iailab.module.model.mpk.dto.ProjectPackageHistoryModelDTO; import com.iailab.module.model.mpk.service.ProjectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @description: * @author: dzd * @date: 2024/8/22 14:40 **/ @RestController @RequestMapping("/model/mpk/project") public class ProjectController { @Autowired private ProjectService projectService; @PreAuthorize("@ss.hasPermission('mpk:project:query')") @GetMapping("page") public CommonResult> page(@RequestParam Map params){ PageData page = projectService.page(params); return success(page); } @PreAuthorize("@ss.hasPermission('mpk:project:query')") @GetMapping("list") public CommonResult> list() { List list = projectService.list(new HashMap<>()); return success(list); } @PreAuthorize("@ss.hasPermission('mpk:project:query')") @GetMapping("{id}") public CommonResult get(@PathVariable("id") String id){ ProjectDTO data = projectService.get(id); return success(data); } @PreAuthorize("@ss.hasPermission('mpk:project:create')") @PostMapping public CommonResult save(@RequestBody ProjectDTO dto){ projectService.save(dto); return CommonResult.success(true); } @PreAuthorize("@ss.hasPermission('mpk:project:update')") @PutMapping public CommonResult update(@RequestBody ProjectDTO dto){ dto.setUpdateTime(new Date()); projectService.update(dto); return CommonResult.success(true); } @PreAuthorize("@ss.hasPermission('mpk:project:delete')") @DeleteMapping public CommonResult delete(String id){ projectService.delete(id); return CommonResult.success(true); } @GetMapping("getProjectModel") public CommonResult> getProjectModel(@RequestParam Map params){ PageData page = projectService.getProjectModel(params); return CommonResult.success(page); } }