mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 18:46:36 +08:00
commit:权限模块新增分配详情功能
This commit is contained in:
15
orange-demo-single-service/.gitignore
vendored
15
orange-demo-single-service/.gitignore
vendored
@@ -1,7 +1,6 @@
|
|||||||
target/
|
/target/
|
||||||
!.mvn/wrapper/maven-wrapper.jar
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
/.mvn/*
|
/.mvn/*
|
||||||
/zzlogs/*
|
|
||||||
|
|
||||||
### STS ###
|
### STS ###
|
||||||
.apt_generated
|
.apt_generated
|
||||||
@@ -19,9 +18,9 @@ target/
|
|||||||
*.ipr
|
*.ipr
|
||||||
|
|
||||||
### NetBeans ###
|
### NetBeans ###
|
||||||
nbproject/private/
|
/nbproject/private/
|
||||||
nbbuild/
|
/build/
|
||||||
dist/
|
/nbbuild/
|
||||||
nbdist/
|
/dist/
|
||||||
.nb-gradle/
|
/nbdist/
|
||||||
src/main/java/com/formmaker/.DS_Store
|
/.nb-gradle/
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
### 服务接口文档
|
### 服务接口文档
|
||||||
---
|
---
|
||||||
- Knife4j
|
- Postman
|
||||||
- 服务启动后,Knife4j的文档入口地址 [http://localhost:8082/doc.html#/plus](http://localhost:8082/doc.html#/plus)
|
- 无需启动服务,即可将当前工程的接口导出成Postman格式。在工程的common/common-tools/模块下,找到ExportApiApp文件,并执行main函数。
|
||||||
|
|
||||||
### 服务启动环境依赖
|
### 服务启动环境依赖
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -30,11 +30,6 @@
|
|||||||
<artifactId>application-common</artifactId>
|
<artifactId>application-common</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.orange.demo</groupId>
|
|
||||||
<artifactId>common-swagger</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.orange.demo.app.controller;
|
package com.orange.demo.app.controller;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import cn.jimmyshi.beanquery.BeanQuery;
|
import cn.jimmyshi.beanquery.BeanQuery;
|
||||||
import com.orange.demo.app.model.AreaCode;
|
import com.orange.demo.app.model.AreaCode;
|
||||||
import com.orange.demo.app.service.AreaCodeService;
|
import com.orange.demo.app.service.AreaCodeService;
|
||||||
@@ -20,7 +19,6 @@ import java.util.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "行政区划数据访问接口")
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/app/areaCode")
|
@RequestMapping("/admin/app/areaCode")
|
||||||
public class AreaCodeController {
|
public class AreaCodeController {
|
||||||
@@ -33,8 +31,8 @@ public class AreaCodeController {
|
|||||||
*
|
*
|
||||||
* @return 字典形式的行政区划列表。
|
* @return 字典形式的行政区划列表。
|
||||||
*/
|
*/
|
||||||
@GetMapping("/listDictAreaCode")
|
@GetMapping("/listDict")
|
||||||
public ResponseResult<List<Map<String, Object>>> listDictAreaCode() {
|
public ResponseResult<List<Map<String, Object>>> listDict() {
|
||||||
List<AreaCode> resultList = areaCodeService.getAllList();
|
List<AreaCode> resultList = areaCodeService.getAllList();
|
||||||
return ResponseResult.success(BeanQuery.select(
|
return ResponseResult.success(BeanQuery.select(
|
||||||
"parentId as parentId", "areaId as id", "areaName as name").executeFrom(resultList));
|
"parentId as parentId", "areaId as id", "areaName as name").executeFrom(resultList));
|
||||||
@@ -46,8 +44,8 @@ public class AreaCodeController {
|
|||||||
* @param parentId 上级行政区划Id。
|
* @param parentId 上级行政区划Id。
|
||||||
* @return 按照字典的形式返回下级行政区划列表。
|
* @return 按照字典的形式返回下级行政区划列表。
|
||||||
*/
|
*/
|
||||||
@GetMapping("/listDictAreaCodeByParentId")
|
@GetMapping("/listDictByParentId")
|
||||||
public ResponseResult<List<Map<String, Object>>> listDictAreaCodeByParentId(@RequestParam(required = false) Long parentId) {
|
public ResponseResult<List<Map<String, Object>>> listDictByParentId(@RequestParam(required = false) Long parentId) {
|
||||||
Collection<AreaCode> resultList = areaCodeService.getListByParentId(parentId);
|
Collection<AreaCode> resultList = areaCodeService.getListByParentId(parentId);
|
||||||
if (CollectionUtils.isEmpty(resultList)) {
|
if (CollectionUtils.isEmpty(resultList)) {
|
||||||
return ResponseResult.success(new LinkedList<>());
|
return ResponseResult.success(new LinkedList<>());
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ import com.orange.demo.common.core.annotation.MyRequestBody;
|
|||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.common.core.cache.SessionCacheHelper;
|
import com.orange.demo.common.core.cache.SessionCacheHelper;
|
||||||
import com.orange.demo.config.ApplicationConfig;
|
import com.orange.demo.config.ApplicationConfig;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -33,7 +31,6 @@ import javax.validation.groups.Default;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "课程数据管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/app/course")
|
@RequestMapping("/admin/app/course")
|
||||||
@@ -54,25 +51,17 @@ public class CourseController {
|
|||||||
* @param course 新增对象。
|
* @param course 新增对象。
|
||||||
* @return 应答结果对象,包含新增对象主键Id。
|
* @return 应答结果对象,包含新增对象主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {
|
|
||||||
"course.courseId",
|
|
||||||
"course.priceStart",
|
|
||||||
"course.priceEnd",
|
|
||||||
"course.classHourStart",
|
|
||||||
"course.classHourEnd",
|
|
||||||
"course.createTimeStart",
|
|
||||||
"course.createTimeEnd"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody Course course) {
|
public ResponseResult<Long> add(@MyRequestBody Course course) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(course);
|
String errorMessage = MyCommonUtil.getModelValidationError(course);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
// 验证关联Id的数据合法性
|
// 验证关联Id的数据合法性
|
||||||
CallResult callResult = courseService.verifyRelatedData(course, null);
|
CallResult callResult = courseService.verifyRelatedData(course, null);
|
||||||
if (!callResult.isSuccess()) {
|
if (!callResult.isSuccess()) {
|
||||||
errorMessage = callResult.getErrorMessage();
|
errorMessage = callResult.getErrorMessage();
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
course = courseService.saveNew(course);
|
course = courseService.saveNew(course);
|
||||||
return ResponseResult.success(course.getCourseId());
|
return ResponseResult.success(course.getCourseId());
|
||||||
@@ -84,18 +73,11 @@ public class CourseController {
|
|||||||
* @param course 更新对象。
|
* @param course 更新对象。
|
||||||
* @return 应答结果对象。
|
* @return 应答结果对象。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {
|
|
||||||
"course.priceStart",
|
|
||||||
"course.priceEnd",
|
|
||||||
"course.classHourStart",
|
|
||||||
"course.classHourEnd",
|
|
||||||
"course.createTimeStart",
|
|
||||||
"course.createTimeEnd"})
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public ResponseResult<Void> update(@MyRequestBody Course course) {
|
public ResponseResult<Void> update(@MyRequestBody Course course) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(course, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(course, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
// 验证关联Id的数据合法性
|
// 验证关联Id的数据合法性
|
||||||
Course originalCourse = courseService.getById(course.getCourseId());
|
Course originalCourse = courseService.getById(course.getCourseId());
|
||||||
@@ -108,7 +90,7 @@ public class CourseController {
|
|||||||
CallResult callResult = courseService.verifyRelatedData(course, originalCourse);
|
CallResult callResult = courseService.verifyRelatedData(course, originalCourse);
|
||||||
if (!callResult.isSuccess()) {
|
if (!callResult.isSuccess()) {
|
||||||
errorMessage = callResult.getErrorMessage();
|
errorMessage = callResult.getErrorMessage();
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
if (!courseService.update(course, originalCourse)) {
|
if (!courseService.update(course, originalCourse)) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||||
@@ -281,8 +263,8 @@ public class CourseController {
|
|||||||
* @param filter 过滤对象。
|
* @param filter 过滤对象。
|
||||||
* @return 应答结果对象,包含的数据为 List<Map<String, String>>,map中包含两条记录,key的值分别是id和name,value对应具体数据。
|
* @return 应答结果对象,包含的数据为 List<Map<String, String>>,map中包含两条记录,key的值分别是id和name,value对应具体数据。
|
||||||
*/
|
*/
|
||||||
@GetMapping("/listDictCourse")
|
@GetMapping("/listDict")
|
||||||
public ResponseResult<List<Map<String, Object>>> listDictCourse(Course filter) {
|
public ResponseResult<List<Map<String, Object>>> listDict(Course filter) {
|
||||||
List<Course> resultList = courseService.getListByFilter(filter, null);
|
List<Course> resultList = courseService.getListByFilter(filter, null);
|
||||||
return ResponseResult.success(BeanQuery.select(
|
return ResponseResult.success(BeanQuery.select(
|
||||||
"courseId as id", "courseName as name").executeFrom(resultList));
|
"courseId as id", "courseName as name").executeFrom(resultList));
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.orange.demo.common.core.object.*;
|
|||||||
import com.orange.demo.common.core.util.*;
|
import com.orange.demo.common.core.util.*;
|
||||||
import com.orange.demo.common.core.constant.*;
|
import com.orange.demo.common.core.constant.*;
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -20,7 +19,6 @@ import java.util.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "课程统计管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/app/courseTransStats")
|
@RequestMapping("/admin/app/courseTransStats")
|
||||||
@@ -62,7 +60,7 @@ public class CourseTransStatsController {
|
|||||||
@PostMapping("/listWithGroup")
|
@PostMapping("/listWithGroup")
|
||||||
public ResponseResult<MyPageData<CourseTransStats>> listWithGroup(
|
public ResponseResult<MyPageData<CourseTransStats>> listWithGroup(
|
||||||
@MyRequestBody CourseTransStats courseTransStatsFilter,
|
@MyRequestBody CourseTransStats courseTransStatsFilter,
|
||||||
@MyRequestBody MyGroupParam groupParam,
|
@MyRequestBody(required = true) MyGroupParam groupParam,
|
||||||
@MyRequestBody MyOrderParam orderParam,
|
@MyRequestBody MyOrderParam orderParam,
|
||||||
@MyRequestBody MyPageParam pageParam) {
|
@MyRequestBody MyPageParam pageParam) {
|
||||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, CourseTransStats.class);
|
String orderBy = MyOrderParam.buildOrderBy(orderParam, CourseTransStats.class);
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import com.orange.demo.common.core.object.ResponseResult;
|
|||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -24,7 +22,6 @@ import java.util.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "年级管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/app/grade")
|
@RequestMapping("/admin/app/grade")
|
||||||
@@ -39,12 +36,11 @@ public class GradeController {
|
|||||||
* @param grade 新增对象。
|
* @param grade 新增对象。
|
||||||
* @return 应答结果对象,包含新增对象主键Id。
|
* @return 应答结果对象,包含新增对象主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {"grade.gradeId"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Integer> add(@MyRequestBody Grade grade) {
|
public ResponseResult<Integer> add(@MyRequestBody Grade grade) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(grade);
|
String errorMessage = MyCommonUtil.getModelValidationError(grade);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
grade = gradeService.saveNew(grade);
|
grade = gradeService.saveNew(grade);
|
||||||
return ResponseResult.success(grade.getGradeId());
|
return ResponseResult.success(grade.getGradeId());
|
||||||
@@ -60,7 +56,7 @@ public class GradeController {
|
|||||||
public ResponseResult<Void> update(@MyRequestBody Grade grade) {
|
public ResponseResult<Void> update(@MyRequestBody Grade grade) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(grade, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(grade, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
Grade originalGrade = gradeService.getById(grade.getGradeId());
|
Grade originalGrade = gradeService.getById(grade.getGradeId());
|
||||||
if (originalGrade == null) {
|
if (originalGrade == null) {
|
||||||
@@ -95,8 +91,8 @@ public class GradeController {
|
|||||||
*
|
*
|
||||||
* @return 应答结果对象,包含字典形式的数据集合。
|
* @return 应答结果对象,包含字典形式的数据集合。
|
||||||
*/
|
*/
|
||||||
@GetMapping("/listDictGrade")
|
@GetMapping("/listDict")
|
||||||
public ResponseResult<List<Map<String, Object>>> listDictGrade() {
|
public ResponseResult<List<Map<String, Object>>> listDict() {
|
||||||
List<Grade> resultList = gradeService.getAllList();
|
List<Grade> resultList = gradeService.getAllList();
|
||||||
return ResponseResult.success(BeanQuery.select(
|
return ResponseResult.success(BeanQuery.select(
|
||||||
"gradeId as id", "gradeName as name").executeFrom(resultList));
|
"gradeId as id", "gradeName as name").executeFrom(resultList));
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import com.orange.demo.common.core.util.*;
|
|||||||
import com.orange.demo.common.core.constant.*;
|
import com.orange.demo.common.core.constant.*;
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -24,7 +22,6 @@ import javax.validation.groups.Default;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "校区数据管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/app/schoolInfo")
|
@RequestMapping("/admin/app/schoolInfo")
|
||||||
@@ -39,18 +36,17 @@ public class SchoolInfoController {
|
|||||||
* @param schoolInfo 新增对象。
|
* @param schoolInfo 新增对象。
|
||||||
* @return 应答结果对象,包含新增对象主键Id。
|
* @return 应答结果对象,包含新增对象主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {"schoolInfo.userId"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody SchoolInfo schoolInfo) {
|
public ResponseResult<Long> add(@MyRequestBody SchoolInfo schoolInfo) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(schoolInfo);
|
String errorMessage = MyCommonUtil.getModelValidationError(schoolInfo);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
// 验证关联Id的数据合法性
|
// 验证关联Id的数据合法性
|
||||||
CallResult callResult = schoolInfoService.verifyRelatedData(schoolInfo, null);
|
CallResult callResult = schoolInfoService.verifyRelatedData(schoolInfo, null);
|
||||||
if (!callResult.isSuccess()) {
|
if (!callResult.isSuccess()) {
|
||||||
errorMessage = callResult.getErrorMessage();
|
errorMessage = callResult.getErrorMessage();
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
schoolInfo = schoolInfoService.saveNew(schoolInfo);
|
schoolInfo = schoolInfoService.saveNew(schoolInfo);
|
||||||
return ResponseResult.success(schoolInfo.getSchoolId());
|
return ResponseResult.success(schoolInfo.getSchoolId());
|
||||||
@@ -66,7 +62,7 @@ public class SchoolInfoController {
|
|||||||
public ResponseResult<Void> update(@MyRequestBody SchoolInfo schoolInfo) {
|
public ResponseResult<Void> update(@MyRequestBody SchoolInfo schoolInfo) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(schoolInfo, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(schoolInfo, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
// 验证关联Id的数据合法性
|
// 验证关联Id的数据合法性
|
||||||
SchoolInfo originalSchoolInfo = schoolInfoService.getById(schoolInfo.getSchoolId());
|
SchoolInfo originalSchoolInfo = schoolInfoService.getById(schoolInfo.getSchoolId());
|
||||||
@@ -79,7 +75,7 @@ public class SchoolInfoController {
|
|||||||
CallResult callResult = schoolInfoService.verifyRelatedData(schoolInfo, originalSchoolInfo);
|
CallResult callResult = schoolInfoService.verifyRelatedData(schoolInfo, originalSchoolInfo);
|
||||||
if (!callResult.isSuccess()) {
|
if (!callResult.isSuccess()) {
|
||||||
errorMessage = callResult.getErrorMessage();
|
errorMessage = callResult.getErrorMessage();
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
if (!schoolInfoService.update(schoolInfo, originalSchoolInfo)) {
|
if (!schoolInfoService.update(schoolInfo, originalSchoolInfo)) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||||
@@ -159,8 +155,8 @@ public class SchoolInfoController {
|
|||||||
* @param filter 过滤对象。
|
* @param filter 过滤对象。
|
||||||
* @return 应答结果对象,包含的数据为 List<Map<String, String>>,map中包含两条记录,key的值分别是id和name,value对应具体数据。
|
* @return 应答结果对象,包含的数据为 List<Map<String, String>>,map中包含两条记录,key的值分别是id和name,value对应具体数据。
|
||||||
*/
|
*/
|
||||||
@GetMapping("/listDictSchoolInfo")
|
@GetMapping("/listDict")
|
||||||
public ResponseResult<List<Map<String, Object>>> listDictSchoolInfo(SchoolInfo filter) {
|
public ResponseResult<List<Map<String, Object>>> listDict(SchoolInfo filter) {
|
||||||
List<SchoolInfo> resultList = schoolInfoService.getListByFilter(filter, null);
|
List<SchoolInfo> resultList = schoolInfoService.getListByFilter(filter, null);
|
||||||
return ResponseResult.success(BeanQuery.select(
|
return ResponseResult.success(BeanQuery.select(
|
||||||
"schoolId as id", "schoolName as name").executeFrom(resultList));
|
"schoolId as id", "schoolName as name").executeFrom(resultList));
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.orange.demo.common.core.object.*;
|
|||||||
import com.orange.demo.common.core.util.*;
|
import com.orange.demo.common.core.util.*;
|
||||||
import com.orange.demo.common.core.constant.*;
|
import com.orange.demo.common.core.constant.*;
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -20,7 +19,6 @@ import java.util.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "学生行为统计管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/app/studentActionStats")
|
@RequestMapping("/admin/app/studentActionStats")
|
||||||
@@ -62,7 +60,7 @@ public class StudentActionStatsController {
|
|||||||
@PostMapping("/listWithGroup")
|
@PostMapping("/listWithGroup")
|
||||||
public ResponseResult<MyPageData<StudentActionStats>> listWithGroup(
|
public ResponseResult<MyPageData<StudentActionStats>> listWithGroup(
|
||||||
@MyRequestBody StudentActionStats studentActionStatsFilter,
|
@MyRequestBody StudentActionStats studentActionStatsFilter,
|
||||||
@MyRequestBody MyGroupParam groupParam,
|
@MyRequestBody(required = true) MyGroupParam groupParam,
|
||||||
@MyRequestBody MyOrderParam orderParam,
|
@MyRequestBody MyOrderParam orderParam,
|
||||||
@MyRequestBody MyPageParam pageParam) {
|
@MyRequestBody MyPageParam pageParam) {
|
||||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, StudentActionStats.class);
|
String orderBy = MyOrderParam.buildOrderBy(orderParam, StudentActionStats.class);
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import com.orange.demo.common.core.util.*;
|
|||||||
import com.orange.demo.common.core.constant.*;
|
import com.orange.demo.common.core.constant.*;
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -23,7 +21,6 @@ import javax.validation.groups.Default;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "学生行为流水管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/app/studentActionTrans")
|
@RequestMapping("/admin/app/studentActionTrans")
|
||||||
@@ -38,21 +35,17 @@ public class StudentActionTransController {
|
|||||||
* @param studentActionTrans 新增对象。
|
* @param studentActionTrans 新增对象。
|
||||||
* @return 应答结果对象,包含新增对象主键Id。
|
* @return 应答结果对象,包含新增对象主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {
|
|
||||||
"studentActionTrans.transId",
|
|
||||||
"studentActionTrans.createTimeStart",
|
|
||||||
"studentActionTrans.createTimeEnd"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody StudentActionTrans studentActionTrans) {
|
public ResponseResult<Long> add(@MyRequestBody StudentActionTrans studentActionTrans) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(studentActionTrans);
|
String errorMessage = MyCommonUtil.getModelValidationError(studentActionTrans);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
// 验证关联Id的数据合法性
|
// 验证关联Id的数据合法性
|
||||||
CallResult callResult = studentActionTransService.verifyRelatedData(studentActionTrans, null);
|
CallResult callResult = studentActionTransService.verifyRelatedData(studentActionTrans, null);
|
||||||
if (!callResult.isSuccess()) {
|
if (!callResult.isSuccess()) {
|
||||||
errorMessage = callResult.getErrorMessage();
|
errorMessage = callResult.getErrorMessage();
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
studentActionTrans = studentActionTransService.saveNew(studentActionTrans);
|
studentActionTrans = studentActionTransService.saveNew(studentActionTrans);
|
||||||
return ResponseResult.success(studentActionTrans.getTransId());
|
return ResponseResult.success(studentActionTrans.getTransId());
|
||||||
@@ -64,14 +57,11 @@ public class StudentActionTransController {
|
|||||||
* @param studentActionTrans 更新对象。
|
* @param studentActionTrans 更新对象。
|
||||||
* @return 应答结果对象。
|
* @return 应答结果对象。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {
|
|
||||||
"studentActionTrans.createTimeStart",
|
|
||||||
"studentActionTrans.createTimeEnd"})
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public ResponseResult<Void> update(@MyRequestBody StudentActionTrans studentActionTrans) {
|
public ResponseResult<Void> update(@MyRequestBody StudentActionTrans studentActionTrans) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(studentActionTrans, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(studentActionTrans, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
// 验证关联Id的数据合法性
|
// 验证关联Id的数据合法性
|
||||||
StudentActionTrans originalStudentActionTrans = studentActionTransService.getById(studentActionTrans.getTransId());
|
StudentActionTrans originalStudentActionTrans = studentActionTransService.getById(studentActionTrans.getTransId());
|
||||||
@@ -84,7 +74,7 @@ public class StudentActionTransController {
|
|||||||
CallResult callResult = studentActionTransService.verifyRelatedData(studentActionTrans, originalStudentActionTrans);
|
CallResult callResult = studentActionTransService.verifyRelatedData(studentActionTrans, originalStudentActionTrans);
|
||||||
if (!callResult.isSuccess()) {
|
if (!callResult.isSuccess()) {
|
||||||
errorMessage = callResult.getErrorMessage();
|
errorMessage = callResult.getErrorMessage();
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
if (!studentActionTransService.update(studentActionTrans, originalStudentActionTrans)) {
|
if (!studentActionTransService.update(studentActionTrans, originalStudentActionTrans)) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import com.orange.demo.common.core.util.*;
|
|||||||
import com.orange.demo.common.core.constant.*;
|
import com.orange.demo.common.core.constant.*;
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -24,7 +22,6 @@ import java.util.stream.Collectors;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "班级数据管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/app/studentClass")
|
@RequestMapping("/admin/app/studentClass")
|
||||||
@@ -43,18 +40,17 @@ public class StudentClassController {
|
|||||||
* @param studentClass 新增对象。
|
* @param studentClass 新增对象。
|
||||||
* @return 应答结果对象,包含新增对象主键Id。
|
* @return 应答结果对象,包含新增对象主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {"studentClass.userId"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody StudentClass studentClass) {
|
public ResponseResult<Long> add(@MyRequestBody StudentClass studentClass) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(studentClass);
|
String errorMessage = MyCommonUtil.getModelValidationError(studentClass);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
// 验证关联Id的数据合法性
|
// 验证关联Id的数据合法性
|
||||||
CallResult callResult = studentClassService.verifyRelatedData(studentClass, null);
|
CallResult callResult = studentClassService.verifyRelatedData(studentClass, null);
|
||||||
if (!callResult.isSuccess()) {
|
if (!callResult.isSuccess()) {
|
||||||
errorMessage = callResult.getErrorMessage();
|
errorMessage = callResult.getErrorMessage();
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
studentClass = studentClassService.saveNew(studentClass);
|
studentClass = studentClassService.saveNew(studentClass);
|
||||||
return ResponseResult.success(studentClass.getClassId());
|
return ResponseResult.success(studentClass.getClassId());
|
||||||
@@ -70,7 +66,7 @@ public class StudentClassController {
|
|||||||
public ResponseResult<Void> update(@MyRequestBody StudentClass studentClass) {
|
public ResponseResult<Void> update(@MyRequestBody StudentClass studentClass) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(studentClass, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(studentClass, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
// 验证关联Id的数据合法性
|
// 验证关联Id的数据合法性
|
||||||
StudentClass originalStudentClass = studentClassService.getById(studentClass.getClassId());
|
StudentClass originalStudentClass = studentClassService.getById(studentClass.getClassId());
|
||||||
@@ -83,7 +79,7 @@ public class StudentClassController {
|
|||||||
CallResult callResult = studentClassService.verifyRelatedData(studentClass, originalStudentClass);
|
CallResult callResult = studentClassService.verifyRelatedData(studentClass, originalStudentClass);
|
||||||
if (!callResult.isSuccess()) {
|
if (!callResult.isSuccess()) {
|
||||||
errorMessage = callResult.getErrorMessage();
|
errorMessage = callResult.getErrorMessage();
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
if (!studentClassService.update(studentClass, originalStudentClass)) {
|
if (!studentClassService.update(studentClass, originalStudentClass)) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||||
@@ -239,7 +235,7 @@ public class StudentClassController {
|
|||||||
for (ClassCourse classCourse : classCourseList) {
|
for (ClassCourse classCourse : classCourseList) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(classCourse);
|
String errorMessage = MyCommonUtil.getModelValidationError(classCourse);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Set<Long> courseIdSet =
|
Set<Long> courseIdSet =
|
||||||
@@ -262,7 +258,7 @@ public class StudentClassController {
|
|||||||
public ResponseResult<Void> updateClassCourse(@MyRequestBody ClassCourse classCourse) {
|
public ResponseResult<Void> updateClassCourse(@MyRequestBody ClassCourse classCourse) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(classCourse);
|
String errorMessage = MyCommonUtil.getModelValidationError(classCourse);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
if (!studentClassService.updateClassCourse(classCourse)) {
|
if (!studentClassService.updateClassCourse(classCourse)) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||||
@@ -392,7 +388,7 @@ public class StudentClassController {
|
|||||||
for (ClassStudent classStudent : classStudentList) {
|
for (ClassStudent classStudent : classStudentList) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(classStudent);
|
String errorMessage = MyCommonUtil.getModelValidationError(classStudent);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Set<Long> studentIdSet =
|
Set<Long> studentIdSet =
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import com.orange.demo.common.core.util.*;
|
|||||||
import com.orange.demo.common.core.constant.*;
|
import com.orange.demo.common.core.constant.*;
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -24,7 +22,6 @@ import javax.validation.groups.Default;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "学生数据管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/app/student")
|
@RequestMapping("/admin/app/student")
|
||||||
@@ -39,24 +36,17 @@ public class StudentController {
|
|||||||
* @param student 新增对象。
|
* @param student 新增对象。
|
||||||
* @return 应答结果对象,包含新增对象主键Id。
|
* @return 应答结果对象,包含新增对象主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {
|
|
||||||
"student.studentId",
|
|
||||||
"student.searchString",
|
|
||||||
"student.birthdayStart",
|
|
||||||
"student.birthdayEnd",
|
|
||||||
"student.registerTimeStart",
|
|
||||||
"student.registerTimeEnd"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody Student student) {
|
public ResponseResult<Long> add(@MyRequestBody Student student) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(student);
|
String errorMessage = MyCommonUtil.getModelValidationError(student);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
// 验证关联Id的数据合法性
|
// 验证关联Id的数据合法性
|
||||||
CallResult callResult = studentService.verifyRelatedData(student, null);
|
CallResult callResult = studentService.verifyRelatedData(student, null);
|
||||||
if (!callResult.isSuccess()) {
|
if (!callResult.isSuccess()) {
|
||||||
errorMessage = callResult.getErrorMessage();
|
errorMessage = callResult.getErrorMessage();
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
student = studentService.saveNew(student);
|
student = studentService.saveNew(student);
|
||||||
return ResponseResult.success(student.getStudentId());
|
return ResponseResult.success(student.getStudentId());
|
||||||
@@ -68,17 +58,11 @@ public class StudentController {
|
|||||||
* @param student 更新对象。
|
* @param student 更新对象。
|
||||||
* @return 应答结果对象。
|
* @return 应答结果对象。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {
|
|
||||||
"student.searchString",
|
|
||||||
"student.birthdayStart",
|
|
||||||
"student.birthdayEnd",
|
|
||||||
"student.registerTimeStart",
|
|
||||||
"student.registerTimeEnd"})
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public ResponseResult<Void> update(@MyRequestBody Student student) {
|
public ResponseResult<Void> update(@MyRequestBody Student student) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(student, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(student, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
// 验证关联Id的数据合法性
|
// 验证关联Id的数据合法性
|
||||||
Student originalStudent = studentService.getById(student.getStudentId());
|
Student originalStudent = studentService.getById(student.getStudentId());
|
||||||
@@ -91,7 +75,7 @@ public class StudentController {
|
|||||||
CallResult callResult = studentService.verifyRelatedData(student, originalStudent);
|
CallResult callResult = studentService.verifyRelatedData(student, originalStudent);
|
||||||
if (!callResult.isSuccess()) {
|
if (!callResult.isSuccess()) {
|
||||||
errorMessage = callResult.getErrorMessage();
|
errorMessage = callResult.getErrorMessage();
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
if (!studentService.update(student, originalStudent)) {
|
if (!studentService.update(student, originalStudent)) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||||
@@ -171,8 +155,8 @@ public class StudentController {
|
|||||||
* @param filter 过滤对象。
|
* @param filter 过滤对象。
|
||||||
* @return 应答结果对象,包含的数据为 List<Map<String, String>>,map中包含两条记录,key的值分别是id和name,value对应具体数据。
|
* @return 应答结果对象,包含的数据为 List<Map<String, String>>,map中包含两条记录,key的值分别是id和name,value对应具体数据。
|
||||||
*/
|
*/
|
||||||
@GetMapping("/listDictStudent")
|
@GetMapping("/listDict")
|
||||||
public ResponseResult<List<Map<String, Object>>> listDictStudent(Student filter) {
|
public ResponseResult<List<Map<String, Object>>> listDict(Student filter) {
|
||||||
List<Student> resultList = studentService.getListByFilter(filter, null);
|
List<Student> resultList = studentService.getListByFilter(filter, null);
|
||||||
return ResponseResult.success(BeanQuery.select(
|
return ResponseResult.success(BeanQuery.select(
|
||||||
"studentId as id", "studentName as name").executeFrom(resultList));
|
"studentId as id", "studentName as name").executeFrom(resultList));
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.orange.demo.app.model;
|
package com.orange.demo.app.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
@@ -12,7 +10,6 @@ import javax.persistence.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("行政区划实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_area_code")
|
@Table(name = "zz_area_code")
|
||||||
public class AreaCode {
|
public class AreaCode {
|
||||||
@@ -20,7 +17,6 @@ public class AreaCode {
|
|||||||
/**
|
/**
|
||||||
* 行政区划主键Id
|
* 行政区划主键Id
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "行政区划主键Id", required = true)
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "area_id")
|
@Column(name = "area_id")
|
||||||
private Long areaId;
|
private Long areaId;
|
||||||
@@ -28,21 +24,18 @@ public class AreaCode {
|
|||||||
/**
|
/**
|
||||||
* 行政区划名称
|
* 行政区划名称
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "行政区划名称")
|
|
||||||
@Column(name = "area_name")
|
@Column(name = "area_name")
|
||||||
private String areaName;
|
private String areaName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 行政区划级别 (1: 省级别 2: 市级别 3: 区级别)
|
* 行政区划级别 (1: 省级别 2: 市级别 3: 区级别)
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "行政区划级别")
|
|
||||||
@Column(name = "area_level")
|
@Column(name = "area_level")
|
||||||
private Integer areaLevel;
|
private Integer areaLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父级行政区划Id
|
* 父级行政区划Id
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "父级行政区划Id")
|
|
||||||
@Column(name = "parent_id")
|
@Column(name = "parent_id")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.orange.demo.app.model;
|
package com.orange.demo.app.model;
|
||||||
|
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -13,7 +11,6 @@ import javax.validation.constraints.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("ClassCourse实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_class_course")
|
@Table(name = "zz_class_course")
|
||||||
public class ClassCourse {
|
public class ClassCourse {
|
||||||
@@ -21,7 +18,6 @@ public class ClassCourse {
|
|||||||
/**
|
/**
|
||||||
* 班级Id。
|
* 班级Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "班级Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,班级Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,班级Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "class_id")
|
@Column(name = "class_id")
|
||||||
@@ -30,7 +26,6 @@ public class ClassCourse {
|
|||||||
/**
|
/**
|
||||||
* 课程Id。
|
* 课程Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "课程Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,课程Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,课程Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "course_id")
|
@Column(name = "course_id")
|
||||||
@@ -39,7 +34,6 @@ public class ClassCourse {
|
|||||||
/**
|
/**
|
||||||
* 课程顺序(数值越小越靠前)。
|
* 课程顺序(数值越小越靠前)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "课程顺序(数值越小越靠前)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,课程顺序(数值越小越靠前)不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,课程顺序(数值越小越靠前)不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "course_order")
|
@Column(name = "course_order")
|
||||||
private Integer courseOrder;
|
private Integer courseOrder;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.orange.demo.app.model;
|
package com.orange.demo.app.model;
|
||||||
|
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -13,7 +11,6 @@ import javax.validation.constraints.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("ClassStudent实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_class_student")
|
@Table(name = "zz_class_student")
|
||||||
public class ClassStudent {
|
public class ClassStudent {
|
||||||
@@ -21,7 +18,6 @@ public class ClassStudent {
|
|||||||
/**
|
/**
|
||||||
* 班级Id。
|
* 班级Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "班级Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,班级Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,班级Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "class_id")
|
@Column(name = "class_id")
|
||||||
@@ -30,7 +26,6 @@ public class ClassStudent {
|
|||||||
/**
|
/**
|
||||||
* 学生Id。
|
* 学生Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,学生Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,学生Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "student_id")
|
@Column(name = "student_id")
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import com.orange.demo.common.core.annotation.RelationDict;
|
|||||||
import com.orange.demo.common.core.annotation.RelationConstDict;
|
import com.orange.demo.common.core.annotation.RelationConstDict;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -24,7 +22,6 @@ import java.util.Map;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("Course实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_course")
|
@Table(name = "zz_course")
|
||||||
public class Course {
|
public class Course {
|
||||||
@@ -32,7 +29,6 @@ public class Course {
|
|||||||
/**
|
/**
|
||||||
* 主键Id。
|
* 主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "主键Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "course_id")
|
@Column(name = "course_id")
|
||||||
@@ -41,7 +37,6 @@ public class Course {
|
|||||||
/**
|
/**
|
||||||
* 课程名称。
|
* 课程名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "课程名称", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,课程名称不能为空!")
|
@NotBlank(message = "数据验证失败,课程名称不能为空!")
|
||||||
@Column(name = "course_name")
|
@Column(name = "course_name")
|
||||||
private String courseName;
|
private String courseName;
|
||||||
@@ -49,20 +44,17 @@ public class Course {
|
|||||||
/**
|
/**
|
||||||
* 课程价格。
|
* 课程价格。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "课程价格", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,课程价格不能为空!")
|
@NotNull(message = "数据验证失败,课程价格不能为空!")
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程描述。
|
* 课程描述。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "课程描述")
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程难度(0: 容易 1: 普通 2: 很难)。
|
* 课程难度(0: 容易 1: 普通 2: 很难)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "课程难度(0: 容易 1: 普通 2: 很难)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,课程难度不能为空!")
|
@NotNull(message = "数据验证失败,课程难度不能为空!")
|
||||||
@ConstDictRef(constDictClass = CourseDifficult.class, message = "数据验证失败,课程难度为无效值!")
|
@ConstDictRef(constDictClass = CourseDifficult.class, message = "数据验证失败,课程难度为无效值!")
|
||||||
private Integer difficulty;
|
private Integer difficulty;
|
||||||
@@ -70,7 +62,6 @@ public class Course {
|
|||||||
/**
|
/**
|
||||||
* 年级Id。
|
* 年级Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "年级Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所属年级不能为空!")
|
@NotNull(message = "数据验证失败,所属年级不能为空!")
|
||||||
@Column(name = "grade_id")
|
@Column(name = "grade_id")
|
||||||
private Integer gradeId;
|
private Integer gradeId;
|
||||||
@@ -78,7 +69,6 @@ public class Course {
|
|||||||
/**
|
/**
|
||||||
* 学科Id。
|
* 学科Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学科Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所属学科不能为空!")
|
@NotNull(message = "数据验证失败,所属学科不能为空!")
|
||||||
@ConstDictRef(constDictClass = Subject.class, message = "数据验证失败,所属学科为无效值!")
|
@ConstDictRef(constDictClass = Subject.class, message = "数据验证失败,所属学科为无效值!")
|
||||||
@Column(name = "subject_id")
|
@Column(name = "subject_id")
|
||||||
@@ -87,7 +77,6 @@ public class Course {
|
|||||||
/**
|
/**
|
||||||
* 课时数量。
|
* 课时数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "课时数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,课时数量不能为空!")
|
@NotNull(message = "数据验证失败,课时数量不能为空!")
|
||||||
@Column(name = "class_hour")
|
@Column(name = "class_hour")
|
||||||
private Integer classHour;
|
private Integer classHour;
|
||||||
@@ -95,7 +84,6 @@ public class Course {
|
|||||||
/**
|
/**
|
||||||
* 多张课程图片地址。
|
* 多张课程图片地址。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "多张课程图片地址", required = true)
|
|
||||||
@UploadFlagColumn(storeType = UploadStoreTypeEnum.LOCAL_SYSTEM)
|
@UploadFlagColumn(storeType = UploadStoreTypeEnum.LOCAL_SYSTEM)
|
||||||
@NotBlank(message = "数据验证失败,课程图片不能为空!")
|
@NotBlank(message = "数据验证失败,课程图片不能为空!")
|
||||||
@Column(name = "picture_url")
|
@Column(name = "picture_url")
|
||||||
@@ -104,74 +92,63 @@ public class Course {
|
|||||||
/**
|
/**
|
||||||
* 创建用户Id。
|
* 创建用户Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建用户Id")
|
|
||||||
@Column(name = "create_user_id")
|
@Column(name = "create_user_id")
|
||||||
private Long createUserId;
|
private Long createUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间。
|
* 创建时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@Column(name = "create_time")
|
@Column(name = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最后修改时间。
|
* 最后修改时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "最后修改时间")
|
|
||||||
@Column(name = "update_time")
|
@Column(name = "update_time")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* price 范围过滤起始值(>=)。
|
* price 范围过滤起始值(>=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "price 范围过滤起始值(>=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private BigDecimal priceStart;
|
private BigDecimal priceStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* price 范围过滤结束值(<=)。
|
* price 范围过滤结束值(<=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "price 范围过滤结束值(<=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private BigDecimal priceEnd;
|
private BigDecimal priceEnd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* classHour 范围过滤起始值(>=)。
|
* classHour 范围过滤起始值(>=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "classHour 范围过滤起始值(>=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private Integer classHourStart;
|
private Integer classHourStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* classHour 范围过滤结束值(<=)。
|
* classHour 范围过滤结束值(<=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "classHour 范围过滤结束值(<=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private Integer classHourEnd;
|
private Integer classHourEnd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createTime 范围过滤起始值(>=)。
|
* createTime 范围过滤起始值(>=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "createTime 范围过滤起始值(>=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String createTimeStart;
|
private String createTimeStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createTime 范围过滤结束值(<=)。
|
* createTime 范围过滤结束值(<=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "createTime 范围过滤结束值(<=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String createTimeEnd;
|
private String createTimeEnd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* courseId 的多对多关联表数据对象。
|
* courseId 的多对多关联表数据对象。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@Transient
|
@Transient
|
||||||
private ClassCourse classCourse;
|
private ClassCourse classCourse;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "gradeId",
|
masterIdField = "gradeId",
|
||||||
slaveServiceName = "gradeService",
|
slaveServiceName = "gradeService",
|
||||||
@@ -181,14 +158,12 @@ public class Course {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> gradeIdDictMap;
|
private Map<String, Object> gradeIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "difficulty",
|
masterIdField = "difficulty",
|
||||||
constantDictClass = CourseDifficult.class)
|
constantDictClass = CourseDifficult.class)
|
||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> difficultyDictMap;
|
private Map<String, Object> difficultyDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "subjectId",
|
masterIdField = "subjectId",
|
||||||
constantDictClass = Subject.class)
|
constantDictClass = Subject.class)
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import com.orange.demo.common.core.annotation.RelationDict;
|
|||||||
import com.orange.demo.common.core.annotation.RelationConstDict;
|
import com.orange.demo.common.core.annotation.RelationConstDict;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -20,7 +18,6 @@ import java.util.Map;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("CourseTransStats实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_course_trans_stats")
|
@Table(name = "zz_course_trans_stats")
|
||||||
public class CourseTransStats {
|
public class CourseTransStats {
|
||||||
@@ -28,7 +25,6 @@ public class CourseTransStats {
|
|||||||
/**
|
/**
|
||||||
* 主键Id。
|
* 主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "主键Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@@ -38,7 +34,6 @@ public class CourseTransStats {
|
|||||||
/**
|
/**
|
||||||
* 统计日期。
|
* 统计日期。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "统计日期", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,统计日期不能为空!")
|
@NotNull(message = "数据验证失败,统计日期不能为空!")
|
||||||
@Column(name = "stats_date")
|
@Column(name = "stats_date")
|
||||||
private Date statsDate;
|
private Date statsDate;
|
||||||
@@ -46,7 +41,6 @@ public class CourseTransStats {
|
|||||||
/**
|
/**
|
||||||
* 科目Id。
|
* 科目Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "科目Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所属科目不能为空!")
|
@NotNull(message = "数据验证失败,所属科目不能为空!")
|
||||||
@ConstDictRef(constDictClass = Subject.class, message = "数据验证失败,所属科目为无效值!")
|
@ConstDictRef(constDictClass = Subject.class, message = "数据验证失败,所属科目为无效值!")
|
||||||
@Column(name = "subject_id")
|
@Column(name = "subject_id")
|
||||||
@@ -55,7 +49,6 @@ public class CourseTransStats {
|
|||||||
/**
|
/**
|
||||||
* 年级Id。
|
* 年级Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "年级Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所属年级不能为空!")
|
@NotNull(message = "数据验证失败,所属年级不能为空!")
|
||||||
@Column(name = "grade_id")
|
@Column(name = "grade_id")
|
||||||
private Integer gradeId;
|
private Integer gradeId;
|
||||||
@@ -63,14 +56,12 @@ public class CourseTransStats {
|
|||||||
/**
|
/**
|
||||||
* 年级名称。
|
* 年级名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "年级名称")
|
|
||||||
@Column(name = "grade_name")
|
@Column(name = "grade_name")
|
||||||
private String gradeName;
|
private String gradeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程Id。
|
* 课程Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "课程Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,课程Id不能为空!")
|
@NotNull(message = "数据验证失败,课程Id不能为空!")
|
||||||
@Column(name = "course_id")
|
@Column(name = "course_id")
|
||||||
private Long courseId;
|
private Long courseId;
|
||||||
@@ -78,14 +69,12 @@ public class CourseTransStats {
|
|||||||
/**
|
/**
|
||||||
* 课程名称。
|
* 课程名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "课程名称")
|
|
||||||
@Column(name = "course_name")
|
@Column(name = "course_name")
|
||||||
private String courseName;
|
private String courseName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 学生上课次数。
|
* 学生上课次数。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生上课次数", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,上课次数不能为空!")
|
@NotNull(message = "数据验证失败,上课次数不能为空!")
|
||||||
@Column(name = "student_attend_count")
|
@Column(name = "student_attend_count")
|
||||||
private Integer studentAttendCount;
|
private Integer studentAttendCount;
|
||||||
@@ -93,7 +82,6 @@ public class CourseTransStats {
|
|||||||
/**
|
/**
|
||||||
* 学生献花数量。
|
* 学生献花数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生献花数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,献花数量不能为空!")
|
@NotNull(message = "数据验证失败,献花数量不能为空!")
|
||||||
@Column(name = "student_flower_amount")
|
@Column(name = "student_flower_amount")
|
||||||
private Integer studentFlowerAmount;
|
private Integer studentFlowerAmount;
|
||||||
@@ -101,7 +89,6 @@ public class CourseTransStats {
|
|||||||
/**
|
/**
|
||||||
* 学生献花次数。
|
* 学生献花次数。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生献花次数", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,献花次数不能为空!")
|
@NotNull(message = "数据验证失败,献花次数不能为空!")
|
||||||
@Column(name = "student_flower_count")
|
@Column(name = "student_flower_count")
|
||||||
private Integer studentFlowerCount;
|
private Integer studentFlowerCount;
|
||||||
@@ -109,18 +96,15 @@ public class CourseTransStats {
|
|||||||
/**
|
/**
|
||||||
* statsDate 范围过滤起始值(>=)。
|
* statsDate 范围过滤起始值(>=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "statsDate 范围过滤起始值(>=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String statsDateStart;
|
private String statsDateStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* statsDate 范围过滤结束值(<=)。
|
* statsDate 范围过滤结束值(<=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "statsDate 范围过滤结束值(<=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String statsDateEnd;
|
private String statsDateEnd;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "gradeId",
|
masterIdField = "gradeId",
|
||||||
slaveServiceName = "gradeService",
|
slaveServiceName = "gradeService",
|
||||||
@@ -130,7 +114,6 @@ public class CourseTransStats {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> gradeIdDictMap;
|
private Map<String, Object> gradeIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "subjectId",
|
masterIdField = "subjectId",
|
||||||
constantDictClass = Subject.class)
|
constantDictClass = Subject.class)
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package com.orange.demo.app.model;
|
|||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -15,7 +13,6 @@ import javax.validation.constraints.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("Grade实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_grade")
|
@Table(name = "zz_grade")
|
||||||
public class Grade {
|
public class Grade {
|
||||||
@@ -23,7 +20,6 @@ public class Grade {
|
|||||||
/**
|
/**
|
||||||
* 主键Id。
|
* 主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "主键Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@@ -33,7 +29,6 @@ public class Grade {
|
|||||||
/**
|
/**
|
||||||
* 年级名称。
|
* 年级名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "年级名称", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,年级名称不能为空!")
|
@NotBlank(message = "数据验证失败,年级名称不能为空!")
|
||||||
@Column(name = "grade_name")
|
@Column(name = "grade_name")
|
||||||
private String gradeName;
|
private String gradeName;
|
||||||
@@ -41,7 +36,6 @@ public class Grade {
|
|||||||
/**
|
/**
|
||||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
@DeletedFlagColumn
|
@DeletedFlagColumn
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.orange.demo.app.model;
|
package com.orange.demo.app.model;
|
||||||
|
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -13,7 +11,6 @@ import javax.validation.constraints.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("MaterialEdition实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_material_edition")
|
@Table(name = "zz_material_edition")
|
||||||
public class MaterialEdition {
|
public class MaterialEdition {
|
||||||
@@ -21,7 +18,6 @@ public class MaterialEdition {
|
|||||||
/**
|
/**
|
||||||
* 主键Id。
|
* 主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "主键Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@@ -31,7 +27,6 @@ public class MaterialEdition {
|
|||||||
/**
|
/**
|
||||||
* 教材版本名称。
|
* 教材版本名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "教材版本名称", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,教材版本名称不能为空!")
|
@NotBlank(message = "数据验证失败,教材版本名称不能为空!")
|
||||||
@Column(name = "edition_name")
|
@Column(name = "edition_name")
|
||||||
private String editionName;
|
private String editionName;
|
||||||
@@ -39,7 +34,6 @@ public class MaterialEdition {
|
|||||||
/**
|
/**
|
||||||
* 是否正在使用(0:不是,1:是)。
|
* 是否正在使用(0:不是,1:是)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "是否正在使用(0:不是,1:是)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,是否正在使用(0:不是,1:是)不能为空!")
|
@NotNull(message = "数据验证失败,是否正在使用(0:不是,1:是)不能为空!")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package com.orange.demo.app.model;
|
|||||||
|
|
||||||
import com.orange.demo.common.core.annotation.RelationDict;
|
import com.orange.demo.common.core.annotation.RelationDict;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -16,7 +14,6 @@ import java.util.Map;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("SchoolInfo实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_school_info")
|
@Table(name = "zz_school_info")
|
||||||
public class SchoolInfo {
|
public class SchoolInfo {
|
||||||
@@ -24,7 +21,6 @@ public class SchoolInfo {
|
|||||||
/**
|
/**
|
||||||
* 学校Id。
|
* 学校Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学校Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,学校Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,学校Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "school_id")
|
@Column(name = "school_id")
|
||||||
@@ -33,7 +29,6 @@ public class SchoolInfo {
|
|||||||
/**
|
/**
|
||||||
* 学校名称。
|
* 学校名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学校名称", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,学校名称不能为空!")
|
@NotBlank(message = "数据验证失败,学校名称不能为空!")
|
||||||
@Column(name = "school_name")
|
@Column(name = "school_name")
|
||||||
private String schoolName;
|
private String schoolName;
|
||||||
@@ -41,7 +36,6 @@ public class SchoolInfo {
|
|||||||
/**
|
/**
|
||||||
* 所在省Id。
|
* 所在省Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "所在省Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
||||||
@Column(name = "province_id")
|
@Column(name = "province_id")
|
||||||
private Long provinceId;
|
private Long provinceId;
|
||||||
@@ -49,12 +43,10 @@ public class SchoolInfo {
|
|||||||
/**
|
/**
|
||||||
* 所在城市Id。
|
* 所在城市Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "所在城市Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所在城市不能为空!")
|
@NotNull(message = "数据验证失败,所在城市不能为空!")
|
||||||
@Column(name = "city_id")
|
@Column(name = "city_id")
|
||||||
private Long cityId;
|
private Long cityId;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "provinceId",
|
masterIdField = "provinceId",
|
||||||
slaveServiceName = "areaCodeService",
|
slaveServiceName = "areaCodeService",
|
||||||
@@ -64,7 +56,6 @@ public class SchoolInfo {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> provinceIdDictMap;
|
private Map<String, Object> provinceIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "cityId",
|
masterIdField = "cityId",
|
||||||
slaveServiceName = "areaCodeService",
|
slaveServiceName = "areaCodeService",
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import com.orange.demo.common.core.annotation.RelationDict;
|
|||||||
import com.orange.demo.common.core.annotation.RelationConstDict;
|
import com.orange.demo.common.core.annotation.RelationConstDict;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -22,7 +20,6 @@ import java.util.Map;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("Student实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_student")
|
@Table(name = "zz_student")
|
||||||
public class Student {
|
public class Student {
|
||||||
@@ -30,7 +27,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 学生Id。
|
* 学生Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,学生Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,学生Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "student_id")
|
@Column(name = "student_id")
|
||||||
@@ -39,7 +35,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 登录手机。
|
* 登录手机。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "登录手机", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,手机号码不能为空!")
|
@NotBlank(message = "数据验证失败,手机号码不能为空!")
|
||||||
@Column(name = "login_mobile")
|
@Column(name = "login_mobile")
|
||||||
private String loginMobile;
|
private String loginMobile;
|
||||||
@@ -47,7 +42,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 学生姓名。
|
* 学生姓名。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生姓名", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,学生姓名不能为空!")
|
@NotBlank(message = "数据验证失败,学生姓名不能为空!")
|
||||||
@Column(name = "student_name")
|
@Column(name = "student_name")
|
||||||
private String studentName;
|
private String studentName;
|
||||||
@@ -55,7 +49,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 所在省份Id。
|
* 所在省份Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "所在省份Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
||||||
@Column(name = "province_id")
|
@Column(name = "province_id")
|
||||||
private Long provinceId;
|
private Long provinceId;
|
||||||
@@ -63,7 +56,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 所在城市Id。
|
* 所在城市Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "所在城市Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所在城市不能为空!")
|
@NotNull(message = "数据验证失败,所在城市不能为空!")
|
||||||
@Column(name = "city_id")
|
@Column(name = "city_id")
|
||||||
private Long cityId;
|
private Long cityId;
|
||||||
@@ -71,7 +63,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 区县Id。
|
* 区县Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "区县Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所在区县不能为空!")
|
@NotNull(message = "数据验证失败,所在区县不能为空!")
|
||||||
@Column(name = "district_id")
|
@Column(name = "district_id")
|
||||||
private Long districtId;
|
private Long districtId;
|
||||||
@@ -79,7 +70,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 学生性别 (0: 女生 1: 男生)。
|
* 学生性别 (0: 女生 1: 男生)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生性别 (0: 女生 1: 男生)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,学生性别不能为空!")
|
@NotNull(message = "数据验证失败,学生性别不能为空!")
|
||||||
@ConstDictRef(constDictClass = Gender.class, message = "数据验证失败,学生性别为无效值!")
|
@ConstDictRef(constDictClass = Gender.class, message = "数据验证失败,学生性别为无效值!")
|
||||||
private Integer gender;
|
private Integer gender;
|
||||||
@@ -87,14 +77,12 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 生日。
|
* 生日。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "生日", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,出生日期不能为空!")
|
@NotNull(message = "数据验证失败,出生日期不能为空!")
|
||||||
private Date birthday;
|
private Date birthday;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)。
|
* 经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,经验等级不能为空!")
|
@NotNull(message = "数据验证失败,经验等级不能为空!")
|
||||||
@ConstDictRef(constDictClass = ExpLevel.class, message = "数据验证失败,经验等级为无效值!")
|
@ConstDictRef(constDictClass = ExpLevel.class, message = "数据验证失败,经验等级为无效值!")
|
||||||
@Column(name = "experience_level")
|
@Column(name = "experience_level")
|
||||||
@@ -103,7 +91,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 总共充值学币数量。
|
* 总共充值学币数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "总共充值学币数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,充值学币不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,充值学币不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "total_coin")
|
@Column(name = "total_coin")
|
||||||
private Integer totalCoin;
|
private Integer totalCoin;
|
||||||
@@ -111,7 +98,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 可用学币数量。
|
* 可用学币数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "可用学币数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,剩余学币不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,剩余学币不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "left_coin")
|
@Column(name = "left_coin")
|
||||||
private Integer leftCoin;
|
private Integer leftCoin;
|
||||||
@@ -119,7 +105,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 年级Id。
|
* 年级Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "年级Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,年级不能为空!")
|
@NotNull(message = "数据验证失败,年级不能为空!")
|
||||||
@Column(name = "grade_id")
|
@Column(name = "grade_id")
|
||||||
private Integer gradeId;
|
private Integer gradeId;
|
||||||
@@ -127,7 +112,6 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 校区Id。
|
* 校区Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "校区Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所属校区不能为空!")
|
@NotNull(message = "数据验证失败,所属校区不能为空!")
|
||||||
@Column(name = "school_id")
|
@Column(name = "school_id")
|
||||||
private Long schoolId;
|
private Long schoolId;
|
||||||
@@ -135,14 +119,12 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* 注册时间。
|
* 注册时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "注册时间")
|
|
||||||
@Column(name = "register_time")
|
@Column(name = "register_time")
|
||||||
private Date registerTime;
|
private Date registerTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 学生状态 (0: 正常 1: 锁定 2: 注销)。
|
* 学生状态 (0: 正常 1: 锁定 2: 注销)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生状态 (0: 正常 1: 锁定 2: 注销)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,学生状态不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,学生状态不能为空!", groups = {UpdateGroup.class})
|
||||||
@ConstDictRef(constDictClass = StudentStatus.class, message = "数据验证失败,学生状态为无效值!")
|
@ConstDictRef(constDictClass = StudentStatus.class, message = "数据验证失败,学生状态为无效值!")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
@@ -150,39 +132,33 @@ public class Student {
|
|||||||
/**
|
/**
|
||||||
* birthday 范围过滤起始值(>=)。
|
* birthday 范围过滤起始值(>=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "birthday 范围过滤起始值(>=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String birthdayStart;
|
private String birthdayStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* birthday 范围过滤结束值(<=)。
|
* birthday 范围过滤结束值(<=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "birthday 范围过滤结束值(<=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String birthdayEnd;
|
private String birthdayEnd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* registerTime 范围过滤起始值(>=)。
|
* registerTime 范围过滤起始值(>=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "registerTime 范围过滤起始值(>=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String registerTimeStart;
|
private String registerTimeStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* registerTime 范围过滤结束值(<=)。
|
* registerTime 范围过滤结束值(<=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "registerTime 范围过滤结束值(<=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String registerTimeEnd;
|
private String registerTimeEnd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* login_mobile / student_name LIKE搜索字符串。
|
* login_mobile / student_name LIKE搜索字符串。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "LIKE模糊搜索字符串")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String searchString;
|
private String searchString;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "provinceId",
|
masterIdField = "provinceId",
|
||||||
slaveServiceName = "areaCodeService",
|
slaveServiceName = "areaCodeService",
|
||||||
@@ -192,7 +168,6 @@ public class Student {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> provinceIdDictMap;
|
private Map<String, Object> provinceIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "cityId",
|
masterIdField = "cityId",
|
||||||
slaveServiceName = "areaCodeService",
|
slaveServiceName = "areaCodeService",
|
||||||
@@ -202,7 +177,6 @@ public class Student {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> cityIdDictMap;
|
private Map<String, Object> cityIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "districtId",
|
masterIdField = "districtId",
|
||||||
slaveServiceName = "areaCodeService",
|
slaveServiceName = "areaCodeService",
|
||||||
@@ -212,7 +186,6 @@ public class Student {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> districtIdDictMap;
|
private Map<String, Object> districtIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "gradeId",
|
masterIdField = "gradeId",
|
||||||
slaveServiceName = "gradeService",
|
slaveServiceName = "gradeService",
|
||||||
@@ -222,7 +195,6 @@ public class Student {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> gradeIdDictMap;
|
private Map<String, Object> gradeIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "schoolId",
|
masterIdField = "schoolId",
|
||||||
slaveServiceName = "schoolInfoService",
|
slaveServiceName = "schoolInfoService",
|
||||||
@@ -232,21 +204,18 @@ public class Student {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> schoolIdDictMap;
|
private Map<String, Object> schoolIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "gender",
|
masterIdField = "gender",
|
||||||
constantDictClass = Gender.class)
|
constantDictClass = Gender.class)
|
||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> genderDictMap;
|
private Map<String, Object> genderDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "experienceLevel",
|
masterIdField = "experienceLevel",
|
||||||
constantDictClass = ExpLevel.class)
|
constantDictClass = ExpLevel.class)
|
||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> experienceLevelDictMap;
|
private Map<String, Object> experienceLevelDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "status",
|
masterIdField = "status",
|
||||||
constantDictClass = StudentStatus.class)
|
constantDictClass = StudentStatus.class)
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package com.orange.demo.app.model;
|
|||||||
|
|
||||||
import com.orange.demo.common.core.annotation.RelationDict;
|
import com.orange.demo.common.core.annotation.RelationDict;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -17,7 +15,6 @@ import java.util.Map;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("StudentActionStats实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_student_action_stats")
|
@Table(name = "zz_student_action_stats")
|
||||||
public class StudentActionStats {
|
public class StudentActionStats {
|
||||||
@@ -25,7 +22,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 主键Id。
|
* 主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "主键Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "stats_id")
|
@Column(name = "stats_id")
|
||||||
@@ -34,7 +30,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 统计日期。
|
* 统计日期。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "统计日期", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,统计日期不能为空!")
|
@NotNull(message = "数据验证失败,统计日期不能为空!")
|
||||||
@Column(name = "stats_date")
|
@Column(name = "stats_date")
|
||||||
private Date statsDate;
|
private Date statsDate;
|
||||||
@@ -42,14 +37,12 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 统计小时。
|
* 统计小时。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "统计小时")
|
|
||||||
@Column(name = "stats_month")
|
@Column(name = "stats_month")
|
||||||
private Date statsMonth;
|
private Date statsMonth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 年级Id。
|
* 年级Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "年级Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所属年级不能为空!")
|
@NotNull(message = "数据验证失败,所属年级不能为空!")
|
||||||
@Column(name = "grade_id")
|
@Column(name = "grade_id")
|
||||||
private Integer gradeId;
|
private Integer gradeId;
|
||||||
@@ -57,7 +50,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 学生所在省Id。
|
* 学生所在省Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生所在省Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
||||||
@Column(name = "province_id")
|
@Column(name = "province_id")
|
||||||
private Long provinceId;
|
private Long provinceId;
|
||||||
@@ -65,7 +57,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 学生所在城市Id。
|
* 学生所在城市Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生所在城市Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所在城市不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,所在城市不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "city_id")
|
@Column(name = "city_id")
|
||||||
private Long cityId;
|
private Long cityId;
|
||||||
@@ -73,7 +64,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 购课学币数量。
|
* 购课学币数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购课学币数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,购课学币数量不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,购课学币数量不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "buy_course_amount")
|
@Column(name = "buy_course_amount")
|
||||||
private Integer buyCourseAmount;
|
private Integer buyCourseAmount;
|
||||||
@@ -81,7 +71,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 购买课程次数。
|
* 购买课程次数。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买课程次数", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,购买课程次数不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,购买课程次数不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "buy_course_count")
|
@Column(name = "buy_course_count")
|
||||||
private Integer buyCourseCount;
|
private Integer buyCourseCount;
|
||||||
@@ -89,7 +78,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 购买视频学币数量。
|
* 购买视频学币数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买视频学币数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,购买视频学币数量不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,购买视频学币数量不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "buy_video_amount")
|
@Column(name = "buy_video_amount")
|
||||||
private Integer buyVideoAmount;
|
private Integer buyVideoAmount;
|
||||||
@@ -97,7 +85,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 购买视频次数。
|
* 购买视频次数。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买视频次数", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,购买视频次数不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,购买视频次数不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "buy_video_count")
|
@Column(name = "buy_video_count")
|
||||||
private Integer buyVideoCount;
|
private Integer buyVideoCount;
|
||||||
@@ -105,7 +92,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 购买作业学币数量。
|
* 购买作业学币数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买作业学币数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,购买作业学币数量不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,购买作业学币数量不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "buy_paper_amount")
|
@Column(name = "buy_paper_amount")
|
||||||
private Integer buyPaperAmount;
|
private Integer buyPaperAmount;
|
||||||
@@ -113,7 +99,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 购买作业次数。
|
* 购买作业次数。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买作业次数", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,购买作业次数不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,购买作业次数不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "buy_paper_count")
|
@Column(name = "buy_paper_count")
|
||||||
private Integer buyPaperCount;
|
private Integer buyPaperCount;
|
||||||
@@ -121,7 +106,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 购买献花数量。
|
* 购买献花数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买献花数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,购买献花数量不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,购买献花数量不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "buy_flower_amount")
|
@Column(name = "buy_flower_amount")
|
||||||
private Integer buyFlowerAmount;
|
private Integer buyFlowerAmount;
|
||||||
@@ -129,7 +113,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 购买献花次数。
|
* 购买献花次数。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买献花次数", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,购买献花次数不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,购买献花次数不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "buy_flower_count")
|
@Column(name = "buy_flower_count")
|
||||||
private Integer buyFlowerCount;
|
private Integer buyFlowerCount;
|
||||||
@@ -137,7 +120,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 充值学币数量。
|
* 充值学币数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "充值学币数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,充值学币数量不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,充值学币数量不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "recharge_coin_amount")
|
@Column(name = "recharge_coin_amount")
|
||||||
private Integer rechargeCoinAmount;
|
private Integer rechargeCoinAmount;
|
||||||
@@ -145,7 +127,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 充值学币次数。
|
* 充值学币次数。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "充值学币次数", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,充值学币次数不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,充值学币次数不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "recharge_coin_count")
|
@Column(name = "recharge_coin_count")
|
||||||
private Integer rechargeCoinCount;
|
private Integer rechargeCoinCount;
|
||||||
@@ -153,7 +134,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 线下课程上课次数。
|
* 线下课程上课次数。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "线下课程上课次数", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,线下课程上课次数不能为空!")
|
@NotNull(message = "数据验证失败,线下课程上课次数不能为空!")
|
||||||
@Column(name = "do_course_count")
|
@Column(name = "do_course_count")
|
||||||
private Integer doCourseCount;
|
private Integer doCourseCount;
|
||||||
@@ -161,7 +141,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 观看视频次数。
|
* 观看视频次数。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "观看视频次数", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,观看视频次数不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,观看视频次数不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "watch_video_count")
|
@Column(name = "watch_video_count")
|
||||||
private Integer watchVideoCount;
|
private Integer watchVideoCount;
|
||||||
@@ -169,7 +148,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 购买献花消费学币数量。
|
* 购买献花消费学币数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买献花消费学币数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,购买献花消费学币数量不能为空!")
|
@NotNull(message = "数据验证失败,购买献花消费学币数量不能为空!")
|
||||||
@Column(name = "watch_video_total_second")
|
@Column(name = "watch_video_total_second")
|
||||||
private Integer watchVideoTotalSecond;
|
private Integer watchVideoTotalSecond;
|
||||||
@@ -177,7 +155,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 做题数量。
|
* 做题数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "做题数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,做题数量不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,做题数量不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "do_exercise_count")
|
@Column(name = "do_exercise_count")
|
||||||
private Integer doExerciseCount;
|
private Integer doExerciseCount;
|
||||||
@@ -185,7 +162,6 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* 做题正确的数量。
|
* 做题正确的数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "做题正确的数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,做题正确的数量不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,做题正确的数量不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "do_exercise_correct_count")
|
@Column(name = "do_exercise_correct_count")
|
||||||
private Integer doExerciseCorrectCount;
|
private Integer doExerciseCorrectCount;
|
||||||
@@ -193,18 +169,15 @@ public class StudentActionStats {
|
|||||||
/**
|
/**
|
||||||
* statsDate 范围过滤起始值(>=)。
|
* statsDate 范围过滤起始值(>=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "statsDate 范围过滤起始值(>=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String statsDateStart;
|
private String statsDateStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* statsDate 范围过滤结束值(<=)。
|
* statsDate 范围过滤结束值(<=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "statsDate 范围过滤结束值(<=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String statsDateEnd;
|
private String statsDateEnd;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "gradeId",
|
masterIdField = "gradeId",
|
||||||
slaveServiceName = "gradeService",
|
slaveServiceName = "gradeService",
|
||||||
@@ -214,7 +187,6 @@ public class StudentActionStats {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> gradeIdDictMap;
|
private Map<String, Object> gradeIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "provinceId",
|
masterIdField = "provinceId",
|
||||||
slaveServiceName = "areaCodeService",
|
slaveServiceName = "areaCodeService",
|
||||||
@@ -224,7 +196,6 @@ public class StudentActionStats {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> provinceIdDictMap;
|
private Map<String, Object> provinceIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "cityId",
|
masterIdField = "cityId",
|
||||||
slaveServiceName = "areaCodeService",
|
slaveServiceName = "areaCodeService",
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import com.orange.demo.common.core.annotation.RelationDict;
|
|||||||
import com.orange.demo.common.core.annotation.RelationConstDict;
|
import com.orange.demo.common.core.annotation.RelationConstDict;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -21,7 +19,6 @@ import java.util.Map;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("StudentActionTrans实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_student_action_trans")
|
@Table(name = "zz_student_action_trans")
|
||||||
public class StudentActionTrans {
|
public class StudentActionTrans {
|
||||||
@@ -29,7 +26,6 @@ public class StudentActionTrans {
|
|||||||
/**
|
/**
|
||||||
* 主键Id。
|
* 主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "主键Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "trans_id")
|
@Column(name = "trans_id")
|
||||||
@@ -38,7 +34,6 @@ public class StudentActionTrans {
|
|||||||
/**
|
/**
|
||||||
* 学生Id。
|
* 学生Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,学生Id不能为空!")
|
@NotNull(message = "数据验证失败,学生Id不能为空!")
|
||||||
@Column(name = "student_id")
|
@Column(name = "student_id")
|
||||||
private Long studentId;
|
private Long studentId;
|
||||||
@@ -46,7 +41,6 @@ public class StudentActionTrans {
|
|||||||
/**
|
/**
|
||||||
* 学生名称。
|
* 学生名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生名称", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,学生名称不能为空!")
|
@NotBlank(message = "数据验证失败,学生名称不能为空!")
|
||||||
@Column(name = "student_name")
|
@Column(name = "student_name")
|
||||||
private String studentName;
|
private String studentName;
|
||||||
@@ -54,7 +48,6 @@ public class StudentActionTrans {
|
|||||||
/**
|
/**
|
||||||
* 学生校区。
|
* 学生校区。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生校区", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,学生校区不能为空!")
|
@NotNull(message = "数据验证失败,学生校区不能为空!")
|
||||||
@Column(name = "school_id")
|
@Column(name = "school_id")
|
||||||
private Long schoolId;
|
private Long schoolId;
|
||||||
@@ -62,7 +55,6 @@ public class StudentActionTrans {
|
|||||||
/**
|
/**
|
||||||
* 年级Id。
|
* 年级Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "年级Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,学生年级不能为空!")
|
@NotNull(message = "数据验证失败,学生年级不能为空!")
|
||||||
@Column(name = "grade_id")
|
@Column(name = "grade_id")
|
||||||
private Integer gradeId;
|
private Integer gradeId;
|
||||||
@@ -70,7 +62,6 @@ public class StudentActionTrans {
|
|||||||
/**
|
/**
|
||||||
* 行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)。
|
* 行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,行为类型不能为空!")
|
@NotNull(message = "数据验证失败,行为类型不能为空!")
|
||||||
@ConstDictRef(constDictClass = StudentActionType.class, message = "数据验证失败,行为类型为无效值!")
|
@ConstDictRef(constDictClass = StudentActionType.class, message = "数据验证失败,行为类型为无效值!")
|
||||||
@Column(name = "action_type")
|
@Column(name = "action_type")
|
||||||
@@ -79,7 +70,6 @@ public class StudentActionTrans {
|
|||||||
/**
|
/**
|
||||||
* 设备类型(0: iOS 1: Android 2: PC)。
|
* 设备类型(0: iOS 1: Android 2: PC)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "设备类型(0: iOS 1: Android 2: PC)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,设备类型不能为空!")
|
@NotNull(message = "数据验证失败,设备类型不能为空!")
|
||||||
@ConstDictRef(constDictClass = DeviceType.class, message = "数据验证失败,设备类型为无效值!")
|
@ConstDictRef(constDictClass = DeviceType.class, message = "数据验证失败,设备类型为无效值!")
|
||||||
@Column(name = "device_type")
|
@Column(name = "device_type")
|
||||||
@@ -88,56 +78,48 @@ public class StudentActionTrans {
|
|||||||
/**
|
/**
|
||||||
* 看视频秒数。
|
* 看视频秒数。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "看视频秒数")
|
|
||||||
@Column(name = "watch_video_seconds")
|
@Column(name = "watch_video_seconds")
|
||||||
private Integer watchVideoSeconds;
|
private Integer watchVideoSeconds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 购买献花数量。
|
* 购买献花数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买献花数量")
|
|
||||||
@Column(name = "flower_count")
|
@Column(name = "flower_count")
|
||||||
private Integer flowerCount;
|
private Integer flowerCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 购买作业数量。
|
* 购买作业数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买作业数量")
|
|
||||||
@Column(name = "paper_count")
|
@Column(name = "paper_count")
|
||||||
private Integer paperCount;
|
private Integer paperCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 购买视频数量。
|
* 购买视频数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买视频数量")
|
|
||||||
@Column(name = "video_count")
|
@Column(name = "video_count")
|
||||||
private Integer videoCount;
|
private Integer videoCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 购买课程数量。
|
* 购买课程数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "购买课程数量")
|
|
||||||
@Column(name = "course_count")
|
@Column(name = "course_count")
|
||||||
private Integer courseCount;
|
private Integer courseCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充值学币数量。
|
* 充值学币数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "充值学币数量")
|
|
||||||
@Column(name = "coin_count")
|
@Column(name = "coin_count")
|
||||||
private Integer coinCount;
|
private Integer coinCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 做题是否正确标记。
|
* 做题是否正确标记。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "做题是否正确标记")
|
|
||||||
@Column(name = "exercise_correct_flag")
|
@Column(name = "exercise_correct_flag")
|
||||||
private Integer exerciseCorrectFlag;
|
private Integer exerciseCorrectFlag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发生时间。
|
* 发生时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "发生时间", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,发生时间不能为空!")
|
@NotNull(message = "数据验证失败,发生时间不能为空!")
|
||||||
@Column(name = "create_time")
|
@Column(name = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
@@ -145,18 +127,15 @@ public class StudentActionTrans {
|
|||||||
/**
|
/**
|
||||||
* createTime 范围过滤起始值(>=)。
|
* createTime 范围过滤起始值(>=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "createTime 范围过滤起始值(>=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String createTimeStart;
|
private String createTimeStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createTime 范围过滤结束值(<=)。
|
* createTime 范围过滤结束值(<=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "createTime 范围过滤结束值(<=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String createTimeEnd;
|
private String createTimeEnd;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "schoolId",
|
masterIdField = "schoolId",
|
||||||
slaveServiceName = "schoolInfoService",
|
slaveServiceName = "schoolInfoService",
|
||||||
@@ -166,7 +145,6 @@ public class StudentActionTrans {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> schoolIdDictMap;
|
private Map<String, Object> schoolIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "gradeId",
|
masterIdField = "gradeId",
|
||||||
slaveServiceName = "gradeService",
|
slaveServiceName = "gradeService",
|
||||||
@@ -176,14 +154,12 @@ public class StudentActionTrans {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> gradeIdDictMap;
|
private Map<String, Object> gradeIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "actionType",
|
masterIdField = "actionType",
|
||||||
constantDictClass = StudentActionType.class)
|
constantDictClass = StudentActionType.class)
|
||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> actionTypeDictMap;
|
private Map<String, Object> actionTypeDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "deviceType",
|
masterIdField = "deviceType",
|
||||||
constantDictClass = DeviceType.class)
|
constantDictClass = DeviceType.class)
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import com.orange.demo.common.core.annotation.RelationConstDict;
|
|||||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -22,7 +20,6 @@ import java.util.Map;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("StudentClass实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_class")
|
@Table(name = "zz_class")
|
||||||
public class StudentClass {
|
public class StudentClass {
|
||||||
@@ -30,7 +27,6 @@ public class StudentClass {
|
|||||||
/**
|
/**
|
||||||
* 班级Id。
|
* 班级Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "班级Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,班级Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,班级Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "class_id")
|
@Column(name = "class_id")
|
||||||
@@ -39,7 +35,6 @@ public class StudentClass {
|
|||||||
/**
|
/**
|
||||||
* 班级名称。
|
* 班级名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "班级名称", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,班级名称不能为空!")
|
@NotBlank(message = "数据验证失败,班级名称不能为空!")
|
||||||
@Column(name = "class_name")
|
@Column(name = "class_name")
|
||||||
private String className;
|
private String className;
|
||||||
@@ -47,7 +42,6 @@ public class StudentClass {
|
|||||||
/**
|
/**
|
||||||
* 学校Id。
|
* 学校Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学校Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,所属校区不能为空!")
|
@NotNull(message = "数据验证失败,所属校区不能为空!")
|
||||||
@Column(name = "school_id")
|
@Column(name = "school_id")
|
||||||
private Long schoolId;
|
private Long schoolId;
|
||||||
@@ -55,7 +49,6 @@ public class StudentClass {
|
|||||||
/**
|
/**
|
||||||
* 学生班长Id。
|
* 学生班长Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "学生班长Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,学生班长不能为空!")
|
@NotNull(message = "数据验证失败,学生班长不能为空!")
|
||||||
@Column(name = "leader_id")
|
@Column(name = "leader_id")
|
||||||
private Long leaderId;
|
private Long leaderId;
|
||||||
@@ -63,7 +56,6 @@ public class StudentClass {
|
|||||||
/**
|
/**
|
||||||
* 已完成课时数量。
|
* 已完成课时数量。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "已完成课时数量", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,已完成课时不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,已完成课时不能为空!", groups = {UpdateGroup.class})
|
||||||
@Column(name = "finish_class_hour")
|
@Column(name = "finish_class_hour")
|
||||||
private Integer finishClassHour;
|
private Integer finishClassHour;
|
||||||
@@ -71,7 +63,6 @@ public class StudentClass {
|
|||||||
/**
|
/**
|
||||||
* 班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)。
|
* 班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,班级级别不能为空!")
|
@NotNull(message = "数据验证失败,班级级别不能为空!")
|
||||||
@ConstDictRef(constDictClass = ClassLevel.class, message = "数据验证失败,班级级别为无效值!")
|
@ConstDictRef(constDictClass = ClassLevel.class, message = "数据验证失败,班级级别为无效值!")
|
||||||
@Column(name = "class_level")
|
@Column(name = "class_level")
|
||||||
@@ -80,26 +71,22 @@ public class StudentClass {
|
|||||||
/**
|
/**
|
||||||
* 创建用户。
|
* 创建用户。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建用户")
|
|
||||||
@Column(name = "create_user_id")
|
@Column(name = "create_user_id")
|
||||||
private Long createUserId;
|
private Long createUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 班级创建时间。
|
* 班级创建时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "班级创建时间")
|
|
||||||
@Column(name = "create_time")
|
@Column(name = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
@DeletedFlagColumn
|
@DeletedFlagColumn
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "schoolId",
|
masterIdField = "schoolId",
|
||||||
slaveServiceName = "schoolInfoService",
|
slaveServiceName = "schoolInfoService",
|
||||||
@@ -109,7 +96,6 @@ public class StudentClass {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> schoolIdDictMap;
|
private Map<String, Object> schoolIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "leaderId",
|
masterIdField = "leaderId",
|
||||||
slaveServiceName = "studentService",
|
slaveServiceName = "studentService",
|
||||||
@@ -119,7 +105,6 @@ public class StudentClass {
|
|||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> leaderIdDictMap;
|
private Map<String, Object> leaderIdDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "classLevel",
|
masterIdField = "classLevel",
|
||||||
constantDictClass = ClassLevel.class)
|
constantDictClass = ClassLevel.class)
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
package com.orange.demo.upms.controller;
|
package com.orange.demo.upms.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.orange.demo.config.ApplicationConfig;
|
import com.orange.demo.config.ApplicationConfig;
|
||||||
import com.orange.demo.upms.service.*;
|
import com.orange.demo.upms.service.*;
|
||||||
@@ -13,6 +9,7 @@ import com.orange.demo.upms.model.SysUser;
|
|||||||
import com.orange.demo.upms.model.constant.SysUserStatus;
|
import com.orange.demo.upms.model.constant.SysUserStatus;
|
||||||
import com.orange.demo.upms.model.constant.SysUserType;
|
import com.orange.demo.upms.model.constant.SysUserType;
|
||||||
import com.orange.demo.common.core.annotation.NoAuthInterface;
|
import com.orange.demo.common.core.annotation.NoAuthInterface;
|
||||||
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
import com.orange.demo.common.core.constant.ApplicationConstant;
|
import com.orange.demo.common.core.constant.ApplicationConstant;
|
||||||
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
||||||
import com.orange.demo.common.core.object.ResponseResult;
|
import com.orange.demo.common.core.object.ResponseResult;
|
||||||
@@ -33,8 +30,6 @@ import java.util.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiSupport(order = 1)
|
|
||||||
@Api(tags = "用户登录接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/upms/login")
|
@RequestMapping("/admin/upms/login")
|
||||||
@@ -62,16 +57,10 @@ public class LoginController {
|
|||||||
* @param password 密码。
|
* @param password 密码。
|
||||||
* @return 应答结果对象,其中包括JWT的Token数据,以及菜单列表。
|
* @return 应答结果对象,其中包括JWT的Token数据,以及菜单列表。
|
||||||
*/
|
*/
|
||||||
@ApiImplicitParams({
|
|
||||||
// 这里包含密码密文,仅用于方便开发期间的接口测试,集成测试和发布阶段,需要将当前注解去掉。
|
|
||||||
// 如果您重新生成了公钥和私钥,请替换password的缺省值。
|
|
||||||
@ApiImplicitParam(name = "loginName", defaultValue = "admin"),
|
|
||||||
@ApiImplicitParam(name = "password", defaultValue = "IP3ccke3GhH45iGHB5qP9p7iZw6xUyj28Ju10rnBiPKOI35sc%2BjI7%2FdsjOkHWMfUwGYGfz8ik31HC2Ruk%2Fhkd9f6RPULTHj7VpFdNdde2P9M4mQQnFBAiPM7VT9iW3RyCtPlJexQ3nAiA09OqG%2F0sIf1kcyveSrulxembARDbDo%3D")
|
|
||||||
})
|
|
||||||
@NoAuthInterface
|
@NoAuthInterface
|
||||||
@GetMapping("/doLogin")
|
@PostMapping("/doLogin")
|
||||||
public ResponseResult<JSONObject> doLogin(
|
public ResponseResult<JSONObject> doLogin(
|
||||||
@RequestParam String loginName, @RequestParam String password) throws Exception {
|
@MyRequestBody String loginName, @MyRequestBody String password) throws Exception {
|
||||||
if (MyCommonUtil.existBlankArgument(loginName, password)) {
|
if (MyCommonUtil.existBlankArgument(loginName, password)) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
}
|
}
|
||||||
@@ -139,7 +128,7 @@ public class LoginController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/changePassword")
|
@PostMapping("/changePassword")
|
||||||
public ResponseResult<Void> changePassword(
|
public ResponseResult<Void> changePassword(
|
||||||
@RequestParam String oldPass, @RequestParam String newPass) throws Exception {
|
@MyRequestBody String oldPass, @MyRequestBody String newPass) throws Exception {
|
||||||
if (MyCommonUtil.existBlankArgument(oldPass, oldPass)) {
|
if (MyCommonUtil.existBlankArgument(oldPass, oldPass)) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.orange.demo.upms.controller;
|
package com.orange.demo.upms.controller;
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.orange.demo.upms.model.SysMenu;
|
import com.orange.demo.upms.model.SysMenu;
|
||||||
import com.orange.demo.upms.service.SysMenuService;
|
import com.orange.demo.upms.service.SysMenuService;
|
||||||
@@ -23,7 +21,6 @@ import java.util.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "菜单管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/upms/sysMenu")
|
@RequestMapping("/admin/upms/sysMenu")
|
||||||
@@ -42,16 +39,15 @@ public class SysMenuController {
|
|||||||
* @return 应答结果对象,包含新增菜单的主键Id。
|
* @return 应答结果对象,包含新增菜单的主键Id。
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ApiOperationSupport(ignoreParameters = {"sysMenu.menuId"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody SysMenu sysMenu, @MyRequestBody String permCodeIdListString) {
|
public ResponseResult<Long> add(@MyRequestBody SysMenu sysMenu, @MyRequestBody String permCodeIdListString) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysMenu);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysMenu);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
CallResult result = sysMenuService.verifyRelatedData(sysMenu, null, permCodeIdListString);
|
CallResult result = sysMenuService.verifyRelatedData(sysMenu, null, permCodeIdListString);
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
}
|
}
|
||||||
Set<Long> permCodeIdSet = null;
|
Set<Long> permCodeIdSet = null;
|
||||||
if (result.getData() != null) {
|
if (result.getData() != null) {
|
||||||
@@ -73,7 +69,7 @@ public class SysMenuController {
|
|||||||
public ResponseResult<Void> update(@MyRequestBody SysMenu sysMenu, @MyRequestBody String permCodeIdListString) {
|
public ResponseResult<Void> update(@MyRequestBody SysMenu sysMenu, @MyRequestBody String permCodeIdListString) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysMenu, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysMenu, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
SysMenu originalSysMenu = sysMenuService.getById(sysMenu.getMenuId());
|
SysMenu originalSysMenu = sysMenuService.getById(sysMenu.getMenuId());
|
||||||
if (originalSysMenu == null) {
|
if (originalSysMenu == null) {
|
||||||
@@ -82,7 +78,7 @@ public class SysMenuController {
|
|||||||
}
|
}
|
||||||
CallResult result = sysMenuService.verifyRelatedData(sysMenu, originalSysMenu, permCodeIdListString);
|
CallResult result = sysMenuService.verifyRelatedData(sysMenu, originalSysMenu, permCodeIdListString);
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
}
|
}
|
||||||
Set<Long> permCodeIdSet = null;
|
Set<Long> permCodeIdSet = null;
|
||||||
if (result.getData() != null) {
|
if (result.getData() != null) {
|
||||||
@@ -147,13 +143,32 @@ public class SysMenuController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列出与指定菜单关联的权限字和权限资源,便于管理员排查配置中的错误。
|
* 查询菜单的权限资源地址列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param menuId 菜单Id。
|
* @param menuId 菜单Id。
|
||||||
* @return 与菜单关联的权限字和权限资源列表。
|
* @param url 权限资源地址过滤条件。
|
||||||
|
* @return 应答对象,包含从菜单到权限资源的权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
@GetMapping("/listMenuPerm")
|
@GetMapping("/listSysPermWithDetail")
|
||||||
public ResponseResult<List<Map<String, Object>>> listMenuPerm(@RequestParam Long menuId) {
|
public ResponseResult<List<Map<String, Object>>> listSysPermWithDetail(Long menuId, String url) {
|
||||||
return ResponseResult.success(sysPermCodeService.getPermCodeListByMenuId(menuId));
|
if (MyCommonUtil.isBlankOrNull(menuId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
return ResponseResult.success(sysMenuService.getSysPermListWithDetail(menuId, url));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询菜单的用户列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param menuId 菜单Id。
|
||||||
|
* @param loginName 登录名。
|
||||||
|
* @return 应答对象,包含从菜单到用户的完整权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
@GetMapping("/listSysUserWithDetail")
|
||||||
|
public ResponseResult<List<Map<String, Object>>> listSysUserWithDetail(Long menuId, String loginName) {
|
||||||
|
if (MyCommonUtil.isBlankOrNull(menuId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
return ResponseResult.success(sysMenuService.getSysUserListWithDetail(menuId, loginName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
package com.orange.demo.upms.controller;
|
package com.orange.demo.upms.controller;
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import com.github.pagehelper.page.PageMethod;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.orange.demo.upms.model.SysPermCode;
|
import com.orange.demo.upms.model.SysPermCode;
|
||||||
import com.orange.demo.upms.service.SysPermCodeService;
|
import com.orange.demo.upms.service.SysPermCodeService;
|
||||||
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
||||||
import com.orange.demo.common.core.object.*;
|
import com.orange.demo.common.core.object.*;
|
||||||
import com.orange.demo.common.core.util.MyCommonUtil;
|
import com.orange.demo.common.core.util.MyCommonUtil;
|
||||||
import com.orange.demo.common.core.util.MyPageUtil;
|
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -25,7 +21,6 @@ import java.util.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "权限字管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/upms/sysPermCode")
|
@RequestMapping("/admin/upms/sysPermCode")
|
||||||
@@ -42,16 +37,15 @@ public class SysPermCodeController {
|
|||||||
* @return 应答结果对象,包含新增权限字的主键Id。
|
* @return 应答结果对象,包含新增权限字的主键Id。
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ApiOperationSupport(ignoreParameters = {"sysPermCode.permCodeId"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody SysPermCode sysPermCode, @MyRequestBody String permIdListString) {
|
public ResponseResult<Long> add(@MyRequestBody SysPermCode sysPermCode, @MyRequestBody String permIdListString) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermCode);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysPermCode);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED);
|
||||||
}
|
}
|
||||||
CallResult result = sysPermCodeService.verifyRelatedData(sysPermCode, null, permIdListString);
|
CallResult result = sysPermCodeService.verifyRelatedData(sysPermCode, null, permIdListString);
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
}
|
}
|
||||||
Set<Long> permIdSet = null;
|
Set<Long> permIdSet = null;
|
||||||
if (result.getData() != null) {
|
if (result.getData() != null) {
|
||||||
@@ -73,7 +67,7 @@ public class SysPermCodeController {
|
|||||||
public ResponseResult<Void> update(@MyRequestBody SysPermCode sysPermCode, @MyRequestBody String permIdListString) {
|
public ResponseResult<Void> update(@MyRequestBody SysPermCode sysPermCode, @MyRequestBody String permIdListString) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermCode, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysPermCode, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
SysPermCode originalSysPermCode = sysPermCodeService.getById(sysPermCode.getPermCodeId());
|
SysPermCode originalSysPermCode = sysPermCodeService.getById(sysPermCode.getPermCodeId());
|
||||||
if (originalSysPermCode == null) {
|
if (originalSysPermCode == null) {
|
||||||
@@ -82,7 +76,7 @@ public class SysPermCodeController {
|
|||||||
}
|
}
|
||||||
CallResult result = sysPermCodeService.verifyRelatedData(sysPermCode, originalSysPermCode, permIdListString);
|
CallResult result = sysPermCodeService.verifyRelatedData(sysPermCode, originalSysPermCode, permIdListString);
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
}
|
}
|
||||||
Set<Long> permIdSet = null;
|
Set<Long> permIdSet = null;
|
||||||
if (result.getData() != null) {
|
if (result.getData() != null) {
|
||||||
@@ -152,25 +146,32 @@ public class SysPermCodeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看用户关联的权限字列表。
|
* 查询权限字的用户列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param loginName 精确匹配用户登录名。
|
* @param permCodeId 权限字Id。
|
||||||
* @param permCode 模糊匹配的权限字名,LIKE %permCode%。
|
* @param loginName 登录名。
|
||||||
* @param pageParam 分页对象。
|
* @return 应答对象。包含从权限字到用户的完整权限分配路径信息的查询结果列表。
|
||||||
* @return 应答结果对象,包含该用户的全部权限资源列表。
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/listAllPermCodesByUserFilter")
|
@GetMapping("/listSysUserWithDetail")
|
||||||
public ResponseResult<MyPageData<SysPermCode>> listAllPermCodesByUserFilter(
|
public ResponseResult<List<Map<String, Object>>> listSysUserWithDetail(Long permCodeId, String loginName) {
|
||||||
@MyRequestBody String loginName,
|
if (MyCommonUtil.isBlankOrNull(permCodeId)) {
|
||||||
@MyRequestBody String permCode,
|
|
||||||
@MyRequestBody MyPageParam pageParam) {
|
|
||||||
if (MyCommonUtil.existBlankArgument(loginName)) {
|
|
||||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
}
|
}
|
||||||
if (pageParam != null) {
|
return ResponseResult.success(sysPermCodeService.getSysUserListWithDetail(permCodeId, loginName));
|
||||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
|
||||||
}
|
}
|
||||||
List<SysPermCode> permCodeList = sysPermCodeService.getUserPermCodeListByFilter(loginName, permCode);
|
|
||||||
return ResponseResult.success(MyPageUtil.makeResponseData(permCodeList));
|
/**
|
||||||
|
* 查询权限字的角色列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param permCodeId 权限字Id。
|
||||||
|
* @param roleName 角色名。
|
||||||
|
* @return 应答对象。包含从权限字到角色的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
@GetMapping("/listSysRoleWithDetail")
|
||||||
|
public ResponseResult<List<Map<String, Object>>> listSysRoleWithDetail(Long permCodeId, String roleName) {
|
||||||
|
if (MyCommonUtil.isBlankOrNull(permCodeId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
return ResponseResult.success(sysPermCodeService.getSysRoleListWithDetail(permCodeId, roleName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.orange.demo.upms.controller;
|
package com.orange.demo.upms.controller;
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import com.github.pagehelper.page.PageMethod;
|
import com.github.pagehelper.page.PageMethod;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.orange.demo.upms.model.SysPerm;
|
import com.orange.demo.upms.model.SysPerm;
|
||||||
@@ -26,7 +24,6 @@ import java.util.Map;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "权限资源管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/upms/sysPerm")
|
@RequestMapping("/admin/upms/sysPerm")
|
||||||
@@ -41,16 +38,15 @@ public class SysPermController {
|
|||||||
* @param sysPerm 新增权限资源对象。
|
* @param sysPerm 新增权限资源对象。
|
||||||
* @return 应答结果对象,包含新增权限资源的主键Id。
|
* @return 应答结果对象,包含新增权限资源的主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {"sysPerm.permId"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody SysPerm sysPerm) {
|
public ResponseResult<Long> add(@MyRequestBody SysPerm sysPerm) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPerm);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysPerm);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
CallResult result = sysPermService.verifyRelatedData(sysPerm, null);
|
CallResult result = sysPermService.verifyRelatedData(sysPerm, null);
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
}
|
}
|
||||||
sysPerm = sysPermService.saveNew(sysPerm);
|
sysPerm = sysPermService.saveNew(sysPerm);
|
||||||
return ResponseResult.success(sysPerm.getPermId());
|
return ResponseResult.success(sysPerm.getPermId());
|
||||||
@@ -66,7 +62,7 @@ public class SysPermController {
|
|||||||
public ResponseResult<Void> update(@MyRequestBody SysPerm sysPerm) {
|
public ResponseResult<Void> update(@MyRequestBody SysPerm sysPerm) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPerm, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysPerm, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
SysPerm originalPerm = sysPermService.getById(sysPerm.getPermId());
|
SysPerm originalPerm = sysPermService.getById(sysPerm.getPermId());
|
||||||
if (originalPerm == null) {
|
if (originalPerm == null) {
|
||||||
@@ -75,7 +71,7 @@ public class SysPermController {
|
|||||||
}
|
}
|
||||||
CallResult result = sysPermService.verifyRelatedData(sysPerm, originalPerm);
|
CallResult result = sysPermService.verifyRelatedData(sysPerm, originalPerm);
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
}
|
}
|
||||||
if (result.getData() != null) {
|
if (result.getData() != null) {
|
||||||
SysPermModule permModule = (SysPermModule) result.getData().get("permModule");
|
SysPermModule permModule = (SysPermModule) result.getData().get("permModule");
|
||||||
@@ -129,7 +125,8 @@ public class SysPermController {
|
|||||||
* @return 应答结果对象,包含权限资源列表。
|
* @return 应答结果对象,包含权限资源列表。
|
||||||
*/
|
*/
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public ResponseResult<MyPageData<SysPerm>> list(@MyRequestBody SysPerm sysPermFilter, @MyRequestBody MyPageParam pageParam) {
|
public ResponseResult<MyPageData<SysPerm>> list(
|
||||||
|
@MyRequestBody SysPerm sysPermFilter, @MyRequestBody MyPageParam pageParam) {
|
||||||
if (pageParam != null) {
|
if (pageParam != null) {
|
||||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||||
}
|
}
|
||||||
@@ -138,58 +135,47 @@ public class SysPermController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看用户关联的权限资源列表。
|
* 查询权限资源地址的用户列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param loginName 精确匹配用户登录名。
|
* @param permId 权限资源Id。
|
||||||
* @param moduleId 精确匹配权限模块Id。
|
* @param loginName 登录名。
|
||||||
* @param url 模糊匹配的url过滤条件。
|
* @return 应答对象。包含从权限资源到用户的完整权限分配路径信息的查询结果列表。
|
||||||
* @param pageParam 分页对象。
|
|
||||||
* @return 应答结果对象,包含该用户的全部权限资源列表。
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/listAllPermsByUserFilter")
|
@GetMapping("/listSysUserWithDetail")
|
||||||
public ResponseResult<MyPageData<Map<String, Object>>> listAllPermsByUserFilter(
|
public ResponseResult<List<Map<String, Object>>> listSysUserWithDetail(Long permId, String loginName) {
|
||||||
@MyRequestBody String loginName,
|
if (MyCommonUtil.isBlankOrNull(permId)) {
|
||||||
@MyRequestBody Long moduleId,
|
|
||||||
@MyRequestBody String url,
|
|
||||||
@MyRequestBody MyPageParam pageParam) {
|
|
||||||
if (MyCommonUtil.existBlankArgument(loginName)) {
|
|
||||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
}
|
}
|
||||||
if (pageParam != null) {
|
return ResponseResult.success(sysPermService.getSysUserListWithDetail(permId, loginName));
|
||||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
|
||||||
}
|
|
||||||
List<Map<String, Object>> userPermMapList =
|
|
||||||
sysPermService.getUserPermListByFilter(loginName, moduleId, url);
|
|
||||||
return ResponseResult.success(MyPageUtil.makeResponseData(userPermMapList));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看拥有指定权限资源的所有用户数据列表。
|
* 查询权限资源地址的角色列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param permId 指定权限资源主键Id。
|
* @param permId 权限资源Id。
|
||||||
* @return 应答结果对象,包含用户数据列表。
|
* @param roleName 角色名。
|
||||||
|
* @return 应答对象。包含从权限资源到角色的权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
@PostMapping("/listAllUsers")
|
@GetMapping("/listSysRoleWithDetail")
|
||||||
public ResponseResult<List<Map<String, Object>>> listAllUsers(@MyRequestBody Long permId) {
|
public ResponseResult<List<Map<String, Object>>> listSysRoleWithDetail(Long permId, String roleName) {
|
||||||
if (MyCommonUtil.existBlankArgument(permId)) {
|
if (MyCommonUtil.isBlankOrNull(permId)) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
}
|
}
|
||||||
List<Map<String, Object>> permUserMapList = sysPermService.getPermUserListById(permId);
|
return ResponseResult.success(sysPermService.getSysRoleListWithDetail(permId, roleName));
|
||||||
return ResponseResult.success(permUserMapList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看拥有指定权限资源的所有角色数据列表。
|
* 查询权限资源地址的菜单列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param permId 指定权限资源主键Id。
|
* @param permId 权限资源Id。
|
||||||
* @return 应答结果对象,包含角色数据列表。
|
* @param menuName 菜单名。
|
||||||
|
* @return 应答对象。包含从权限资源到菜单的权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
@PostMapping("/listAllRoles")
|
@GetMapping("/listSysMenuWithDetail")
|
||||||
public ResponseResult<List<Map<String, Object>>> listAllRoles(@MyRequestBody Long permId) {
|
public ResponseResult<List<Map<String, Object>>> listSysMenuWithDetail(Long permId, String menuName) {
|
||||||
if (MyCommonUtil.existBlankArgument(permId)) {
|
if (MyCommonUtil.isBlankOrNull(permId)) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
}
|
}
|
||||||
List<Map<String, Object>> permRoleMapList = sysPermService.getPermRoleListById(permId);
|
return ResponseResult.success(sysPermService.getSysMenuListWithDetail(permId, menuName));
|
||||||
return ResponseResult.success(permRoleMapList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.orange.demo.upms.controller;
|
package com.orange.demo.upms.controller;
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.orange.demo.upms.model.SysPerm;
|
import com.orange.demo.upms.model.SysPerm;
|
||||||
import com.orange.demo.upms.model.SysPermModule;
|
import com.orange.demo.upms.model.SysPermModule;
|
||||||
@@ -27,7 +25,6 @@ import java.util.Map;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "权限资源模块管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/upms/sysPermModule")
|
@RequestMapping("/admin/upms/sysPermModule")
|
||||||
@@ -42,12 +39,11 @@ public class SysPermModuleController {
|
|||||||
* @param sysPermModule 新增权限资源模块对象。
|
* @param sysPermModule 新增权限资源模块对象。
|
||||||
* @return 应答结果对象,包含新增权限资源模块的主键Id。
|
* @return 应答结果对象,包含新增权限资源模块的主键Id。
|
||||||
*/
|
*/
|
||||||
@ApiOperationSupport(ignoreParameters = {"sysPermModule.moduleId"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody SysPermModule sysPermModule) {
|
public ResponseResult<Long> add(@MyRequestBody SysPermModule sysPermModule) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermModule);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysPermModule);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
if (sysPermModule.getParentId() != null
|
if (sysPermModule.getParentId() != null
|
||||||
&& sysPermModuleService.getById(sysPermModule.getParentId()) == null) {
|
&& sysPermModuleService.getById(sysPermModule.getParentId()) == null) {
|
||||||
@@ -68,7 +64,7 @@ public class SysPermModuleController {
|
|||||||
public ResponseResult<Void> update(@MyRequestBody SysPermModule sysPermModule) {
|
public ResponseResult<Void> update(@MyRequestBody SysPermModule sysPermModule) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermModule, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysPermModule, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
SysPermModule originalPermModule = sysPermModuleService.getById(sysPermModule.getModuleId());
|
SysPermModule originalPermModule = sysPermModuleService.getById(sysPermModule.getModuleId());
|
||||||
if (originalPermModule == null) {
|
if (originalPermModule == null) {
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package com.orange.demo.upms.controller;
|
package com.orange.demo.upms.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import com.github.pagehelper.page.PageMethod;
|
import com.github.pagehelper.page.PageMethod;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.orange.demo.upms.model.SysRole;
|
import com.orange.demo.upms.model.SysRole;
|
||||||
@@ -29,7 +26,6 @@ import java.util.stream.Collectors;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "角色管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/upms/sysRole")
|
@RequestMapping("/admin/upms/sysRole")
|
||||||
@@ -48,16 +44,15 @@ public class SysRoleController {
|
|||||||
* @return 应答结果对象,包含新增角色的主键Id。
|
* @return 应答结果对象,包含新增角色的主键Id。
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ApiOperationSupport(ignoreParameters = {"sysRole.roleId", "sysRole.createTimeStart", "sysRole.createTimeEnd"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody SysRole sysRole, @MyRequestBody String menuIdListString) {
|
public ResponseResult<Long> add(@MyRequestBody SysRole sysRole, @MyRequestBody String menuIdListString) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysRole);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysRole);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
CallResult result = sysRoleService.verifyRelatedData(sysRole, null, menuIdListString);
|
CallResult result = sysRoleService.verifyRelatedData(sysRole, null, menuIdListString);
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
}
|
}
|
||||||
Set<Long> menuIdSet = null;
|
Set<Long> menuIdSet = null;
|
||||||
if (result.getData() != null) {
|
if (result.getData() != null) {
|
||||||
@@ -75,12 +70,11 @@ public class SysRoleController {
|
|||||||
* @return 应答结果对象。
|
* @return 应答结果对象。
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ApiOperationSupport(ignoreParameters = {"sysRole.createTimeStart", "sysRole.createTimeEnd"})
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public ResponseResult<Void> update(@MyRequestBody SysRole sysRole, @MyRequestBody String menuIdListString) {
|
public ResponseResult<Void> update(@MyRequestBody SysRole sysRole, @MyRequestBody String menuIdListString) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysRole, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysRole, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
SysRole originalSysRole = sysRoleService.getById(sysRole.getRoleId());
|
SysRole originalSysRole = sysRoleService.getById(sysRole.getRoleId());
|
||||||
if (originalSysRole == null) {
|
if (originalSysRole == null) {
|
||||||
@@ -89,7 +83,7 @@ public class SysRoleController {
|
|||||||
}
|
}
|
||||||
CallResult result = sysRoleService.verifyRelatedData(sysRole, originalSysRole, menuIdListString);
|
CallResult result = sysRoleService.verifyRelatedData(sysRole, originalSysRole, menuIdListString);
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
}
|
}
|
||||||
Set<Long> menuIdSet = null;
|
Set<Long> menuIdSet = null;
|
||||||
if (result.getData() != null) {
|
if (result.getData() != null) {
|
||||||
@@ -275,44 +269,32 @@ public class SysRoleController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过权限字Id获取拥有改权限的所有角色。
|
* 查询角色的权限资源地址列表。同时返回详细的分配路径。
|
||||||
* 开发人员调试用接口。
|
|
||||||
*
|
*
|
||||||
* @param permCodeId 查询的权限字Id。
|
* @param roleId 角色Id。
|
||||||
* @param pageParam 分页对象。
|
* @param url url过滤条件。
|
||||||
* @return 符合条件的角色列表。
|
* @return 应答对象,包含从角色到权限资源的完整权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
@PostMapping("/listAllRolesByPermCode")
|
@GetMapping("/listSysPermWithDetail")
|
||||||
public ResponseResult<MyPageData<SysRole>> listAllRolesByPermCode(
|
public ResponseResult<List<Map<String, Object>>> listSysPermByWithDetail(Long roleId, String url) {
|
||||||
@MyRequestBody Long permCodeId, @MyRequestBody MyPageParam pageParam) {
|
if (MyCommonUtil.isBlankOrNull(roleId)) {
|
||||||
if (MyCommonUtil.existBlankArgument(permCodeId)) {
|
|
||||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
}
|
}
|
||||||
if (pageParam != null) {
|
return ResponseResult.success(sysRoleService.getSysPermListWithDetail(roleId, url));
|
||||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
|
||||||
}
|
|
||||||
List<SysRole> roleList = sysRoleService.getSysRoleListByPermCodeId(permCodeId);
|
|
||||||
return ResponseResult.success(MyPageUtil.makeResponseData(roleList));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过权限资源url,模糊搜索拥有改权限的所有角色。
|
* 查询角色的权限字列表。同时返回详细的分配路径。
|
||||||
* 开发人员调试用接口。
|
|
||||||
*
|
*
|
||||||
* @param url 用于模糊搜索的url。
|
* @param roleId 角色Id。
|
||||||
* @param pageParam 分页对象。
|
* @param permCode 权限字名称过滤条件。
|
||||||
* @return 符合条件的角色列表。
|
* @return 应答对象,包含从角色到权限字的权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
@PostMapping("/listAllRolesByPerm")
|
@GetMapping("/listSysPermCodeWithDetail")
|
||||||
public ResponseResult<MyPageData<SysRole>> listAllRolesByPerm(
|
public ResponseResult<List<Map<String, Object>>> listSysPermCodeWithDetail(Long roleId, String permCode) {
|
||||||
@MyRequestBody String url, @MyRequestBody MyPageParam pageParam) {
|
if (MyCommonUtil.isBlankOrNull(roleId)) {
|
||||||
if (MyCommonUtil.existBlankArgument(url)) {
|
|
||||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
}
|
}
|
||||||
if (pageParam != null) {
|
return ResponseResult.success(sysRoleService.getSysPermCodeListWithDetail(roleId, permCode));
|
||||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
|
||||||
}
|
|
||||||
List<SysRole> roleList = sysRoleService.getSysRoleListByPerm(url);
|
|
||||||
return ResponseResult.success(MyPageUtil.makeResponseData(roleList));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import com.orange.demo.common.core.annotation.MyRequestBody;
|
|||||||
import com.orange.demo.common.core.validator.AddGroup;
|
import com.orange.demo.common.core.validator.AddGroup;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.config.ApplicationConfig;
|
import com.orange.demo.config.ApplicationConfig;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -26,7 +24,6 @@ import javax.validation.groups.Default;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@Api(tags = "用户管理管理接口")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/upms/sysUser")
|
@RequestMapping("/admin/upms/sysUser")
|
||||||
@@ -47,19 +44,15 @@ public class SysUserController {
|
|||||||
* @return 应答结果对象,包含新增用户的主键Id。
|
* @return 应答结果对象,包含新增用户的主键Id。
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ApiOperationSupport(ignoreParameters = {
|
|
||||||
"sysUser.userId",
|
|
||||||
"sysUser.createTimeStart",
|
|
||||||
"sysUser.createTimeEnd"})
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseResult<Long> add(@MyRequestBody SysUser sysUser, @MyRequestBody String roleIdListString) {
|
public ResponseResult<Long> add(@MyRequestBody SysUser sysUser, @MyRequestBody String roleIdListString) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysUser, Default.class, AddGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysUser, Default.class, AddGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
CallResult result = sysUserService.verifyRelatedData(sysUser, null, roleIdListString);
|
CallResult result = sysUserService.verifyRelatedData(sysUser, null, roleIdListString);
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
}
|
}
|
||||||
Set<Long> roleIdSet = (Set<Long>) result.getData().get("roleIdSet");
|
Set<Long> roleIdSet = (Set<Long>) result.getData().get("roleIdSet");
|
||||||
sysUserService.saveNew(sysUser, roleIdSet);
|
sysUserService.saveNew(sysUser, roleIdSet);
|
||||||
@@ -74,14 +67,11 @@ public class SysUserController {
|
|||||||
* @return 应答结果对象。
|
* @return 应答结果对象。
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ApiOperationSupport(ignoreParameters = {
|
|
||||||
"sysUser.createTimeStart",
|
|
||||||
"sysUser.createTimeEnd"})
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public ResponseResult<Void> update(@MyRequestBody SysUser sysUser, @MyRequestBody String roleIdListString) {
|
public ResponseResult<Void> update(@MyRequestBody SysUser sysUser, @MyRequestBody String roleIdListString) {
|
||||||
String errorMessage = MyCommonUtil.getModelValidationError(sysUser, Default.class, UpdateGroup.class);
|
String errorMessage = MyCommonUtil.getModelValidationError(sysUser, Default.class, UpdateGroup.class);
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
}
|
}
|
||||||
SysUser originalUser = sysUserService.getById(sysUser.getUserId());
|
SysUser originalUser = sysUserService.getById(sysUser.getUserId());
|
||||||
if (originalUser == null) {
|
if (originalUser == null) {
|
||||||
@@ -89,7 +79,7 @@ public class SysUserController {
|
|||||||
}
|
}
|
||||||
CallResult result = sysUserService.verifyRelatedData(sysUser, originalUser, roleIdListString);
|
CallResult result = sysUserService.verifyRelatedData(sysUser, originalUser, roleIdListString);
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
}
|
}
|
||||||
Set<Long> roleIdSet = (Set<Long>) result.getData().get("roleIdSet");
|
Set<Long> roleIdSet = (Set<Long>) result.getData().get("roleIdSet");
|
||||||
if (!sysUserService.update(sysUser, originalUser, roleIdSet)) {
|
if (!sysUserService.update(sysUser, originalUser, roleIdSet)) {
|
||||||
@@ -180,4 +170,49 @@ public class SysUserController {
|
|||||||
}
|
}
|
||||||
return ResponseResult.success(sysUser);
|
return ResponseResult.success(sysUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的权限资源地址列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param userId 用户Id。
|
||||||
|
* @param url url过滤条件。
|
||||||
|
* @return 应答对象,包含从用户到权限资源的完整权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
@GetMapping("/listSysPermWithDetail")
|
||||||
|
public ResponseResult<List<Map<String, Object>>> listSysPermWithDetail(Long userId, String url) {
|
||||||
|
if (MyCommonUtil.isBlankOrNull(userId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
return ResponseResult.success(sysUserService.getSysPermListWithDetail(userId, url));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的权限字列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param userId 用户Id。
|
||||||
|
* @param permCode 权限字名称过滤条件。
|
||||||
|
* @return 应答对象,包含从用户到权限字的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
@GetMapping("/listSysPermCodeWithDetail")
|
||||||
|
public ResponseResult<List<Map<String, Object>>> listSysPermCodeWithDetail(Long userId, String permCode) {
|
||||||
|
if (MyCommonUtil.isBlankOrNull(userId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
return ResponseResult.success(sysUserService.getSysPermCodeListWithDetail(userId, permCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的菜单列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param userId 用户Id。
|
||||||
|
* @param menuName 菜单名称过滤条件。
|
||||||
|
* @return 应答对象,包含从用户到菜单的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
@GetMapping("/listSysMenuWithDetail")
|
||||||
|
public ResponseResult<List<Map<String, Object>>> listSysMenuWithDetail(Long userId, String menuName) {
|
||||||
|
if (MyCommonUtil.isBlankOrNull(userId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
return ResponseResult.success(sysUserService.getSysMenuListWithDetail(userId, menuName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ package com.orange.demo.upms.dao;
|
|||||||
|
|
||||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
import com.orange.demo.upms.model.SysMenu;
|
import com.orange.demo.upms.model.SysMenu;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单数据访问操作接口。
|
* 菜单数据访问操作接口。
|
||||||
@@ -19,5 +20,25 @@ public interface SysMenuMapper extends BaseDaoMapper<SysMenu> {
|
|||||||
* @param userId 登录用户。
|
* @param userId 登录用户。
|
||||||
* @return 菜单列表。
|
* @return 菜单列表。
|
||||||
*/
|
*/
|
||||||
List<SysMenu> getMenuListByUserId(Long userId);
|
List<SysMenu> getMenuListByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询菜单的权限资源地址列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param menuId 菜单Id。
|
||||||
|
* @param url 权限资源地址过滤条件。
|
||||||
|
* @return 包含从菜单到权限资源的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getSysPermListWithDetail(
|
||||||
|
@Param("menuId") Long menuId, @Param("url") String url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询菜单的用户列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param menuId 菜单Id。
|
||||||
|
* @param loginName 登录名。
|
||||||
|
* @return 包含从菜单到用户的完整权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getSysUserListWithDetail(
|
||||||
|
@Param("menuId") Long menuId, @Param("loginName") String loginName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,23 +21,25 @@ public interface SysPermCodeMapper extends BaseDaoMapper<SysPermCode> {
|
|||||||
* @param userId 用户Id。
|
* @param userId 用户Id。
|
||||||
* @return 该用户的权限字列表。
|
* @return 该用户的权限字列表。
|
||||||
*/
|
*/
|
||||||
List<String> getPermCodeListByUserId(Long userId);
|
List<String> getPermCodeListByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取该菜单的权限字和关联的权限资源列表。
|
* 查询权限字的用户列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param menuId 菜单Id。
|
* @param permCodeId 权限字Id。
|
||||||
* @return 权限字和关联的权限资源列表。
|
* @param loginName 登录名。
|
||||||
|
* @return 包含从权限字到用户的完整权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> getPermCodeListByMenuId(Long menuId);
|
List<Map<String, Object>> getSysUserListWithDetail(
|
||||||
|
@Param("permCodeId") Long permCodeId, @Param("loginName") String loginName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定用户的权限字列表。
|
* 查询权限字的角色列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param loginName 精确匹配用户登录名。
|
* @param permCodeId 权限字Id。
|
||||||
* @param permCode 模糊匹配的权限字名,LIKE %permCode%。
|
* @param roleName 角色名。
|
||||||
* @return 权限字列表。
|
* @return 包含从权限字到角色的权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
List<SysPermCode> getUserPermCodeListByFilter(
|
List<Map<String, Object>> getSysRoleListWithDetail(
|
||||||
@Param("loginName") String loginName, @Param("permCode") String permCode);
|
@Param("permCodeId") Long permCodeId, @Param("roleName") String roleName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
|||||||
import com.orange.demo.upms.model.SysPerm;
|
import com.orange.demo.upms.model.SysPerm;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限资源数据访问操作接口。
|
* 权限资源数据访问操作接口。
|
||||||
@@ -23,17 +22,6 @@ public interface SysPermMapper extends BaseDaoMapper<SysPerm> {
|
|||||||
*/
|
*/
|
||||||
List<SysPerm> getPermListByUserId(@Param("userId") Long userId);
|
List<SysPerm> getPermListByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定用户Id的权限列表。
|
|
||||||
*
|
|
||||||
* @param loginName 精确匹配用户登录名。
|
|
||||||
* @param moduleId 精确匹配权限模块Id。
|
|
||||||
* @param url 权限的url过滤条件,LIKE %url%。
|
|
||||||
* @return 权限列表。
|
|
||||||
*/
|
|
||||||
List<Map<String, Object>> getUserPermListByFilter(
|
|
||||||
@Param("loginName") String loginName, @Param("moduleId") Long moduleId, @Param("url") String url);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据关联权限字主键Id,获取权限资源数据列表。
|
* 根据关联权限字主键Id,获取权限资源数据列表。
|
||||||
*
|
*
|
||||||
@@ -44,18 +32,32 @@ public interface SysPermMapper extends BaseDaoMapper<SysPerm> {
|
|||||||
List<SysPerm> getPermListByPermCodeId(@Param("permCodeId") Long permCodeId, @Param("orderBy") String orderBy);
|
List<SysPerm> getPermListByPermCodeId(@Param("permCodeId") Long permCodeId, @Param("orderBy") String orderBy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定权限的用户列表。
|
* 查询权限资源地址的用户列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param permId 指定权限。
|
* @param permId 权限资源Id。
|
||||||
* @return 用户列表。
|
* @param loginName 登录名。
|
||||||
|
* @return 包含从权限资源到用户的完整权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> getPermUserListById(@Param("permId") Long permId);
|
List<Map<String, Object>> getSysUserListWithDetail(
|
||||||
|
@Param("permId") Long permId, @Param("loginName") String loginName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定权限的角色列表。
|
* 查询权限资源地址的角色列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param permId 指定权限。
|
* @param permId 权限资源Id。
|
||||||
* @return 角色列表。
|
* @param roleName 角色名。
|
||||||
|
* @return 包含从权限资源到角色的权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> getPermRoleListById(@Param("permId") Long permId);
|
List<Map<String, Object>> getSysRoleListWithDetail(
|
||||||
|
@Param("permId") Long permId, @Param("roleName") String roleName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询权限资源地址的菜单列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param permId 权限资源Id。
|
||||||
|
* @param menuName 菜单名。
|
||||||
|
* @return 包含从权限资源到菜单的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getSysMenuListWithDetail(
|
||||||
|
@Param("permId") Long permId, @Param("menuName") String menuName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
|||||||
import com.orange.demo.upms.model.SysRole;
|
import com.orange.demo.upms.model.SysRole;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色数据访问操作接口。
|
* 角色数据访问操作接口。
|
||||||
@@ -24,18 +24,22 @@ public interface SysRoleMapper extends BaseDaoMapper<SysRole> {
|
|||||||
List<SysRole> getSysRoleList(@Param("sysRoleFilter") SysRole sysRoleFilter, @Param("orderBy") String orderBy);
|
List<SysRole> getSysRoleList(@Param("sysRoleFilter") SysRole sysRoleFilter, @Param("orderBy") String orderBy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据权限字Id获取关联的角色列表。
|
* 查询角色的权限资源地址列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param permCodeId 权限字Id。
|
* @param roleId 角色Id。
|
||||||
* @return 关联的角色列表。
|
* @param url url过滤条件。
|
||||||
|
* @return 包含从角色到权限资源的完整权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
List<SysRole> getSysRoleListByPermCodeId(@Param("permCodeId") Long permCodeId);
|
List<Map<String, Object>> getSysPermListWithDetail(
|
||||||
|
@Param("roleId") Long roleId, @Param("url") String url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据url模糊查询关联的角色列表。
|
* 查询角色的权限字列表。同时返回详细的分配路径。
|
||||||
*
|
*
|
||||||
* @param url url片段。
|
* @param roleId 角色Id。
|
||||||
* @return 关联的角色列表。
|
* @param permCode 权限字名称过滤条件。
|
||||||
|
* @return 包含从角色到权限字的权限分配路径信息的查询结果列表。
|
||||||
*/
|
*/
|
||||||
List<SysRole> getSysRoleListByPerm(@Param("url") String url);
|
List<Map<String, Object>> getSysPermCodeListWithDetail(
|
||||||
|
@Param("roleId") Long roleId, @Param("permCode") String permCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,4 +49,34 @@ public interface SysUserMapper extends BaseDaoMapper<SysUser> {
|
|||||||
@Param("roleId") Long roleId,
|
@Param("roleId") Long roleId,
|
||||||
@Param("sysUserFilter") SysUser sysUserFilter,
|
@Param("sysUserFilter") SysUser sysUserFilter,
|
||||||
@Param("orderBy") String orderBy);
|
@Param("orderBy") String orderBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的权限资源地址列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param userId 用户Id。
|
||||||
|
* @param url url过滤条件。
|
||||||
|
* @return 包含从用户到权限资源的完整权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getSysPermListWithDetail(
|
||||||
|
@Param("userId") Long userId, @Param("url") String url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的权限字列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param userId 用户Id。
|
||||||
|
* @param permCode 权限字名称过滤条件。
|
||||||
|
* @return 包含从用户到权限字的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getSysPermCodeListWithDetail(
|
||||||
|
@Param("userId") Long userId, @Param("permCode") String permCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的菜单列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param userId 用户Id。
|
||||||
|
* @param menuName 菜单名称过滤条件。
|
||||||
|
* @return 包含从用户到菜单的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getSysMenuListWithDetail(
|
||||||
|
@Param("userId") Long userId, @Param("menuName") String menuName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,4 +32,57 @@
|
|||||||
</where>
|
</where>
|
||||||
ORDER BY m.show_order
|
ORDER BY m.show_order
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 以下查询仅用于权限分配的问题定位,由于关联表较多,可能会给系统运行带来性能影响 -->
|
||||||
|
<select id="getSysPermListWithDetail" resultType="map">
|
||||||
|
SELECT
|
||||||
|
pc.perm_code_id permCodeId,
|
||||||
|
pc.show_name showName,
|
||||||
|
pc.perm_code_type permCodeType,
|
||||||
|
pc.perm_code permCode,
|
||||||
|
p.perm_id permId,
|
||||||
|
p.perm_name permName,
|
||||||
|
p.url
|
||||||
|
FROM
|
||||||
|
zz_sys_menu_perm_code mpc,
|
||||||
|
zz_sys_perm_code_perm pcp,
|
||||||
|
zz_sys_perm_code pc,
|
||||||
|
zz_sys_perm p
|
||||||
|
<where>
|
||||||
|
AND mpc.menu_id = #{menuId}
|
||||||
|
AND mpc.perm_code_id = pc.perm_code_id
|
||||||
|
AND mpc.perm_code_id = pcp.perm_code_id
|
||||||
|
AND pcp.perm_id = p.perm_id
|
||||||
|
<if test="url != null and url != ''">
|
||||||
|
AND p.url = #{url}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY
|
||||||
|
pc.perm_code_id, p.url
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getSysUserListWithDetail" resultType="map">
|
||||||
|
SELECT
|
||||||
|
u.user_id userId,
|
||||||
|
u.login_name loginName,
|
||||||
|
u.show_name showName,
|
||||||
|
r.role_id roleId,
|
||||||
|
r.role_name roleName
|
||||||
|
FROM
|
||||||
|
zz_sys_role_menu rm,
|
||||||
|
zz_sys_role r,
|
||||||
|
zz_sys_user_role ur,
|
||||||
|
zz_sys_user u
|
||||||
|
<where>
|
||||||
|
AND rm.menu_id = #{menuId}
|
||||||
|
AND rm.role_id = r.role_id
|
||||||
|
AND rm.role_id = ur.role_id
|
||||||
|
AND ur.user_id = u.user_id
|
||||||
|
<if test="loginName != null and loginName != ''">
|
||||||
|
AND u.login_name = #{loginName}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY
|
||||||
|
u.user_id, r.role_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -32,53 +32,61 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getUserPermCodeListByFilter" resultMap="BaseResultMap">
|
<!-- 以下查询仅用于权限分配的问题定位,由于关联表较多,可能会给系统运行带来性能影响 -->
|
||||||
|
<select id="getSysUserListWithDetail" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT pc.*
|
u.user_id userId,
|
||||||
|
u.login_name loginName,
|
||||||
|
u.show_name showName,
|
||||||
|
r.role_id roleId,
|
||||||
|
r.role_name roleName,
|
||||||
|
m.menu_id menuId,
|
||||||
|
m.menu_name menuName,
|
||||||
|
m.menu_type menuType
|
||||||
FROM
|
FROM
|
||||||
zz_sys_user u,
|
|
||||||
zz_sys_user_role ur,
|
|
||||||
zz_sys_role_menu rm,
|
|
||||||
zz_sys_menu_perm_code mpc,
|
zz_sys_menu_perm_code mpc,
|
||||||
zz_sys_perm_code pc
|
zz_sys_menu m,
|
||||||
|
zz_sys_role_menu rm,
|
||||||
|
zz_sys_role r,
|
||||||
|
zz_sys_user_role ur,
|
||||||
|
zz_sys_user u
|
||||||
<where>
|
<where>
|
||||||
|
AND mpc.perm_code_id = #{permCodeId}
|
||||||
|
AND mpc.menu_id = m.menu_id
|
||||||
|
AND mpc.menu_id = rm.menu_id
|
||||||
|
AND rm.role_id = r.role_id
|
||||||
|
AND rm.role_id = ur.role_id
|
||||||
|
AND ur.user_id = u.user_id
|
||||||
|
<if test="loginName != null and loginName != ''">
|
||||||
AND u.login_name = #{loginName}
|
AND u.login_name = #{loginName}
|
||||||
AND u.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
|
||||||
AND u.user_id = ur.user_id
|
|
||||||
AND ur.role_id = rm.role_id
|
|
||||||
AND rm.menu_id = mpc.menu_id
|
|
||||||
AND mpc.perm_code_id = pc.perm_code_id
|
|
||||||
AND pc.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
|
||||||
<if test="permCode != null and permCode != ''">
|
|
||||||
<bind name= "safePermCode" value= "'%' + permCode + '%'" />
|
|
||||||
AND pc.perm_code LIKE #{safePermCode}
|
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY pc.create_time
|
ORDER BY
|
||||||
|
u.user_id, r.role_id, m.menu_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPermCodeListByMenuId" resultType="map">
|
<select id="getSysRoleListWithDetail" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
pc.perm_code_id permCodeId,
|
r.role_id roleId,
|
||||||
pc.show_name showName,
|
r.role_name roleName,
|
||||||
pc.perm_code_type permCodeType,
|
m.menu_id menuId,
|
||||||
pc.perm_code permCode,
|
m.menu_name menuName,
|
||||||
p.perm_id permId,
|
m.menu_type menuType
|
||||||
p.perm_name permName,
|
|
||||||
p.url
|
|
||||||
FROM
|
FROM
|
||||||
zz_sys_menu_perm_code mpc,
|
zz_sys_menu_perm_code mpc,
|
||||||
zz_sys_perm_code_perm pcp,
|
zz_sys_menu m,
|
||||||
zz_sys_perm_code pc,
|
zz_sys_role_menu rm,
|
||||||
zz_sys_perm p
|
zz_sys_role r
|
||||||
<where>
|
<where>
|
||||||
AND mpc.menu_id = #{menuId}
|
AND mpc.perm_code_id = #{permCodeId}
|
||||||
AND mpc.perm_code_id = pc.perm_code_id
|
AND mpc.menu_id = m.menu_id
|
||||||
AND mpc.perm_code_id = pcp.perm_code_id
|
AND mpc.menu_id = rm.menu_id
|
||||||
AND pcp.perm_id = p.perm_id
|
AND rm.role_id = r.role_id
|
||||||
AND pc.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
<if test="roleName != null and roleName != ''">
|
||||||
AND p.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
AND r.role_name = #{roleName}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY pc.perm_code_id, p.show_order
|
ORDER BY
|
||||||
|
r.role_id, m.menu_id
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -33,44 +33,6 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getUserPermListByFilter" resultType="map">
|
|
||||||
SELECT
|
|
||||||
pm.module_id moduleId,
|
|
||||||
pm.module_name moduleName,
|
|
||||||
p.perm_id permId,
|
|
||||||
p.perm_name permName,
|
|
||||||
p.create_time createTime,
|
|
||||||
p.url
|
|
||||||
FROM
|
|
||||||
zz_sys_user u,
|
|
||||||
zz_sys_user_role ur,
|
|
||||||
zz_sys_role_menu rm,
|
|
||||||
zz_sys_menu_perm_code mpc,
|
|
||||||
zz_sys_perm_code_perm pcp,
|
|
||||||
zz_sys_perm p,
|
|
||||||
zz_sys_perm_module pm
|
|
||||||
<where>
|
|
||||||
AND u.login_name = #{loginName}
|
|
||||||
AND u.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
|
||||||
AND u.user_id = ur.user_id
|
|
||||||
AND ur.role_id = rm.role_id
|
|
||||||
AND rm.menu_id = mpc.menu_id
|
|
||||||
AND mpc.perm_code_id = pcp.perm_code_id
|
|
||||||
AND pcp.perm_id = p.perm_id
|
|
||||||
AND p.module_id = pm.module_id
|
|
||||||
AND p.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
|
||||||
AND pm.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
|
||||||
<if test="url != null and url != ''">
|
|
||||||
<bind name= "safeUrl" value= "'%' + url + '%'" />
|
|
||||||
AND p.url LIKE #{safeUrl}
|
|
||||||
</if>
|
|
||||||
<if test="moduleId != null">
|
|
||||||
AND p.module_id = #{moduleId}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
ORDER BY pm.module_id, p.create_time
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getPermListByPermCodeId" resultMap="BaseResultMap">
|
<select id="getPermListByPermCodeId" resultMap="BaseResultMap">
|
||||||
SELECT
|
SELECT
|
||||||
p.*
|
p.*
|
||||||
@@ -87,48 +49,101 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPermUserListById" resultType="map">
|
<!-- 以下查询仅用于权限分配的问题定位,由于关联表较多,可能会给系统运行带来性能影响 -->
|
||||||
|
<select id="getSysUserListWithDetail" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
u.user_id,
|
u.user_id userId,
|
||||||
u.login_name
|
u.login_name loginName,
|
||||||
u.show_name
|
u.show_name showName,
|
||||||
|
r.role_id roleId,
|
||||||
|
r.role_name roleName,
|
||||||
|
m.menu_id menuId,
|
||||||
|
m.menu_name menuName,
|
||||||
|
m.menu_type menuType,
|
||||||
|
pc.perm_code_id permCodeId,
|
||||||
|
pc.perm_code permCode,
|
||||||
|
pc.perm_code_type permCodeType
|
||||||
FROM
|
FROM
|
||||||
zz_sys_perm p,
|
|
||||||
zz_sys_perm_code_perm pcp,
|
zz_sys_perm_code_perm pcp,
|
||||||
|
zz_sys_perm_code pc,
|
||||||
zz_sys_menu_perm_code mpc,
|
zz_sys_menu_perm_code mpc,
|
||||||
|
zz_sys_menu m,
|
||||||
zz_sys_role_menu rm,
|
zz_sys_role_menu rm,
|
||||||
|
zz_sys_role r,
|
||||||
zz_sys_user_role ur,
|
zz_sys_user_role ur,
|
||||||
zz_sys_user u
|
zz_sys_user u
|
||||||
<where>
|
<where>
|
||||||
AND p.perm_id = #{permId}
|
AND pcp.perm_id = #{permId}
|
||||||
AND p.perm_id = pcp.perm_id
|
AND pcp.perm_code_id = pc.perm_code_id
|
||||||
AND pcp.perm_code_id = mpc.perm_code_id
|
AND pcp.perm_code_id = mpc.perm_code_id
|
||||||
|
AND mpc.menu_id = m.menu_id
|
||||||
AND mpc.menu_id = rm.menu_id
|
AND mpc.menu_id = rm.menu_id
|
||||||
|
AND rm.role_id = r.role_id
|
||||||
AND rm.role_id = ur.role_id
|
AND rm.role_id = ur.role_id
|
||||||
AND ur.user_id = u.user_id
|
AND ur.user_id = u.user_id
|
||||||
AND u.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
<if test="loginName != null and loginName != ''">
|
||||||
AND p.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
AND u.login_name = #{loginName}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY
|
||||||
|
u.user_id, r.role_id, m.menu_id, pc.perm_code_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPermRoleListById" resultType="map">
|
<select id="getSysRoleListWithDetail" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
r.role_id,
|
r.role_id roleId,
|
||||||
r.role_name
|
r.role_name roleName,
|
||||||
|
m.menu_id menuId,
|
||||||
|
m.menu_name menuName,
|
||||||
|
m.menu_type menuType,
|
||||||
|
pc.perm_code_id permCodeId,
|
||||||
|
pc.perm_code permCode,
|
||||||
|
pc.perm_code_type permCodeType
|
||||||
FROM
|
FROM
|
||||||
zz_sys_perm p,
|
|
||||||
zz_sys_perm_code_perm pcp,
|
zz_sys_perm_code_perm pcp,
|
||||||
|
zz_sys_perm_code pc,
|
||||||
zz_sys_menu_perm_code mpc,
|
zz_sys_menu_perm_code mpc,
|
||||||
|
zz_sys_menu m,
|
||||||
zz_sys_role_menu rm,
|
zz_sys_role_menu rm,
|
||||||
zz_sys_role r
|
zz_sys_role r
|
||||||
<where>
|
<where>
|
||||||
AND p.perm_id = #{permId}
|
AND pcp.perm_id = #{permId}
|
||||||
AND p.perm_id = pcp.perm_id
|
AND pcp.perm_code_id = pc.perm_code_id
|
||||||
AND p.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
|
||||||
AND r.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
|
||||||
AND pcp.perm_code_id = mpc.perm_code_id
|
AND pcp.perm_code_id = mpc.perm_code_id
|
||||||
|
AND mpc.menu_id = m.menu_id
|
||||||
AND mpc.menu_id = rm.menu_id
|
AND mpc.menu_id = rm.menu_id
|
||||||
AND rm.role_id = r.role_id
|
AND rm.role_id = r.role_id
|
||||||
|
<if test="roleName != null and roleName != ''">
|
||||||
|
AND r.role_name = #{roleName}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY
|
||||||
|
r.role_id, m.menu_id, pc.perm_code_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getSysMenuListWithDetail" resultType="map">
|
||||||
|
SELECT
|
||||||
|
m.menu_id menuId,
|
||||||
|
m.menu_name menuName,
|
||||||
|
m.menu_type menuType,
|
||||||
|
pc.perm_code_id permCodeId,
|
||||||
|
pc.perm_code permCode,
|
||||||
|
pc.perm_code_type permCodeType
|
||||||
|
FROM
|
||||||
|
zz_sys_perm_code_perm pcp,
|
||||||
|
zz_sys_perm_code pc,
|
||||||
|
zz_sys_menu_perm_code mpc,
|
||||||
|
zz_sys_menu m
|
||||||
|
<where>
|
||||||
|
AND pcp.perm_id = #{permId}
|
||||||
|
AND pcp.perm_code_id = pc.perm_code_id
|
||||||
|
AND pcp.perm_code_id = mpc.perm_code_id
|
||||||
|
AND mpc.menu_id = m.menu_id
|
||||||
|
<if test="menuName != null and menuName != ''">
|
||||||
|
AND m.menu_name = #{menuName}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY
|
||||||
|
m.menu_id, pc.perm_code_id
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -27,41 +27,61 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSysRoleListByPermCodeId" resultMap="BaseResultMap">
|
<!-- 以下查询仅用于权限分配的问题定位,由于关联表较多,可能会给系统运行带来性能影响 -->
|
||||||
|
<select id="getSysPermListWithDetail" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT r.*
|
m.menu_id menuId,
|
||||||
|
m.menu_name menuName,
|
||||||
|
m.menu_type menuType,
|
||||||
|
pc.perm_code_id permCodeId,
|
||||||
|
pc.perm_code permCode,
|
||||||
|
pc.perm_code_type permCodeType,
|
||||||
|
p.url
|
||||||
FROM
|
FROM
|
||||||
my_sys_role r,
|
zz_sys_role_menu rm,
|
||||||
my_sys_role_menu rm,
|
zz_sys_menu m,
|
||||||
my_sys_menu_perm_code mpc
|
zz_sys_menu_perm_code mpc,
|
||||||
|
zz_sys_perm_code pc,
|
||||||
|
zz_sys_perm_code_perm pcp,
|
||||||
|
zz_sys_perm p
|
||||||
<where>
|
<where>
|
||||||
mpc.perm_code_id = #{permCodeId}
|
AND rm.role_id = #{roleId}
|
||||||
AND mpc.menu_id = rm.menu_id
|
AND rm.menu_id = m.menu_id
|
||||||
AND rm.role_id = r.role_id
|
AND rm.menu_id = mpc.menu_id
|
||||||
AND r.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
AND mpc.perm_code_id = pc.perm_code_id
|
||||||
|
AND mpc.perm_code_id = pcp.perm_code_id
|
||||||
|
AND pcp.perm_id = p.perm_id
|
||||||
|
<if test="url != null and url != ''">
|
||||||
|
AND p.url = #{url}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY r.create_time
|
ORDER BY
|
||||||
|
m.menu_id, pc.perm_code_id, p.url
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSysRoleListByPerm" resultMap="BaseResultMap">
|
<select id="getSysPermCodeListWithDetail" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT r.*
|
m.menu_id menuId,
|
||||||
|
m.menu_name menuName,
|
||||||
|
m.menu_type menuType,
|
||||||
|
pc.perm_code_id permCodeId,
|
||||||
|
pc.perm_code permCode,
|
||||||
|
pc.perm_code_type permCodeType
|
||||||
FROM
|
FROM
|
||||||
my_sys_role r,
|
zz_sys_role_menu rm,
|
||||||
my_sys_role_menu rm,
|
zz_sys_menu m,
|
||||||
my_sys_menu_perm_code mpc,
|
zz_sys_menu_perm_code mpc,
|
||||||
my_sys_perm_code_perm pcp,
|
zz_sys_perm_code pc
|
||||||
my_sys_perm p
|
|
||||||
<where>
|
<where>
|
||||||
<bind name= "safeUrl" value= "'%' + url + '%'"/>
|
AND rm.role_id = #{roleId}
|
||||||
p.url LIKE #{safeUrl}
|
AND rm.menu_id = m.menu_id
|
||||||
AND p.perm_id = pcp.perm_id
|
AND rm.menu_id = mpc.menu_id
|
||||||
AND pcp.perm_code_id = mpc.perm_code_id
|
AND mpc.perm_code_id = pc.perm_code_id
|
||||||
AND mpc.menu_id = rm.menu_id
|
<if test="permCode != null and permCode != ''">
|
||||||
AND rm.role_id = r.role_id
|
AND pc.perm_code = #{permCode}
|
||||||
AND r.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
</if>
|
||||||
AND p.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
|
||||||
</where>
|
</where>
|
||||||
ORDER BY r.create_time
|
ORDER BY
|
||||||
|
m.menu_id, pc.perm_code_id
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -76,4 +76,99 @@
|
|||||||
ORDER BY ${orderBy}
|
ORDER BY ${orderBy}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 以下查询仅用于权限分配的问题定位,由于关联表较多,可能会给系统运行带来性能影响 -->
|
||||||
|
<select id="getSysPermListWithDetail" resultType="map">
|
||||||
|
SELECT
|
||||||
|
r.role_id roleId,
|
||||||
|
r.role_name roleName,
|
||||||
|
m.menu_id menuId,
|
||||||
|
m.menu_name menuName,
|
||||||
|
m.menu_type menuType,
|
||||||
|
pc.perm_code_id permCodeId,
|
||||||
|
pc.perm_code permCode,
|
||||||
|
pc.perm_code_type permCodeType,
|
||||||
|
p.url
|
||||||
|
FROM
|
||||||
|
zz_sys_user_role ur,
|
||||||
|
zz_sys_role r,
|
||||||
|
zz_sys_role_menu rm,
|
||||||
|
zz_sys_menu m,
|
||||||
|
zz_sys_menu_perm_code mpc,
|
||||||
|
zz_sys_perm_code pc,
|
||||||
|
zz_sys_perm_code_perm pcp,
|
||||||
|
zz_sys_perm p
|
||||||
|
<where>
|
||||||
|
AND ur.user_id = #{userId}
|
||||||
|
AND ur.role_id = r.role_id
|
||||||
|
AND ur.role_id = rm.role_id
|
||||||
|
AND rm.menu_id = m.menu_id
|
||||||
|
AND rm.menu_id = mpc.menu_id
|
||||||
|
AND mpc.perm_code_id = pc.perm_code_id
|
||||||
|
AND mpc.perm_code_id = pcp.perm_code_id
|
||||||
|
AND pcp.perm_id = p.perm_id
|
||||||
|
<if test="url != null and url != ''">
|
||||||
|
AND p.url = #{url}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY
|
||||||
|
r.role_id, m.menu_id, pc.perm_code_id, p.url
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getSysPermCodeListWithDetail" resultType="map">
|
||||||
|
SELECT
|
||||||
|
r.role_id roleId,
|
||||||
|
r.role_name roleName,
|
||||||
|
m.menu_id menuId,
|
||||||
|
m.menu_name menuName,
|
||||||
|
m.menu_type menuType,
|
||||||
|
pc.perm_code_id permCodeId,
|
||||||
|
pc.perm_code permCode,
|
||||||
|
pc.perm_code_type permCodeType
|
||||||
|
FROM
|
||||||
|
zz_sys_user_role ur,
|
||||||
|
zz_sys_role r,
|
||||||
|
zz_sys_role_menu rm,
|
||||||
|
zz_sys_menu m,
|
||||||
|
zz_sys_menu_perm_code mpc,
|
||||||
|
zz_sys_perm_code pc
|
||||||
|
<where>
|
||||||
|
AND ur.user_id = #{userId}
|
||||||
|
AND ur.role_id = r.role_id
|
||||||
|
AND ur.role_id = rm.role_id
|
||||||
|
AND rm.menu_id = m.menu_id
|
||||||
|
AND rm.menu_id = mpc.menu_id
|
||||||
|
AND mpc.perm_code_id = pc.perm_code_id
|
||||||
|
<if test="permCode != null and permCode != ''">
|
||||||
|
AND pc.perm_code = #{permCode}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY
|
||||||
|
r.role_id, m.menu_id, pc.perm_code_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getSysMenuListWithDetail" resultType="map">
|
||||||
|
SELECT
|
||||||
|
r.role_id roleId,
|
||||||
|
r.role_name roleName,
|
||||||
|
m.menu_id menuId,
|
||||||
|
m.menu_name menuName,
|
||||||
|
m.menu_type menuType
|
||||||
|
FROM
|
||||||
|
zz_sys_user_role ur,
|
||||||
|
zz_sys_role r,
|
||||||
|
zz_sys_role_menu rm,
|
||||||
|
zz_sys_menu m
|
||||||
|
<where>
|
||||||
|
AND ur.user_id = #{userId}
|
||||||
|
AND ur.role_id = r.role_id
|
||||||
|
AND ur.role_id = rm.role_id
|
||||||
|
AND rm.menu_id = m.menu_id
|
||||||
|
<if test="menuName != null and menuName != ''">
|
||||||
|
AND m.menu_name = #{menuName}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY
|
||||||
|
r.role_id, m.menu_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import com.orange.demo.common.core.annotation.RelationManyToMany;
|
|||||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.upms.model.constant.SysMenuType;
|
import com.orange.demo.upms.model.constant.SysMenuType;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
@@ -21,7 +19,6 @@ import java.util.List;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("菜单实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_sys_menu")
|
@Table(name = "zz_sys_menu")
|
||||||
public class SysMenu {
|
public class SysMenu {
|
||||||
@@ -29,7 +26,6 @@ public class SysMenu {
|
|||||||
/**
|
/**
|
||||||
* 菜单Id。
|
* 菜单Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "菜单Id", required = true)
|
|
||||||
@NotNull(message = "菜单Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "菜单Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "menu_id")
|
@Column(name = "menu_id")
|
||||||
@@ -38,14 +34,12 @@ public class SysMenu {
|
|||||||
/**
|
/**
|
||||||
* 父菜单Id,目录菜单的父菜单为null。
|
* 父菜单Id,目录菜单的父菜单为null。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "父菜单Id")
|
|
||||||
@Column(name = "parent_id")
|
@Column(name = "parent_id")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单显示名称。
|
* 菜单显示名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "菜单显示名称", required = true)
|
|
||||||
@NotBlank(message = "菜单显示名称不能为空!")
|
@NotBlank(message = "菜单显示名称不能为空!")
|
||||||
@Column(name = "menu_name")
|
@Column(name = "menu_name")
|
||||||
private String menuName;
|
private String menuName;
|
||||||
@@ -53,7 +47,6 @@ public class SysMenu {
|
|||||||
/**
|
/**
|
||||||
* 菜单类型(0: 目录 1: 菜单 2: 按钮 3: UI片段)。
|
* 菜单类型(0: 目录 1: 菜单 2: 按钮 3: UI片段)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "菜单类型", required = true)
|
|
||||||
@NotNull(message = "菜单类型不能为空!")
|
@NotNull(message = "菜单类型不能为空!")
|
||||||
@ConstDictRef(constDictClass = SysMenuType.class, message = "数据验证失败,菜单类型为无效值!")
|
@ConstDictRef(constDictClass = SysMenuType.class, message = "数据验证失败,菜单类型为无效值!")
|
||||||
@Column(name = "menu_type")
|
@Column(name = "menu_type")
|
||||||
@@ -62,14 +55,12 @@ public class SysMenu {
|
|||||||
/**
|
/**
|
||||||
* 前端表单路由名称,仅用于menu_type为1的菜单类型。
|
* 前端表单路由名称,仅用于menu_type为1的菜单类型。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "前端表单路由名称")
|
|
||||||
@Column(name = "form_router_name")
|
@Column(name = "form_router_name")
|
||||||
private String formRouterName;
|
private String formRouterName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单显示顺序 (值越小,排序越靠前)。
|
* 菜单显示顺序 (值越小,排序越靠前)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "菜单显示顺序", required = true)
|
|
||||||
@NotNull(message = "菜单显示顺序不能为空!")
|
@NotNull(message = "菜单显示顺序不能为空!")
|
||||||
@Column(name = "show_order")
|
@Column(name = "show_order")
|
||||||
private Integer showOrder;
|
private Integer showOrder;
|
||||||
@@ -77,26 +68,22 @@ public class SysMenu {
|
|||||||
/**
|
/**
|
||||||
* 菜单图标。
|
* 菜单图标。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "菜单图标")
|
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间。
|
* 创建时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@Column(name = "create_time")
|
@Column(name = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
@DeletedFlagColumn
|
@DeletedFlagColumn
|
||||||
@Column(name = "deleted_flag")
|
@Column(name = "deleted_flag")
|
||||||
private Integer deletedFlag;
|
private Integer deletedFlag;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationManyToMany(
|
@RelationManyToMany(
|
||||||
relationMapperName = "sysMenuPermCodeMapper",
|
relationMapperName = "sysMenuPermCodeMapper",
|
||||||
relationMasterIdField = "menuId",
|
relationMasterIdField = "menuId",
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.orange.demo.upms.model;
|
package com.orange.demo.upms.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
@@ -12,7 +10,6 @@ import javax.persistence.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("菜单与权限字关联实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_sys_menu_perm_code")
|
@Table(name = "zz_sys_menu_perm_code")
|
||||||
public class SysMenuPermCode {
|
public class SysMenuPermCode {
|
||||||
@@ -20,7 +17,6 @@ public class SysMenuPermCode {
|
|||||||
/**
|
/**
|
||||||
* 关联菜单Id。
|
* 关联菜单Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "关联菜单Id", required = true)
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "menu_id")
|
@Column(name = "menu_id")
|
||||||
private Long menuId;
|
private Long menuId;
|
||||||
@@ -28,7 +24,6 @@ public class SysMenuPermCode {
|
|||||||
/**
|
/**
|
||||||
* 关联权限字Id。
|
* 关联权限字Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "关联权限字Id", required = true)
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "perm_code_id")
|
@Column(name = "perm_code_id")
|
||||||
private Long permCodeId;
|
private Long permCodeId;
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import com.alibaba.fastjson.annotation.JSONField;
|
|||||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||||
import com.orange.demo.common.core.annotation.RelationDict;
|
import com.orange.demo.common.core.annotation.RelationDict;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
@@ -19,7 +17,6 @@ import java.util.Map;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("权限资源实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_sys_perm")
|
@Table(name = "zz_sys_perm")
|
||||||
public class SysPerm {
|
public class SysPerm {
|
||||||
@@ -27,7 +24,6 @@ public class SysPerm {
|
|||||||
/**
|
/**
|
||||||
* 权限资源Id。
|
* 权限资源Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限资源Id", required = true)
|
|
||||||
@NotNull(message = "权限Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "权限Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "perm_id")
|
@Column(name = "perm_id")
|
||||||
@@ -36,7 +32,6 @@ public class SysPerm {
|
|||||||
/**
|
/**
|
||||||
* 权限所在的权限模块Id。
|
* 权限所在的权限模块Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限所在的权限模块Id", required = true)
|
|
||||||
@NotNull(message = "权限模块Id不能为空!")
|
@NotNull(message = "权限模块Id不能为空!")
|
||||||
@Column(name = "module_id")
|
@Column(name = "module_id")
|
||||||
private Long moduleId;
|
private Long moduleId;
|
||||||
@@ -44,7 +39,6 @@ public class SysPerm {
|
|||||||
/**
|
/**
|
||||||
* 权限名称。
|
* 权限名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限名称", required = true)
|
|
||||||
@NotBlank(message = "权限名称不能为空!")
|
@NotBlank(message = "权限名称不能为空!")
|
||||||
@Column(name = "perm_name")
|
@Column(name = "perm_name")
|
||||||
private String permName;
|
private String permName;
|
||||||
@@ -52,14 +46,12 @@ public class SysPerm {
|
|||||||
/**
|
/**
|
||||||
* 关联的URL。
|
* 关联的URL。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "关联的URL", required = true)
|
|
||||||
@NotBlank(message = "权限关联的url不能为空!")
|
@NotBlank(message = "权限关联的url不能为空!")
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限在当前模块下的顺序,由小到大。
|
* 权限在当前模块下的顺序,由小到大。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限在当前模块下的顺序", required = true)
|
|
||||||
@NotNull(message = "权限显示顺序不能为空!")
|
@NotNull(message = "权限显示顺序不能为空!")
|
||||||
@Column(name = "show_order")
|
@Column(name = "show_order")
|
||||||
private Integer showOrder;
|
private Integer showOrder;
|
||||||
@@ -67,20 +59,17 @@ public class SysPerm {
|
|||||||
/**
|
/**
|
||||||
* 创建时间。
|
* 创建时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@Column(name = "create_time")
|
@Column(name = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
@DeletedFlagColumn
|
@DeletedFlagColumn
|
||||||
@Column(name = "deleted_flag")
|
@Column(name = "deleted_flag")
|
||||||
private Integer deletedFlag;
|
private Integer deletedFlag;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationDict(
|
@RelationDict(
|
||||||
masterIdField = "moduleId",
|
masterIdField = "moduleId",
|
||||||
slaveServiceName = "SysPermModuleService",
|
slaveServiceName = "SysPermModuleService",
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import com.orange.demo.common.core.annotation.RelationManyToMany;
|
|||||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.upms.model.constant.SysPermCodeType;
|
import com.orange.demo.upms.model.constant.SysPermCodeType;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
@@ -21,7 +19,6 @@ import java.util.List;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("权限字实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_sys_perm_code")
|
@Table(name = "zz_sys_perm_code")
|
||||||
public class SysPermCode {
|
public class SysPermCode {
|
||||||
@@ -29,7 +26,6 @@ public class SysPermCode {
|
|||||||
/**
|
/**
|
||||||
* 权限字Id。
|
* 权限字Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限字Id", required = true)
|
|
||||||
@NotNull(message = "权限字Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "权限字Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "perm_code_id")
|
@Column(name = "perm_code_id")
|
||||||
@@ -38,14 +34,12 @@ public class SysPermCode {
|
|||||||
/**
|
/**
|
||||||
* 上级权限字Id。
|
* 上级权限字Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "上级权限字Id")
|
|
||||||
@Column(name = "parent_id")
|
@Column(name = "parent_id")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限字标识(一般为有含义的英文字符串)。
|
* 权限字标识(一般为有含义的英文字符串)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限字标识", required = true)
|
|
||||||
@NotBlank(message = "权限字编码不能为空!")
|
@NotBlank(message = "权限字编码不能为空!")
|
||||||
@Column(name = "perm_code")
|
@Column(name = "perm_code")
|
||||||
private String permCode;
|
private String permCode;
|
||||||
@@ -53,7 +47,6 @@ public class SysPermCode {
|
|||||||
/**
|
/**
|
||||||
* 权限类型(0: 表单 1: UI片段 2: 操作)。
|
* 权限类型(0: 表单 1: UI片段 2: 操作)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限类型", required = true)
|
|
||||||
@NotNull(message = "权限字类型不能为空!")
|
@NotNull(message = "权限字类型不能为空!")
|
||||||
@ConstDictRef(constDictClass = SysPermCodeType.class, message = "数据验证失败,权限类型为无效值!")
|
@ConstDictRef(constDictClass = SysPermCodeType.class, message = "数据验证失败,权限类型为无效值!")
|
||||||
@Column(name = "perm_code_type")
|
@Column(name = "perm_code_type")
|
||||||
@@ -62,7 +55,6 @@ public class SysPermCode {
|
|||||||
/**
|
/**
|
||||||
* 显示名称。
|
* 显示名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "显示名称", required = true)
|
|
||||||
@NotBlank(message = "权限字显示名称不能为空!")
|
@NotBlank(message = "权限字显示名称不能为空!")
|
||||||
@Column(name = "show_name")
|
@Column(name = "show_name")
|
||||||
private String showName;
|
private String showName;
|
||||||
@@ -70,7 +62,6 @@ public class SysPermCode {
|
|||||||
/**
|
/**
|
||||||
* 显示顺序(数值越小,越靠前)。
|
* 显示顺序(数值越小,越靠前)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "显示顺序", required = true)
|
|
||||||
@NotNull(message = "权限字显示顺序不能为空!")
|
@NotNull(message = "权限字显示顺序不能为空!")
|
||||||
@Column(name = "show_order")
|
@Column(name = "show_order")
|
||||||
private Integer showOrder;
|
private Integer showOrder;
|
||||||
@@ -78,20 +69,17 @@ public class SysPermCode {
|
|||||||
/**
|
/**
|
||||||
* 创建时间。
|
* 创建时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@Column(name = "create_time")
|
@Column(name = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
@DeletedFlagColumn
|
@DeletedFlagColumn
|
||||||
@Column(name = "deleted_flag")
|
@Column(name = "deleted_flag")
|
||||||
private Integer deletedFlag;
|
private Integer deletedFlag;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationManyToMany(
|
@RelationManyToMany(
|
||||||
relationMapperName = "sysPermCodePermMapper",
|
relationMapperName = "sysPermCodePermMapper",
|
||||||
relationMasterIdField = "permCodeId",
|
relationMasterIdField = "permCodeId",
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.orange.demo.upms.model;
|
package com.orange.demo.upms.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
@@ -12,7 +10,6 @@ import javax.persistence.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("权限字与权限资源关联实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_sys_perm_code_perm")
|
@Table(name = "zz_sys_perm_code_perm")
|
||||||
public class SysPermCodePerm {
|
public class SysPermCodePerm {
|
||||||
@@ -20,7 +17,6 @@ public class SysPermCodePerm {
|
|||||||
/**
|
/**
|
||||||
* 权限字Id。
|
* 权限字Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限字Id", required = true)
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "perm_code_id")
|
@Column(name = "perm_code_id")
|
||||||
private Long permCodeId;
|
private Long permCodeId;
|
||||||
@@ -28,7 +24,6 @@ public class SysPermCodePerm {
|
|||||||
/**
|
/**
|
||||||
* 权限Id。
|
* 权限Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限Id", required = true)
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "perm_id")
|
@Column(name = "perm_id")
|
||||||
private Long permId;
|
private Long permId;
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
|||||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.upms.model.constant.SysPermModuleType;
|
import com.orange.demo.upms.model.constant.SysPermModuleType;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
@@ -20,7 +18,6 @@ import java.util.List;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("权限模块实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_sys_perm_module")
|
@Table(name = "zz_sys_perm_module")
|
||||||
public class SysPermModule {
|
public class SysPermModule {
|
||||||
@@ -28,7 +25,6 @@ public class SysPermModule {
|
|||||||
/**
|
/**
|
||||||
* 权限模块Id。
|
* 权限模块Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限模块Id", required = true)
|
|
||||||
@NotNull(message = "权限模块Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "权限模块Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "module_id")
|
@Column(name = "module_id")
|
||||||
@@ -37,14 +33,12 @@ public class SysPermModule {
|
|||||||
/**
|
/**
|
||||||
* 上级权限模块Id。
|
* 上级权限模块Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "上级权限模块Id")
|
|
||||||
@Column(name = "parent_id")
|
@Column(name = "parent_id")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限模块名称。
|
* 权限模块名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限模块名称", required = true)
|
|
||||||
@NotBlank(message = "权限模块名称不能为空!")
|
@NotBlank(message = "权限模块名称不能为空!")
|
||||||
@Column(name = "module_name")
|
@Column(name = "module_name")
|
||||||
private String moduleName;
|
private String moduleName;
|
||||||
@@ -52,7 +46,6 @@ public class SysPermModule {
|
|||||||
/**
|
/**
|
||||||
* 权限模块类型(0: 普通模块 1: Controller模块)。
|
* 权限模块类型(0: 普通模块 1: Controller模块)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "权限模块类型", required = true)
|
|
||||||
@NotNull(message = "模块类型不能为空!")
|
@NotNull(message = "模块类型不能为空!")
|
||||||
@ConstDictRef(constDictClass = SysPermModuleType.class, message = "数据验证失败,权限模块类型为无效值!")
|
@ConstDictRef(constDictClass = SysPermModuleType.class, message = "数据验证失败,权限模块类型为无效值!")
|
||||||
@Column(name = "module_type")
|
@Column(name = "module_type")
|
||||||
@@ -61,7 +54,6 @@ public class SysPermModule {
|
|||||||
/**
|
/**
|
||||||
* 权限模块在当前层级下的顺序,由小到大。
|
* 权限模块在当前层级下的顺序,由小到大。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "显示顺序", required = true)
|
|
||||||
@NotNull(message = "权限模块显示顺序不能为空!")
|
@NotNull(message = "权限模块显示顺序不能为空!")
|
||||||
@Column(name = "show_order")
|
@Column(name = "show_order")
|
||||||
private Integer showOrder;
|
private Integer showOrder;
|
||||||
@@ -69,20 +61,17 @@ public class SysPermModule {
|
|||||||
/**
|
/**
|
||||||
* 创建时间。
|
* 创建时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@Column(name = "create_time")
|
@Column(name = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
@DeletedFlagColumn
|
@DeletedFlagColumn
|
||||||
@Column(name = "deleted_flag")
|
@Column(name = "deleted_flag")
|
||||||
private Integer deletedFlag;
|
private Integer deletedFlag;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@Transient
|
@Transient
|
||||||
private List<SysPerm> sysPermList;
|
private List<SysPerm> sysPermList;
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,6 @@ import com.alibaba.fastjson.annotation.JSONField;
|
|||||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||||
import com.orange.demo.common.core.annotation.RelationManyToMany;
|
import com.orange.demo.common.core.annotation.RelationManyToMany;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
@@ -19,7 +17,6 @@ import java.util.List;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("角色实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_sys_role")
|
@Table(name = "zz_sys_role")
|
||||||
public class SysRole {
|
public class SysRole {
|
||||||
@@ -27,7 +24,6 @@ public class SysRole {
|
|||||||
/**
|
/**
|
||||||
* 角色Id。
|
* 角色Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "角色Id", required = true)
|
|
||||||
@NotNull(message = "角色Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "角色Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "role_id")
|
@Column(name = "role_id")
|
||||||
@@ -36,7 +32,6 @@ public class SysRole {
|
|||||||
/**
|
/**
|
||||||
* 角色名称。
|
* 角色名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "角色名称", required = true)
|
|
||||||
@NotBlank(message = "角色名称不能为空!")
|
@NotBlank(message = "角色名称不能为空!")
|
||||||
@Column(name = "role_name")
|
@Column(name = "role_name")
|
||||||
private String roleName;
|
private String roleName;
|
||||||
@@ -44,41 +39,35 @@ public class SysRole {
|
|||||||
/**
|
/**
|
||||||
* 创建者Id。
|
* 创建者Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建者Id")
|
|
||||||
@Column(name = "create_user_id")
|
@Column(name = "create_user_id")
|
||||||
private Long createUserId;
|
private Long createUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建者显示名称。
|
* 创建者显示名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建者显示名称")
|
|
||||||
@Column(name = "create_username")
|
@Column(name = "create_username")
|
||||||
private String createUsername;
|
private String createUsername;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间。
|
* 创建时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@Column(name = "create_time")
|
@Column(name = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间。
|
* 更新时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "更新时间")
|
|
||||||
@Column(name = "update_time")
|
@Column(name = "update_time")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
@DeletedFlagColumn
|
@DeletedFlagColumn
|
||||||
@Column(name = "deleted_flag")
|
@Column(name = "deleted_flag")
|
||||||
private Integer deletedFlag;
|
private Integer deletedFlag;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationManyToMany(
|
@RelationManyToMany(
|
||||||
relationMapperName = "sysRoleMenuMapper",
|
relationMapperName = "sysRoleMenuMapper",
|
||||||
relationMasterIdField = "roleId",
|
relationMasterIdField = "roleId",
|
||||||
@@ -86,11 +75,9 @@ public class SysRole {
|
|||||||
@Transient
|
@Transient
|
||||||
private List<SysRoleMenu> sysRoleMenuList;
|
private List<SysRoleMenu> sysRoleMenuList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间开始查询时间")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String createTimeStart;
|
private String createTimeStart;
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间结束查询时间")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String createTimeEnd;
|
private String createTimeEnd;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.orange.demo.upms.model;
|
package com.orange.demo.upms.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
@@ -12,7 +10,6 @@ import javax.persistence.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("角色菜单实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_sys_role_menu")
|
@Table(name = "zz_sys_role_menu")
|
||||||
public class SysRoleMenu {
|
public class SysRoleMenu {
|
||||||
@@ -20,7 +17,6 @@ public class SysRoleMenu {
|
|||||||
/**
|
/**
|
||||||
* 角色Id。
|
* 角色Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "角色Id", required = true)
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "role_id")
|
@Column(name = "role_id")
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
@@ -28,7 +24,6 @@ public class SysRoleMenu {
|
|||||||
/**
|
/**
|
||||||
* 菜单Id。
|
* 菜单Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "菜单Id", required = true)
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "menu_id")
|
@Column(name = "menu_id")
|
||||||
private Long menuId;
|
private Long menuId;
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
|||||||
import com.orange.demo.common.core.validator.AddGroup;
|
import com.orange.demo.common.core.validator.AddGroup;
|
||||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -25,7 +23,6 @@ import java.util.List;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("SysUser实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_sys_user")
|
@Table(name = "zz_sys_user")
|
||||||
public class SysUser {
|
public class SysUser {
|
||||||
@@ -33,7 +30,6 @@ public class SysUser {
|
|||||||
/**
|
/**
|
||||||
* 用户Id。
|
* 用户Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用户Id", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,用户Id不能为空!", groups = {UpdateGroup.class})
|
@NotNull(message = "数据验证失败,用户Id不能为空!", groups = {UpdateGroup.class})
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "user_id")
|
@Column(name = "user_id")
|
||||||
@@ -42,7 +38,6 @@ public class SysUser {
|
|||||||
/**
|
/**
|
||||||
* 登录用户名。
|
* 登录用户名。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "登录用户名", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,登录用户名不能为空!")
|
@NotBlank(message = "数据验证失败,登录用户名不能为空!")
|
||||||
@Column(name = "login_name")
|
@Column(name = "login_name")
|
||||||
private String loginName;
|
private String loginName;
|
||||||
@@ -50,14 +45,12 @@ public class SysUser {
|
|||||||
/**
|
/**
|
||||||
* 用户密码。
|
* 用户密码。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用户密码", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,用户密码不能为空!", groups = {AddGroup.class})
|
@NotBlank(message = "数据验证失败,用户密码不能为空!", groups = {AddGroup.class})
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户显示名称。
|
* 用户显示名称。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用户显示名称", required = true)
|
|
||||||
@NotBlank(message = "数据验证失败,用户显示名称不能为空!")
|
@NotBlank(message = "数据验证失败,用户显示名称不能为空!")
|
||||||
@Column(name = "show_name")
|
@Column(name = "show_name")
|
||||||
private String showName;
|
private String showName;
|
||||||
@@ -65,7 +58,6 @@ public class SysUser {
|
|||||||
/**
|
/**
|
||||||
* 用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)。
|
* 用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)不能为空!")
|
@NotNull(message = "数据验证失败,用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)不能为空!")
|
||||||
@ConstDictRef(constDictClass = SysUserType.class, message = "数据验证失败,用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)为无效值!")
|
@ConstDictRef(constDictClass = SysUserType.class, message = "数据验证失败,用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)为无效值!")
|
||||||
@Column(name = "user_type")
|
@Column(name = "user_type")
|
||||||
@@ -74,14 +66,12 @@ public class SysUser {
|
|||||||
/**
|
/**
|
||||||
* 用户头像的Url。
|
* 用户头像的Url。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用户头像的Url")
|
|
||||||
@Column(name = "head_image_url")
|
@Column(name = "head_image_url")
|
||||||
private String headImageUrl;
|
private String headImageUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户状态(0: 正常 1: 锁定)。
|
* 用户状态(0: 正常 1: 锁定)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用户状态(0: 正常 1: 锁定)", required = true)
|
|
||||||
@NotNull(message = "数据验证失败,用户状态(0: 正常 1: 锁定)不能为空!")
|
@NotNull(message = "数据验证失败,用户状态(0: 正常 1: 锁定)不能为空!")
|
||||||
@ConstDictRef(constDictClass = SysUserStatus.class, message = "数据验证失败,用户状态(0: 正常 1: 锁定)为无效值!")
|
@ConstDictRef(constDictClass = SysUserStatus.class, message = "数据验证失败,用户状态(0: 正常 1: 锁定)为无效值!")
|
||||||
@Column(name = "user_status")
|
@Column(name = "user_status")
|
||||||
@@ -90,7 +80,6 @@ public class SysUser {
|
|||||||
/**
|
/**
|
||||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
@DeletedFlagColumn
|
@DeletedFlagColumn
|
||||||
@Column(name = "deleted_flag")
|
@Column(name = "deleted_flag")
|
||||||
@@ -99,49 +88,42 @@ public class SysUser {
|
|||||||
/**
|
/**
|
||||||
* 创建用户Id。
|
* 创建用户Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建用户Id")
|
|
||||||
@Column(name = "create_user_id")
|
@Column(name = "create_user_id")
|
||||||
private Long createUserId;
|
private Long createUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建用户名。
|
* 创建用户名。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建用户名")
|
|
||||||
@Column(name = "create_username")
|
@Column(name = "create_username")
|
||||||
private String createUsername;
|
private String createUsername;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间。
|
* 创建时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@Column(name = "create_time")
|
@Column(name = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间。
|
* 更新时间。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "更新时间")
|
|
||||||
@Column(name = "update_time")
|
@Column(name = "update_time")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createTime 范围过滤起始值(>=)。
|
* createTime 范围过滤起始值(>=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "createTime 范围过滤起始值(>=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String createTimeStart;
|
private String createTimeStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createTime 范围过滤结束值(<=)。
|
* createTime 范围过滤结束值(<=)。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "createTime 范围过滤结束值(<=)")
|
|
||||||
@Transient
|
@Transient
|
||||||
private String createTimeEnd;
|
private String createTimeEnd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多对多用户角色数据集合。
|
* 多对多用户角色数据集合。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationManyToMany(
|
@RelationManyToMany(
|
||||||
relationMapperName = "sysUserRoleMapper",
|
relationMapperName = "sysUserRoleMapper",
|
||||||
relationMasterIdField = "userId",
|
relationMasterIdField = "userId",
|
||||||
@@ -149,14 +131,12 @@ public class SysUser {
|
|||||||
@Transient
|
@Transient
|
||||||
private List<SysUserRole> sysUserRoleList;
|
private List<SysUserRole> sysUserRoleList;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "userType",
|
masterIdField = "userType",
|
||||||
constantDictClass = SysUserType.class)
|
constantDictClass = SysUserType.class)
|
||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> userTypeDictMap;
|
private Map<String, Object> userTypeDictMap;
|
||||||
|
|
||||||
@ApiModelProperty(hidden = true)
|
|
||||||
@RelationConstDict(
|
@RelationConstDict(
|
||||||
masterIdField = "userStatus",
|
masterIdField = "userStatus",
|
||||||
constantDictClass = SysUserStatus.class)
|
constantDictClass = SysUserStatus.class)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.orange.demo.upms.model;
|
package com.orange.demo.upms.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
@@ -12,7 +10,6 @@ import javax.persistence.*;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("用户角色实体对象")
|
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "zz_sys_user_role")
|
@Table(name = "zz_sys_user_role")
|
||||||
public class SysUserRole {
|
public class SysUserRole {
|
||||||
@@ -20,7 +17,6 @@ public class SysUserRole {
|
|||||||
/**
|
/**
|
||||||
* 用户Id。
|
* 用户Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用户Id", required = true)
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "user_id")
|
@Column(name = "user_id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
@@ -28,7 +24,6 @@ public class SysUserRole {
|
|||||||
/**
|
/**
|
||||||
* 角色Id。
|
* 角色Id。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "角色Id", required = true)
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "role_id")
|
@Column(name = "role_id")
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|||||||
@@ -204,6 +204,28 @@ public class SysMenuService extends BaseService<SysMenu, Long> {
|
|||||||
return CallResult.ok(jsonObject);
|
return CallResult.ok(jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询菜单的权限资源地址列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param menuId 菜单Id。
|
||||||
|
* @param url 权限资源地址过滤条件。
|
||||||
|
* @return 包含从菜单到权限资源的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysPermListWithDetail(Long menuId, String url) {
|
||||||
|
return sysMenuMapper.getSysPermListWithDetail(menuId, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询菜单的用户列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param menuId 菜单Id。
|
||||||
|
* @param loginName 登录名。
|
||||||
|
* @return 包含从菜单到用户的完整权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysUserListWithDetail(Long menuId, String loginName) {
|
||||||
|
return sysMenuMapper.getSysUserListWithDetail(menuId, loginName);
|
||||||
|
}
|
||||||
|
|
||||||
private String checkErrorOfNonDirectoryMenu(SysMenu sysMenu) {
|
private String checkErrorOfNonDirectoryMenu(SysMenu sysMenu) {
|
||||||
// 判断父节点是否存在
|
// 判断父节点是否存在
|
||||||
SysMenu parentSysMenu = getById(sysMenu.getParentId());
|
SysMenu parentSysMenu = getById(sysMenu.getParentId());
|
||||||
|
|||||||
@@ -141,27 +141,6 @@ public class SysPermCodeService extends BaseService<SysPermCode, Long> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定用户的权限字列表。
|
|
||||||
*
|
|
||||||
* @param loginName 精确匹配用户登录名。
|
|
||||||
* @param permCode 模糊匹配的权限字名,LIKE %permCode%。
|
|
||||||
* @return 权限字列表。
|
|
||||||
*/
|
|
||||||
public List<SysPermCode> getUserPermCodeListByFilter(String loginName, String permCode) {
|
|
||||||
return sysPermCodeMapper.getUserPermCodeListByFilter(loginName, permCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取该菜单的权限字,及其权限字关联的权限资源列表。
|
|
||||||
*
|
|
||||||
* @param menuId 菜单Id。
|
|
||||||
* @return 关联了权限资源的权限字列表。
|
|
||||||
*/
|
|
||||||
public List<Map<String, Object>> getPermCodeListByMenuId(Long menuId) {
|
|
||||||
return sysPermCodeMapper.getPermCodeListByMenuId(menuId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断当前权限字是否存在下级权限字对象。
|
* 判断当前权限字是否存在下级权限字对象。
|
||||||
*
|
*
|
||||||
@@ -201,4 +180,26 @@ public class SysPermCodeService extends BaseService<SysPermCode, Long> {
|
|||||||
}
|
}
|
||||||
return CallResult.ok(jsonObject);
|
return CallResult.ok(jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询权限字的用户列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param permCodeId 权限字Id。
|
||||||
|
* @param loginName 登录名。
|
||||||
|
* @return 包含从权限字到用户的完整权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysUserListWithDetail(Long permCodeId, String loginName) {
|
||||||
|
return sysPermCodeMapper.getSysUserListWithDetail(permCodeId, loginName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询权限字的角色列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param permCodeId 权限字Id。
|
||||||
|
* @param roleName 角色名。
|
||||||
|
* @return 包含从权限字到角色的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysRoleListWithDetail(Long permCodeId, String roleName) {
|
||||||
|
return sysPermCodeMapper.getSysRoleListWithDetail(permCodeId, roleName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,9 +99,9 @@ public class SysPermService extends BaseService<SysPerm, Long> {
|
|||||||
if (sysPermMapper.updateByPrimaryKeySelective(perm) != 1) {
|
if (sysPermMapper.updateByPrimaryKeySelective(perm) != 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Example e = new Example(SysPermCodePerm.class);
|
SysPermCodePerm permCodePerm = new SysPermCodePerm();
|
||||||
e.createCriteria().andEqualTo("permId", permId);
|
permCodePerm.setPermId(permId);
|
||||||
sysPermCodePermMapper.deleteByExample(e);
|
sysPermCodePermMapper.delete(permCodePerm);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,38 +203,6 @@ public class SysPermService extends BaseService<SysPerm, Long> {
|
|||||||
return sysPermMapper.getPermListByUserId(userId);
|
return sysPermMapper.getPermListByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定用户的用户权限关联列表。
|
|
||||||
*
|
|
||||||
* @param loginName 精确匹配用户登录名。
|
|
||||||
* @param moduleId 精确匹配权限模块Id。
|
|
||||||
* @param url 模糊匹配的url过滤条件。
|
|
||||||
* @return 用户权限关联列表。
|
|
||||||
*/
|
|
||||||
public List<Map<String, Object>> getUserPermListByFilter(String loginName, Long moduleId, String url) {
|
|
||||||
return sysPermMapper.getUserPermListByFilter(loginName, moduleId, url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定权限资源的权限用户关联数据列表。
|
|
||||||
*
|
|
||||||
* @param permId 权限资源主键Id。
|
|
||||||
* @return 用户和权限资源关联列表。
|
|
||||||
*/
|
|
||||||
public List<Map<String, Object>> getPermUserListById(Long permId) {
|
|
||||||
return sysPermMapper.getPermUserListById(permId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定权限资源的权限角色关联数据列表。
|
|
||||||
*
|
|
||||||
* @param permId 权限资源主键Id。
|
|
||||||
* @return 角色和权限资源关联列表。
|
|
||||||
*/
|
|
||||||
public List<Map<String, Object>> getPermRoleListById(Long permId) {
|
|
||||||
return sysPermMapper.getPermRoleListById(permId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证权限资源对象关联的数据是否都合法。
|
* 验证权限资源对象关联的数据是否都合法。
|
||||||
*
|
*
|
||||||
@@ -254,4 +222,37 @@ public class SysPermService extends BaseService<SysPerm, Long> {
|
|||||||
}
|
}
|
||||||
return CallResult.ok(jsonObject);
|
return CallResult.ok(jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询权限资源地址的用户列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param permId 权限资源Id。
|
||||||
|
* @param loginName 登录名。
|
||||||
|
* @return 包含从权限资源到用户的完整权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysUserListWithDetail(Long permId, String loginName) {
|
||||||
|
return sysPermMapper.getSysUserListWithDetail(permId, loginName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询权限资源地址的角色列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param permId 权限资源Id。
|
||||||
|
* @param roleName 角色名。
|
||||||
|
* @return 包含从权限资源到角色的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysRoleListWithDetail(Long permId, String roleName) {
|
||||||
|
return sysPermMapper.getSysRoleListWithDetail(permId, roleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询权限资源地址的菜单列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param permId 权限资源Id。
|
||||||
|
* @param menuName 菜单名。
|
||||||
|
* @return 包含从权限资源到菜单的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysMenuListWithDetail(Long permId, String menuName) {
|
||||||
|
return sysPermMapper.getSysMenuListWithDetail(permId, menuName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,28 +150,6 @@ public class SysRoleService extends BaseService<SysRole, Long> {
|
|||||||
return sysRoleMapper.getSysRoleList(filter, orderBy);
|
return sysRoleMapper.getSysRoleList(filter, orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过权限字Id获取拥有改权限的所有角色。
|
|
||||||
* 开发人员调试用接口。
|
|
||||||
*
|
|
||||||
* @param permCodeId 查询的权限字Id。
|
|
||||||
* @return 符合条件的角色列表。
|
|
||||||
*/
|
|
||||||
public List<SysRole> getSysRoleListByPermCodeId(Long permCodeId) {
|
|
||||||
return sysRoleMapper.getSysRoleListByPermCodeId(permCodeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过权限资源url,模糊搜索拥有改权限的所有角色。
|
|
||||||
* 开发人员调试用接口。
|
|
||||||
*
|
|
||||||
* @param url 用于模糊搜索的url。
|
|
||||||
* @return 符合条件的角色列表。
|
|
||||||
*/
|
|
||||||
public List<SysRole> getSysRoleListByPerm(String url) {
|
|
||||||
return sysRoleMapper.getSysRoleListByPerm(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增用户角色关联。
|
* 批量新增用户角色关联。
|
||||||
*
|
*
|
||||||
@@ -218,4 +196,26 @@ public class SysRoleService extends BaseService<SysRole, Long> {
|
|||||||
}
|
}
|
||||||
return CallResult.ok(jsonObject);
|
return CallResult.ok(jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询角色的权限资源地址列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param roleId 角色Id。
|
||||||
|
* @param url url过滤条件。
|
||||||
|
* @return 包含从角色到权限资源的完整权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysPermListWithDetail(Long roleId, String url) {
|
||||||
|
return sysRoleMapper.getSysPermListWithDetail(roleId, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询角色的权限字列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param roleId 角色Id。
|
||||||
|
* @param permCode 权限字名称过滤条件。
|
||||||
|
* @return 包含从角色到权限字的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysPermCodeListWithDetail(Long roleId, String permCode) {
|
||||||
|
return sysRoleMapper.getSysPermCodeListWithDetail(roleId, permCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,6 +227,39 @@ public class SysUserService extends BaseService<SysUser, Long> {
|
|||||||
return sysUserMapper.getNotInSysUserListByRoleId(roleId, filter, orderBy);
|
return sysUserMapper.getNotInSysUserListByRoleId(roleId, filter, orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的权限资源地址列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param userId 用户Id。
|
||||||
|
* @param url url过滤条件。
|
||||||
|
* @return 包含从用户到权限资源的完整权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysPermListWithDetail(Long userId, String url) {
|
||||||
|
return sysUserMapper.getSysPermListWithDetail(userId, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的权限字列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param userId 用户Id。
|
||||||
|
* @param permCode 权限字名称过滤条件。
|
||||||
|
* @return 包含从用户到权限字的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysPermCodeListWithDetail(Long userId, String permCode) {
|
||||||
|
return sysUserMapper.getSysPermCodeListWithDetail(userId, permCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的菜单列表。同时返回详细的分配路径。
|
||||||
|
*
|
||||||
|
* @param userId 用户Id。
|
||||||
|
* @param menuName 菜单名称过滤条件。
|
||||||
|
* @return 包含从用户到菜单的权限分配路径信息的查询结果列表。
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getSysMenuListWithDetail(Long userId, String menuName) {
|
||||||
|
return sysUserMapper.getSysMenuListWithDetail(userId, menuName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证用户对象关联的数据是否都合法。
|
* 验证用户对象关联的数据是否都合法。
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -56,15 +56,6 @@ pagehelper:
|
|||||||
supportMethodsArguments: false
|
supportMethodsArguments: false
|
||||||
params: count=countSql
|
params: count=countSql
|
||||||
|
|
||||||
swagger:
|
|
||||||
# 当enabled为false的时候,则可禁用swagger。
|
|
||||||
enabled: true
|
|
||||||
# 工程的基础包名。
|
|
||||||
basePackage: com.orange.demo
|
|
||||||
title: 橙单单体开源版
|
|
||||||
description: 橙单单体开源版详情
|
|
||||||
version: 1.0
|
|
||||||
|
|
||||||
# 暴露监控端点
|
# 暴露监控端点
|
||||||
management:
|
management:
|
||||||
endpoints:
|
endpoints:
|
||||||
|
|||||||
@@ -53,9 +53,6 @@
|
|||||||
<root level="${OUTPUT_LOG_LEVEL}">
|
<root level="${OUTPUT_LOG_LEVEL}">
|
||||||
<AppenderRef ref="console"/>
|
<AppenderRef ref="console"/>
|
||||||
</root>
|
</root>
|
||||||
<Logger name="springfox.documentation" additivity="false" level="error">
|
|
||||||
<AppenderRef ref="console"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="com.orange.demo" additivity="false" level="info">
|
<Logger name="com.orange.demo" additivity="false" level="info">
|
||||||
<AppenderRef ref="console"/>
|
<AppenderRef ref="console"/>
|
||||||
<AppenderRef ref="file_log"/>
|
<AppenderRef ref="file_log"/>
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
package com.orange.demo.common.core.cache;
|
package com.orange.demo.common.core.cache;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.exception.MapCacheAccessException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.TimeoutException;
|
||||||
|
import java.util.concurrent.locks.ReadWriteLock;
|
||||||
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,6 +18,7 @@ import java.util.function.Function;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,6 +29,14 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
|||||||
* 获取字典主键数据的函数对象。
|
* 获取字典主键数据的函数对象。
|
||||||
*/
|
*/
|
||||||
protected Function<V, K> idGetter;
|
protected Function<V, K> idGetter;
|
||||||
|
/**
|
||||||
|
* 由于大部分场景是读取操作,所以使用读写锁提高并发的伸缩性。
|
||||||
|
*/
|
||||||
|
protected ReadWriteLock lock = new ReentrantReadWriteLock();
|
||||||
|
/**
|
||||||
|
* 超时时长。单位毫秒。
|
||||||
|
*/
|
||||||
|
protected static final long TIMEOUT = 2000L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前对象的构造器函数。
|
* 当前对象的构造器函数。
|
||||||
@@ -52,11 +68,28 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
|||||||
* @return 全部字段数据列表。
|
* @return 全部字段数据列表。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized List<V> getAll() {
|
public List<V> getAll() {
|
||||||
List<V> resultList = new LinkedList<>();
|
List<V> resultList = new LinkedList<>();
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
for (Map.Entry<K, V> entry : dataMap.entrySet()) {
|
for (Map.Entry<K, V> entry : dataMap.entrySet()) {
|
||||||
resultList.add(entry.getValue());
|
resultList.add(entry.getValue());
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,14 +100,31 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
|||||||
* @return 对象列表。
|
* @return 对象列表。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized List<V> getInList(Set<K> keys) {
|
public List<V> getInList(Set<K> keys) {
|
||||||
List<V> resultList = new LinkedList<>();
|
List<V> resultList = new LinkedList<>();
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
keys.forEach(key -> {
|
keys.forEach(key -> {
|
||||||
V object = dataMap.get(key);
|
V object = dataMap.get(key);
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
resultList.add(object);
|
resultList.add(object);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,14 +134,31 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
|||||||
* @param dataList 待缓存的数据列表。
|
* @param dataList 待缓存的数据列表。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void putAll(List<V> dataList) {
|
public void putAll(List<V> dataList) {
|
||||||
if (dataList == null) {
|
if (dataList == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
dataList.forEach(dataObj -> {
|
dataList.forEach(dataObj -> {
|
||||||
K id = idGetter.apply(dataObj);
|
K id = idGetter.apply(dataObj);
|
||||||
dataMap.put(id, dataObj);
|
dataMap.put(id, dataObj);
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,12 +168,32 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
|||||||
* @param force true则强制刷新,如果false,当缓存中存在数据时不刷新。
|
* @param force true则强制刷新,如果false,当缓存中存在数据时不刷新。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void reload(List<V> dataList, boolean force) {
|
public void reload(List<V> dataList, boolean force) {
|
||||||
if (!force && this.getCount() > 0) {
|
if (!force && this.getCount() > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.invalidateAll();
|
String exceptionMessage;
|
||||||
this.putAll(dataList);
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
|
dataMap.clear();
|
||||||
|
dataList.forEach(dataObj -> {
|
||||||
|
K id = idGetter.apply(dataObj);
|
||||||
|
dataMap.put(id, dataObj);
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,8 +203,30 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
|||||||
* @return 获取到的数据,如果没有返回null。
|
* @return 获取到的数据,如果没有返回null。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized V get(K id) {
|
public V get(K id) {
|
||||||
return id == null ? null : dataMap.get(id);
|
if (id == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
V data;
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
|
data = dataMap.get(id);
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,8 +236,25 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
|||||||
* @param object 字典数据对象。
|
* @param object 字典数据对象。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void put(K id, V object) {
|
public void put(K id, V object) {
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
dataMap.put(id, object);
|
dataMap.put(id, object);
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,7 +263,7 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
|||||||
* @return 返回缓存的数据数量。
|
* @return 返回缓存的数据数量。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized int getCount() {
|
public int getCount() {
|
||||||
return dataMap.size();
|
return dataMap.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,8 +274,30 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
|||||||
* @return 返回被删除的对象,如果主键不存在,返回null。
|
* @return 返回被删除的对象,如果主键不存在,返回null。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized V invalidate(K id) {
|
public V invalidate(K id) {
|
||||||
return id == null ? null : dataMap.remove(id);
|
if (id == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String exceptionMessage;
|
||||||
|
V data;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
|
data = dataMap.remove(id);
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,19 +306,53 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
|
|||||||
* @param keys 待删除数据的主键集合。
|
* @param keys 待删除数据的主键集合。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void invalidateSet(Set<K> keys) {
|
public void invalidateSet(Set<K> keys) {
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
keys.forEach(id -> {
|
keys.forEach(id -> {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
dataMap.remove(id);
|
dataMap.remove(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空缓存。
|
* 清空缓存。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void invalidateAll() {
|
public void invalidateAll() {
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
dataMap.clear();
|
dataMap.clear();
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
package com.orange.demo.common.core.cache;
|
package com.orange.demo.common.core.cache;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.exception.MapCacheAccessException;
|
||||||
import com.google.common.collect.LinkedHashMultimap;
|
import com.google.common.collect.LinkedHashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.TimeoutException;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,6 +18,7 @@ import java.util.function.Function;
|
|||||||
* @author Jerry
|
* @author Jerry
|
||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
|
public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,8 +66,27 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
|
|||||||
* @param parentId 父主键Id。
|
* @param parentId 父主键Id。
|
||||||
* @return 子数据列表。
|
* @return 子数据列表。
|
||||||
*/
|
*/
|
||||||
public synchronized List<V> getListByParentId(K parentId) {
|
public List<V> getListByParentId(K parentId) {
|
||||||
return new LinkedList<>(allTreeMap.get(parentId));
|
List<V> resultList = new LinkedList<>();
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
|
resultList.addAll(allTreeMap.get(parentId));
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,16 +95,33 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
|
|||||||
* @param dataList 待缓存的数据列表。
|
* @param dataList 待缓存的数据列表。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void putAll(List<V> dataList) {
|
public void putAll(List<V> dataList) {
|
||||||
if (dataList == null) {
|
if (dataList == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
super.putAll(dataList);
|
super.putAll(dataList);
|
||||||
dataList.forEach(data -> {
|
dataList.forEach(data -> {
|
||||||
K parentId = parentIdGetter.apply(data);
|
K parentId = parentIdGetter.apply(data);
|
||||||
allTreeMap.remove(parentId, data);
|
allTreeMap.remove(parentId, data);
|
||||||
allTreeMap.put(parentId, data);
|
allTreeMap.put(parentId, data);
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,11 +131,28 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
|
|||||||
* @param data 字典数据对象。
|
* @param data 字典数据对象。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void put(K id, V data) {
|
public void put(K id, V data) {
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
super.put(id, data);
|
super.put(id, data);
|
||||||
K parentId = parentIdGetter.apply(data);
|
K parentId = parentIdGetter.apply(data);
|
||||||
allTreeMap.remove(parentId, data);
|
allTreeMap.remove(parentId, data);
|
||||||
allTreeMap.put(parentId, data);
|
allTreeMap.put(parentId, data);
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,12 +162,30 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
|
|||||||
* @return 返回被删除的对象,如果主键不存在,返回null。
|
* @return 返回被删除的对象,如果主键不存在,返回null。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized V invalidate(K id) {
|
public V invalidate(K id) {
|
||||||
V v = super.invalidate(id);
|
V v;
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
|
v = super.invalidate(id);
|
||||||
if (v != null) {
|
if (v != null) {
|
||||||
K parentId = parentIdGetter.apply(v);
|
K parentId = parentIdGetter.apply(v);
|
||||||
allTreeMap.remove(parentId, v);
|
allTreeMap.remove(parentId, v);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +195,11 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
|
|||||||
* @param keys 待删除数据的主键集合。
|
* @param keys 待删除数据的主键集合。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void invalidateSet(Set<K> keys) {
|
public void invalidateSet(Set<K> keys) {
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
keys.forEach(id -> {
|
keys.forEach(id -> {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
V data = dataMap.remove(id);
|
V data = dataMap.remove(id);
|
||||||
@@ -129,14 +209,44 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空缓存。
|
* 清空缓存。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void invalidateAll() {
|
public void invalidateAll() {
|
||||||
|
String exceptionMessage;
|
||||||
|
try {
|
||||||
|
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
|
||||||
|
try {
|
||||||
super.invalidateAll();
|
super.invalidateAll();
|
||||||
allTreeMap.clear();
|
allTreeMap.clear();
|
||||||
|
} finally {
|
||||||
|
lock.readLock().unlock();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
exceptionMessage = String.format(
|
||||||
|
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
|
||||||
|
e.getClass().getSimpleName());
|
||||||
|
log.warn(exceptionMessage);
|
||||||
|
throw new MapCacheAccessException(exceptionMessage, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ package com.orange.demo.common.core.constant;
|
|||||||
*/
|
*/
|
||||||
public final class ApplicationConstant {
|
public final class ApplicationConstant {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为字典表数据缓存时,缓存名称的固定后缀。
|
||||||
|
*/
|
||||||
|
public static final String DICT_CACHE_NAME_SUFFIX = "-DICT";
|
||||||
/**
|
/**
|
||||||
* 图片文件上传的父目录。
|
* 图片文件上传的父目录。
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public enum ErrorCodeEnum {
|
|||||||
INVALID_USER_STATUS("用户状态错误,请刷新后重试!"),
|
INVALID_USER_STATUS("用户状态错误,请刷新后重试!"),
|
||||||
|
|
||||||
HAS_CHILDREN_DATA("数据验证失败,子数据存在,请刷新后重试!"),
|
HAS_CHILDREN_DATA("数据验证失败,子数据存在,请刷新后重试!"),
|
||||||
DATA_VALIDATAED_FAILED("数据验证失败,请核对!"),
|
DATA_VALIDATED_FAILED("数据验证失败,请核对!"),
|
||||||
UPLOAD_FILE_FAILED("文件上传失败,请联系管理员!"),
|
UPLOAD_FILE_FAILED("文件上传失败,请联系管理员!"),
|
||||||
DATA_SAVE_FAILED("数据保存失败,请联系管理员!"),
|
DATA_SAVE_FAILED("数据保存失败,请联系管理员!"),
|
||||||
DATA_ACCESS_FAILED("数据访问失败,请联系管理员!"),
|
DATA_ACCESS_FAILED("数据访问失败,请联系管理员!"),
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.orange.demo.common.core.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内存缓存访问失败。比如:获取分布式数据锁超时、等待线程中断等。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-09-24
|
||||||
|
*/
|
||||||
|
public class MapCacheAccessException extends RuntimeException {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造函数。
|
||||||
|
*
|
||||||
|
* @param msg 错误信息。
|
||||||
|
* @param cause 原始异常。
|
||||||
|
*/
|
||||||
|
public MapCacheAccessException(String msg, Throwable cause) {
|
||||||
|
super(msg, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,7 @@ import org.springframework.web.method.support.ModelAndViewContainer;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,6 +46,7 @@ public class MyRequestArgumentResolver implements HandlerMethodArgumentResolver
|
|||||||
classSet.add(Double.class);
|
classSet.add(Double.class);
|
||||||
classSet.add(Boolean.class);
|
classSet.add(Boolean.class);
|
||||||
classSet.add(Byte.class);
|
classSet.add(Byte.class);
|
||||||
|
classSet.add(BigDecimal.class);
|
||||||
classSet.add(Character.class);
|
classSet.add(Character.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,6 +198,12 @@ public class MyRequestArgumentResolver implements HandlerMethodArgumentResolver
|
|||||||
return number.doubleValue();
|
return number.doubleValue();
|
||||||
} else if (parameterType == Byte.class) {
|
} else if (parameterType == Byte.class) {
|
||||||
return number.byteValue();
|
return number.byteValue();
|
||||||
|
} else if (parameterType == BigDecimal.class) {
|
||||||
|
if (value instanceof Double || value instanceof Float) {
|
||||||
|
return BigDecimal.valueOf(number.doubleValue());
|
||||||
|
} else {
|
||||||
|
return BigDecimal.valueOf(number.longValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (parameterType == Boolean.class) {
|
} else if (parameterType == Boolean.class) {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ public class MyGroupParam extends ArrayList<MyGroupParam.GroupInfo> {
|
|||||||
|
|
||||||
private static GroupBaseData parseGroupBaseData(GroupInfo groupInfo, Class<?> modelClazz) {
|
private static GroupBaseData parseGroupBaseData(GroupInfo groupInfo, Class<?> modelClazz) {
|
||||||
GroupBaseData baseData = new GroupBaseData();
|
GroupBaseData baseData = new GroupBaseData();
|
||||||
|
if (StringUtils.isBlank(groupInfo.fieldName)) {
|
||||||
|
throw new IllegalArgumentException("GroupInfo.fieldName can't be EMPTY");
|
||||||
|
}
|
||||||
String[] stringArray = StringUtils.split(groupInfo.fieldName,'.');
|
String[] stringArray = StringUtils.split(groupInfo.fieldName,'.');
|
||||||
if (stringArray.length == 1) {
|
if (stringArray.length == 1) {
|
||||||
baseData.modelName = modelClazz.getSimpleName();
|
baseData.modelName = modelClazz.getSimpleName();
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import org.springframework.context.ApplicationContextAware;
|
|||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spring 系统启动应用感知对象,主要用于获取Spring Bean的上下文对象,后续的代码中可以直接查找系统中加载的Bean对象。
|
* Spring 系统启动应用感知对象,主要用于获取Spring Bean的上下文对象,后续的代码中可以直接查找系统中加载的Bean对象。
|
||||||
*
|
*
|
||||||
@@ -62,6 +65,19 @@ public class ApplicationContextHolder implements ApplicationContextAware {
|
|||||||
return applicationContext.getBean(beanType);
|
return applicationContext.getBean(beanType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据Bean的ClassType,获取Bean对象列表。
|
||||||
|
*
|
||||||
|
* @param beanType Bean的Class类型。。
|
||||||
|
* @param <T> 返回的Bean类型。
|
||||||
|
* @return Bean对象列表。
|
||||||
|
*/
|
||||||
|
public static <T> Collection<T> getBeanListOfType(Class<T> beanType) {
|
||||||
|
assertApplicationContext();
|
||||||
|
Map<String, T> beanMap = applicationContext.getBeansOfType(beanType);
|
||||||
|
return beanMap == null ? null : beanMap.values();
|
||||||
|
}
|
||||||
|
|
||||||
private static void assertApplicationContext() {
|
private static void assertApplicationContext() {
|
||||||
if (ApplicationContextHolder.applicationContext == null) {
|
if (ApplicationContextHolder.applicationContext == null) {
|
||||||
throw new MyRuntimeException("applicaitonContext属性为null,请检查是否注入了ApplicationContextHolder!");
|
throw new MyRuntimeException("applicaitonContext属性为null,请检查是否注入了ApplicationContextHolder!");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.orange.demo.common.core.util;
|
package com.orange.demo.common.core.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
import cn.hutool.crypto.digest.DigestUtil;
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -7,10 +8,9 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import javax.validation.ConstraintViolation;
|
import javax.validation.ConstraintViolation;
|
||||||
import javax.validation.Validation;
|
import javax.validation.Validation;
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
import java.util.Collection;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Iterator;
|
import java.util.*;
|
||||||
import java.util.Set;
|
import java.util.stream.Collectors;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 脚手架中常用的基本工具方法集合,一般而言工程内部使用的方法。
|
* 脚手架中常用的基本工具方法集合,一般而言工程内部使用的方法。
|
||||||
@@ -136,6 +136,25 @@ public class MyCommonUtil {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对象中,非空字段的名字列表。
|
||||||
|
*
|
||||||
|
* @param object 数据对象。
|
||||||
|
* @param clazz 数据对象的class类型。
|
||||||
|
* @param <T> 数据对象类型。
|
||||||
|
* @return 数据对象中,值不为NULL的字段数组。
|
||||||
|
*/
|
||||||
|
public static <T> String[] getNotNullFieldNames(T object, Class<T> clazz) {
|
||||||
|
Field[] fields = ReflectUtil.getFields(clazz);
|
||||||
|
List<String> fieldNameList = Arrays.stream(fields)
|
||||||
|
.filter(f -> ReflectUtil.getFieldValue(object, f) != null)
|
||||||
|
.map(Field::getName).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(fieldNameList)) {
|
||||||
|
return fieldNameList.toArray(new String[]{});
|
||||||
|
}
|
||||||
|
return new String[]{};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 私有构造函数,明确标识该常量类的作用。
|
* 私有构造函数,明确标识该常量类的作用。
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,6 +50,59 @@ public class MyModelUtil {
|
|||||||
*/
|
*/
|
||||||
private static Map<String, Tuple2<String, Integer>> cachedColumnInfoMap = new ConcurrentHashMap<>();
|
private static Map<String, Tuple2<String, Integer>> cachedColumnInfoMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拷贝源类型的集合数据到目标类型的集合中,其中源类型和目标类型中的对象字段类型完全相同。
|
||||||
|
* NOTE: 该函数主要应用于框架中,Dto和Model之间的copy,特别针对一对一关联的深度copy。
|
||||||
|
* 在Dto中,一对一对象可以使用Map来表示,而不需要使用从表对象的Dto。
|
||||||
|
*
|
||||||
|
* @param sourceCollection 源类型集合。
|
||||||
|
* @param targetClazz 目标类型的Class对象。
|
||||||
|
* @param <S> 源类型。
|
||||||
|
* @param <T> 目标类型。
|
||||||
|
* @return copy后的目标类型对象集合。
|
||||||
|
*/
|
||||||
|
public static <S, T> List<T> copyCollectionTo(Collection<S> sourceCollection, Class<T> targetClazz) {
|
||||||
|
List<T> targetList = new LinkedList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(sourceCollection)) {
|
||||||
|
for (S source : sourceCollection) {
|
||||||
|
try {
|
||||||
|
T target = targetClazz.newInstance();
|
||||||
|
BeanUtil.copyProperties(source, target);
|
||||||
|
targetList.add(target);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to call MyModelUtil.copyCollectionTo", e);
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return targetList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拷贝源类型的对象数据到目标类型的对象中,其中源类型和目标类型中的对象字段类型完全相同。
|
||||||
|
* NOTE: 该函数主要应用于框架中,Dto和Model之间的copy,特别针对一对一关联的深度copy。
|
||||||
|
* 在Dto中,一对一对象可以使用Map来表示,而不需要使用从表对象的Dto。
|
||||||
|
*
|
||||||
|
* @param source 源类型对象。
|
||||||
|
* @param targetClazz 目标类型的Class对象。
|
||||||
|
* @param <S> 源类型。
|
||||||
|
* @param <T> 目标类型。
|
||||||
|
* @return copy后的目标类型对象。
|
||||||
|
*/
|
||||||
|
public static <S, T> T copyTo(S source, Class<T> targetClazz) {
|
||||||
|
if (source == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
T target = targetClazz.newInstance();
|
||||||
|
BeanUtil.copyProperties(source, target);
|
||||||
|
return target;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to call MyModelUtil.copyTo", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 映射Model对象的字段反射对象,获取与该字段对应的数据库列名称。
|
* 映射Model对象的字段反射对象,获取与该字段对应的数据库列名称。
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
|||||||
* @date 2020-09-24
|
* @date 2020-09-24
|
||||||
*/
|
*/
|
||||||
@EnableConfigurationProperties({IdGeneratorProperties.class})
|
@EnableConfigurationProperties({IdGeneratorProperties.class})
|
||||||
public class IdGeneratorAutoConfigure {
|
public class IdGeneratorAutoConfig {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
com.orange.demo.common.sequence.config.IdGeneratorAutoConfigure
|
com.orange.demo.common.sequence.config.IdGeneratorAutoConfig
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>common</artifactId>
|
|
||||||
<groupId>com.orange.demo</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>common-swagger</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<name>common-swagger</name>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
|
||||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
|
||||||
<version>${knife4j.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.orange.demo</groupId>
|
|
||||||
<artifactId>common-core</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
package com.orange.demo.common.swagger.config;
|
|
||||||
|
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
|
||||||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
|
||||||
import springfox.documentation.builders.PathSelectors;
|
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
|
||||||
import springfox.documentation.service.ApiInfo;
|
|
||||||
import springfox.documentation.spi.DocumentationType;
|
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
|
||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自动加载bean的配置对象。
|
|
||||||
*
|
|
||||||
* @author Jerry
|
|
||||||
* @date 2020-09-24
|
|
||||||
*/
|
|
||||||
@EnableSwagger2
|
|
||||||
@EnableKnife4j
|
|
||||||
@EnableConfigurationProperties(SwaggerProperties.class)
|
|
||||||
@ConditionalOnProperty(prefix = "swagger", name = "enabled")
|
|
||||||
public class SwaggerAutoConfiguration {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Docket upmsDocket(SwaggerProperties properties) {
|
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
|
||||||
.groupName("1. 用户权限分组接口")
|
|
||||||
.ignoredParameterTypes(MyRequestBody.class)
|
|
||||||
.apiInfo(apiInfo(properties))
|
|
||||||
.select()
|
|
||||||
.apis(RequestHandlerSelectors.basePackage(properties.getBasePackage() + ".upms.controller"))
|
|
||||||
.paths(PathSelectors.any()).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Docket bizDocket(SwaggerProperties properties) {
|
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
|
||||||
.groupName("2. 业务应用分组接口")
|
|
||||||
.ignoredParameterTypes(MyRequestBody.class)
|
|
||||||
.apiInfo(apiInfo(properties))
|
|
||||||
.select()
|
|
||||||
.apis(RequestHandlerSelectors.basePackage(properties.getBasePackage() + ".app.controller"))
|
|
||||||
.paths(PathSelectors.any()).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ApiInfo apiInfo(SwaggerProperties properties) {
|
|
||||||
return new ApiInfoBuilder()
|
|
||||||
.title(properties.getTitle())
|
|
||||||
.description(properties.getDescription())
|
|
||||||
.version(properties.getVersion()).build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
package com.orange.demo.common.swagger.config;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置参数对象。
|
|
||||||
*
|
|
||||||
* @author Jerry
|
|
||||||
* @date 2020-09-24
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ConfigurationProperties("swagger")
|
|
||||||
public class SwaggerProperties {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否开启Swagger。
|
|
||||||
*/
|
|
||||||
private Boolean enabled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swagger解析的基础包路径。
|
|
||||||
**/
|
|
||||||
private String basePackage = "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ApiInfo中的标题。
|
|
||||||
**/
|
|
||||||
private String title = "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ApiInfo中的描述信息。
|
|
||||||
**/
|
|
||||||
private String description = "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ApiInfo中的版本信息。
|
|
||||||
**/
|
|
||||||
private String version = "";
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
package com.orange.demo.common.swagger.plugin;
|
|
||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
|
||||||
import com.github.xiaoymin.knife4j.core.conf.Consts;
|
|
||||||
import javassist.*;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import springfox.documentation.service.ResolvedMethodParameter;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过字节码方式动态创建接口参数封装对象。
|
|
||||||
*
|
|
||||||
* @author Jerry
|
|
||||||
* @date 2020-09-24
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class ByteBodyUtils {
|
|
||||||
private static final ClassPool CLASS_POOL = ClassPool.getDefault();
|
|
||||||
|
|
||||||
public static Class<?> createDynamicModelClass(String name, List<ResolvedMethodParameter> parameters) {
|
|
||||||
String clazzName = Consts.BASE_PACKAGE_PREFIX + name;
|
|
||||||
try {
|
|
||||||
CtClass tmp = CLASS_POOL.getCtClass(clazzName);
|
|
||||||
if (tmp != null) {
|
|
||||||
tmp.detach();
|
|
||||||
}
|
|
||||||
} catch (NotFoundException e) {
|
|
||||||
// 需要吃掉这个异常。
|
|
||||||
}
|
|
||||||
CtClass ctClass = CLASS_POOL.makeClass(clazzName);
|
|
||||||
try {
|
|
||||||
int fieldCount = 0;
|
|
||||||
for (ResolvedMethodParameter dynamicParameter : parameters) {
|
|
||||||
// 因为在调用这个方法之前,这些参数都包含MyRequestBody注解。
|
|
||||||
MyRequestBody myRequestBody =
|
|
||||||
dynamicParameter.findAnnotation(MyRequestBody.class).orNull();
|
|
||||||
Assert.notNull(myRequestBody);
|
|
||||||
String fieldName = dynamicParameter.defaultName().isPresent()
|
|
||||||
? dynamicParameter.defaultName().get() : "parameter";
|
|
||||||
if (StringUtils.isNotBlank(myRequestBody.value())) {
|
|
||||||
fieldName = myRequestBody.value();
|
|
||||||
}
|
|
||||||
ctClass.addField(createField(dynamicParameter, fieldName, ctClass));
|
|
||||||
fieldCount++;
|
|
||||||
}
|
|
||||||
if (fieldCount > 0) {
|
|
||||||
return ctClass.toClass();
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
log.error(e.getMessage());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CtField createField(ResolvedMethodParameter parameter, String parameterName, CtClass ctClass)
|
|
||||||
throws NotFoundException, CannotCompileException {
|
|
||||||
CtField field = new CtField(getFieldType(parameter.getParameterType().getErasedType()), parameterName, ctClass);
|
|
||||||
field.setModifiers(Modifier.PUBLIC);
|
|
||||||
return field;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CtClass getFieldType(Class<?> propetyType) {
|
|
||||||
CtClass fieldType = null;
|
|
||||||
try {
|
|
||||||
if (!propetyType.isAssignableFrom(Void.class)) {
|
|
||||||
fieldType = CLASS_POOL.get(propetyType.getName());
|
|
||||||
} else {
|
|
||||||
fieldType = CLASS_POOL.get(String.class.getName());
|
|
||||||
}
|
|
||||||
} catch (NotFoundException e) {
|
|
||||||
//抛异常
|
|
||||||
ClassClassPath path = new ClassClassPath(propetyType);
|
|
||||||
CLASS_POOL.insertClassPath(path);
|
|
||||||
try {
|
|
||||||
fieldType = CLASS_POOL.get(propetyType.getName());
|
|
||||||
} catch (NotFoundException e1) {
|
|
||||||
log.error(e1.getMessage(), e1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fieldType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package com.orange.demo.common.swagger.plugin;
|
|
||||||
|
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
|
||||||
import com.fasterxml.classmate.TypeResolver;
|
|
||||||
import com.google.common.base.CaseFormat;
|
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.core.Ordered;
|
|
||||||
import org.springframework.core.annotation.Order;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import springfox.documentation.service.ResolvedMethodParameter;
|
|
||||||
import springfox.documentation.spi.DocumentationType;
|
|
||||||
import springfox.documentation.spi.service.OperationModelsProviderPlugin;
|
|
||||||
import springfox.documentation.spi.service.contexts.RequestMappingContext;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成参数包装类的插件。
|
|
||||||
*
|
|
||||||
* @author Jerry
|
|
||||||
* @date 2020-09-24
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@Order(Ordered.HIGHEST_PRECEDENCE + 200)
|
|
||||||
@ConditionalOnProperty(prefix = "swagger", name = "enabled")
|
|
||||||
public class DynamicBodyModelPlugin implements OperationModelsProviderPlugin {
|
|
||||||
|
|
||||||
private final TypeResolver typeResolver;
|
|
||||||
|
|
||||||
public DynamicBodyModelPlugin(TypeResolver typeResolver) {
|
|
||||||
this.typeResolver = typeResolver;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(RequestMappingContext context) {
|
|
||||||
List<ResolvedMethodParameter> parameterTypes = context.getParameters();
|
|
||||||
if (CollectionUtils.isEmpty(parameterTypes)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<ResolvedMethodParameter> bodyParameter = parameterTypes.stream()
|
|
||||||
.filter(p -> p.hasParameterAnnotation(MyRequestBody.class)).collect(Collectors.toList());
|
|
||||||
if (CollectionUtils.isEmpty(bodyParameter)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String groupName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, context.getGroupName());
|
|
||||||
String clazzName = groupName + StringUtils.capitalize(context.getName());
|
|
||||||
Class<?> clazz = ByteBodyUtils.createDynamicModelClass(clazzName, bodyParameter);
|
|
||||||
if (clazz != null) {
|
|
||||||
context.operationModelsBuilder().addInputParam(typeResolver.resolve(clazz));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supports(DocumentationType delimiter) {
|
|
||||||
//支持2.0版本
|
|
||||||
return delimiter == DocumentationType.SWAGGER_2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
package com.orange.demo.common.swagger.plugin;
|
|
||||||
|
|
||||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
|
||||||
import com.google.common.base.CaseFormat;
|
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.core.Ordered;
|
|
||||||
import org.springframework.core.annotation.Order;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import springfox.documentation.builders.ParameterBuilder;
|
|
||||||
import springfox.documentation.schema.ModelRef;
|
|
||||||
import springfox.documentation.service.Parameter;
|
|
||||||
import springfox.documentation.service.ResolvedMethodParameter;
|
|
||||||
import springfox.documentation.spi.DocumentationType;
|
|
||||||
import springfox.documentation.spi.service.OperationBuilderPlugin;
|
|
||||||
import springfox.documentation.spi.service.contexts.OperationContext;
|
|
||||||
import springfox.documentation.spi.service.contexts.ParameterContext;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建操作接口参数对象的插件。
|
|
||||||
*
|
|
||||||
* @author Jerry
|
|
||||||
* @date 2020-09-24
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@Order(Ordered.HIGHEST_PRECEDENCE + 102)
|
|
||||||
@ConditionalOnProperty(prefix = "swagger", name = "enabled")
|
|
||||||
public class DynamicBodyParameterBuilder implements OperationBuilderPlugin {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(OperationContext context) {
|
|
||||||
List<ResolvedMethodParameter> methodParameters = context.getParameters();
|
|
||||||
List<Parameter> parameters = new ArrayList<>();
|
|
||||||
if (CollectionUtils.isNotEmpty(methodParameters)) {
|
|
||||||
List<ResolvedMethodParameter> bodyParameter = methodParameters.stream()
|
|
||||||
.filter(p -> p.hasParameterAnnotation(MyRequestBody.class)).collect(Collectors.toList());
|
|
||||||
if (CollectionUtils.isNotEmpty(bodyParameter)) {
|
|
||||||
//构造model
|
|
||||||
String groupName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, context.getGroupName());
|
|
||||||
String clazzName = groupName + StringUtils.capitalize(context.getName());
|
|
||||||
ResolvedMethodParameter methodParameter = bodyParameter.get(0);
|
|
||||||
ParameterContext parameterContext = new ParameterContext(methodParameter,
|
|
||||||
new ParameterBuilder(),
|
|
||||||
context.getDocumentationContext(),
|
|
||||||
context.getGenericsNamingStrategy(),
|
|
||||||
context);
|
|
||||||
Parameter parameter = parameterContext.parameterBuilder()
|
|
||||||
.parameterType("body").modelRef(new ModelRef(clazzName)).name(clazzName).build();
|
|
||||||
parameters.add(parameter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
context.operationBuilder().parameters(parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supports(DocumentationType delimiter) {
|
|
||||||
return delimiter == DocumentationType.SWAGGER_2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
|
||||||
com.orange.demo.common.swagger.config.SwaggerAutoConfiguration
|
|
||||||
@@ -14,6 +14,5 @@
|
|||||||
<modules>
|
<modules>
|
||||||
<module>common-core</module>
|
<module>common-core</module>
|
||||||
<module>common-sequence</module>
|
<module>common-sequence</module>
|
||||||
<module>common-swagger</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -34,9 +34,6 @@
|
|||||||
<mybatis-generator.version>1.3.7</mybatis-generator.version>
|
<mybatis-generator.version>1.3.7</mybatis-generator.version>
|
||||||
<pagehelper.version>1.2.13</pagehelper.version>
|
<pagehelper.version>1.2.13</pagehelper.version>
|
||||||
<qdox.version>2.0.0</qdox.version>
|
<qdox.version>2.0.0</qdox.version>
|
||||||
<knife4j.version>2.0.5</knife4j.version>
|
|
||||||
<springfox.version>2.9.2</springfox.version>
|
|
||||||
<swagger.version>1.5.21</swagger.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
1097
orange-demo-single-service/zzlogs/server/server.log
Normal file
1097
orange-demo-single-service/zzlogs/server/server.log
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user