micro-fast-IIDYB 角色的权限管理接口开发
This commit is contained in:
+15
-13
@@ -25,11 +25,11 @@ import java.util.Map;
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class InitUpmsSystem implements ApplicationListener<ContextRefreshedEvent> {
|
||||
public class InitSystem implements ApplicationListener<ContextRefreshedEvent> {
|
||||
public static final String ANNOTATION_CONFIG_EMBEDDED_WEB_APPLICATION_CONTEXT = "AnnotationConfigEmbeddedWebApplicationContext";
|
||||
public static final String ANNOTATION_CONFIG_APPLICATION_CONTEXT = "AnnotationConfigApplicationContext";
|
||||
|
||||
@Autowired
|
||||
@Autowired(required = false)
|
||||
private Map<String,SqlInitProperties> sqlInitPropertiesMap;
|
||||
|
||||
@Override
|
||||
@@ -39,17 +39,19 @@ public class InitUpmsSystem implements ApplicationListener<ContextRefreshedEvent
|
||||
// 保证springBoot上下文初始化完毕
|
||||
if (applicationContext.getDisplayName().contains(ANNOTATION_CONFIG_EMBEDDED_WEB_APPLICATION_CONTEXT)
|
||||
&& parent.getDisplayName().contains(ANNOTATION_CONFIG_APPLICATION_CONTEXT)) {
|
||||
// 初始化数据表
|
||||
sqlInitPropertiesMap.forEach((key,value) -> {
|
||||
if (value != null) {
|
||||
runInitSql(value.getDriverClassName(),value.getUrl(),value.getUsername(),value.getPassword(),value.getSqlPath());
|
||||
}
|
||||
});
|
||||
log.info("name:{} displayName: {} parentName:{} parentName: {}",
|
||||
applicationContext.getApplicationName(),
|
||||
applicationContext.getDisplayName(),
|
||||
parent.getApplicationName(),
|
||||
parent.getDisplayName());
|
||||
if ( sqlInitPropertiesMap != null) {
|
||||
// 初始化数据表
|
||||
sqlInitPropertiesMap.forEach((key,value) -> {
|
||||
if (value != null) {
|
||||
runInitSql(value.getDriverClassName(),value.getUrl(),value.getUsername(),value.getPassword(),value.getSqlPath());
|
||||
}
|
||||
});
|
||||
log.info("name:{} displayName: {} parentName:{} parentName: {}",
|
||||
applicationContext.getApplicationName(),
|
||||
applicationContext.getDisplayName(),
|
||||
parent.getApplicationName(),
|
||||
parent.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -76,4 +77,18 @@ public class UpmsPermissionController {
|
||||
public ServerResponse getPermissions(@RequestParam("userId") Integer userId,@RequestParam("type") Integer type,@RequestParam("pType") Integer pType) {
|
||||
return upmsPermissionService.getPermissionsByUserIdandPTypeandType(userId, type, pType);
|
||||
}
|
||||
|
||||
@ApiOperation("按类型查询角色所拥有的权限")
|
||||
@GetMapping("/role/permission")
|
||||
public ServerResponse getRolePermission(@RequestParam("type") int type,@RequestParam("roleId") Integer roleId){
|
||||
// todo
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation("按类型查询角色未拥有的权限")
|
||||
@GetMapping("/role/unhave/permission")
|
||||
public ServerResponse getRoleUnHavePermission(@RequestParam("type") int type,@RequestParam("roleId") Integer roleId){
|
||||
// todo
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+19
-7
@@ -2,19 +2,17 @@ package com.micro.fast.upms.controller;
|
||||
|
||||
import com.micro.fast.boot.starter.common.response.BaseConst;
|
||||
import com.micro.fast.boot.starter.common.response.ServerResponse;
|
||||
import com.micro.fast.upms.pojo.UpmsRolePermission;
|
||||
import com.micro.fast.upms.service.UpmsRolePermissionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -28,4 +26,18 @@ public class UpmsRolePermissionController {
|
||||
@Autowired
|
||||
private UpmsRolePermissionService upmsRolePermissionService;
|
||||
|
||||
@ApiOperation("给角色批量添加权限")
|
||||
@PostMapping("/addRolePermission")
|
||||
public ServerResponse addRolePermission(@RequestParam("roleId") @NotNull(message = BaseConst.BASEMSG_PREFIX+"请传入角色id") Integer roleId,
|
||||
@RequestParam("permissionIds") @NotNull(message = BaseConst.BASEMSG_PREFIX+"请传入权限id的集合") ArrayList<Integer> permissionIds){
|
||||
// todo
|
||||
return null;
|
||||
}
|
||||
@ApiOperation("给角色批量删除权限")
|
||||
@PostMapping("/deleteRolePermission")
|
||||
public ServerResponse deleteRolePermission(@RequestParam("roleId") @NotNull(message = BaseConst.BASEMSG_PREFIX+"请传入角色id") Integer roleId,
|
||||
@RequestParam("permissionIds") @NotNull(message = BaseConst.BASEMSG_PREFIX+"请传入权限id的集合") ArrayList<Integer> permissionIds){
|
||||
// todo
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.micro.fast.upms.dao;
|
||||
|
||||
import com.micro.fast.boot.starter.common.response.ServerResponse;
|
||||
import com.micro.fast.common.dao.SsmMapper;
|
||||
import com.micro.fast.upms.pojo.UpmsPermission;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -32,5 +31,7 @@ public interface UpmsPermissionMapper extends SsmMapper<UpmsPermission,Integer>
|
||||
@Override
|
||||
int deleteByPrimaryKeys(List<Integer> integers);
|
||||
|
||||
|
||||
List<UpmsPermission> selectByUserIdAndType(@Param("userId") Integer userId,@Param("pType") Integer pType,@Param("type") Integer type);
|
||||
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
and id in (select permission_id from upms_user_permission where user_id = #{userId} and type =#{type} )
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKeys">
|
||||
<delete id="deleteByPrimaryKeys">
|
||||
DELETE FROM upms_permission WHERE id IN
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")" >
|
||||
#{item}
|
||||
|
||||
@@ -43,7 +43,9 @@
|
||||
<spring-cloud-task.version>1.2.2.RELEASE</spring-cloud-task.version>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<!--/主要版本控制属性-->
|
||||
<gatling-plugin.version>2.2.4</gatling-plugin.version>
|
||||
<activiti.version>5.21.0</activiti.version>
|
||||
<gatling.version>2.3.0</gatling.version>
|
||||
<ratelimit.version>1.4.0.RELEASE</ratelimit.version>
|
||||
<docker.repository>registry.cn-hangzhou.aliyuncs.com/lishouyu/hub</docker.repository>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -310,6 +312,12 @@
|
||||
<artifactId>quartz-jobs</artifactId>
|
||||
<version>${quartz.version}</version>
|
||||
</dependency>
|
||||
<!-- 性能测试 Gatling -->
|
||||
<dependency>
|
||||
<groupId>io.gatling.highcharts</groupId>
|
||||
<artifactId>gatling-charts-highcharts</artifactId>
|
||||
<version>${gatling.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
@@ -405,6 +413,12 @@
|
||||
<!--</resources>-->
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--gatling性能测试插件依赖,mvn gatling:execute-->
|
||||
<plugin>
|
||||
<groupId>io.gatling</groupId>
|
||||
<artifactId>gatling-maven-plugin</artifactId>
|
||||
<version>${gatling-plugin.version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
|
||||
Reference in New Issue
Block a user