SysPermissionExtController.java 3.2 KB
package com.skua.modules.system.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.core.api.vo.Result;
import com.skua.modules.system.entity.SysPermissionExt;
import com.skua.modules.system.service.ISysPermissionExtService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <pre>
 * 菜单权限扩展配置
 * </pre>
 * @author 谢超
 * @version V1.0, 2022-06-16 14:44:41
 */
@Slf4j
@Api(tags="菜单权限扩展配置")
@RestController
@RequestMapping("/system/sysPermissionExt")
public class SysPermissionExtController {
	@Autowired
	private ISysPermissionExtService sysPermissionExtService;

	/**
	 * <pre>
	 * 更新机构信息
	 * </pre>
	 * @param sysPermissionDepartConfigId
	 * @param sysPermissionIds
	 * @author Xie Chao,2022-06-16 17:53
	 * @Description: TODO(这里描述这个方法的需求变更情况)
	 */
	@GetMapping("/updateSysPermissionExt")
	public Result<String> updateSysPermissionExt(String sysPermissionDepartConfigId, String sysPermissionIds){
		Result<String> result = new Result<>();
		sysPermissionExtService.updateSysPermissionExt(sysPermissionDepartConfigId,sysPermissionIds);
		result.setResult("更新成功");
		result.setSuccess(true);
		return result;
	}

	/**
	 * <pre>
	 * 查询已选择的权限ID
	 * </pre>
	 * @param sysPermissionDepartConfigId
	 * @author Xie Chao,2022-06-16 18:13
	 * @Description: TODO(这里描述这个方法的需求变更情况)
	 */
	@GetMapping("/getSelectedPermission")
	public Result<List<String>> getSelectedPermission(String sysPermissionDepartConfigId){
		Result<List<String>> result = new Result<>();
		List<String> sysPermissionIdList = new ArrayList<>();
		QueryWrapper<SysPermissionExt> sysPermissionExtQueryWrapper = new QueryWrapper<>();
		if (!StringUtils.isBlank(sysPermissionDepartConfigId)){
			sysPermissionExtQueryWrapper.eq("sys_permission_depart_config_id",sysPermissionDepartConfigId);
		}
		List<SysPermissionExt> list = sysPermissionExtService.list(sysPermissionExtQueryWrapper);
		for (SysPermissionExt sysPermissionExt : list) {
			sysPermissionIdList.add(sysPermissionExt.getSysPermissionId());
		}
		result.setResult(sysPermissionIdList);
		result.setSuccess(true);
		return result;
	}

	/**
	 * <pre>
	 * 通过菜单ID查询菜单机构配置
	 * </pre>
	 * @param sysPermissionId
	 * @author Xie Chao,2022-06-16 18:13
	 * @Description: TODO(这里描述这个方法的需求变更情况)
	 */
	@GetMapping("/getSysPermissionDepartConfigBySysPermissionId")
	public Result<Map<String,String>> getSysPermissionDepartConfigBySysPermissionId(String sysPermissionId){
		Result<Map<String,String>> result = new Result<>();
		Map<String,String> resultMap = sysPermissionExtService.getSysPermissionDepartConfigBySysPermissionId(sysPermissionId);
		result.setResult(resultMap);
		result.setSuccess(true);
		return result;
	}

}