| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- package jnpf.base.controller;
- import io.swagger.v3.oas.annotations.Operation;
- import io.swagger.v3.oas.annotations.tags.Tag;
- import jnpf.base.ActionResult;
- import jnpf.base.entity.PortalManageEntity;
- import jnpf.base.model.portalManage.*;
- import jnpf.base.service.PortalManageService;
- import jnpf.base.vo.PageListVO;
- import jnpf.constant.MsgCode;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import jakarta.validation.Valid;
- import java.util.List;
- import java.util.stream.Collectors;
- /**
- * 门户管理
- *
- * @author JNPF开发平台组 YanYu
- * @version v3.4.6
- * @copyrignt 引迈信息技术有限公司
- * @date 2023-02-16
- */
- @Slf4j
- @RestController
- @Tag(name = "门户管理", description = "PortalManage")
- @RequestMapping("/api/system/PortalManage")
- public class PortalManageController extends SuperController<PortalManageService, PortalManageEntity> {
- @Autowired
- PortalManageService portalManageService;
- // @Autowired
- // PortalService portalApi;
- // @Autowired
- // private AuthorizeService authorizeService;
- @Operation(summary = "新增")
- @PostMapping
- public ActionResult<String> create(@RequestBody @Valid PortalManageCreForm portalManageForm) {
- PortalManageEntity entity = portalManageForm.convertEntity();
- try {
- portalManageService.checkCreUp(entity);
- } catch (Exception e) {
- return ActionResult.fail(e.getMessage());
- }
- portalManageService.save(entity);
- return ActionResult.success(MsgCode.SU018.get());
- }
- @Operation(summary = "删除")
- @DeleteMapping("/{id}")
- public ActionResult<String> delete(@PathVariable String id) {
- boolean flag = portalManageService.removeById(id);
- if(flag){
- // 删除绑定的所有权限
- // authorizeService.remove(new AuthorizePortalManagePrimary(null, id).getQuery());
- return ActionResult.success(MsgCode.SU003.get());
- } else {
- return ActionResult.fail(MsgCode.FA003.get());
- }
- }
- @Operation(summary = "编辑")
- @PutMapping("/{id}")
- public ActionResult<String> update(@PathVariable("id") String id, @RequestBody @Valid PortalManageUpForm portalManageUpForm){
- PortalManageEntity update = portalManageUpForm.convertEntity();
- try {
- portalManageService.checkCreUp(update);
- } catch (Exception e) {
- return ActionResult.fail(e.getMessage());
- }
- portalManageService.updateById(update);
- return ActionResult.success(MsgCode.SU004.get());
- }
- @Operation(summary = "查看")
- @GetMapping("/{id}")
- public ActionResult<PortalManageVO> getOne(@PathVariable("id") String id) {
- PortalManageEntity entity = portalManageService.getById(id);
- return ActionResult.success(portalManageService.convertVO(entity));
- }
- @Operation(summary = "列表")
- @GetMapping("/list/{systemId}")
- public ActionResult<PageListVO<PortalManageVO>> getPage(@PathVariable("systemId") String systemId, PortalManagePage pmPage) {
- pmPage.setSystemId(systemId);
- return ActionResult.page(
- portalManageService.getPage(pmPage).getRecords()
- .stream().map(PortalManagePageDO::convert).collect(Collectors.toList()),
- pmPage.getPaginationVO());
- }
- }
|