mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 18:46:36 +08:00
同步到1.8.0
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
### 服务接口文档
|
||||
---
|
||||
- Knife4j
|
||||
- 服务启动后,Knife4j的文档入口地址 [http://localhost:8082/doc.html#/plus](http://localhost:8082/doc.html#/plus)
|
||||
- Postman
|
||||
- 无需启动服务,即可将当前工程的接口导出成Postman格式。在工程的common/common-tools/模块下,找到ExportApiApp文件,并执行main函数。
|
||||
|
||||
|
||||
@@ -13,12 +13,4 @@
|
||||
<version>1.0.0</version>
|
||||
<name>application-common</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.orange.demo</groupId>
|
||||
<artifactId>common-core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -30,6 +30,11 @@
|
||||
<artifactId>application-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.orange.demo</groupId>
|
||||
<artifactId>common-swagger</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.webadmin.app.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import cn.jimmyshi.beanquery.BeanQuery;
|
||||
import com.orange.demo.webadmin.app.model.AreaCode;
|
||||
import com.orange.demo.webadmin.app.service.AreaCodeService;
|
||||
@@ -21,6 +22,7 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "行政区划数据访问接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/areaCode")
|
||||
public class AreaCodeController {
|
||||
|
||||
@@ -18,6 +18,8 @@ import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import com.orange.demo.common.redis.cache.SessionCacheHelper;
|
||||
import com.orange.demo.webadmin.config.ApplicationConfig;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -33,6 +35,7 @@ import javax.validation.groups.Default;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "课程数据管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/course")
|
||||
@@ -53,6 +56,14 @@ public class CourseController {
|
||||
* @param courseDto 新增对象。
|
||||
* @return 应答结果对象,包含新增对象主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"courseDto.courseId",
|
||||
"courseDto.priceStart",
|
||||
"courseDto.priceEnd",
|
||||
"courseDto.classHourStart",
|
||||
"courseDto.classHourEnd",
|
||||
"courseDto.createTimeStart",
|
||||
"courseDto.createTimeEnd"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody CourseDto courseDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(courseDto);
|
||||
@@ -76,6 +87,13 @@ public class CourseController {
|
||||
* @param courseDto 更新对象。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"courseDto.priceStart",
|
||||
"courseDto.priceEnd",
|
||||
"courseDto.classHourStart",
|
||||
"courseDto.classHourEnd",
|
||||
"courseDto.createTimeStart",
|
||||
"courseDto.createTimeEnd"})
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(@MyRequestBody CourseDto courseDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(courseDto, Default.class, UpdateGroup.class);
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.orange.demo.common.core.object.*;
|
||||
import com.orange.demo.common.core.util.*;
|
||||
import com.orange.demo.common.core.constant.*;
|
||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -21,6 +22,7 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "课程统计管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/courseTransStats")
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.orange.demo.common.core.util.MyCommonUtil;
|
||||
import com.orange.demo.common.core.object.ResponseResult;
|
||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
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 org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -25,6 +27,7 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "年级管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/grade")
|
||||
@@ -39,6 +42,7 @@ public class GradeController {
|
||||
* @param gradeDto 新增对象。
|
||||
* @return 应答结果对象,包含新增对象主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"gradeDto.gradeId"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Integer> add(@MyRequestBody GradeDto gradeDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(gradeDto);
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.orange.demo.common.core.util.*;
|
||||
import com.orange.demo.common.core.constant.*;
|
||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -24,6 +26,7 @@ import javax.validation.groups.Default;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "校区数据管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/schoolInfo")
|
||||
@@ -38,6 +41,7 @@ public class SchoolInfoController {
|
||||
* @param schoolInfoDto 新增对象。
|
||||
* @return 应答结果对象,包含新增对象主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"schoolInfoDto.schoolId"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody SchoolInfoDto schoolInfoDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(schoolInfoDto);
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.orange.demo.common.core.object.*;
|
||||
import com.orange.demo.common.core.util.*;
|
||||
import com.orange.demo.common.core.constant.*;
|
||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -21,6 +22,7 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "学生行为统计管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/studentActionStats")
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.orange.demo.common.core.util.*;
|
||||
import com.orange.demo.common.core.constant.*;
|
||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -23,6 +25,7 @@ import javax.validation.groups.Default;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "学生行为流水管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/studentActionTrans")
|
||||
@@ -37,6 +40,10 @@ public class StudentActionTransController {
|
||||
* @param studentActionTransDto 新增对象。
|
||||
* @return 应答结果对象,包含新增对象主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"studentActionTransDto.transId",
|
||||
"studentActionTransDto.createTimeStart",
|
||||
"studentActionTransDto.createTimeEnd"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody StudentActionTransDto studentActionTransDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(studentActionTransDto);
|
||||
@@ -60,6 +67,9 @@ public class StudentActionTransController {
|
||||
* @param studentActionTransDto 更新对象。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"studentActionTransDto.createTimeStart",
|
||||
"studentActionTransDto.createTimeEnd"})
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(@MyRequestBody StudentActionTransDto studentActionTransDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(studentActionTransDto, Default.class, UpdateGroup.class);
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.orange.demo.common.core.util.*;
|
||||
import com.orange.demo.common.core.constant.*;
|
||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -24,6 +26,7 @@ import java.util.stream.Collectors;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "班级数据管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/studentClass")
|
||||
@@ -42,6 +45,7 @@ public class StudentClassController {
|
||||
* @param studentClassDto 新增对象。
|
||||
* @return 应答结果对象,包含新增对象主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"studentClassDto.classId"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody StudentClassDto studentClassDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(studentClassDto);
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.orange.demo.common.core.util.*;
|
||||
import com.orange.demo.common.core.constant.*;
|
||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -24,6 +26,7 @@ import javax.validation.groups.Default;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "学生数据管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/student")
|
||||
@@ -38,6 +41,13 @@ public class StudentController {
|
||||
* @param studentDto 新增对象。
|
||||
* @return 应答结果对象,包含新增对象主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"studentDto.studentId",
|
||||
"studentDto.searchString",
|
||||
"studentDto.birthdayStart",
|
||||
"studentDto.birthdayEnd",
|
||||
"studentDto.registerTimeStart",
|
||||
"studentDto.registerTimeEnd"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody StudentDto studentDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(studentDto);
|
||||
@@ -61,6 +71,12 @@ public class StudentController {
|
||||
* @param studentDto 更新对象。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"studentDto.searchString",
|
||||
"studentDto.birthdayStart",
|
||||
"studentDto.birthdayEnd",
|
||||
"studentDto.registerTimeStart",
|
||||
"studentDto.registerTimeEnd"})
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(@MyRequestBody StudentDto studentDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(studentDto, Default.class, UpdateGroup.class);
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.orange.demo.webadmin.app.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -12,24 +14,28 @@ import javax.validation.constraints.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("ClassCourseDto对象")
|
||||
@Data
|
||||
public class ClassCourseDto {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级Id", required = true)
|
||||
@NotNull(message = "数据验证失败,班级Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 课程Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程Id", required = true)
|
||||
@NotNull(message = "数据验证失败,课程Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程顺序(数值越小越靠前)。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程顺序(数值越小越靠前)", required = true)
|
||||
@NotNull(message = "数据验证失败,课程顺序(数值越小越靠前)不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer courseOrder;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.orange.demo.webadmin.app.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -12,18 +14,21 @@ import javax.validation.constraints.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("ClassStudentDto对象")
|
||||
@Data
|
||||
public class ClassStudentDto {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级Id", required = true)
|
||||
@NotNull(message = "数据验证失败,班级Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生Id", required = true)
|
||||
@NotNull(message = "数据验证失败,学生Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long studentId;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
import com.orange.demo.webadmin.app.model.constant.CourseDifficult;
|
||||
import com.orange.demo.application.common.constant.Subject;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -17,35 +19,41 @@ import java.math.BigDecimal;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("CourseDto对象")
|
||||
@Data
|
||||
public class CourseDto {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id", required = true)
|
||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程名称", required = true)
|
||||
@NotBlank(message = "数据验证失败,课程名称不能为空!")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 课程价格。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程价格", required = true)
|
||||
@NotNull(message = "数据验证失败,课程价格不能为空!")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 课程描述。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 课程难度(0: 容易 1: 普通 2: 很难)。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程难度(0: 容易 1: 普通 2: 很难)", required = true)
|
||||
@NotNull(message = "数据验证失败,课程难度不能为空!")
|
||||
@ConstDictRef(constDictClass = CourseDifficult.class, message = "数据验证失败,课程难度为无效值!")
|
||||
private Integer difficulty;
|
||||
@@ -53,12 +61,14 @@ public class CourseDto {
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所属年级不能为空!")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 学科Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学科Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所属学科不能为空!")
|
||||
@ConstDictRef(constDictClass = Subject.class, message = "数据验证失败,所属学科为无效值!")
|
||||
private Integer subjectId;
|
||||
@@ -66,42 +76,50 @@ public class CourseDto {
|
||||
/**
|
||||
* 课时数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "课时数量", required = true)
|
||||
@NotNull(message = "数据验证失败,课时数量不能为空!")
|
||||
private Integer classHour;
|
||||
|
||||
/**
|
||||
* 多张课程图片地址。
|
||||
*/
|
||||
@ApiModelProperty(value = "多张课程图片地址", required = true)
|
||||
@NotBlank(message = "数据验证失败,课程图片不能为空!")
|
||||
private String pictureUrl;
|
||||
|
||||
/**
|
||||
* price 范围过滤起始值(>=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "price 范围过滤起始值(>=)")
|
||||
private BigDecimal priceStart;
|
||||
|
||||
/**
|
||||
* price 范围过滤结束值(<=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "price 范围过滤结束值(<=)")
|
||||
private BigDecimal priceEnd;
|
||||
|
||||
/**
|
||||
* classHour 范围过滤起始值(>=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "classHour 范围过滤起始值(>=)")
|
||||
private Integer classHourStart;
|
||||
|
||||
/**
|
||||
* classHour 范围过滤结束值(<=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "classHour 范围过滤结束值(<=)")
|
||||
private Integer classHourEnd;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "createTime 范围过滤起始值(>=)")
|
||||
private String createTimeStart;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "createTime 范围过滤结束值(<=)")
|
||||
private String createTimeEnd;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
import com.orange.demo.application.common.constant.Subject;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -16,24 +18,28 @@ import java.util.Date;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("CourseTransStatsDto对象")
|
||||
@Data
|
||||
public class CourseTransStatsDto {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id", required = true)
|
||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 统计日期。
|
||||
*/
|
||||
@ApiModelProperty(value = "统计日期", required = true)
|
||||
@NotNull(message = "数据验证失败,统计日期不能为空!")
|
||||
private Date statsDate;
|
||||
|
||||
/**
|
||||
* 科目Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "科目Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所属科目不能为空!")
|
||||
@ConstDictRef(constDictClass = Subject.class, message = "数据验证失败,所属科目为无效值!")
|
||||
private Integer subjectId;
|
||||
@@ -41,50 +47,59 @@ public class CourseTransStatsDto {
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所属年级不能为空!")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 年级名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级名称")
|
||||
private String gradeName;
|
||||
|
||||
/**
|
||||
* 课程Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程Id", required = true)
|
||||
@NotNull(message = "数据验证失败,课程Id不能为空!")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程名称")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 学生上课次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生上课次数", required = true)
|
||||
@NotNull(message = "数据验证失败,上课次数不能为空!")
|
||||
private Integer studentAttendCount;
|
||||
|
||||
/**
|
||||
* 学生献花数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生献花数量", required = true)
|
||||
@NotNull(message = "数据验证失败,献花数量不能为空!")
|
||||
private Integer studentFlowerAmount;
|
||||
|
||||
/**
|
||||
* 学生献花次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生献花次数", required = true)
|
||||
@NotNull(message = "数据验证失败,献花次数不能为空!")
|
||||
private Integer studentFlowerCount;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤起始值(>=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "statsDate 范围过滤起始值(>=)")
|
||||
private String statsDateStart;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤结束值(<=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "statsDate 范围过滤结束值(<=)")
|
||||
private String statsDateEnd;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.orange.demo.webadmin.app.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -12,18 +14,21 @@ import javax.validation.constraints.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("GradeDto对象")
|
||||
@Data
|
||||
public class GradeDto {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id", required = true)
|
||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 年级名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级名称", required = true)
|
||||
@NotBlank(message = "数据验证失败,年级名称不能为空!")
|
||||
private String gradeName;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.orange.demo.webadmin.app.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -12,30 +14,35 @@ import javax.validation.constraints.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("SchoolInfoDto对象")
|
||||
@Data
|
||||
public class SchoolInfoDto {
|
||||
|
||||
/**
|
||||
* 学校Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学校Id", required = true)
|
||||
@NotNull(message = "数据验证失败,学校Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学校名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "学校名称", required = true)
|
||||
@NotBlank(message = "数据验证失败,学校名称不能为空!")
|
||||
private String schoolName;
|
||||
|
||||
/**
|
||||
* 所在省Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "所在省Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 所在城市Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "所在城市Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所在城市不能为空!")
|
||||
private Long cityId;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.orange.demo.webadmin.app.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -14,141 +16,165 @@ import java.util.Date;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("StudentActionStatsDto对象")
|
||||
@Data
|
||||
public class StudentActionStatsDto {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id", required = true)
|
||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 统计日期。
|
||||
*/
|
||||
@ApiModelProperty(value = "统计日期", required = true)
|
||||
@NotNull(message = "数据验证失败,统计日期不能为空!")
|
||||
private Date statsDate;
|
||||
|
||||
/**
|
||||
* 统计小时。
|
||||
*/
|
||||
@ApiModelProperty(value = "统计小时")
|
||||
private Date statsMonth;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所属年级不能为空!")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 学生所在省Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生所在省Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 学生所在城市Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生所在城市Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所在城市不能为空!", groups = {UpdateGroup.class})
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* 购课学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购课学币数量", required = true)
|
||||
@NotNull(message = "数据验证失败,购课学币数量不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer buyCourseAmount;
|
||||
|
||||
/**
|
||||
* 购买课程次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买课程次数", required = true)
|
||||
@NotNull(message = "数据验证失败,购买课程次数不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer buyCourseCount;
|
||||
|
||||
/**
|
||||
* 购买视频学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买视频学币数量", required = true)
|
||||
@NotNull(message = "数据验证失败,购买视频学币数量不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer buyVideoAmount;
|
||||
|
||||
/**
|
||||
* 购买视频次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买视频次数", required = true)
|
||||
@NotNull(message = "数据验证失败,购买视频次数不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer buyVideoCount;
|
||||
|
||||
/**
|
||||
* 购买作业学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买作业学币数量", required = true)
|
||||
@NotNull(message = "数据验证失败,购买作业学币数量不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer buyPaperAmount;
|
||||
|
||||
/**
|
||||
* 购买作业次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买作业次数", required = true)
|
||||
@NotNull(message = "数据验证失败,购买作业次数不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer buyPaperCount;
|
||||
|
||||
/**
|
||||
* 购买献花数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买献花数量", required = true)
|
||||
@NotNull(message = "数据验证失败,购买献花数量不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer buyFlowerAmount;
|
||||
|
||||
/**
|
||||
* 购买献花次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买献花次数", required = true)
|
||||
@NotNull(message = "数据验证失败,购买献花次数不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer buyFlowerCount;
|
||||
|
||||
/**
|
||||
* 充值学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "充值学币数量", required = true)
|
||||
@NotNull(message = "数据验证失败,充值学币数量不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer rechargeCoinAmount;
|
||||
|
||||
/**
|
||||
* 充值学币次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "充值学币次数", required = true)
|
||||
@NotNull(message = "数据验证失败,充值学币次数不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer rechargeCoinCount;
|
||||
|
||||
/**
|
||||
* 线下课程上课次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "线下课程上课次数", required = true)
|
||||
@NotNull(message = "数据验证失败,线下课程上课次数不能为空!")
|
||||
private Integer doCourseCount;
|
||||
|
||||
/**
|
||||
* 观看视频次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "观看视频次数", required = true)
|
||||
@NotNull(message = "数据验证失败,观看视频次数不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer watchVideoCount;
|
||||
|
||||
/**
|
||||
* 购买献花消费学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买献花消费学币数量", required = true)
|
||||
@NotNull(message = "数据验证失败,购买献花消费学币数量不能为空!")
|
||||
private Integer watchVideoTotalSecond;
|
||||
|
||||
/**
|
||||
* 做题数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "做题数量", required = true)
|
||||
@NotNull(message = "数据验证失败,做题数量不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer doExerciseCount;
|
||||
|
||||
/**
|
||||
* 做题正确的数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "做题正确的数量", required = true)
|
||||
@NotNull(message = "数据验证失败,做题正确的数量不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer doExerciseCorrectCount;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤起始值(>=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "statsDate 范围过滤起始值(>=)")
|
||||
private String statsDateStart;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤结束值(<=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "statsDate 范围过滤结束值(<=)")
|
||||
private String statsDateEnd;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
import com.orange.demo.application.common.constant.StudentActionType;
|
||||
import com.orange.demo.application.common.constant.DeviceType;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -17,42 +19,49 @@ import java.util.Date;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("StudentActionTransDto对象")
|
||||
@Data
|
||||
public class StudentActionTransDto {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id", required = true)
|
||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long transId;
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生Id", required = true)
|
||||
@NotNull(message = "数据验证失败,学生Id不能为空!")
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 学生名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生名称", required = true)
|
||||
@NotBlank(message = "数据验证失败,学生名称不能为空!")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 学生校区。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生校区", required = true)
|
||||
@NotNull(message = "数据验证失败,学生校区不能为空!")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级Id", required = true)
|
||||
@NotNull(message = "数据验证失败,学生年级不能为空!")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)。
|
||||
*/
|
||||
@ApiModelProperty(value = "行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)", required = true)
|
||||
@NotNull(message = "数据验证失败,行为类型不能为空!")
|
||||
@ConstDictRef(constDictClass = StudentActionType.class, message = "数据验证失败,行为类型为无效值!")
|
||||
private Integer actionType;
|
||||
@@ -60,6 +69,7 @@ public class StudentActionTransDto {
|
||||
/**
|
||||
* 设备类型(0: iOS 1: Android 2: PC)。
|
||||
*/
|
||||
@ApiModelProperty(value = "设备类型(0: iOS 1: Android 2: PC)", required = true)
|
||||
@NotNull(message = "数据验证失败,设备类型不能为空!")
|
||||
@ConstDictRef(constDictClass = DeviceType.class, message = "数据验证失败,设备类型为无效值!")
|
||||
private Integer deviceType;
|
||||
@@ -67,51 +77,61 @@ public class StudentActionTransDto {
|
||||
/**
|
||||
* 看视频秒数。
|
||||
*/
|
||||
@ApiModelProperty(value = "看视频秒数")
|
||||
private Integer watchVideoSeconds;
|
||||
|
||||
/**
|
||||
* 购买献花数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买献花数量")
|
||||
private Integer flowerCount;
|
||||
|
||||
/**
|
||||
* 购买作业数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买作业数量")
|
||||
private Integer paperCount;
|
||||
|
||||
/**
|
||||
* 购买视频数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买视频数量")
|
||||
private Integer videoCount;
|
||||
|
||||
/**
|
||||
* 购买课程数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买课程数量")
|
||||
private Integer courseCount;
|
||||
|
||||
/**
|
||||
* 充值学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "充值学币数量")
|
||||
private Integer coinCount;
|
||||
|
||||
/**
|
||||
* 做题是否正确标记。
|
||||
*/
|
||||
@ApiModelProperty(value = "做题是否正确标记")
|
||||
private Integer exerciseCorrectFlag;
|
||||
|
||||
/**
|
||||
* 发生时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "发生时间", required = true)
|
||||
@NotNull(message = "数据验证失败,发生时间不能为空!")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "createTime 范围过滤起始值(>=)")
|
||||
private String createTimeStart;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "createTime 范围过滤结束值(<=)")
|
||||
private String createTimeEnd;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
import com.orange.demo.webadmin.app.model.constant.ClassLevel;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -14,42 +16,49 @@ import javax.validation.constraints.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("StudentClassDto对象")
|
||||
@Data
|
||||
public class StudentClassDto {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级Id", required = true)
|
||||
@NotNull(message = "数据验证失败,班级Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 班级名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级名称", required = true)
|
||||
@NotBlank(message = "数据验证失败,班级名称不能为空!")
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 学校Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学校Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所属校区不能为空!")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学生班长Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生班长Id", required = true)
|
||||
@NotNull(message = "数据验证失败,学生班长不能为空!")
|
||||
private Long leaderId;
|
||||
|
||||
/**
|
||||
* 已完成课时数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "已完成课时数量", required = true)
|
||||
@NotNull(message = "数据验证失败,已完成课时不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer finishClassHour;
|
||||
|
||||
/**
|
||||
* 班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)", required = true)
|
||||
@NotNull(message = "数据验证失败,班级级别不能为空!")
|
||||
@ConstDictRef(constDictClass = ClassLevel.class, message = "数据验证失败,班级级别为无效值!")
|
||||
private Integer classLevel;
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.orange.demo.application.common.constant.Gender;
|
||||
import com.orange.demo.application.common.constant.ExpLevel;
|
||||
import com.orange.demo.application.common.constant.StudentStatus;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -18,48 +20,56 @@ import java.util.Date;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("StudentDto对象")
|
||||
@Data
|
||||
public class StudentDto {
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生Id", required = true)
|
||||
@NotNull(message = "数据验证失败,学生Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 登录手机。
|
||||
*/
|
||||
@ApiModelProperty(value = "登录手机", required = true)
|
||||
@NotBlank(message = "数据验证失败,手机号码不能为空!")
|
||||
private String loginMobile;
|
||||
|
||||
/**
|
||||
* 学生姓名。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生姓名", required = true)
|
||||
@NotBlank(message = "数据验证失败,学生姓名不能为空!")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 所在省份Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "所在省份Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 所在城市Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "所在城市Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所在城市不能为空!")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* 区县Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "区县Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所在区县不能为空!")
|
||||
private Long districtId;
|
||||
|
||||
/**
|
||||
* 学生性别 (0: 女生 1: 男生)。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生性别 (0: 女生 1: 男生)", required = true)
|
||||
@NotNull(message = "数据验证失败,学生性别不能为空!")
|
||||
@ConstDictRef(constDictClass = Gender.class, message = "数据验证失败,学生性别为无效值!")
|
||||
private Integer gender;
|
||||
@@ -67,12 +77,14 @@ public class StudentDto {
|
||||
/**
|
||||
* 生日。
|
||||
*/
|
||||
@ApiModelProperty(value = "生日", required = true)
|
||||
@NotNull(message = "数据验证失败,出生日期不能为空!")
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)。
|
||||
*/
|
||||
@ApiModelProperty(value = "经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)", required = true)
|
||||
@NotNull(message = "数据验证失败,经验等级不能为空!")
|
||||
@ConstDictRef(constDictClass = ExpLevel.class, message = "数据验证失败,经验等级为无效值!")
|
||||
private Integer experienceLevel;
|
||||
@@ -80,29 +92,34 @@ public class StudentDto {
|
||||
/**
|
||||
* 总共充值学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "总共充值学币数量", required = true)
|
||||
@NotNull(message = "数据验证失败,充值学币不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer totalCoin;
|
||||
|
||||
/**
|
||||
* 可用学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "可用学币数量")
|
||||
private Integer leftCoin;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级Id", required = true)
|
||||
@NotNull(message = "数据验证失败,年级不能为空!")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 校区Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "校区Id", required = true)
|
||||
@NotNull(message = "数据验证失败,所属校区不能为空!")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学生状态 (0: 正常 1: 锁定 2: 注销)。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生状态 (0: 正常 1: 锁定 2: 注销)", required = true)
|
||||
@NotNull(message = "数据验证失败,学生状态不能为空!", groups = {UpdateGroup.class})
|
||||
@ConstDictRef(constDictClass = StudentStatus.class, message = "数据验证失败,学生状态为无效值!")
|
||||
private Integer status;
|
||||
@@ -110,25 +127,30 @@ public class StudentDto {
|
||||
/**
|
||||
* birthday 范围过滤起始值(>=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "birthday 范围过滤起始值(>=)")
|
||||
private String birthdayStart;
|
||||
|
||||
/**
|
||||
* birthday 范围过滤结束值(<=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "birthday 范围过滤结束值(<=)")
|
||||
private String birthdayEnd;
|
||||
|
||||
/**
|
||||
* registerTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "registerTime 范围过滤起始值(>=)")
|
||||
private String registerTimeStart;
|
||||
|
||||
/**
|
||||
* registerTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "registerTime 范围过滤结束值(<=)")
|
||||
private String registerTimeEnd;
|
||||
|
||||
/**
|
||||
* login_mobile / student_name LIKE搜索字符串。
|
||||
*/
|
||||
@ApiModelProperty(value = "LIKE模糊搜索字符串")
|
||||
private String searchString;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 行政区划实体对象。
|
||||
*
|
||||
@@ -11,31 +10,30 @@ import javax.persistence.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_area_code")
|
||||
@TableName(value = "zz_area_code")
|
||||
public class AreaCode {
|
||||
|
||||
/**
|
||||
* 行政区划主键Id
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "area_id")
|
||||
@TableId(value = "area_id")
|
||||
private Long areaId;
|
||||
|
||||
/**
|
||||
* 行政区划名称
|
||||
*/
|
||||
@Column(name = "area_name")
|
||||
@TableField(value = "area_name")
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 行政区划级别 (1: 省级别 2: 市级别 3: 区级别)
|
||||
*/
|
||||
@Column(name = "area_level")
|
||||
@TableField(value = "area_level")
|
||||
private Integer areaLevel;
|
||||
|
||||
/**
|
||||
* 父级行政区划Id
|
||||
*/
|
||||
@Column(name = "parent_id")
|
||||
@TableField(value = "parent_id")
|
||||
private Long parentId;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* ClassCourse实体对象。
|
||||
@@ -10,26 +10,24 @@ import javax.persistence.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_class_course")
|
||||
@TableName(value = "zz_class_course")
|
||||
public class ClassCourse {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "class_id")
|
||||
@TableField(value = "class_id")
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 课程Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "course_id")
|
||||
@TableField(value = "course_id")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程顺序(数值越小越靠前)。
|
||||
*/
|
||||
@Column(name = "course_order")
|
||||
@TableField(value = "course_order")
|
||||
private Integer courseOrder;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* ClassStudent实体对象。
|
||||
@@ -10,20 +10,18 @@ import javax.persistence.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_class_student")
|
||||
@TableName(value = "zz_class_student")
|
||||
public class ClassStudent {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "class_id")
|
||||
@TableField(value = "class_id")
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "student_id")
|
||||
@TableField(value = "student_id")
|
||||
private Long studentId;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.webadmin.app.model.constant.CourseDifficult;
|
||||
import com.orange.demo.application.common.constant.Subject;
|
||||
import com.orange.demo.common.core.upload.UploadStoreTypeEnum;
|
||||
@@ -11,7 +12,6 @@ import com.orange.demo.webadmin.app.vo.CourseVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -24,20 +24,19 @@ import java.util.Map;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_course")
|
||||
@TableName(value = "zz_course")
|
||||
public class Course {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "course_id")
|
||||
@TableId(value = "course_id")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称。
|
||||
*/
|
||||
@Column(name = "course_name")
|
||||
@TableField(value = "course_name")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
@@ -58,86 +57,86 @@ public class Course {
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@Column(name = "grade_id")
|
||||
@TableField(value = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 学科Id。
|
||||
*/
|
||||
@Column(name = "subject_id")
|
||||
@TableField(value = "subject_id")
|
||||
private Integer subjectId;
|
||||
|
||||
/**
|
||||
* 课时数量。
|
||||
*/
|
||||
@Column(name = "class_hour")
|
||||
@TableField(value = "class_hour")
|
||||
private Integer classHour;
|
||||
|
||||
/**
|
||||
* 多张课程图片地址。
|
||||
*/
|
||||
@UploadFlagColumn(storeType = UploadStoreTypeEnum.LOCAL_SYSTEM)
|
||||
@Column(name = "picture_url")
|
||||
@TableField(value = "picture_url")
|
||||
private String pictureUrl;
|
||||
|
||||
/**
|
||||
* 创建用户Id。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 最后修改时间。
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* price 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private BigDecimal priceStart;
|
||||
|
||||
/**
|
||||
* price 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private BigDecimal priceEnd;
|
||||
|
||||
/**
|
||||
* classHour 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Integer classHourStart;
|
||||
|
||||
/**
|
||||
* classHour 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Integer classHourEnd;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String createTimeStart;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String createTimeEnd;
|
||||
|
||||
/**
|
||||
* courseId 的多对多关联表数据对象。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private ClassCourse classCourse;
|
||||
|
||||
@RelationDict(
|
||||
@@ -146,19 +145,19 @@ public class Course {
|
||||
slaveModelClass = Grade.class,
|
||||
slaveIdField = "gradeId",
|
||||
slaveNameField = "gradeName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "difficulty",
|
||||
constantDictClass = CourseDifficult.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> difficultyDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "subjectId",
|
||||
constantDictClass = Subject.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> subjectIdDictMap;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.application.common.constant.Subject;
|
||||
import com.orange.demo.common.core.annotation.RelationDict;
|
||||
import com.orange.demo.common.core.annotation.RelationConstDict;
|
||||
@@ -8,7 +9,6 @@ import com.orange.demo.webadmin.app.vo.CourseTransStatsVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -20,81 +20,79 @@ import java.util.Map;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_course_trans_stats")
|
||||
@TableName(value = "zz_course_trans_stats")
|
||||
public class CourseTransStats {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "stats_id")
|
||||
@TableId(value = "stats_id", type = IdType.AUTO)
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 统计日期。
|
||||
*/
|
||||
@Column(name = "stats_date")
|
||||
@TableField(value = "stats_date")
|
||||
private Date statsDate;
|
||||
|
||||
/**
|
||||
* 科目Id。
|
||||
*/
|
||||
@Column(name = "subject_id")
|
||||
@TableField(value = "subject_id")
|
||||
private Integer subjectId;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@Column(name = "grade_id")
|
||||
@TableField(value = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 年级名称。
|
||||
*/
|
||||
@Column(name = "grade_name")
|
||||
@TableField(value = "grade_name")
|
||||
private String gradeName;
|
||||
|
||||
/**
|
||||
* 课程Id。
|
||||
*/
|
||||
@Column(name = "course_id")
|
||||
@TableField(value = "course_id")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称。
|
||||
*/
|
||||
@Column(name = "course_name")
|
||||
@TableField(value = "course_name")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 学生上课次数。
|
||||
*/
|
||||
@Column(name = "student_attend_count")
|
||||
@TableField(value = "student_attend_count")
|
||||
private Integer studentAttendCount;
|
||||
|
||||
/**
|
||||
* 学生献花数量。
|
||||
*/
|
||||
@Column(name = "student_flower_amount")
|
||||
@TableField(value = "student_flower_amount")
|
||||
private Integer studentFlowerAmount;
|
||||
|
||||
/**
|
||||
* 学生献花次数。
|
||||
*/
|
||||
@Column(name = "student_flower_count")
|
||||
@TableField(value = "student_flower_count")
|
||||
private Integer studentFlowerCount;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String statsDateStart;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String statsDateEnd;
|
||||
|
||||
@RelationDict(
|
||||
@@ -103,13 +101,13 @@ public class CourseTransStats {
|
||||
slaveModelClass = Grade.class,
|
||||
slaveIdField = "gradeId",
|
||||
slaveNameField = "gradeName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "subjectId",
|
||||
constantDictClass = Subject.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> subjectIdDictMap;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* Grade实体对象。
|
||||
@@ -11,26 +10,24 @@ import javax.persistence.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_grade")
|
||||
@TableName(value = "zz_grade")
|
||||
public class Grade {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "grade_id")
|
||||
@TableId(value = "grade_id", type = IdType.AUTO)
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 年级名称。
|
||||
*/
|
||||
@Column(name = "grade_name")
|
||||
@TableField(value = "grade_name")
|
||||
private String gradeName;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@DeletedFlagColumn
|
||||
@TableLogic
|
||||
private Integer status;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* MaterialEdition实体对象。
|
||||
@@ -10,21 +10,19 @@ import javax.persistence.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_material_edition")
|
||||
@TableName(value = "zz_material_edition")
|
||||
public class MaterialEdition {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "edition_id")
|
||||
@TableId(value = "edition_id", type = IdType.AUTO)
|
||||
private Integer editionId;
|
||||
|
||||
/**
|
||||
* 教材版本名称。
|
||||
*/
|
||||
@Column(name = "edition_name")
|
||||
@TableField(value = "edition_name")
|
||||
private String editionName;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.common.core.annotation.RelationDict;
|
||||
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orange.demo.webadmin.app.vo.SchoolInfoVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -17,32 +17,31 @@ import java.util.Map;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_school_info")
|
||||
@TableName(value = "zz_school_info")
|
||||
public class SchoolInfo {
|
||||
|
||||
/**
|
||||
* 学校Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "school_id")
|
||||
@TableId(value = "school_id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学校名称。
|
||||
*/
|
||||
@Column(name = "school_name")
|
||||
@TableField(value = "school_name")
|
||||
private String schoolName;
|
||||
|
||||
/**
|
||||
* 所在省Id。
|
||||
*/
|
||||
@Column(name = "province_id")
|
||||
@TableField(value = "province_id")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 所在城市Id。
|
||||
*/
|
||||
@Column(name = "city_id")
|
||||
@TableField(value = "city_id")
|
||||
private Long cityId;
|
||||
|
||||
@RelationDict(
|
||||
@@ -51,7 +50,7 @@ public class SchoolInfo {
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
@@ -60,7 +59,7 @@ public class SchoolInfo {
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.application.common.constant.Gender;
|
||||
import com.orange.demo.application.common.constant.ExpLevel;
|
||||
import com.orange.demo.application.common.constant.StudentStatus;
|
||||
@@ -11,7 +12,6 @@ import com.orange.demo.webadmin.app.vo.StudentVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -23,44 +23,43 @@ import java.util.Map;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_student")
|
||||
@TableName(value = "zz_student")
|
||||
public class Student {
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "student_id")
|
||||
@TableId(value = "student_id")
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 登录手机。
|
||||
*/
|
||||
@Column(name = "login_mobile")
|
||||
@TableField(value = "login_mobile")
|
||||
private String loginMobile;
|
||||
|
||||
/**
|
||||
* 学生姓名。
|
||||
*/
|
||||
@Column(name = "student_name")
|
||||
@TableField(value = "student_name")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 所在省份Id。
|
||||
*/
|
||||
@Column(name = "province_id")
|
||||
@TableField(value = "province_id")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 所在城市Id。
|
||||
*/
|
||||
@Column(name = "city_id")
|
||||
@TableField(value = "city_id")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* 区县Id。
|
||||
*/
|
||||
@Column(name = "district_id")
|
||||
@TableField(value = "district_id")
|
||||
private Long districtId;
|
||||
|
||||
/**
|
||||
@@ -76,37 +75,37 @@ public class Student {
|
||||
/**
|
||||
* 经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)。
|
||||
*/
|
||||
@Column(name = "experience_level")
|
||||
@TableField(value = "experience_level")
|
||||
private Integer experienceLevel;
|
||||
|
||||
/**
|
||||
* 总共充值学币数量。
|
||||
*/
|
||||
@Column(name = "total_coin")
|
||||
@TableField(value = "total_coin")
|
||||
private Integer totalCoin;
|
||||
|
||||
/**
|
||||
* 可用学币数量。
|
||||
*/
|
||||
@Column(name = "left_coin")
|
||||
@TableField(value = "left_coin")
|
||||
private Integer leftCoin;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@Column(name = "grade_id")
|
||||
@TableField(value = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 校区Id。
|
||||
*/
|
||||
@Column(name = "school_id")
|
||||
@TableField(value = "school_id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 注册时间。
|
||||
*/
|
||||
@Column(name = "register_time")
|
||||
@TableField(value = "register_time")
|
||||
private Date registerTime;
|
||||
|
||||
/**
|
||||
@@ -117,31 +116,31 @@ public class Student {
|
||||
/**
|
||||
* birthday 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String birthdayStart;
|
||||
|
||||
/**
|
||||
* birthday 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String birthdayEnd;
|
||||
|
||||
/**
|
||||
* registerTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String registerTimeStart;
|
||||
|
||||
/**
|
||||
* registerTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String registerTimeEnd;
|
||||
|
||||
/**
|
||||
* login_mobile / student_name LIKE搜索字符串。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String searchString;
|
||||
|
||||
public void setSearchString(String searchString) {
|
||||
@@ -154,7 +153,7 @@ public class Student {
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
@@ -163,7 +162,7 @@ public class Student {
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
@@ -172,7 +171,7 @@ public class Student {
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> districtIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
@@ -181,7 +180,7 @@ public class Student {
|
||||
slaveModelClass = Grade.class,
|
||||
slaveIdField = "gradeId",
|
||||
slaveNameField = "gradeName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
@@ -190,25 +189,25 @@ public class Student {
|
||||
slaveModelClass = SchoolInfo.class,
|
||||
slaveIdField = "schoolId",
|
||||
slaveNameField = "schoolName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "gender",
|
||||
constantDictClass = Gender.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> genderDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "experienceLevel",
|
||||
constantDictClass = ExpLevel.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> experienceLevelDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "status",
|
||||
constantDictClass = StudentStatus.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> statusDictMap;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.common.core.annotation.RelationDict;
|
||||
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orange.demo.webadmin.app.vo.StudentActionStatsVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -18,146 +18,145 @@ import java.util.Map;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_student_action_stats")
|
||||
@TableName(value = "zz_student_action_stats")
|
||||
public class StudentActionStats {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "stats_id")
|
||||
@TableId(value = "stats_id")
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 统计日期。
|
||||
*/
|
||||
@Column(name = "stats_date")
|
||||
@TableField(value = "stats_date")
|
||||
private Date statsDate;
|
||||
|
||||
/**
|
||||
* 统计小时。
|
||||
*/
|
||||
@Column(name = "stats_month")
|
||||
@TableField(value = "stats_month")
|
||||
private Date statsMonth;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@Column(name = "grade_id")
|
||||
@TableField(value = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 学生所在省Id。
|
||||
*/
|
||||
@Column(name = "province_id")
|
||||
@TableField(value = "province_id")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 学生所在城市Id。
|
||||
*/
|
||||
@Column(name = "city_id")
|
||||
@TableField(value = "city_id")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* 购课学币数量。
|
||||
*/
|
||||
@Column(name = "buy_course_amount")
|
||||
@TableField(value = "buy_course_amount")
|
||||
private Integer buyCourseAmount;
|
||||
|
||||
/**
|
||||
* 购买课程次数。
|
||||
*/
|
||||
@Column(name = "buy_course_count")
|
||||
@TableField(value = "buy_course_count")
|
||||
private Integer buyCourseCount;
|
||||
|
||||
/**
|
||||
* 购买视频学币数量。
|
||||
*/
|
||||
@Column(name = "buy_video_amount")
|
||||
@TableField(value = "buy_video_amount")
|
||||
private Integer buyVideoAmount;
|
||||
|
||||
/**
|
||||
* 购买视频次数。
|
||||
*/
|
||||
@Column(name = "buy_video_count")
|
||||
@TableField(value = "buy_video_count")
|
||||
private Integer buyVideoCount;
|
||||
|
||||
/**
|
||||
* 购买作业学币数量。
|
||||
*/
|
||||
@Column(name = "buy_paper_amount")
|
||||
@TableField(value = "buy_paper_amount")
|
||||
private Integer buyPaperAmount;
|
||||
|
||||
/**
|
||||
* 购买作业次数。
|
||||
*/
|
||||
@Column(name = "buy_paper_count")
|
||||
@TableField(value = "buy_paper_count")
|
||||
private Integer buyPaperCount;
|
||||
|
||||
/**
|
||||
* 购买献花数量。
|
||||
*/
|
||||
@Column(name = "buy_flower_amount")
|
||||
@TableField(value = "buy_flower_amount")
|
||||
private Integer buyFlowerAmount;
|
||||
|
||||
/**
|
||||
* 购买献花次数。
|
||||
*/
|
||||
@Column(name = "buy_flower_count")
|
||||
@TableField(value = "buy_flower_count")
|
||||
private Integer buyFlowerCount;
|
||||
|
||||
/**
|
||||
* 充值学币数量。
|
||||
*/
|
||||
@Column(name = "recharge_coin_amount")
|
||||
@TableField(value = "recharge_coin_amount")
|
||||
private Integer rechargeCoinAmount;
|
||||
|
||||
/**
|
||||
* 充值学币次数。
|
||||
*/
|
||||
@Column(name = "recharge_coin_count")
|
||||
@TableField(value = "recharge_coin_count")
|
||||
private Integer rechargeCoinCount;
|
||||
|
||||
/**
|
||||
* 线下课程上课次数。
|
||||
*/
|
||||
@Column(name = "do_course_count")
|
||||
@TableField(value = "do_course_count")
|
||||
private Integer doCourseCount;
|
||||
|
||||
/**
|
||||
* 观看视频次数。
|
||||
*/
|
||||
@Column(name = "watch_video_count")
|
||||
@TableField(value = "watch_video_count")
|
||||
private Integer watchVideoCount;
|
||||
|
||||
/**
|
||||
* 购买献花消费学币数量。
|
||||
*/
|
||||
@Column(name = "watch_video_total_second")
|
||||
@TableField(value = "watch_video_total_second")
|
||||
private Integer watchVideoTotalSecond;
|
||||
|
||||
/**
|
||||
* 做题数量。
|
||||
*/
|
||||
@Column(name = "do_exercise_count")
|
||||
@TableField(value = "do_exercise_count")
|
||||
private Integer doExerciseCount;
|
||||
|
||||
/**
|
||||
* 做题正确的数量。
|
||||
*/
|
||||
@Column(name = "do_exercise_correct_count")
|
||||
@TableField(value = "do_exercise_correct_count")
|
||||
private Integer doExerciseCorrectCount;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String statsDateStart;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String statsDateEnd;
|
||||
|
||||
@RelationDict(
|
||||
@@ -166,7 +165,7 @@ public class StudentActionStats {
|
||||
slaveModelClass = Grade.class,
|
||||
slaveIdField = "gradeId",
|
||||
slaveNameField = "gradeName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
@@ -175,7 +174,7 @@ public class StudentActionStats {
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
@@ -184,7 +183,7 @@ public class StudentActionStats {
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.application.common.constant.StudentActionType;
|
||||
import com.orange.demo.application.common.constant.DeviceType;
|
||||
import com.orange.demo.common.core.annotation.RelationDict;
|
||||
@@ -9,7 +10,6 @@ import com.orange.demo.webadmin.app.vo.StudentActionTransVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -21,110 +21,109 @@ import java.util.Map;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_student_action_trans")
|
||||
@TableName(value = "zz_student_action_trans")
|
||||
public class StudentActionTrans {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "trans_id")
|
||||
@TableId(value = "trans_id")
|
||||
private Long transId;
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@Column(name = "student_id")
|
||||
@TableField(value = "student_id")
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 学生名称。
|
||||
*/
|
||||
@Column(name = "student_name")
|
||||
@TableField(value = "student_name")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 学生校区。
|
||||
*/
|
||||
@Column(name = "school_id")
|
||||
@TableField(value = "school_id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@Column(name = "grade_id")
|
||||
@TableField(value = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)。
|
||||
*/
|
||||
@Column(name = "action_type")
|
||||
@TableField(value = "action_type")
|
||||
private Integer actionType;
|
||||
|
||||
/**
|
||||
* 设备类型(0: iOS 1: Android 2: PC)。
|
||||
*/
|
||||
@Column(name = "device_type")
|
||||
@TableField(value = "device_type")
|
||||
private Integer deviceType;
|
||||
|
||||
/**
|
||||
* 看视频秒数。
|
||||
*/
|
||||
@Column(name = "watch_video_seconds")
|
||||
@TableField(value = "watch_video_seconds")
|
||||
private Integer watchVideoSeconds;
|
||||
|
||||
/**
|
||||
* 购买献花数量。
|
||||
*/
|
||||
@Column(name = "flower_count")
|
||||
@TableField(value = "flower_count")
|
||||
private Integer flowerCount;
|
||||
|
||||
/**
|
||||
* 购买作业数量。
|
||||
*/
|
||||
@Column(name = "paper_count")
|
||||
@TableField(value = "paper_count")
|
||||
private Integer paperCount;
|
||||
|
||||
/**
|
||||
* 购买视频数量。
|
||||
*/
|
||||
@Column(name = "video_count")
|
||||
@TableField(value = "video_count")
|
||||
private Integer videoCount;
|
||||
|
||||
/**
|
||||
* 购买课程数量。
|
||||
*/
|
||||
@Column(name = "course_count")
|
||||
@TableField(value = "course_count")
|
||||
private Integer courseCount;
|
||||
|
||||
/**
|
||||
* 充值学币数量。
|
||||
*/
|
||||
@Column(name = "coin_count")
|
||||
@TableField(value = "coin_count")
|
||||
private Integer coinCount;
|
||||
|
||||
/**
|
||||
* 做题是否正确标记。
|
||||
*/
|
||||
@Column(name = "exercise_correct_flag")
|
||||
@TableField(value = "exercise_correct_flag")
|
||||
private Integer exerciseCorrectFlag;
|
||||
|
||||
/**
|
||||
* 发生时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String createTimeStart;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String createTimeEnd;
|
||||
|
||||
@RelationDict(
|
||||
@@ -133,7 +132,7 @@ public class StudentActionTrans {
|
||||
slaveModelClass = SchoolInfo.class,
|
||||
slaveIdField = "schoolId",
|
||||
slaveNameField = "schoolName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
@@ -142,19 +141,19 @@ public class StudentActionTrans {
|
||||
slaveModelClass = Grade.class,
|
||||
slaveIdField = "gradeId",
|
||||
slaveNameField = "gradeName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "actionType",
|
||||
constantDictClass = StudentActionType.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> actionTypeDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "deviceType",
|
||||
constantDictClass = DeviceType.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> deviceTypeDictMap;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.webadmin.app.model.constant.ClassLevel;
|
||||
import com.orange.demo.common.core.annotation.RelationDict;
|
||||
import com.orange.demo.common.core.annotation.RelationConstDict;
|
||||
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||
import com.orange.demo.webadmin.app.vo.StudentClassVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -21,62 +20,61 @@ import java.util.Map;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_class")
|
||||
@TableName(value = "zz_class")
|
||||
public class StudentClass {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "class_id")
|
||||
@TableId(value = "class_id")
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 班级名称。
|
||||
*/
|
||||
@Column(name = "class_name")
|
||||
@TableField(value = "class_name")
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 学校Id。
|
||||
*/
|
||||
@Column(name = "school_id")
|
||||
@TableField(value = "school_id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学生班长Id。
|
||||
*/
|
||||
@Column(name = "leader_id")
|
||||
@TableField(value = "leader_id")
|
||||
private Long leaderId;
|
||||
|
||||
/**
|
||||
* 已完成课时数量。
|
||||
*/
|
||||
@Column(name = "finish_class_hour")
|
||||
@TableField(value = "finish_class_hour")
|
||||
private Integer finishClassHour;
|
||||
|
||||
/**
|
||||
* 班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)。
|
||||
*/
|
||||
@Column(name = "class_level")
|
||||
@TableField(value = "class_level")
|
||||
private Integer classLevel;
|
||||
|
||||
/**
|
||||
* 创建用户。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 班级创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@DeletedFlagColumn
|
||||
@TableLogic
|
||||
private Integer status;
|
||||
|
||||
@RelationDict(
|
||||
@@ -85,7 +83,7 @@ public class StudentClass {
|
||||
slaveModelClass = SchoolInfo.class,
|
||||
slaveIdField = "schoolId",
|
||||
slaveNameField = "schoolName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
@@ -94,13 +92,13 @@ public class StudentClass {
|
||||
slaveModelClass = Student.class,
|
||||
slaveIdField = "studentId",
|
||||
slaveNameField = "studentName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> leaderIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "classLevel",
|
||||
constantDictClass = ClassLevel.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> classLevelDictMap;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
@@ -79,7 +81,8 @@ public class CourseServiceImpl extends BaseService<Course, Long> implements Cour
|
||||
course.setCreateTime(originalCourse.getCreateTime());
|
||||
course.setUpdateTime(new Date());
|
||||
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
|
||||
return courseMapper.updateByPrimaryKey(course) == 1;
|
||||
UpdateWrapper<Course> uw = this.createUpdateQueryForNullValue(course, course.getCourseId());
|
||||
return courseMapper.update(course, uw) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,14 +94,13 @@ public class CourseServiceImpl extends BaseService<Course, Long> implements Cour
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long courseId) {
|
||||
// 这里先删除主数据
|
||||
if (!this.removeById(courseId)) {
|
||||
if (courseMapper.deleteById(courseId) == 0) {
|
||||
return false;
|
||||
}
|
||||
// 开始删除多对多父表的关联
|
||||
ClassCourse classCourse = new ClassCourse();
|
||||
classCourse.setCourseId(courseId);
|
||||
classCourseMapper.delete(classCourse);
|
||||
classCourseMapper.delete(new QueryWrapper<>(classCourse));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
@@ -68,7 +69,8 @@ public class SchoolInfoServiceImpl extends BaseService<SchoolInfo, Long> impleme
|
||||
@Override
|
||||
public boolean update(SchoolInfo schoolInfo, SchoolInfo originalSchoolInfo) {
|
||||
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
|
||||
return schoolInfoMapper.updateByPrimaryKey(schoolInfo) == 1;
|
||||
UpdateWrapper<SchoolInfo> uw = this.createUpdateQueryForNullValue(schoolInfo, schoolInfo.getSchoolId());
|
||||
return schoolInfoMapper.update(schoolInfo, uw) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,8 +82,7 @@ public class SchoolInfoServiceImpl extends BaseService<SchoolInfo, Long> impleme
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long schoolId) {
|
||||
// 这里先删除主数据
|
||||
return this.removeById(schoolId);
|
||||
return schoolInfoMapper.deleteById(schoolId) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
@@ -70,7 +71,8 @@ public class StudentActionTransServiceImpl extends BaseService<StudentActionTran
|
||||
@Override
|
||||
public boolean update(StudentActionTrans studentActionTrans, StudentActionTrans originalStudentActionTrans) {
|
||||
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
|
||||
return studentActionTransMapper.updateByPrimaryKey(studentActionTrans) == 1;
|
||||
UpdateWrapper<StudentActionTrans> uw = this.createUpdateQueryForNullValue(studentActionTrans, studentActionTrans.getTransId());
|
||||
return studentActionTransMapper.update(studentActionTrans, uw) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,8 +84,7 @@ public class StudentActionTransServiceImpl extends BaseService<StudentActionTran
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long transId) {
|
||||
// 这里先删除主数据
|
||||
return this.removeById(transId);
|
||||
return studentActionTransMapper.deleteById(transId) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
@@ -16,7 +18,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -84,9 +85,9 @@ public class StudentClassServiceImpl extends BaseService<StudentClass, Long> imp
|
||||
public boolean update(StudentClass studentClass, StudentClass originalStudentClass) {
|
||||
studentClass.setCreateUserId(originalStudentClass.getCreateUserId());
|
||||
studentClass.setCreateTime(originalStudentClass.getCreateTime());
|
||||
studentClass.setStatus(GlobalDeletedFlag.NORMAL);
|
||||
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
|
||||
return studentClassMapper.updateByPrimaryKey(studentClass) == 1;
|
||||
UpdateWrapper<StudentClass> uw = this.createUpdateQueryForNullValue(studentClass, studentClass.getClassId());
|
||||
return studentClassMapper.update(studentClass, uw) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,17 +99,16 @@ public class StudentClassServiceImpl extends BaseService<StudentClass, Long> imp
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long classId) {
|
||||
// 这里先删除主数据
|
||||
if (!this.removeById(classId)) {
|
||||
if (studentClassMapper.deleteById(classId) == 0) {
|
||||
return false;
|
||||
}
|
||||
// 开始删除多对多子表的关联
|
||||
ClassCourse classCourse = new ClassCourse();
|
||||
classCourse.setClassId(classId);
|
||||
classCourseMapper.delete(classCourse);
|
||||
classCourseMapper.delete(new QueryWrapper<>(classCourse));
|
||||
ClassStudent classStudent = new ClassStudent();
|
||||
classStudent.setClassId(classId);
|
||||
classStudentMapper.delete(classStudent);
|
||||
classStudentMapper.delete(new QueryWrapper<>(classStudent));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -156,8 +156,8 @@ public class StudentClassServiceImpl extends BaseService<StudentClass, Long> imp
|
||||
for (ClassCourse classCourse : classCourseList) {
|
||||
classCourse.setClassId(classId);
|
||||
MyModelUtil.setDefaultValue(classCourse, "courseOrder", 0);
|
||||
classCourseMapper.insert(classCourse);
|
||||
}
|
||||
classCourseMapper.insertList(classCourseList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,11 +169,13 @@ public class StudentClassServiceImpl extends BaseService<StudentClass, Long> imp
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean updateClassCourse(ClassCourse classCourse) {
|
||||
Example e = new Example(ClassCourse.class);
|
||||
e.createCriteria()
|
||||
.andEqualTo("classId", classCourse.getClassId())
|
||||
.andEqualTo("courseId", classCourse.getCourseId());
|
||||
return classCourseMapper.updateByExample(classCourse, e) > 0;
|
||||
ClassCourse filter = new ClassCourse();
|
||||
filter.setClassId(classCourse.getClassId());
|
||||
filter.setCourseId(classCourse.getCourseId());
|
||||
UpdateWrapper<ClassCourse> uw =
|
||||
BaseService.createUpdateQueryForNullValue(classCourse, ClassCourse.class);
|
||||
uw.setEntity(filter);
|
||||
return classCourseMapper.update(classCourse, uw) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,11 +187,10 @@ public class StudentClassServiceImpl extends BaseService<StudentClass, Long> imp
|
||||
*/
|
||||
@Override
|
||||
public ClassCourse getClassCourse(Long classId, Long courseId) {
|
||||
Example e = new Example(ClassCourse.class);
|
||||
e.createCriteria()
|
||||
.andEqualTo("classId", classId)
|
||||
.andEqualTo("courseId", courseId);
|
||||
return classCourseMapper.selectOneByExample(e);
|
||||
ClassCourse filter = new ClassCourse();
|
||||
filter.setClassId(classId);
|
||||
filter.setCourseId(courseId);
|
||||
return classCourseMapper.selectOne(new QueryWrapper<>(filter));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,7 +206,7 @@ public class StudentClassServiceImpl extends BaseService<StudentClass, Long> imp
|
||||
ClassCourse filter = new ClassCourse();
|
||||
filter.setClassId(classId);
|
||||
filter.setCourseId(courseId);
|
||||
return classCourseMapper.delete(filter) > 0;
|
||||
return classCourseMapper.delete(new QueryWrapper<>(filter)) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,8 +220,8 @@ public class StudentClassServiceImpl extends BaseService<StudentClass, Long> imp
|
||||
public void addClassStudentList(List<ClassStudent> classStudentList, Long classId) {
|
||||
for (ClassStudent classStudent : classStudentList) {
|
||||
classStudent.setClassId(classId);
|
||||
classStudentMapper.insert(classStudent);
|
||||
}
|
||||
classStudentMapper.insertList(classStudentList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,7 +237,7 @@ public class StudentClassServiceImpl extends BaseService<StudentClass, Long> imp
|
||||
ClassStudent filter = new ClassStudent();
|
||||
filter.setClassId(classId);
|
||||
filter.setStudentId(studentId);
|
||||
return classStudentMapper.delete(filter) > 0;
|
||||
return classStudentMapper.delete(new QueryWrapper<>(filter)) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orange.demo.application.common.constant.StudentStatus;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
@@ -81,7 +83,8 @@ public class StudentServiceImpl extends BaseService<Student, Long> implements St
|
||||
public boolean update(Student student, Student originalStudent) {
|
||||
student.setRegisterTime(originalStudent.getRegisterTime());
|
||||
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
|
||||
return studentMapper.updateByPrimaryKey(student) == 1;
|
||||
UpdateWrapper<Student> uw = this.createUpdateQueryForNullValue(student, student.getStudentId());
|
||||
return studentMapper.update(student, uw) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,14 +96,13 @@ public class StudentServiceImpl extends BaseService<Student, Long> implements St
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long studentId) {
|
||||
// 这里先删除主数据
|
||||
if (!this.removeById(studentId)) {
|
||||
if (studentMapper.deleteById(studentId) == 0) {
|
||||
return false;
|
||||
}
|
||||
// 开始删除多对多父表的关联
|
||||
ClassStudent classStudent = new ClassStudent();
|
||||
classStudent.setStudentId(studentId);
|
||||
classStudentMapper.delete(classStudent);
|
||||
classStudentMapper.delete(new QueryWrapper<>(classStudent));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -8,26 +10,31 @@ import lombok.Data;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("行政区划实体对象")
|
||||
@Data
|
||||
public class AreaCodeVo {
|
||||
|
||||
/**
|
||||
* 行政区划主键Id
|
||||
*/
|
||||
@ApiModelProperty(value = "行政区划主键Id", required = true)
|
||||
private Long areaId;
|
||||
|
||||
/**
|
||||
* 行政区划名称
|
||||
*/
|
||||
@ApiModelProperty(value = "行政区划名称")
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 行政区划级别 (1: 省级别 2: 市级别 3: 区级别)
|
||||
*/
|
||||
@ApiModelProperty(value = "行政区划级别")
|
||||
private Integer areaLevel;
|
||||
|
||||
/**
|
||||
* 父级行政区划Id
|
||||
*/
|
||||
@ApiModelProperty(value = "父级行政区划Id")
|
||||
private Long parentId;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -8,21 +10,25 @@ import lombok.Data;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("ClassCourseVO实体对象")
|
||||
@Data
|
||||
public class ClassCourseVo {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级Id")
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 课程Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程Id")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程顺序(数值越小越靠前)。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程顺序(数值越小越靠前)")
|
||||
private Integer courseOrder;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -8,16 +10,19 @@ import lombok.Data;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("ClassStudentVO实体对象")
|
||||
@Data
|
||||
public class ClassStudentVo {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级Id")
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生Id")
|
||||
private Long studentId;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -11,66 +13,79 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("CourseTransStatsVO实体对象")
|
||||
@Data
|
||||
public class CourseTransStatsVo {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id")
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 统计日期。
|
||||
*/
|
||||
@ApiModelProperty(value = "统计日期")
|
||||
private Date statsDate;
|
||||
|
||||
/**
|
||||
* 科目Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "科目Id")
|
||||
private Integer subjectId;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级Id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 年级名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级名称")
|
||||
private String gradeName;
|
||||
|
||||
/**
|
||||
* 课程Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程Id")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程名称")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 学生上课次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生上课次数")
|
||||
private Integer studentAttendCount;
|
||||
|
||||
/**
|
||||
* 学生献花数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生献花数量")
|
||||
private Integer studentFlowerAmount;
|
||||
|
||||
/**
|
||||
* 学生献花次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生献花次数")
|
||||
private Integer studentFlowerCount;
|
||||
|
||||
/**
|
||||
* gradeId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "gradeId 字典关联数据")
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
/**
|
||||
* subjectId 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "subjectId 常量字典关联数据")
|
||||
private Map<String, Object> subjectIdDictMap;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -12,86 +14,103 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("CourseVO实体对象")
|
||||
@Data
|
||||
public class CourseVo {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程名称")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 课程价格。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程价格")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 课程描述。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 课程难度(0: 容易 1: 普通 2: 很难)。
|
||||
*/
|
||||
@ApiModelProperty(value = "课程难度(0: 容易 1: 普通 2: 很难)")
|
||||
private Integer difficulty;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级Id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 学科Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学科Id")
|
||||
private Integer subjectId;
|
||||
|
||||
/**
|
||||
* 课时数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "课时数量")
|
||||
private Integer classHour;
|
||||
|
||||
/**
|
||||
* 多张课程图片地址。
|
||||
*/
|
||||
@ApiModelProperty(value = "多张课程图片地址")
|
||||
private String pictureUrl;
|
||||
|
||||
/**
|
||||
* 创建用户Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建用户Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 最后修改时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "最后修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* courseId 的多对多关联表数据对象,数据对应类型为ClassCourseVo。
|
||||
*/
|
||||
@ApiModelProperty(value = "courseId 的多对多关联表数据对象,数据对应类型为ClassCourseVo")
|
||||
private Map<String, Object> classCourse;
|
||||
|
||||
/**
|
||||
* gradeId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "gradeId 字典关联数据")
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
/**
|
||||
* difficulty 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "difficulty 常量字典关联数据")
|
||||
private Map<String, Object> difficultyDictMap;
|
||||
|
||||
/**
|
||||
* subjectId 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "subjectId 常量字典关联数据")
|
||||
private Map<String, Object> subjectIdDictMap;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -8,16 +10,19 @@ import lombok.Data;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("GradeVO实体对象")
|
||||
@Data
|
||||
public class GradeVo {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 年级名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级名称")
|
||||
private String gradeName;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -10,36 +12,43 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("SchoolInfoVO实体对象")
|
||||
@Data
|
||||
public class SchoolInfoVo {
|
||||
|
||||
/**
|
||||
* 学校Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学校Id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学校名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "学校名称")
|
||||
private String schoolName;
|
||||
|
||||
/**
|
||||
* 所在省Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "所在省Id")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 所在城市Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "所在城市Id")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* provinceId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "provinceId 字典关联数据")
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
/**
|
||||
* cityId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "cityId 字典关联数据")
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -11,126 +13,151 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("StudentActionStatsVO实体对象")
|
||||
@Data
|
||||
public class StudentActionStatsVo {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id")
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 统计日期。
|
||||
*/
|
||||
@ApiModelProperty(value = "统计日期")
|
||||
private Date statsDate;
|
||||
|
||||
/**
|
||||
* 统计小时。
|
||||
*/
|
||||
@ApiModelProperty(value = "统计小时")
|
||||
private Date statsMonth;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级Id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 学生所在省Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生所在省Id")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 学生所在城市Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生所在城市Id")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* 购课学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购课学币数量")
|
||||
private Integer buyCourseAmount;
|
||||
|
||||
/**
|
||||
* 购买课程次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买课程次数")
|
||||
private Integer buyCourseCount;
|
||||
|
||||
/**
|
||||
* 购买视频学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买视频学币数量")
|
||||
private Integer buyVideoAmount;
|
||||
|
||||
/**
|
||||
* 购买视频次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买视频次数")
|
||||
private Integer buyVideoCount;
|
||||
|
||||
/**
|
||||
* 购买作业学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买作业学币数量")
|
||||
private Integer buyPaperAmount;
|
||||
|
||||
/**
|
||||
* 购买作业次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买作业次数")
|
||||
private Integer buyPaperCount;
|
||||
|
||||
/**
|
||||
* 购买献花数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买献花数量")
|
||||
private Integer buyFlowerAmount;
|
||||
|
||||
/**
|
||||
* 购买献花次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买献花次数")
|
||||
private Integer buyFlowerCount;
|
||||
|
||||
/**
|
||||
* 充值学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "充值学币数量")
|
||||
private Integer rechargeCoinAmount;
|
||||
|
||||
/**
|
||||
* 充值学币次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "充值学币次数")
|
||||
private Integer rechargeCoinCount;
|
||||
|
||||
/**
|
||||
* 线下课程上课次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "线下课程上课次数")
|
||||
private Integer doCourseCount;
|
||||
|
||||
/**
|
||||
* 观看视频次数。
|
||||
*/
|
||||
@ApiModelProperty(value = "观看视频次数")
|
||||
private Integer watchVideoCount;
|
||||
|
||||
/**
|
||||
* 购买献花消费学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买献花消费学币数量")
|
||||
private Integer watchVideoTotalSecond;
|
||||
|
||||
/**
|
||||
* 做题数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "做题数量")
|
||||
private Integer doExerciseCount;
|
||||
|
||||
/**
|
||||
* 做题正确的数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "做题正确的数量")
|
||||
private Integer doExerciseCorrectCount;
|
||||
|
||||
/**
|
||||
* gradeId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "gradeId 字典关联数据")
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
/**
|
||||
* provinceId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "provinceId 字典关联数据")
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
/**
|
||||
* cityId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "cityId 字典关联数据")
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -11,101 +13,121 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("StudentActionTransVO实体对象")
|
||||
@Data
|
||||
public class StudentActionTransVo {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id")
|
||||
private Long transId;
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生Id")
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 学生名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生名称")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 学生校区。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生校区")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级Id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)。
|
||||
*/
|
||||
@ApiModelProperty(value = "行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)")
|
||||
private Integer actionType;
|
||||
|
||||
/**
|
||||
* 设备类型(0: iOS 1: Android 2: PC)。
|
||||
*/
|
||||
@ApiModelProperty(value = "设备类型(0: iOS 1: Android 2: PC)")
|
||||
private Integer deviceType;
|
||||
|
||||
/**
|
||||
* 看视频秒数。
|
||||
*/
|
||||
@ApiModelProperty(value = "看视频秒数")
|
||||
private Integer watchVideoSeconds;
|
||||
|
||||
/**
|
||||
* 购买献花数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买献花数量")
|
||||
private Integer flowerCount;
|
||||
|
||||
/**
|
||||
* 购买作业数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买作业数量")
|
||||
private Integer paperCount;
|
||||
|
||||
/**
|
||||
* 购买视频数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买视频数量")
|
||||
private Integer videoCount;
|
||||
|
||||
/**
|
||||
* 购买课程数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "购买课程数量")
|
||||
private Integer courseCount;
|
||||
|
||||
/**
|
||||
* 充值学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "充值学币数量")
|
||||
private Integer coinCount;
|
||||
|
||||
/**
|
||||
* 做题是否正确标记。
|
||||
*/
|
||||
@ApiModelProperty(value = "做题是否正确标记")
|
||||
private Integer exerciseCorrectFlag;
|
||||
|
||||
/**
|
||||
* 发生时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "发生时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* schoolId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "schoolId 字典关联数据")
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
/**
|
||||
* gradeId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "gradeId 字典关联数据")
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
/**
|
||||
* actionType 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "actionType 常量字典关联数据")
|
||||
private Map<String, Object> actionTypeDictMap;
|
||||
|
||||
/**
|
||||
* deviceType 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "deviceType 常量字典关联数据")
|
||||
private Map<String, Object> deviceTypeDictMap;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -11,61 +13,73 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("StudentClassVO实体对象")
|
||||
@Data
|
||||
public class StudentClassVo {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级Id")
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 班级名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级名称")
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 学校Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学校Id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学生班长Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生班长Id")
|
||||
private Long leaderId;
|
||||
|
||||
/**
|
||||
* 已完成课时数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "已完成课时数量")
|
||||
private Integer finishClassHour;
|
||||
|
||||
/**
|
||||
* 班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)")
|
||||
private Integer classLevel;
|
||||
|
||||
/**
|
||||
* 创建用户。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建用户")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 班级创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "班级创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* schoolId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "schoolId 字典关联数据")
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
/**
|
||||
* leaderId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "leaderId 字典关联数据")
|
||||
private Map<String, Object> leaderIdDictMap;
|
||||
|
||||
/**
|
||||
* classLevel 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "classLevel 常量字典关联数据")
|
||||
private Map<String, Object> classLevelDictMap;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -11,121 +13,145 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("StudentVO实体对象")
|
||||
@Data
|
||||
public class StudentVo {
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生Id")
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 登录手机。
|
||||
*/
|
||||
@ApiModelProperty(value = "登录手机")
|
||||
private String loginMobile;
|
||||
|
||||
/**
|
||||
* 学生姓名。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生姓名")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 所在省份Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "所在省份Id")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 所在城市Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "所在城市Id")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* 区县Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "区县Id")
|
||||
private Long districtId;
|
||||
|
||||
/**
|
||||
* 学生性别 (0: 女生 1: 男生)。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生性别 (0: 女生 1: 男生)")
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 生日。
|
||||
*/
|
||||
@ApiModelProperty(value = "生日")
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)。
|
||||
*/
|
||||
@ApiModelProperty(value = "经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)")
|
||||
private Integer experienceLevel;
|
||||
|
||||
/**
|
||||
* 总共充值学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "总共充值学币数量")
|
||||
private Integer totalCoin;
|
||||
|
||||
/**
|
||||
* 可用学币数量。
|
||||
*/
|
||||
@ApiModelProperty(value = "可用学币数量")
|
||||
private Integer leftCoin;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级Id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 校区Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "校区Id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 注册时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private Date registerTime;
|
||||
|
||||
/**
|
||||
* 学生状态 (0: 正常 1: 锁定 2: 注销)。
|
||||
*/
|
||||
@ApiModelProperty(value = "学生状态 (0: 正常 1: 锁定 2: 注销)")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* provinceId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "provinceId 字典关联数据")
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
/**
|
||||
* cityId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "cityId 字典关联数据")
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
|
||||
/**
|
||||
* districtId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "districtId 字典关联数据")
|
||||
private Map<String, Object> districtIdDictMap;
|
||||
|
||||
/**
|
||||
* gradeId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "gradeId 字典关联数据")
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
/**
|
||||
* schoolId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "schoolId 字典关联数据")
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
/**
|
||||
* gender 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "gender 常量字典关联数据")
|
||||
private Map<String, Object> genderDictMap;
|
||||
|
||||
/**
|
||||
* experienceLevel 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "experienceLevel 常量字典关联数据")
|
||||
private Map<String, Object> experienceLevelDictMap;
|
||||
|
||||
/**
|
||||
* status 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "status 常量字典关联数据")
|
||||
private Map<String, Object> statusDictMap;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import tk.mybatis.spring.annotation.MapperScan;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ package com.orange.demo.webadmin.upms.controller;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
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 com.orange.demo.webadmin.config.ApplicationConfig;
|
||||
import com.orange.demo.webadmin.upms.service.*;
|
||||
@@ -34,6 +38,8 @@ import java.util.concurrent.TimeUnit;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiSupport(order = 1)
|
||||
@Api(tags = "用户登录接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/upms/login")
|
||||
@@ -63,6 +69,12 @@ public class LoginController {
|
||||
* @param password 密码。
|
||||
* @return 应答结果对象,其中包括JWT的Token数据,以及菜单列表。
|
||||
*/
|
||||
@ApiImplicitParams({
|
||||
// 这里包含密码密文,仅用于方便开发期间的接口测试,集成测试和发布阶段,需要将当前注解去掉。
|
||||
// 如果您重新生成了公钥和私钥,请替换password的缺省值。
|
||||
@ApiImplicitParam(name = "loginName", defaultValue = "admin"),
|
||||
@ApiImplicitParam(name = "password", defaultValue = "IP3ccke3GhH45iGHB5qP9p7iZw6xUyj28Ju10rnBiPKOI35sc%2BjI7%2FdsjOkHWMfUwGYGfz8ik31HC2Ruk%2Fhkd9f6RPULTHj7VpFdNdde2P9M4mQQnFBAiPM7VT9iW3RyCtPlJexQ3nAiA09OqG%2F0sIf1kcyveSrulxembARDbDo%3D")
|
||||
})
|
||||
@NoAuthInterface
|
||||
@PostMapping("/doLogin")
|
||||
public ResponseResult<JSONObject> doLogin(
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
import com.orange.demo.common.core.object.*;
|
||||
import com.orange.demo.common.core.util.RedisKeyUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RBucket;
|
||||
import org.redisson.api.RedissonClient;
|
||||
@@ -22,6 +23,7 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "在线用户接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/upms/loginUser")
|
||||
@@ -40,7 +42,6 @@ public class LoginUserController {
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<LoginUserInfo>> list(
|
||||
@MyRequestBody String loginName, @MyRequestBody MyPageParam pageParam) {
|
||||
List<LoginUserInfo> loginUserInfoList = new LinkedList<>();
|
||||
int queryCount = pageParam.getPageNum() * pageParam.getPageSize();
|
||||
int skipCount = (pageParam.getPageNum() - 1) * pageParam.getPageSize();
|
||||
String patternKey;
|
||||
@@ -49,17 +50,15 @@ public class LoginUserController {
|
||||
} else {
|
||||
patternKey = RedisKeyUtil.getSessionIdPrefix(loginName) + "*";
|
||||
}
|
||||
long totalCount = 0L;
|
||||
int pos = 0;
|
||||
List<LoginUserInfo> loginUserInfoList = new LinkedList<>();
|
||||
Iterable<String> keys = redissonClient.getKeys().getKeysByPattern(patternKey);
|
||||
for (String key : keys) {
|
||||
totalCount++;
|
||||
if (pos++ < skipCount) {
|
||||
continue;
|
||||
}
|
||||
loginUserInfoList.add(this.buildTokenDataByRedisKey(key));
|
||||
}
|
||||
return ResponseResult.success(new MyPageData<>(loginUserInfoList, totalCount));
|
||||
loginUserInfoList.sort((o1, o2) -> (int) (o2.getLoginTime().getTime() - o1.getLoginTime().getTime()));
|
||||
int toIndex = Math.min(skipCount + pageParam.getPageSize(), loginUserInfoList.size());
|
||||
List<LoginUserInfo> resultList = loginUserInfoList.subList(skipCount, toIndex);
|
||||
return ResponseResult.success(new MyPageData<>(resultList, (long) loginUserInfoList.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.orange.demo.webadmin.upms.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orange.demo.webadmin.upms.dto.SysMenuDto;
|
||||
import com.orange.demo.webadmin.upms.vo.SysMenuVo;
|
||||
@@ -24,6 +26,7 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "菜单管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/upms/sysMenu")
|
||||
@@ -40,6 +43,7 @@ public class SysMenuController {
|
||||
* @return 应答结果对象,包含新增菜单的主键Id。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@ApiOperationSupport(ignoreParameters = {"sysMenuDto.menuId"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(
|
||||
@MyRequestBody SysMenuDto sysMenuDto, @MyRequestBody String permCodeIdListString) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.controller;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orange.demo.webadmin.upms.dto.SysPermCodeDto;
|
||||
import com.orange.demo.webadmin.upms.vo.SysPermCodeVo;
|
||||
@@ -23,6 +25,7 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "权限字管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/upms/sysPermCode")
|
||||
@@ -39,6 +42,7 @@ public class SysPermCodeController {
|
||||
* @return 应答结果对象,包含新增权限字的主键Id。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@ApiOperationSupport(ignoreParameters = {"sysPermCodeDto.permCodeId"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(
|
||||
@MyRequestBody SysPermCodeDto sysPermCodeDto, @MyRequestBody String permIdListString) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.controller;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -25,6 +27,7 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "权限资源管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/upms/sysPerm")
|
||||
@@ -39,6 +42,7 @@ public class SysPermController {
|
||||
* @param sysPermDto 新增权限资源对象。
|
||||
* @return 应答结果对象,包含新增权限资源的主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"sysPermDto.permId"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody SysPermDto sysPermDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermDto);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.controller;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orange.demo.webadmin.upms.dto.SysPermModuleDto;
|
||||
import com.orange.demo.webadmin.upms.vo.SysPermModuleVo;
|
||||
@@ -27,6 +29,7 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "权限资源模块管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/upms/sysPermModule")
|
||||
@@ -41,6 +44,7 @@ public class SysPermModuleController {
|
||||
* @param sysPermModuleDto 新增权限资源模块对象。
|
||||
* @return 应答结果对象,包含新增权限资源模块的主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"sysPermModuleDto.moduleId"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody SysPermModuleDto sysPermModuleDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermModuleDto);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.controller;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -30,6 +32,7 @@ import java.util.stream.Collectors;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "角色管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/upms/sysRole")
|
||||
@@ -48,6 +51,7 @@ public class SysRoleController {
|
||||
* @return 应答结果对象,包含新增角色的主键Id。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@ApiOperationSupport(ignoreParameters = {"sysRoleDto.roleId", "sysRoleDto.createTimeStart", "sysRoleDto.createTimeEnd"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(
|
||||
@MyRequestBody SysRoleDto sysRoleDto, @MyRequestBody String menuIdListString) {
|
||||
@@ -76,6 +80,7 @@ public class SysRoleController {
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@ApiOperationSupport(ignoreParameters = {"sysRoleDto.createTimeStart", "sysRoleDto.createTimeEnd"})
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(
|
||||
@MyRequestBody SysRoleDto sysRoleDto, @MyRequestBody String menuIdListString) {
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
import com.orange.demo.common.core.validator.AddGroup;
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import com.orange.demo.webadmin.config.ApplicationConfig;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -26,6 +28,7 @@ import javax.validation.groups.Default;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "用户管理管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/upms/sysUser")
|
||||
@@ -46,6 +49,10 @@ public class SysUserController {
|
||||
* @return 应答结果对象,包含新增用户的主键Id。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"sysUserDto.userId",
|
||||
"sysUserDto.createTimeStart",
|
||||
"sysUserDto.createTimeEnd"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(
|
||||
@MyRequestBody SysUserDto sysUserDto, @MyRequestBody String roleIdListString) {
|
||||
@@ -71,6 +78,9 @@ public class SysUserController {
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"sysUserDto.createTimeStart",
|
||||
"sysUserDto.createTimeEnd"})
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(
|
||||
@MyRequestBody SysUserDto sysUserDto, @MyRequestBody String roleIdListString) {
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.orange.demo.webadmin.upms.dto;
|
||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import com.orange.demo.webadmin.upms.model.constant.SysMenuType;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
@@ -14,29 +16,34 @@ import javax.validation.constraints.NotNull;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("菜单Dto")
|
||||
@Data
|
||||
public class SysMenuDto {
|
||||
|
||||
/**
|
||||
* 菜单Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单Id", required = true)
|
||||
@NotNull(message = "菜单Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 父菜单Id,目录菜单的父菜单为null
|
||||
*/
|
||||
@ApiModelProperty(value = "父菜单Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 菜单显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示名称", required = true)
|
||||
@NotBlank(message = "菜单显示名称不能为空!")
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 菜单类型 (0: 目录 1: 菜单 2: 按钮 3: UI片段)。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单类型", required = true)
|
||||
@NotNull(message = "菜单类型不能为空!")
|
||||
@ConstDictRef(constDictClass = SysMenuType.class, message = "数据验证失败,菜单类型为无效值!")
|
||||
private Integer menuType;
|
||||
@@ -44,21 +51,25 @@ public class SysMenuDto {
|
||||
/**
|
||||
* 前端表单路由名称,仅用于menu_type为1的菜单类型。
|
||||
*/
|
||||
@ApiModelProperty(value = "前端表单路由名称")
|
||||
private String formRouterName;
|
||||
|
||||
/**
|
||||
* 在线表单主键Id,仅用于在线表单绑定的菜单。
|
||||
*/
|
||||
@ApiModelProperty(value = "在线表单主键Id")
|
||||
private Long onlineFormId;
|
||||
|
||||
/**
|
||||
* 菜单显示顺序 (值越小,排序越靠前)。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示顺序", required = true)
|
||||
@NotNull(message = "菜单显示顺序不能为空!")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 菜单图标。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示顺序")
|
||||
private String icon;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.orange.demo.webadmin.upms.dto;
|
||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import com.orange.demo.webadmin.upms.model.constant.SysPermCodeType;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
@@ -14,29 +16,34 @@ import javax.validation.constraints.NotNull;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("权限字Dto")
|
||||
@Data
|
||||
public class SysPermCodeDto {
|
||||
|
||||
/**
|
||||
* 权限字Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字Id", required = true)
|
||||
@NotNull(message = "权限字Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long permCodeId;
|
||||
|
||||
/**
|
||||
* 权限字标识(一般为有含义的英文字符串)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字标识", required = true)
|
||||
@NotBlank(message = "权限字编码不能为空!")
|
||||
private String permCode;
|
||||
|
||||
/**
|
||||
* 上级权限字Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "上级权限字Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限字类型(0: 表单 1: UI片段 2: 操作)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字类型", required = true)
|
||||
@NotNull(message = "权限字类型不能为空!")
|
||||
@ConstDictRef(constDictClass = SysPermCodeType.class, message = "数据验证失败,权限类型为无效值!")
|
||||
private Integer permCodeType;
|
||||
@@ -44,12 +51,14 @@ public class SysPermCodeDto {
|
||||
/**
|
||||
* 显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示名称", required = true)
|
||||
@NotBlank(message = "权限字显示名称不能为空!")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 显示顺序(数值越小,越靠前)。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序", required = true)
|
||||
@NotNull(message = "权限字显示顺序不能为空!")
|
||||
private Integer showOrder;
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.orange.demo.webadmin.upms.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
@@ -12,41 +14,48 @@ import javax.validation.constraints.NotNull;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("权限资源Dto")
|
||||
@Data
|
||||
public class SysPermDto {
|
||||
|
||||
/**
|
||||
* 权限资源Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限资源Id", required = true)
|
||||
@NotNull(message = "权限Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long permId;
|
||||
|
||||
/**
|
||||
* 权限资源名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限资源名称", required = true)
|
||||
@NotBlank(message = "权限资源名称不能为空!")
|
||||
private String permName;
|
||||
|
||||
/**
|
||||
* shiro格式的权限字,如(upms:sysUser:add)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字")
|
||||
private String permCode;
|
||||
|
||||
/**
|
||||
* 权限所在的权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限所在的权限模块Id")
|
||||
@NotNull(message = "权限模块Id不能为空!")
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 关联的URL。
|
||||
*/
|
||||
@ApiModelProperty(value = "关联的URL", required = true)
|
||||
@NotBlank(message = "权限关联的url不能为空!")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 权限在当前模块下的顺序,由小到大。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序", required = true)
|
||||
@NotNull(message = "权限显示顺序不能为空!")
|
||||
private Integer showOrder;
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.orange.demo.webadmin.upms.dto;
|
||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import com.orange.demo.webadmin.upms.model.constant.SysPermModuleType;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
@@ -14,29 +16,34 @@ import javax.validation.constraints.NotNull;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("权限资源模块Dto")
|
||||
@Data
|
||||
public class SysPermModuleDto {
|
||||
|
||||
/**
|
||||
* 权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块Id", required = true)
|
||||
@NotNull(message = "权限模块Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 权限模块名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块名称", required = true)
|
||||
@NotBlank(message = "权限模块名称不能为空!")
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 上级权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "上级权限模块Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限模块类型(0: 普通模块 1: Controller模块)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块类型", required = true)
|
||||
@NotNull(message = "模块类型不能为空!")
|
||||
@ConstDictRef(constDictClass = SysPermModuleType.class, message = "数据验证失败,权限模块类型为无效值!")
|
||||
private Integer moduleType;
|
||||
@@ -44,6 +51,7 @@ public class SysPermModuleDto {
|
||||
/**
|
||||
* 权限模块在当前层级下的顺序,由小到大。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序", required = true)
|
||||
@NotNull(message = "权限模块显示顺序不能为空!")
|
||||
private Integer showOrder;
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.orange.demo.webadmin.upms.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -11,18 +13,21 @@ import javax.validation.constraints.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("角色Dto")
|
||||
@Data
|
||||
public class SysRoleDto {
|
||||
|
||||
/**
|
||||
* 角色Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "角色Id", required = true)
|
||||
@NotNull(message = "角色Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "角色名称", required = true)
|
||||
@NotBlank(message = "角色名称不能为空!")
|
||||
private String roleName;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
import com.orange.demo.webadmin.upms.model.constant.SysUserType;
|
||||
import com.orange.demo.webadmin.upms.model.constant.SysUserStatus;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
@@ -16,36 +18,42 @@ import javax.validation.constraints.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("SysUserDto对象")
|
||||
@Data
|
||||
public class SysUserDto {
|
||||
|
||||
/**
|
||||
* 用户Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户Id", required = true)
|
||||
@NotNull(message = "数据验证失败,用户Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 登录用户名。
|
||||
*/
|
||||
@ApiModelProperty(value = "登录用户名", required = true)
|
||||
@NotBlank(message = "数据验证失败,登录用户名不能为空!")
|
||||
private String loginName;
|
||||
|
||||
/**
|
||||
* 用户密码。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户密码", required = true)
|
||||
@NotBlank(message = "数据验证失败,用户密码不能为空!", groups = {AddGroup.class})
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 用户显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户显示名称", required = true)
|
||||
@NotBlank(message = "数据验证失败,用户显示名称不能为空!")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)", required = true)
|
||||
@NotNull(message = "数据验证失败,用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)不能为空!")
|
||||
@ConstDictRef(constDictClass = SysUserType.class, message = "数据验证失败,用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)为无效值!")
|
||||
private Integer userType;
|
||||
@@ -53,11 +61,13 @@ public class SysUserDto {
|
||||
/**
|
||||
* 用户头像的Url。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户头像的Url")
|
||||
private String headImageUrl;
|
||||
|
||||
/**
|
||||
* 用户状态(0: 正常 1: 锁定)。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户状态(0: 正常 1: 锁定)", required = true)
|
||||
@NotNull(message = "数据验证失败,用户状态(0: 正常 1: 锁定)不能为空!")
|
||||
@ConstDictRef(constDictClass = SysUserStatus.class, message = "数据验证失败,用户状态(0: 正常 1: 锁定)为无效值!")
|
||||
private Integer userStatus;
|
||||
@@ -65,10 +75,12 @@ public class SysUserDto {
|
||||
/**
|
||||
* createTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "createTime 范围过滤起始值(>=)")
|
||||
private String createTimeStart;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "createTime 范围过滤结束值(<=)")
|
||||
private String createTimeEnd;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.common.core.annotation.RelationManyToMany;
|
||||
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orange.demo.webadmin.upms.vo.SysMenuVo;
|
||||
@@ -9,7 +9,6 @@ import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -19,56 +18,55 @@ import java.util.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_menu")
|
||||
@TableName(value = "zz_sys_menu")
|
||||
public class SysMenu {
|
||||
|
||||
/**
|
||||
* 菜单Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "menu_id")
|
||||
@TableId(value = "menu_id")
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 父菜单Id,目录菜单的父菜单为null。
|
||||
*/
|
||||
@Column(name = "parent_id")
|
||||
@TableField(value = "parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 菜单显示名称。
|
||||
*/
|
||||
@Column(name = "menu_name")
|
||||
@TableField(value = "menu_name")
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 菜单类型(0: 目录 1: 菜单 2: 按钮 3: UI片段)。
|
||||
*/
|
||||
@Column(name = "menu_type")
|
||||
@TableField(value = "menu_type")
|
||||
private Integer menuType;
|
||||
|
||||
/**
|
||||
* 前端表单路由名称,仅用于menu_type为1的菜单类型。
|
||||
*/
|
||||
@Column(name = "form_router_name")
|
||||
@TableField(value = "form_router_name")
|
||||
private String formRouterName;
|
||||
|
||||
/**
|
||||
* 在线表单主键Id,仅用于在线表单绑定的菜单。
|
||||
*/
|
||||
@Column(name = "online_form_id")
|
||||
@TableField(value = "online_form_id")
|
||||
private Long onlineFormId;
|
||||
|
||||
/**
|
||||
* 在线表单菜单的权限控制类型,具体值可参考SysOnlineMenuPermType常量对象。
|
||||
*/
|
||||
@Column(name = "online_menu_perm_type")
|
||||
@TableField(value = "online_menu_perm_type")
|
||||
private Integer onlineMenuPermType;
|
||||
|
||||
/**
|
||||
* 菜单显示顺序 (值越小,排序越靠前)。
|
||||
*/
|
||||
@Column(name = "show_order")
|
||||
@TableField(value = "show_order")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
@@ -79,39 +77,39 @@ public class SysMenu {
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@Column(name = "update_user_id")
|
||||
@TableField(value = "update_user_id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@DeletedFlagColumn
|
||||
@Column(name = "deleted_flag")
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@RelationManyToMany(
|
||||
relationMapperName = "sysMenuPermCodeMapper",
|
||||
relationMasterIdField = "menuId",
|
||||
relationModelClass = SysMenuPermCode.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private List<SysMenuPermCode> sysMenuPermCodeList;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 菜单与权限字关联实体对象。
|
||||
*
|
||||
@@ -11,20 +10,18 @@ import javax.persistence.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_menu_perm_code")
|
||||
@TableName(value = "zz_sys_menu_perm_code")
|
||||
public class SysMenuPermCode {
|
||||
|
||||
/**
|
||||
* 关联菜单Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "menu_id")
|
||||
@TableField(value = "menu_id")
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 关联权限字Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "perm_code_id")
|
||||
@TableField(value = "perm_code_id")
|
||||
private Long permCodeId;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.common.core.annotation.RelationDict;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -14,26 +13,25 @@ import java.util.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_perm")
|
||||
@TableName(value = "zz_sys_perm")
|
||||
public class SysPerm {
|
||||
|
||||
/**
|
||||
* 权限资源Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "perm_id")
|
||||
@TableId(value = "perm_id")
|
||||
private Long permId;
|
||||
|
||||
/**
|
||||
* 权限所在的权限模块Id。
|
||||
*/
|
||||
@Column(name = "module_id")
|
||||
@TableField(value = "module_id")
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 权限名称。
|
||||
*/
|
||||
@Column(name = "perm_name")
|
||||
@TableField(value = "perm_name")
|
||||
private String permName;
|
||||
|
||||
/**
|
||||
@@ -44,38 +42,38 @@ public class SysPerm {
|
||||
/**
|
||||
* 权限在当前模块下的顺序,由小到大。
|
||||
*/
|
||||
@Column(name = "show_order")
|
||||
@TableField(value = "show_order")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@Column(name = "update_user_id")
|
||||
@TableField(value = "update_user_id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@DeletedFlagColumn
|
||||
@Column(name = "deleted_flag")
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@RelationDict(
|
||||
@@ -84,6 +82,6 @@ public class SysPerm {
|
||||
slaveModelClass = SysPermModule.class,
|
||||
slaveIdField = "moduleId",
|
||||
slaveNameField = "moduleName")
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> moduleIdDictMap;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.common.core.annotation.RelationManyToMany;
|
||||
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orange.demo.webadmin.upms.vo.SysPermCodeVo;
|
||||
@@ -9,7 +9,6 @@ import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -19,82 +18,81 @@ import java.util.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_perm_code")
|
||||
@TableName(value = "zz_sys_perm_code")
|
||||
public class SysPermCode {
|
||||
|
||||
/**
|
||||
* 权限字Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "perm_code_id")
|
||||
@TableId(value = "perm_code_id")
|
||||
private Long permCodeId;
|
||||
|
||||
/**
|
||||
* 上级权限字Id。
|
||||
*/
|
||||
@Column(name = "parent_id")
|
||||
@TableField(value = "parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限字标识(一般为有含义的英文字符串)。
|
||||
*/
|
||||
@Column(name = "perm_code")
|
||||
@TableField(value = "perm_code")
|
||||
private String permCode;
|
||||
|
||||
/**
|
||||
* 权限类型(0: 表单 1: UI片段 2: 操作)。
|
||||
*/
|
||||
@Column(name = "perm_code_type")
|
||||
@TableField(value = "perm_code_type")
|
||||
private Integer permCodeType;
|
||||
|
||||
/**
|
||||
* 显示名称。
|
||||
*/
|
||||
@Column(name = "show_name")
|
||||
@TableField(value = "show_name")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 显示顺序(数值越小,越靠前)。
|
||||
*/
|
||||
@Column(name = "show_order")
|
||||
@TableField(value = "show_order")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@Column(name = "update_user_id")
|
||||
@TableField(value = "update_user_id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@DeletedFlagColumn
|
||||
@Column(name = "deleted_flag")
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@RelationManyToMany(
|
||||
relationMapperName = "sysPermCodePermMapper",
|
||||
relationMasterIdField = "permCodeId",
|
||||
relationModelClass = SysPermCodePerm.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private List<SysPermCodePerm> sysPermCodePermList;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 权限字与权限资源关联实体对象。
|
||||
*
|
||||
@@ -11,20 +10,18 @@ import javax.persistence.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_perm_code_perm")
|
||||
@TableName(value = "zz_sys_perm_code_perm")
|
||||
public class SysPermCodePerm {
|
||||
|
||||
/**
|
||||
* 权限字Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "perm_code_id")
|
||||
@TableField(value = "perm_code_id")
|
||||
private Long permCodeId;
|
||||
|
||||
/**
|
||||
* 权限Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "perm_id")
|
||||
@TableField(value = "perm_id")
|
||||
private Long permId;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -13,71 +12,70 @@ import java.util.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_perm_module")
|
||||
@TableName(value = "zz_sys_perm_module")
|
||||
public class SysPermModule {
|
||||
|
||||
/**
|
||||
* 权限模块Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "module_id")
|
||||
@TableId(value = "module_id")
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 上级权限模块Id。
|
||||
*/
|
||||
@Column(name = "parent_id")
|
||||
@TableField(value = "parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限模块名称。
|
||||
*/
|
||||
@Column(name = "module_name")
|
||||
@TableField(value = "module_name")
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 权限模块类型(0: 普通模块 1: Controller模块)。
|
||||
*/
|
||||
@Column(name = "module_type")
|
||||
@TableField(value = "module_type")
|
||||
private Integer moduleType;
|
||||
|
||||
/**
|
||||
* 权限模块在当前层级下的顺序,由小到大。
|
||||
*/
|
||||
@Column(name = "show_order")
|
||||
@TableField(value = "show_order")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@Column(name = "update_user_id")
|
||||
@TableField(value = "update_user_id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@DeletedFlagColumn
|
||||
@Column(name = "deleted_flag")
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private List<SysPerm> sysPermList;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 白名单实体对象。
|
||||
*
|
||||
@@ -11,25 +10,24 @@ import javax.persistence.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_perm_whitelist")
|
||||
@TableName(value = "zz_sys_perm_whitelist")
|
||||
public class SysPermWhitelist {
|
||||
|
||||
/**
|
||||
* 权限资源的URL。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "perm_url")
|
||||
@TableId(value = "perm_url")
|
||||
private String permUrl;
|
||||
|
||||
/**
|
||||
* 权限资源所属模块名字(通常是Controller的名字)。
|
||||
*/
|
||||
@Column(name = "module_name")
|
||||
@TableField(value = "module_name")
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 权限的名称。
|
||||
*/
|
||||
@Column(name = "perm_name")
|
||||
@TableField(value = "perm_name")
|
||||
private String permName;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.common.core.annotation.RelationManyToMany;
|
||||
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orange.demo.webadmin.upms.vo.SysRoleVo;
|
||||
@@ -9,7 +9,6 @@ import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -19,58 +18,57 @@ import java.util.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_role")
|
||||
@TableName(value = "zz_sys_role")
|
||||
public class SysRole {
|
||||
|
||||
/**
|
||||
* 角色Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "role_id")
|
||||
@TableId(value = "role_id")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色名称。
|
||||
*/
|
||||
@Column(name = "role_name")
|
||||
@TableField(value = "role_name")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@Column(name = "update_user_id")
|
||||
@TableField(value = "update_user_id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@DeletedFlagColumn
|
||||
@Column(name = "deleted_flag")
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@RelationManyToMany(
|
||||
relationMapperName = "sysRoleMenuMapper",
|
||||
relationMasterIdField = "roleId",
|
||||
relationModelClass = SysRoleMenu.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private List<SysRoleMenu> sysRoleMenuList;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 角色菜单实体对象。
|
||||
*
|
||||
@@ -11,20 +10,18 @@ import javax.persistence.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_role_menu")
|
||||
@TableName(value = "zz_sys_role_menu")
|
||||
public class SysRoleMenu {
|
||||
|
||||
/**
|
||||
* 角色Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "role_id")
|
||||
@TableField(value = "role_id")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 菜单Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "menu_id")
|
||||
@TableField(value = "menu_id")
|
||||
private Long menuId;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.webadmin.upms.model.constant.SysUserType;
|
||||
import com.orange.demo.webadmin.upms.model.constant.SysUserStatus;
|
||||
import com.orange.demo.common.core.annotation.RelationConstDict;
|
||||
import com.orange.demo.common.core.annotation.RelationManyToMany;
|
||||
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||
import com.orange.demo.webadmin.upms.vo.SysUserVo;
|
||||
import lombok.Data;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import javax.persistence.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -23,20 +22,19 @@ import java.util.List;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_user")
|
||||
@TableName(value = "zz_sys_user")
|
||||
public class SysUser {
|
||||
|
||||
/**
|
||||
* 用户Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "user_id")
|
||||
@TableId(value = "user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 登录用户名。
|
||||
*/
|
||||
@Column(name = "login_name")
|
||||
@TableField(value = "login_name")
|
||||
private String loginName;
|
||||
|
||||
/**
|
||||
@@ -47,68 +45,68 @@ public class SysUser {
|
||||
/**
|
||||
* 用户显示名称。
|
||||
*/
|
||||
@Column(name = "show_name")
|
||||
@TableField(value = "show_name")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)。
|
||||
*/
|
||||
@Column(name = "user_type")
|
||||
@TableField(value = "user_type")
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 用户头像的Url。
|
||||
*/
|
||||
@Column(name = "head_image_url")
|
||||
@TableField(value = "head_image_url")
|
||||
private String headImageUrl;
|
||||
|
||||
/**
|
||||
* 用户状态(0: 正常 1: 锁定)。
|
||||
*/
|
||||
@Column(name = "user_status")
|
||||
@TableField(value = "user_status")
|
||||
private Integer userStatus;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@DeletedFlagColumn
|
||||
@Column(name = "deleted_flag")
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
/**
|
||||
* 创建用户Id。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@Column(name = "update_user_id")
|
||||
@TableField(value = "update_user_id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String createTimeStart;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private String createTimeEnd;
|
||||
|
||||
/**
|
||||
@@ -118,19 +116,19 @@ public class SysUser {
|
||||
relationMapperName = "sysUserRoleMapper",
|
||||
relationMasterIdField = "userId",
|
||||
relationModelClass = SysUserRole.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private List<SysUserRole> sysUserRoleList;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "userType",
|
||||
constantDictClass = SysUserType.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> userTypeDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "userStatus",
|
||||
constantDictClass = SysUserStatus.class)
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> userStatusDictMap;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.orange.demo.webadmin.upms.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 用户角色实体对象。
|
||||
*
|
||||
@@ -11,20 +10,18 @@ import javax.persistence.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_sys_user_role")
|
||||
@TableName(value = "zz_sys_user_role")
|
||||
public class SysUserRole {
|
||||
|
||||
/**
|
||||
* 用户Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "user_id")
|
||||
@TableField(value = "user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 角色Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "role_id")
|
||||
@TableField(value = "role_id")
|
||||
private Long roleId;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.orange.demo.webadmin.upms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
@@ -23,7 +26,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -74,14 +76,12 @@ public class SysMenuServiceImpl extends BaseService<SysMenu, Long> implements Sy
|
||||
sysMenu.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
sysMenuMapper.insert(sysMenu);
|
||||
if (permCodeIdSet != null) {
|
||||
List<SysMenuPermCode> sysMenuPermCodeList = new LinkedList<>();
|
||||
for (Long permCodeId : permCodeIdSet) {
|
||||
SysMenuPermCode menuPermCode = new SysMenuPermCode();
|
||||
menuPermCode.setMenuId(sysMenu.getMenuId());
|
||||
menuPermCode.setPermCodeId(permCodeId);
|
||||
sysMenuPermCodeList.add(menuPermCode);
|
||||
sysMenuPermCodeMapper.insert(menuPermCode);
|
||||
}
|
||||
sysMenuPermCodeMapper.insertList(sysMenuPermCodeList);
|
||||
}
|
||||
// 判断当前菜单是否为指向在线表单的菜单,并将根据约定,动态插入两个子菜单。
|
||||
if (sysMenu.getOnlineFormId() != null) {
|
||||
@@ -93,6 +93,7 @@ public class SysMenuServiceImpl extends BaseService<SysMenu, Long> implements Sy
|
||||
viewSubMenu.setShowOrder(0);
|
||||
viewSubMenu.setOnlineFormId(sysMenu.getOnlineFormId());
|
||||
viewSubMenu.setOnlineMenuPermType(SysOnlineMenuPermType.TYPE_VIEW);
|
||||
viewSubMenu.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForInsert(viewSubMenu);
|
||||
sysMenuMapper.insert(viewSubMenu);
|
||||
SysMenu editSubMenu = new SysMenu();
|
||||
@@ -103,6 +104,7 @@ public class SysMenuServiceImpl extends BaseService<SysMenu, Long> implements Sy
|
||||
editSubMenu.setShowOrder(1);
|
||||
editSubMenu.setOnlineFormId(sysMenu.getOnlineFormId());
|
||||
editSubMenu.setOnlineMenuPermType(SysOnlineMenuPermType.TYPE_EDIT);
|
||||
editSubMenu.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForInsert(editSubMenu);
|
||||
sysMenuMapper.insert(editSubMenu);
|
||||
}
|
||||
@@ -122,30 +124,27 @@ public class SysMenuServiceImpl extends BaseService<SysMenu, Long> implements Sy
|
||||
public boolean update(SysMenu sysMenu, SysMenu originalSysMenu, Set<Long> permCodeIdSet) {
|
||||
MyModelUtil.fillCommonsForUpdate(sysMenu, originalSysMenu);
|
||||
sysMenu.setMenuType(originalSysMenu.getMenuType());
|
||||
sysMenu.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
if (sysMenuMapper.updateByPrimaryKey(sysMenu) != 1) {
|
||||
UpdateWrapper<SysMenu> uw = this.createUpdateQueryForNullValue(sysMenu, sysMenu.getMenuId());
|
||||
if (sysMenuMapper.update(sysMenu, uw) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysMenuPermCode deletedMenuPermCode = new SysMenuPermCode();
|
||||
deletedMenuPermCode.setMenuId(sysMenu.getMenuId());
|
||||
sysMenuPermCodeMapper.delete(deletedMenuPermCode);
|
||||
sysMenuPermCodeMapper.delete(new QueryWrapper<>(deletedMenuPermCode));
|
||||
if (permCodeIdSet != null) {
|
||||
List<SysMenuPermCode> sysMenuPermCodeList = new LinkedList<>();
|
||||
for (Long permCodeId : permCodeIdSet) {
|
||||
SysMenuPermCode menuPermCode = new SysMenuPermCode();
|
||||
menuPermCode.setMenuId(sysMenu.getMenuId());
|
||||
menuPermCode.setPermCodeId(permCodeId);
|
||||
sysMenuPermCodeList.add(menuPermCode);
|
||||
sysMenuPermCodeMapper.insert(menuPermCode);
|
||||
}
|
||||
sysMenuPermCodeMapper.insertList(sysMenuPermCodeList);
|
||||
}
|
||||
// 如果当前菜单的在线表单Id变化了,就需要同步更新他的内置子菜单也同步更新。
|
||||
if (ObjectUtil.notEqual(originalSysMenu.getOnlineFormId(), sysMenu.getOnlineFormId())) {
|
||||
SysMenu onlineSubMenu = new SysMenu();
|
||||
onlineSubMenu.setOnlineFormId(sysMenu.getOnlineFormId());
|
||||
Example e = new Example(SysMenu.class);
|
||||
e.createCriteria().andEqualTo("parentId", sysMenu.getMenuId());
|
||||
sysMenuMapper.updateByExampleSelective(onlineSubMenu, e);
|
||||
sysMenuMapper.update(onlineSubMenu,
|
||||
new QueryWrapper<SysMenu>().lambda().eq(SysMenu::getParentId, sysMenu.getMenuId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -160,20 +159,18 @@ public class SysMenuServiceImpl extends BaseService<SysMenu, Long> implements Sy
|
||||
@Override
|
||||
public boolean remove(SysMenu menu) {
|
||||
Long menuId = menu.getMenuId();
|
||||
if (!this.removeById(menuId)) {
|
||||
if (sysMenuMapper.deleteById(menuId) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysRoleMenu roleMenu = new SysRoleMenu();
|
||||
roleMenu.setMenuId(menuId);
|
||||
sysRoleMenuMapper.delete(roleMenu);
|
||||
sysRoleMenuMapper.delete(new QueryWrapper<>(roleMenu));
|
||||
SysMenuPermCode menuPermCode = new SysMenuPermCode();
|
||||
menuPermCode.setMenuId(menuId);
|
||||
sysMenuPermCodeMapper.delete(menuPermCode);
|
||||
sysMenuPermCodeMapper.delete(new QueryWrapper<>(menuPermCode));
|
||||
// 如果为指向在线表单的菜单,则连同删除子菜单
|
||||
if (menu.getOnlineFormId() != null) {
|
||||
Example e = new Example(SysMenu.class);
|
||||
e.createCriteria().andEqualTo("parentId", menuId);
|
||||
sysMenuMapper.deleteByExample(e);
|
||||
sysMenuMapper.delete(new QueryWrapper<SysMenu>().lambda().eq(SysMenu::getParentId, menuId));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -185,12 +182,11 @@ public class SysMenuServiceImpl extends BaseService<SysMenu, Long> implements Sy
|
||||
*/
|
||||
@Override
|
||||
public Collection<SysMenu> getAllMenuList() {
|
||||
Example e = new Example(SysMenu.class);
|
||||
e.orderBy("showOrder");
|
||||
Example.Criteria c = e.createCriteria();
|
||||
c.andIn("menuType", Arrays.asList(SysMenuType.TYPE_MENU, SysMenuType.TYPE_DIRECTORY));
|
||||
c.andEqualTo("deletedFlag", GlobalDeletedFlag.NORMAL);
|
||||
return sysMenuMapper.selectByExample(e);
|
||||
QueryWrapper<SysMenu> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByAsc(this.safeMapToColumnName("showOrder"));
|
||||
queryWrapper.in(this.safeMapToColumnName("menuType"),
|
||||
Arrays.asList(SysMenuType.TYPE_MENU, SysMenuType.TYPE_DIRECTORY));
|
||||
return sysMenuMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -289,12 +285,12 @@ public class SysMenuServiceImpl extends BaseService<SysMenu, Long> implements Sy
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> getAllOnlineMenuList(Integer menuType) {
|
||||
Example e = new Example(SysMenu.class);
|
||||
Example.Criteria c = e.createCriteria().andIsNotNull("onlineFormId");
|
||||
LambdaQueryWrapper<SysMenu> queryWrapper =
|
||||
new QueryWrapper<SysMenu>().lambda().isNotNull(SysMenu::getOnlineFormId);
|
||||
if (menuType != null) {
|
||||
c.andEqualTo("menuType", menuType);
|
||||
queryWrapper.eq(SysMenu::getMenuType, menuType);
|
||||
}
|
||||
return sysMenuMapper.selectByExample(e);
|
||||
return sysMenuMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.orange.demo.webadmin.upms.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
@@ -93,14 +95,12 @@ public class SysPermCodeServiceImpl extends BaseService<SysPermCode, Long> imple
|
||||
sysPermCode.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
sysPermCodeMapper.insert(sysPermCode);
|
||||
if (permIdSet != null) {
|
||||
List<SysPermCodePerm> sysPermCodePermList = new LinkedList<>();
|
||||
for (Long permId : permIdSet) {
|
||||
SysPermCodePerm permCodePerm = new SysPermCodePerm();
|
||||
permCodePerm.setPermCodeId(sysPermCode.getPermCodeId());
|
||||
permCodePerm.setPermId(permId);
|
||||
sysPermCodePermList.add(permCodePerm);
|
||||
sysPermCodePermMapper.insert(permCodePerm);
|
||||
}
|
||||
sysPermCodePermMapper.insertList(sysPermCodePermList);
|
||||
}
|
||||
return sysPermCode;
|
||||
}
|
||||
@@ -118,22 +118,21 @@ public class SysPermCodeServiceImpl extends BaseService<SysPermCode, Long> imple
|
||||
public boolean update(SysPermCode sysPermCode, SysPermCode originalSysPermCode, Set<Long> permIdSet) {
|
||||
MyModelUtil.fillCommonsForUpdate(sysPermCode, originalSysPermCode);
|
||||
sysPermCode.setParentId(originalSysPermCode.getParentId());
|
||||
sysPermCode.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
if (sysPermCodeMapper.updateByPrimaryKey(sysPermCode) != 1) {
|
||||
return false;
|
||||
UpdateWrapper<SysPermCode> uw =
|
||||
this.createUpdateQueryForNullValue(sysPermCode, sysPermCode.getPermCodeId());
|
||||
if (sysPermCodeMapper.update(sysPermCode, uw) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysPermCodePerm deletedPermCodePerm = new SysPermCodePerm();
|
||||
deletedPermCodePerm.setPermCodeId(sysPermCode.getPermCodeId());
|
||||
sysPermCodePermMapper.delete(deletedPermCodePerm);
|
||||
sysPermCodePermMapper.delete(new QueryWrapper<>(deletedPermCodePerm));
|
||||
if (permIdSet != null) {
|
||||
List<SysPermCodePerm> sysPermCodePermList = new LinkedList<>();
|
||||
for (Long permId : permIdSet) {
|
||||
SysPermCodePerm permCodePerm = new SysPermCodePerm();
|
||||
permCodePerm.setPermCodeId(sysPermCode.getPermCodeId());
|
||||
permCodePerm.setPermId(permId);
|
||||
sysPermCodePermList.add(permCodePerm);
|
||||
sysPermCodePermMapper.insert(permCodePerm);
|
||||
}
|
||||
sysPermCodePermMapper.insertList(sysPermCodePermList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -147,15 +146,15 @@ public class SysPermCodeServiceImpl extends BaseService<SysPermCode, Long> imple
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long permCodeId) {
|
||||
if (!this.removeById(permCodeId)) {
|
||||
if (sysPermCodeMapper.deleteById(permCodeId) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysMenuPermCode menuPermCode = new SysMenuPermCode();
|
||||
menuPermCode.setPermCodeId(permCodeId);
|
||||
sysMenuPermCodeMapper.delete(menuPermCode);
|
||||
sysMenuPermCodeMapper.delete(new QueryWrapper<>(menuPermCode));
|
||||
SysPermCodePerm permCodePerm = new SysPermCodePerm();
|
||||
permCodePerm.setPermCodeId(permCodeId);
|
||||
sysPermCodePermMapper.delete(permCodePerm);
|
||||
sysPermCodePermMapper.delete(new QueryWrapper<>(permCodePerm));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,7 @@ public class SysPermModuleServiceImpl extends BaseService<SysPermModule, Long> i
|
||||
@Override
|
||||
public boolean update(SysPermModule sysPermModule, SysPermModule originalSysPermModule) {
|
||||
MyModelUtil.fillCommonsForUpdate(sysPermModule, originalSysPermModule);
|
||||
sysPermModule.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
return sysPermModuleMapper.updateByPrimaryKey(sysPermModule) != 0;
|
||||
return sysPermModuleMapper.updateById(sysPermModule) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +83,7 @@ public class SysPermModuleServiceImpl extends BaseService<SysPermModule, Long> i
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long moduleId) {
|
||||
return this.removeById(moduleId);
|
||||
return sysPermModuleMapper.deleteById(moduleId) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.webadmin.upms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
@@ -23,7 +24,6 @@ import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -90,9 +90,8 @@ public class SysPermServiceImpl extends BaseService<SysPerm, Long> implements Sy
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SysPerm perm, SysPerm originalPerm) {
|
||||
perm.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForUpdate(perm, originalPerm);
|
||||
return sysPermMapper.updateByPrimaryKeySelective(perm) != 0;
|
||||
return sysPermMapper.updateById(perm) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,12 +103,12 @@ public class SysPermServiceImpl extends BaseService<SysPerm, Long> implements Sy
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long permId) {
|
||||
if (!this.removeById(permId)) {
|
||||
if (sysPermMapper.deleteById(permId) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysPermCodePerm permCodePerm = new SysPermCodePerm();
|
||||
permCodePerm.setPermId(permId);
|
||||
sysPermCodePermMapper.delete(permCodePerm);
|
||||
sysPermCodePermMapper.delete(new QueryWrapper<>(permCodePerm));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -121,17 +120,13 @@ public class SysPermServiceImpl extends BaseService<SysPerm, Long> implements Sy
|
||||
*/
|
||||
@Override
|
||||
public List<SysPerm> getPermListWithRelation(SysPerm sysPermFilter) {
|
||||
Example e = new Example(SysPerm.class);
|
||||
e.orderBy("showOrder");
|
||||
Example.Criteria c = e.createCriteria();
|
||||
if (ObjectUtil.isNotNull(sysPermFilter.getModuleId())) {
|
||||
c.andEqualTo("moduleId", sysPermFilter.getModuleId());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(sysPermFilter.getUrl())) {
|
||||
c.andLike("url", "%" + sysPermFilter.getUrl() + "%");
|
||||
}
|
||||
c.andEqualTo("deletedFlag", GlobalDeletedFlag.NORMAL);
|
||||
List<SysPerm> permList = sysPermMapper.selectByExample(e);
|
||||
QueryWrapper<SysPerm> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByAsc(this.safeMapToColumnName("showOrder"));
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(sysPermFilter.getModuleId()),
|
||||
this.safeMapToColumnName("moduleId"), sysPermFilter.getModuleId());
|
||||
queryWrapper.like(ObjectUtil.isNotNull(sysPermFilter.getUrl()),
|
||||
this.safeMapToColumnName("url"), "%" + sysPermFilter.getUrl() + "%");
|
||||
List<SysPerm> permList = sysPermMapper.selectList(queryWrapper);
|
||||
// 这里因为权限只有字典数据,所以仅仅做字典关联。
|
||||
this.buildRelationForDataList(permList, MyRelationParam.dictOnly());
|
||||
return permList;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.webadmin.upms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.orange.demo.common.core.util.MyModelUtil;
|
||||
@@ -70,14 +71,12 @@ public class SysRoleServiceImpl extends BaseService<SysRole, Long> implements Sy
|
||||
role.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
sysRoleMapper.insert(role);
|
||||
if (menuIdSet != null) {
|
||||
List<SysRoleMenu> roleMenuList = new LinkedList<>();
|
||||
for (Long menuId : menuIdSet) {
|
||||
SysRoleMenu roleMenu = new SysRoleMenu();
|
||||
roleMenu.setRoleId(role.getRoleId());
|
||||
roleMenu.setMenuId(menuId);
|
||||
roleMenuList.add(roleMenu);
|
||||
sysRoleMenuMapper.insert(roleMenu);
|
||||
}
|
||||
sysRoleMenuMapper.insertList(roleMenuList);
|
||||
}
|
||||
return role;
|
||||
}
|
||||
@@ -93,23 +92,20 @@ public class SysRoleServiceImpl extends BaseService<SysRole, Long> implements Sy
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SysRole role, SysRole originalRole, Set<Long> menuIdSet) {
|
||||
role.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForUpdate(role, originalRole);
|
||||
if (sysRoleMapper.updateByPrimaryKey(role) != 1) {
|
||||
if (sysRoleMapper.updateById(role) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysRoleMenu deletedRoleMenu = new SysRoleMenu();
|
||||
deletedRoleMenu.setRoleId(role.getRoleId());
|
||||
sysRoleMenuMapper.delete(deletedRoleMenu);
|
||||
sysRoleMenuMapper.delete(new QueryWrapper<>(deletedRoleMenu));
|
||||
if (menuIdSet != null) {
|
||||
List<SysRoleMenu> roleMenuList = new LinkedList<>();
|
||||
for (Long menuId : menuIdSet) {
|
||||
SysRoleMenu roleMenu = new SysRoleMenu();
|
||||
roleMenu.setRoleId(role.getRoleId());
|
||||
roleMenu.setMenuId(menuId);
|
||||
roleMenuList.add(roleMenu);
|
||||
sysRoleMenuMapper.insert(roleMenu);
|
||||
}
|
||||
sysRoleMenuMapper.insertList(roleMenuList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -123,15 +119,15 @@ public class SysRoleServiceImpl extends BaseService<SysRole, Long> implements Sy
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long roleId) {
|
||||
if (!this.removeById(roleId)) {
|
||||
if (sysRoleMapper.deleteById(roleId) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysRoleMenu roleMenu = new SysRoleMenu();
|
||||
roleMenu.setRoleId(roleId);
|
||||
sysRoleMenuMapper.delete(roleMenu);
|
||||
sysRoleMenuMapper.delete(new QueryWrapper<>(roleMenu));
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setRoleId(roleId);
|
||||
sysUserRoleMapper.delete(userRole);
|
||||
sysUserRoleMapper.delete(new QueryWrapper<>(userRole));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -155,7 +151,9 @@ public class SysRoleServiceImpl extends BaseService<SysRole, Long> implements Sy
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void addUserRoleList(List<SysUserRole> userRoleList) {
|
||||
sysUserRoleMapper.insertList(userRoleList);
|
||||
for (SysUserRole userRole : userRoleList) {
|
||||
sysUserRoleMapper.insert(userRole);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +169,7 @@ public class SysRoleServiceImpl extends BaseService<SysRole, Long> implements Sy
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setRoleId(roleId);
|
||||
userRole.setUserId(userId);
|
||||
return sysUserRoleMapper.delete(userRole) == 1;
|
||||
return sysUserRoleMapper.delete(new QueryWrapper<>(userRole)) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orange.demo.webadmin.upms.service.*;
|
||||
import com.orange.demo.webadmin.upms.dao.*;
|
||||
@@ -20,7 +22,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -66,8 +67,7 @@ public class SysUserServiceImpl extends BaseService<SysUser, Long> implements Sy
|
||||
public SysUser getSysUserByLoginName(String loginName) {
|
||||
SysUser filter = new SysUser();
|
||||
filter.setLoginName(loginName);
|
||||
filter.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
return sysUserMapper.selectOne(filter);
|
||||
return sysUserMapper.selectOne(new QueryWrapper<>(filter));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,14 +87,12 @@ public class SysUserServiceImpl extends BaseService<SysUser, Long> implements Sy
|
||||
MyModelUtil.fillCommonsForInsert(user);
|
||||
sysUserMapper.insert(user);
|
||||
if (CollectionUtils.isNotEmpty(roleIdSet)) {
|
||||
List<SysUserRole> userRoleList = new LinkedList<>();
|
||||
for (Long roleId : roleIdSet) {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(user.getUserId());
|
||||
userRole.setRoleId(roleId);
|
||||
userRoleList.add(userRole);
|
||||
sysUserRoleMapper.insert(userRole);
|
||||
}
|
||||
sysUserRoleMapper.insertList(userRoleList);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
@@ -113,23 +111,21 @@ public class SysUserServiceImpl extends BaseService<SysUser, Long> implements Sy
|
||||
user.setLoginName(originalUser.getLoginName());
|
||||
user.setPassword(originalUser.getPassword());
|
||||
MyModelUtil.fillCommonsForUpdate(user, originalUser);
|
||||
user.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
if (sysUserMapper.updateByPrimaryKey(user) != 1) {
|
||||
UpdateWrapper<SysUser> uw = this.createUpdateQueryForNullValue(user, user.getUserId());
|
||||
if (sysUserMapper.update(user, uw) != 1) {
|
||||
return false;
|
||||
}
|
||||
// 先删除原有的User-Role关联关系,再重新插入新的关联关系
|
||||
SysUserRole deletedUserRole = new SysUserRole();
|
||||
deletedUserRole.setUserId(user.getUserId());
|
||||
sysUserRoleMapper.delete(deletedUserRole);
|
||||
sysUserRoleMapper.delete(new QueryWrapper<>(deletedUserRole));
|
||||
if (CollectionUtils.isNotEmpty(roleIdSet)) {
|
||||
List<SysUserRole> userRoleList = new LinkedList<>();
|
||||
for (Long roleId : roleIdSet) {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(user.getUserId());
|
||||
userRole.setRoleId(roleId);
|
||||
userRoleList.add(userRole);
|
||||
sysUserRoleMapper.insert(userRole);
|
||||
}
|
||||
sysUserRoleMapper.insertList(userRoleList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -143,13 +139,10 @@ public class SysUserServiceImpl extends BaseService<SysUser, Long> implements Sy
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean changePassword(Long userId, String newPass) {
|
||||
Example e = new Example(SysUser.class);
|
||||
e.createCriteria()
|
||||
.andEqualTo(super.idFieldName, userId)
|
||||
.andEqualTo(super.deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
SysUser updatedUser = new SysUser();
|
||||
updatedUser.setUserId(userId);
|
||||
updatedUser.setPassword(passwordEncoder.encode(newPass));
|
||||
return sysUserMapper.updateByExampleSelective(updatedUser, e) == 1;
|
||||
return sysUserMapper.updateById(updatedUser) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,13 +154,12 @@ public class SysUserServiceImpl extends BaseService<SysUser, Long> implements Sy
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long userId) {
|
||||
// 这里先删除主数据
|
||||
if (!this.removeById(userId)) {
|
||||
if (sysUserMapper.deleteById(userId) == 0) {
|
||||
return false;
|
||||
}
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(userId);
|
||||
sysUserRoleMapper.delete(userRole);
|
||||
sysUserRoleMapper.delete(new QueryWrapper<>(userRole));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
@@ -10,76 +12,91 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("菜单VO")
|
||||
@Data
|
||||
public class SysMenuVo {
|
||||
|
||||
/**
|
||||
* 菜单Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单Id")
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 父菜单Id,目录菜单的父菜单为null
|
||||
*/
|
||||
@ApiModelProperty(value = "父菜单Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 菜单显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示名称")
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 菜单类型 (0: 目录 1: 菜单 2: 按钮 3: UI片段)。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单类型")
|
||||
private Integer menuType;
|
||||
|
||||
/**
|
||||
* 前端表单路由名称,仅用于menu_type为1的菜单类型。
|
||||
*/
|
||||
@ApiModelProperty(value = "前端表单路由名称")
|
||||
private String formRouterName;
|
||||
|
||||
/**
|
||||
* 在线表单主键Id,仅用于在线表单绑定的菜单。
|
||||
*/
|
||||
@ApiModelProperty(value = "在线表单主键Id")
|
||||
private Long onlineFormId;
|
||||
|
||||
/**
|
||||
* 在线表单菜单的权限控制类型,具体值可参考SysOnlineMenuPermType常量对象。
|
||||
*/
|
||||
@ApiModelProperty(value = "在线表单菜单的权限控制类型")
|
||||
private Integer onlineMenuPermType;
|
||||
|
||||
/**
|
||||
* 菜单显示顺序 (值越小,排序越靠前)。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示顺序")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 菜单图标。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示顺序")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 菜单与权限字关联对象列表。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单与权限字关联对象列表")
|
||||
private List<Map<String, Object>> sysMenuPermCodeList;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
@@ -10,61 +12,73 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("权限字VO")
|
||||
@Data
|
||||
public class SysPermCodeVo {
|
||||
|
||||
/**
|
||||
* 权限字Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字Id")
|
||||
private Long permCodeId;
|
||||
|
||||
/**
|
||||
* 权限字标识(一般为有含义的英文字符串)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字标识")
|
||||
private String permCode;
|
||||
|
||||
/**
|
||||
* 上级权限字Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "上级权限字Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限字类型(0: 表单 1: UI片段 2: 操作)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字类型")
|
||||
private Integer permCodeType;
|
||||
|
||||
/**
|
||||
* 显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示名称")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 显示顺序(数值越小,越靠前)。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 权限字与权限资源关联对象列表。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字与权限资源关联对象列表")
|
||||
private List<Map<String, Object>> sysPermCodePermList;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
@@ -10,56 +12,67 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("权限资源模块VO")
|
||||
@Data
|
||||
public class SysPermModuleVo {
|
||||
|
||||
/**
|
||||
* 权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块Id")
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 权限模块名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块名称")
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 上级权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "上级权限模块Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限模块类型(0: 普通模块 1: Controller模块)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块类型")
|
||||
private Integer moduleType;
|
||||
|
||||
/**
|
||||
* 权限模块在当前层级下的顺序,由小到大。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 权限资源对象列表。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限资源对象列表")
|
||||
private List<SysPermVo> sysPermList;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
@@ -10,61 +12,73 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("权限资源VO")
|
||||
@Data
|
||||
public class SysPermVo {
|
||||
|
||||
/**
|
||||
* 权限资源Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限资源Id")
|
||||
private Long permId;
|
||||
|
||||
/**
|
||||
* 权限资源名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限资源名称")
|
||||
private String permName;
|
||||
|
||||
/**
|
||||
* shiro格式的权限字,如(upms:sysUser:add)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字")
|
||||
private String permCode;
|
||||
|
||||
/**
|
||||
* 权限所在的权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限所在的权限模块Id")
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 关联的URL。
|
||||
*/
|
||||
@ApiModelProperty(value = "关联的URL")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 权限在当前模块下的顺序,由小到大。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 模块Id的字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "模块Id的字典关联数据")
|
||||
private Map<String, Object> moduleIdDictMap;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
@@ -10,41 +12,49 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("角色VO")
|
||||
@Data
|
||||
public class SysRoleVo {
|
||||
|
||||
/**
|
||||
* 角色Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "角色Id")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 角色与菜单关联对象列表。
|
||||
*/
|
||||
@ApiModelProperty(value = "角色与菜单关联对象列表")
|
||||
private List<Map<String, Object>> sysRoleMenuList;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.orange.demo.webadmin.upms.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -12,71 +14,85 @@ import java.util.List;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("SysUserVO实体对象")
|
||||
@Data
|
||||
public class SysUserVo {
|
||||
|
||||
/**
|
||||
* 用户Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户Id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 登录用户名。
|
||||
*/
|
||||
@ApiModelProperty(value = "登录用户名")
|
||||
private String loginName;
|
||||
|
||||
/**
|
||||
* 用户显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户显示名称")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)")
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 用户头像的Url。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户头像的Url")
|
||||
private String headImageUrl;
|
||||
|
||||
/**
|
||||
* 用户状态(0: 正常 1: 锁定)。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户状态(0: 正常 1: 锁定)")
|
||||
private Integer userStatus;
|
||||
|
||||
/**
|
||||
* 创建用户Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建用户Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 多对多用户角色数据集合。
|
||||
*/
|
||||
@ApiModelProperty(value = "多对多用户角色数据集合")
|
||||
private List<Map<String, Object>> sysUserRoleList;
|
||||
|
||||
/**
|
||||
* userType 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "userType 常量字典关联数据")
|
||||
private Map<String, Object> userTypeDictMap;
|
||||
|
||||
/**
|
||||
* userStatus 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "userStatus 常量字典关联数据")
|
||||
private Map<String, Object> userStatusDictMap;
|
||||
}
|
||||
|
||||
@@ -40,16 +40,13 @@ spring:
|
||||
request-context-attribute: request
|
||||
suffix: .ftl
|
||||
|
||||
# mybatis的基本配置
|
||||
mybatis:
|
||||
mapperLocations: classpath:com/orange/demo/webadmin/*/dao/mapper/*Mapper.xml,com/orange/demo/common/log/dao/mapper/*Mapper.xml
|
||||
typeAliasesPackage: com.orange.demo.webadmin.*.model,com.orange.demo.common.log.model
|
||||
|
||||
# mybatis的通用mapper的配置
|
||||
mapper:
|
||||
mappers: tk.mybatis.mapper.common.Mapper,tk.mybatis.mapper.additional.insert.InsertListMapper
|
||||
not-empty: false
|
||||
identity: MYSQL
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:com/orange/demo/webadmin/*/dao/mapper/*Mapper.xml,com/orange/demo/common/log/dao/mapper/*Mapper.xml
|
||||
type-aliases-package: com.orange.demo.webadmin.*.model,com.orange.demo.common.log.model
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-value: -1
|
||||
logic-not-delete-value: 1
|
||||
|
||||
# 自动分页的配置
|
||||
pagehelper:
|
||||
@@ -84,12 +81,23 @@ redis:
|
||||
# 单位毫秒。分布式锁的超时检测时长。
|
||||
# 如果一次锁内操作超该毫秒数,或在释放锁之前异常退出,Redis会在该时长之后主动删除该锁使用的key。
|
||||
lockWatchdogTimeout: 60000
|
||||
# redis 密码,空可以不填。
|
||||
password:
|
||||
pool:
|
||||
# 连接池数量。
|
||||
poolSize: 20
|
||||
# 连接池中最小空闲数量。
|
||||
minIdle: 5
|
||||
|
||||
swagger:
|
||||
# 当enabled为false的时候,则可禁用swagger。
|
||||
enabled: true
|
||||
# 工程的基础包名。
|
||||
basePackage: com.orange.demo.webadmin
|
||||
title: 橙单单体服务工程
|
||||
description: 橙单单体服务工程详情
|
||||
version: 1.0
|
||||
|
||||
# 暴露监控端点
|
||||
management:
|
||||
endpoints:
|
||||
|
||||
@@ -53,6 +53,9 @@
|
||||
<root level="${OUTPUT_LOG_LEVEL}">
|
||||
<AppenderRef ref="console"/>
|
||||
</root>
|
||||
<Logger name="springfox.documentation" additivity="false" level="error">
|
||||
<AppenderRef ref="console"/>
|
||||
</Logger>
|
||||
<AsyncLogger name="com.orange.demo" additivity="false" level="info">
|
||||
<AppenderRef ref="console"/>
|
||||
<AppenderRef ref="file_log"/>
|
||||
|
||||
@@ -96,9 +96,9 @@
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper-spring-boot-starter</artifactId>
|
||||
<version>${mybatis-mapper.version}</version>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatisplus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.orange.demo.common.core.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 主要用于标记逻辑删除字段。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DeletedFlagColumn {
|
||||
|
||||
}
|
||||
@@ -36,13 +36,13 @@ public class DataSourceAspect {
|
||||
Class<?> clazz = point.getTarget().getClass();
|
||||
MyDataSource ds = clazz.getAnnotation(MyDataSource.class);
|
||||
// 通过判断 DataSource 中的值来判断当前方法应用哪个数据源
|
||||
DataSourceContextHolder.setDataSourceType(ds.value());
|
||||
Integer originalType = DataSourceContextHolder.setDataSourceType(ds.value());
|
||||
log.debug("set datasource is " + ds.value());
|
||||
try {
|
||||
return point.proceed();
|
||||
} finally {
|
||||
DataSourceContextHolder.clear();
|
||||
log.debug("clean datasource");
|
||||
DataSourceContextHolder.unset(originalType);
|
||||
log.debug("unset datasource is " + originalType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,13 +50,13 @@ public class DataSourceResolveAspect {
|
||||
}
|
||||
int type = resolver.resolve(dsr.arg(), point.getArgs());
|
||||
// 通过判断 DataSource 中的值来判断当前方法应用哪个数据源
|
||||
DataSourceContextHolder.setDataSourceType(type);
|
||||
Integer originalType = DataSourceContextHolder.setDataSourceType(type);
|
||||
log.debug("set datasource is " + type);
|
||||
try {
|
||||
return point.proceed();
|
||||
} finally {
|
||||
DataSourceContextHolder.clear();
|
||||
log.debug("clean datasource");
|
||||
DataSourceContextHolder.unset(originalType);
|
||||
log.debug("unset datasource is " + originalType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 字典缓存同步的AOP。该AOP的优先级必须比事务切面的优先级高,因此会在事务外执行该切面的代码。
|
||||
*
|
||||
@@ -39,23 +41,23 @@ public class DictCacheSyncAspect {
|
||||
Object arg = joinPoint.getArgs()[0];
|
||||
if ("saveNew".equals(methodName)) {
|
||||
Object data = joinPoint.proceed();
|
||||
BaseDictService<Object, Object> service =
|
||||
(BaseDictService<Object, Object>) joinPoint.getTarget();
|
||||
BaseDictService<Object, Serializable> service =
|
||||
(BaseDictService<Object, Serializable>) joinPoint.getTarget();
|
||||
// 这里参数必须使用saveNew方法的返回对象,因为里面包含实际主键值。
|
||||
service.putDictionaryCache(data);
|
||||
return data;
|
||||
} else if ("update".equals(methodName)) {
|
||||
Object data = joinPoint.proceed();
|
||||
BaseDictService<Object, Object> service =
|
||||
(BaseDictService<Object, Object>) joinPoint.getTarget();
|
||||
BaseDictService<Object, Serializable> service =
|
||||
(BaseDictService<Object, Serializable>) joinPoint.getTarget();
|
||||
// update的方法返回的是boolean,因此这里的参数需要使用第一个参数即可。
|
||||
service.putDictionaryCache(arg);
|
||||
return data;
|
||||
} else {
|
||||
// remove
|
||||
BaseDictService<Object, Object> service =
|
||||
(BaseDictService<Object, Object>) joinPoint.getTarget();
|
||||
service.removeDictionaryCache(arg);
|
||||
BaseDictService<Object, Serializable> service =
|
||||
(BaseDictService<Object, Serializable>) joinPoint.getTarget();
|
||||
service.removeDictionaryCache((Serializable) arg);
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.orange.demo.common.core.base.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import tk.mybatis.mapper.additional.insert.InsertListMapper;
|
||||
import tk.mybatis.mapper.annotation.RegisterMapper;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -16,8 +14,7 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@RegisterMapper
|
||||
public interface BaseDaoMapper<M> extends Mapper<M>, InsertListMapper<M> {
|
||||
public interface BaseDaoMapper<M> extends BaseMapper<M> {
|
||||
|
||||
/**
|
||||
* 根据指定的表名、显示字段列表、过滤条件字符串和分组字段,返回聚合计算后的查询结果。
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.orange.demo.common.core.base.service;
|
||||
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.orange.demo.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orange.demo.common.core.exception.MyRuntimeException;
|
||||
import com.orange.demo.common.core.cache.DictionaryCache;
|
||||
@@ -8,8 +9,8 @@ import com.orange.demo.common.core.object.TokenData;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -22,7 +23,7 @@ import java.util.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class BaseDictService<M, K> extends BaseService<M, K> implements IBaseDictService<M, K> {
|
||||
public abstract class BaseDictService<M, K extends Serializable> extends BaseService<M, K> implements IBaseDictService<M, K> {
|
||||
|
||||
/**
|
||||
* 缓存池对象。
|
||||
@@ -89,15 +90,7 @@ public abstract class BaseDictService<M, K> extends BaseService<M, K> implements
|
||||
if (tenantIdField != null) {
|
||||
ReflectUtil.setFieldValue(data, tenantIdField, TokenData.takeFromRequest().getTenantId());
|
||||
}
|
||||
if (deletedFlagFieldName != null) {
|
||||
try {
|
||||
setDeletedFlagMethod.invoke(data, GlobalDeletedFlag.NORMAL);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to call reflection [setDeletedFlagMethod] in BaseDictService.update.", e);
|
||||
throw new MyRuntimeException(e);
|
||||
}
|
||||
}
|
||||
return mapper().updateByPrimaryKey(data) == 1;
|
||||
return mapper().updateById(data) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +102,7 @@ public abstract class BaseDictService<M, K> extends BaseService<M, K> implements
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(K id) {
|
||||
return this.removeById(id);
|
||||
return mapper().deleteById(id) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,15 +111,16 @@ public abstract class BaseDictService<M, K> extends BaseService<M, K> implements
|
||||
* @param id 主键Id。
|
||||
* @return 主键关联的数据,不存在返回null。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public M getById(K id) {
|
||||
M data = dictionaryCache.get(id);
|
||||
public M getById(Serializable id) {
|
||||
M data = dictionaryCache.get((K) id);
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
data = super.getById(id);
|
||||
if (data != null) {
|
||||
this.dictionaryCache.put(id, data);
|
||||
this.dictionaryCache.put((K) id, data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -188,7 +182,7 @@ public abstract class BaseDictService<M, K> extends BaseService<M, K> implements
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回符合 inFilterField in (inFilterValues) 条件的所有数据。蜀国property是主键,则从缓存中读取。
|
||||
* 返回符合 inFilterField in (inFilterValues) 条件的所有数据。属性property是主键,则从缓存中读取。
|
||||
*
|
||||
* @param inFilterField 参与(In-list)过滤的Java字段。
|
||||
* @param inFilterValues 参与(In-list)过滤的Java字段值集合。
|
||||
@@ -200,7 +194,7 @@ public abstract class BaseDictService<M, K> extends BaseService<M, K> implements
|
||||
if (inFilterField.equals(this.idFieldName)) {
|
||||
return this.getInList((Set<K>) inFilterValues);
|
||||
}
|
||||
return this.getInList(inFilterField, inFilterValues);
|
||||
return super.getInList(inFilterField, inFilterValues);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,8 +214,10 @@ public abstract class BaseDictService<M, K> extends BaseService<M, K> implements
|
||||
List<M> dataList = this.getInList((Set<K>) inFilterValues);
|
||||
return dataList.size() == inFilterValues.size();
|
||||
}
|
||||
Example e = this.makeDefaultInListExample(inFilterField, inFilterValues, null);
|
||||
return mapper().selectCountByExample(e) == inFilterValues.size();
|
||||
String columnName = this.safeMapToColumnName(inFilterField);
|
||||
QueryWrapper<M> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in(columnName, inFilterValues);
|
||||
return mapper().selectCount(queryWrapper) == inFilterValues.size();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
package com.orange.demo.common.core.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.orange.demo.common.core.annotation.*;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.core.constant.AggregationType;
|
||||
import com.orange.demo.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orange.demo.common.core.exception.InvalidDataFieldException;
|
||||
import com.orange.demo.common.core.exception.MyRuntimeException;
|
||||
import com.orange.demo.common.core.object.*;
|
||||
import com.orange.demo.common.core.util.AopTargetUtil;
|
||||
@@ -14,13 +20,9 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -39,7 +41,7 @@ import static java.util.stream.Collectors.*;
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
public abstract class BaseService<M, K extends Serializable> extends ServiceImpl<BaseDaoMapper<M>, M> implements IBaseService<M, K> {
|
||||
/**
|
||||
* 当前Service关联的主Model实体对象的Class。
|
||||
*/
|
||||
@@ -133,6 +135,11 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
private static final String AGGREGATED_VALUE = "aggregatedValue";
|
||||
private static final String AND_OP = " AND ";
|
||||
|
||||
@Override
|
||||
public BaseDaoMapper<M> getBaseMapper() {
|
||||
return mapper();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造函数,在实例化的时候,一次性完成所有有关主Model对象信息的加载。
|
||||
*/
|
||||
@@ -140,7 +147,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
public BaseService() {
|
||||
modelClass = (Class<M>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
|
||||
idFieldClass = (Class<K>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
|
||||
this.tableName = modelClass.getAnnotation(Table.class).name();
|
||||
this.tableName = modelClass.getAnnotation(TableName.class).value();
|
||||
Field[] fields = ReflectUtil.getFields(modelClass);
|
||||
for (Field field : fields) {
|
||||
initializeField(field);
|
||||
@@ -148,10 +155,10 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
}
|
||||
|
||||
private void initializeField(Field field) {
|
||||
if (idFieldName == null && null != field.getAnnotation(Id.class)) {
|
||||
if (idFieldName == null && null != field.getAnnotation(TableId.class)) {
|
||||
idFieldName = field.getName();
|
||||
Column c = field.getAnnotation(Column.class);
|
||||
idColumnName = c == null ? idFieldName : c.name();
|
||||
TableId c = field.getAnnotation(TableId.class);
|
||||
idColumnName = c == null ? idFieldName : c.value();
|
||||
setIdFieldMethod = ReflectUtil.getMethod(
|
||||
modelClass, "set" + StringUtils.capitalize(idFieldName), idFieldClass);
|
||||
getIdFieldMethod = ReflectUtil.getMethod(
|
||||
@@ -159,21 +166,18 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
}
|
||||
if (updateTimeFieldName == null && null != field.getAnnotation(JobUpdateTimeColumn.class)) {
|
||||
updateTimeFieldName = field.getName();
|
||||
Column c = field.getAnnotation(Column.class);
|
||||
updateTimeColumnName = c == null ? updateTimeFieldName : c.name();
|
||||
updateTimeColumnName = this.safeMapToColumnName(updateTimeFieldName);
|
||||
}
|
||||
if (deletedFlagFieldName == null && null != field.getAnnotation(DeletedFlagColumn.class)) {
|
||||
if (deletedFlagFieldName == null && null != field.getAnnotation(TableLogic.class)) {
|
||||
deletedFlagFieldName = field.getName();
|
||||
Column c = field.getAnnotation(Column.class);
|
||||
deletedFlagColumnName = c == null ? deletedFlagFieldName : c.name();
|
||||
deletedFlagColumnName = this.safeMapToColumnName(deletedFlagFieldName);
|
||||
setDeletedFlagMethod = ReflectUtil.getMethod(
|
||||
modelClass, "set" + StringUtils.capitalize(deletedFlagFieldName), Integer.class);
|
||||
}
|
||||
if (tenantIdFieldName == null && null != field.getAnnotation(TenantFilterColumn.class)) {
|
||||
tenantIdField = field;
|
||||
tenantIdFieldName = field.getName();
|
||||
Column c = field.getAnnotation(Column.class);
|
||||
tenantIdColumnName = c == null ? tenantIdFieldName : c.name();
|
||||
tenantIdColumnName = this.safeMapToColumnName(tenantIdFieldName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,28 +189,15 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
protected abstract BaseDaoMapper<M> mapper();
|
||||
|
||||
/**
|
||||
* 基于主键Id删除数据。如果包含逻辑删除字段,则进行逻辑删除。
|
||||
* 根据过滤条件删除数据。
|
||||
*
|
||||
* @param id 主键Id值。
|
||||
* @return true删除成功,false数据不存在。
|
||||
* @param filter 过滤对象。
|
||||
* @return 删除数量。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean removeById(K id) {
|
||||
if (this.deletedFlagFieldName == null) {
|
||||
return mapper().deleteByPrimaryKey(id) == 1;
|
||||
}
|
||||
try {
|
||||
Example e = new Example(modelClass);
|
||||
Example.Criteria c = e.createCriteria().andEqualTo(idFieldName, id);
|
||||
c.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
M data = modelClass.newInstance();
|
||||
setDeletedFlagMethod.invoke(data, GlobalDeletedFlag.DELETED);
|
||||
return mapper().updateByExampleSelective(data, e) == 1;
|
||||
} catch (Exception ex) {
|
||||
log.error("Failed to call reflection method in BaseService.removeById.", ex);
|
||||
throw new MyRuntimeException(ex);
|
||||
}
|
||||
public Integer removeBy(M filter) {
|
||||
return mapper().delete(new QueryWrapper<>(filter));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,9 +214,8 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (fieldName.equals(this.idFieldName)) {
|
||||
return this.existId((K) fieldValue);
|
||||
}
|
||||
Example e = new Example(modelClass);
|
||||
e.createCriteria().andEqualTo(fieldName, fieldValue);
|
||||
return mapper().selectCountByExample(e) == 1;
|
||||
String columnName = MyModelUtil.mapToColumnName(fieldName, modelClass);
|
||||
return mapper().selectCount(new QueryWrapper<M>().eq(columnName, fieldValue)) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,24 +229,6 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
return getById(id) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键Id关联的数据。
|
||||
*
|
||||
* @param id 主键Id。
|
||||
* @return 主键关联的数据,不存在返回null。
|
||||
*/
|
||||
@Override
|
||||
public M getById(K id) {
|
||||
if (deletedFlagFieldName == null) {
|
||||
return mapper().selectByPrimaryKey(id);
|
||||
}
|
||||
Example e = new Example(modelClass);
|
||||
e.createCriteria()
|
||||
.andEqualTo(this.idFieldName, id)
|
||||
.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
return mapper().selectOneByExample(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回符合 filterField = filterValue 条件的一条数据。
|
||||
*
|
||||
@@ -270,12 +242,9 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (filterField.equals(idFieldName)) {
|
||||
return this.getById((K) filterValue);
|
||||
}
|
||||
Example e = new Example(modelClass);
|
||||
Example.Criteria c = e.createCriteria().andEqualTo(filterField, filterValue);
|
||||
if (deletedFlagFieldName != null) {
|
||||
c.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
}
|
||||
return mapper().selectOneByExample(e);
|
||||
String columnName = this.safeMapToColumnName(filterField);
|
||||
QueryWrapper<M> queryWrapper = new QueryWrapper<M>().eq(columnName, filterValue);
|
||||
return mapper().selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,12 +268,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public List<M> getAllList() {
|
||||
if (deletedFlagFieldName == null) {
|
||||
return mapper().selectAll();
|
||||
}
|
||||
Example e = new Example(modelClass);
|
||||
e.createCriteria().andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
return mapper().selectByExample(e);
|
||||
return mapper().selectList(Wrappers.emptyWrapper());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,14 +279,11 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public List<M> getAllListByOrder(String... orderByProperties) {
|
||||
Example e = new Example(modelClass);
|
||||
for (String orderByProperty : orderByProperties) {
|
||||
e.orderBy(orderByProperty);
|
||||
String[] columns = new String[orderByProperties.length];
|
||||
for (int i = 0; i < orderByProperties.length; i++) {
|
||||
columns[i] = this.safeMapToColumnName(orderByProperties[i]);
|
||||
}
|
||||
if (deletedFlagFieldName != null) {
|
||||
e.and().andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
}
|
||||
return mapper().selectByExample(e);
|
||||
return mapper().selectList(new QueryWrapper<M>().orderByAsc(columns));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -351,8 +312,8 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (CollectionUtils.isEmpty(inFilterValues)) {
|
||||
return true;
|
||||
}
|
||||
Example e = this.makeDefaultInListExample(inFilterField, inFilterValues, null);
|
||||
return mapper().selectCountByExample(e) == inFilterValues.size();
|
||||
String column = this.safeMapToColumnName(inFilterField);
|
||||
return mapper().selectCount(new QueryWrapper<M>().in(column, inFilterValues)) == inFilterValues.size();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -391,8 +352,12 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (CollectionUtils.isEmpty(inFilterValues)) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
Example e = this.makeDefaultInListExample(inFilterField, inFilterValues, orderBy);
|
||||
return mapper().selectByExample(e);
|
||||
String column = this.safeMapToColumnName(inFilterField);
|
||||
QueryWrapper<M> queryWrapper = new QueryWrapper<M>().in(column, inFilterValues);
|
||||
if (StringUtils.isNotBlank(orderBy)) {
|
||||
queryWrapper.last(orderBy);
|
||||
}
|
||||
return mapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -403,16 +368,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public int getCountByFilter(M filter) {
|
||||
if (deletedFlagFieldName == null) {
|
||||
return mapper().selectCount(filter);
|
||||
}
|
||||
try {
|
||||
setDeletedFlagMethod.invoke(filter, GlobalDeletedFlag.NORMAL);
|
||||
return mapper().selectCount(filter);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to call reflection [setDeletedFlagMethod] in BaseService.getCountByFilter.", e);
|
||||
throw new MyRuntimeException(e);
|
||||
}
|
||||
return mapper().selectCount(new QueryWrapper<>(filter));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -434,42 +390,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public List<M> getListByFilter(M filter) {
|
||||
if (filter == null) {
|
||||
return this.getAllList();
|
||||
}
|
||||
if (deletedFlagFieldName == null) {
|
||||
return mapper().select(filter);
|
||||
}
|
||||
try {
|
||||
setDeletedFlagMethod.invoke(filter, GlobalDeletedFlag.NORMAL);
|
||||
return mapper().select(filter);
|
||||
} catch (Exception ex) {
|
||||
log.error("Failed to call reflection code of BaseService.getListByFilter.", ex);
|
||||
throw new MyRuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void assembleCriteriaByFilter(M filter, Field field, Example.Criteria c) {
|
||||
int modifiers = field.getModifiers();
|
||||
// transient类型的字段不能作为查询条件
|
||||
int transientMask = 128;
|
||||
if ((modifiers & transientMask) != 0 || Modifier.isStatic(modifiers)) {
|
||||
return;
|
||||
}
|
||||
if (field.getName().equals(deletedFlagFieldName)) {
|
||||
c.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
} else {
|
||||
ReflectUtil.setAccessible(field);
|
||||
try {
|
||||
Object o = field.get(filter);
|
||||
if (o != null) {
|
||||
c.andEqualTo(field.getName(), field.get(filter));
|
||||
}
|
||||
} catch (IllegalAccessException ex) {
|
||||
log.error("Failed to call reflection code of BaseService.getListByFilter.", ex);
|
||||
throw new MyRuntimeException(ex);
|
||||
}
|
||||
}
|
||||
return mapper().selectList(new QueryWrapper<>(filter));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -481,17 +402,14 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public List<M> getListByParentId(String parentIdFieldName, K parentId) {
|
||||
Example e = new Example(modelClass);
|
||||
Example.Criteria c = e.createCriteria();
|
||||
QueryWrapper<M> queryWrapper = new QueryWrapper<>();
|
||||
String parentIdColumn = this.safeMapToColumnName(parentIdFieldName);
|
||||
if (parentId != null) {
|
||||
c.andEqualTo(parentIdFieldName, parentId);
|
||||
queryWrapper.eq(parentIdColumn, parentId);
|
||||
} else {
|
||||
c.andIsNull(parentIdFieldName);
|
||||
queryWrapper.isNull(parentIdColumn);
|
||||
}
|
||||
if (deletedFlagFieldName != null) {
|
||||
c.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
}
|
||||
return mapper().selectByExample(e);
|
||||
return mapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -521,32 +439,21 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public List<M> getListByCondition(List<String> selectList, M filter, String whereClause, String orderBy) {
|
||||
Example e = new Example(modelClass);
|
||||
Example.Criteria c = null;
|
||||
QueryWrapper<M> queryWrapper = new QueryWrapper<>(filter);
|
||||
if (CollectionUtils.isNotEmpty(selectList)) {
|
||||
String[] selectFields = new String[selectList.size()];
|
||||
selectList.toArray(selectFields);
|
||||
e.selectProperties(selectFields);
|
||||
}
|
||||
if (StringUtils.isNotBlank(orderBy)) {
|
||||
e.setOrderByClause(orderBy);
|
||||
}
|
||||
if (filter != null) {
|
||||
c = e.createCriteria();
|
||||
Field[] fields = ReflectUtil.getFields(modelClass);
|
||||
for (Field field : fields) {
|
||||
if (field.getAnnotation(Transient.class) == null) {
|
||||
this.assembleCriteriaByFilter(filter, field, c);
|
||||
}
|
||||
String[] columns = new String[selectList.size()];
|
||||
for (int i = 0; i < selectList.size(); i++) {
|
||||
columns[i] = this.safeMapToColumnName(selectList.get(i));
|
||||
}
|
||||
queryWrapper.select(columns);
|
||||
}
|
||||
if (StringUtils.isNotBlank(whereClause)) {
|
||||
if (c == null) {
|
||||
c = e.createCriteria();
|
||||
}
|
||||
c.andCondition(whereClause);
|
||||
queryWrapper.apply(whereClause);
|
||||
}
|
||||
return mapper().selectByExample(e);
|
||||
if (StringUtils.isNotBlank(orderBy)) {
|
||||
queryWrapper.last(" ORDER BY " + orderBy);
|
||||
}
|
||||
return mapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -753,9 +660,10 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
continue;
|
||||
}
|
||||
Object masterIdValue = ReflectUtil.getFieldValue(dataObject, relationStruct.masterIdField);
|
||||
Example e = new Example(relationStruct.relationManyToMany.relationModelClass());
|
||||
e.createCriteria().andEqualTo(relationStruct.masterIdField.getName(), masterIdValue);
|
||||
List<?> manyToManyList = relationStruct.manyToManyMapper.selectByExample(e);
|
||||
String masterIdColumn = this.safeMapToColumnName(relationStruct.masterIdField.getName());
|
||||
Map<String, Object> filterMap = new HashMap<>(1);
|
||||
filterMap.put(masterIdColumn, masterIdValue);
|
||||
List<?> manyToManyList = relationStruct.manyToManyMapper.selectByMap(filterMap);
|
||||
ReflectUtil.setFieldValue(dataObject, relationStruct.relationField, manyToManyList);
|
||||
}
|
||||
}
|
||||
@@ -904,7 +812,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
.collect(toSet());
|
||||
// 从主表集合中,抽取主表关联字段的集合,再以in list形式去从表中查询。
|
||||
if (CollectionUtils.isNotEmpty(masterIdSet)) {
|
||||
BaseService<Object, Object> relationService = relationStruct.service;
|
||||
BaseService<Object, Serializable> relationService = relationStruct.service;
|
||||
List<Object> relationList =
|
||||
relationService.getInList(relationStruct.relationOneToOne.slaveIdField(), masterIdSet);
|
||||
MyModelUtil.makeOneToOneRelation(
|
||||
@@ -913,8 +821,8 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (withDict && relationStruct.relationOneToOne.loadSlaveDict()
|
||||
&& CollectionUtils.isNotEmpty(relationList)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
BaseService<Object, Object> proxyTarget =
|
||||
(BaseService<Object, Object>) AopTargetUtil.getTarget(relationService);
|
||||
BaseService<Object, Serializable> proxyTarget =
|
||||
(BaseService<Object, Serializable>) AopTargetUtil.getTarget(relationService);
|
||||
// 关联本地字典。
|
||||
proxyTarget.buildDictForDataList(relationList, false, ignoreFields);
|
||||
// 关联常量字典
|
||||
@@ -941,14 +849,14 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
}
|
||||
Object id = ReflectUtil.getFieldValue(dataObject, relationStruct.masterIdField);
|
||||
if (id != null) {
|
||||
BaseService<Object, Object> relationService = relationStruct.service;
|
||||
BaseService<Object, Serializable> relationService = relationStruct.service;
|
||||
Object relationObject = relationService.getOne(relationStruct.relationOneToOne.slaveIdField(), id);
|
||||
ReflectUtil.setFieldValue(dataObject, relationStruct.relationField, relationObject);
|
||||
// 仅仅当需要加载从表字典关联时,才去加载。
|
||||
if (withDict && relationStruct.relationOneToOne.loadSlaveDict() && relationObject != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
BaseService<Object, Object> proxyTarget =
|
||||
(BaseService<Object, Object>) AopTargetUtil.getTarget(relationService);
|
||||
BaseService<Object, Serializable> proxyTarget =
|
||||
(BaseService<Object, Serializable>) AopTargetUtil.getTarget(relationService);
|
||||
// 关联本地字典
|
||||
proxyTarget.buildDictForData(relationObject, false, ignoreFields);
|
||||
// 关联常量字典
|
||||
@@ -978,7 +886,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
.collect(toSet());
|
||||
// 从主表集合中,抽取主表关联字段的集合,再以in list形式去从表中查询。
|
||||
if (CollectionUtils.isNotEmpty(masterIdSet)) {
|
||||
BaseService<Object, Object> relationService = relationStruct.service;
|
||||
BaseService<Object, Serializable> relationService = relationStruct.service;
|
||||
List<Object> relationList =
|
||||
relationService.getInList(relationStruct.relationOneToMany.slaveIdField(), masterIdSet);
|
||||
MyModelUtil.makeOneToManyRelation(
|
||||
@@ -1003,7 +911,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
}
|
||||
Object id = ReflectUtil.getFieldValue(dataObject, relationStruct.masterIdField);
|
||||
if (id != null) {
|
||||
BaseService<Object, Object> relationService = relationStruct.service;
|
||||
BaseService<Object, Serializable> relationService = relationStruct.service;
|
||||
Set<Object> masterIdSet = new HashSet<>(1);
|
||||
masterIdSet.add(id);
|
||||
List<Object> relationObject = relationService.getInList(
|
||||
@@ -1289,32 +1197,97 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过(In-list)条件和orderBy条件,构建Example对象,以供后续的查询操作使用。
|
||||
* 因为Mybatis Plus中QueryWrapper的条件方法都要求传入数据表字段名,因此提供该函数将
|
||||
* Java实体对象的字段名转换为数据表字段名,如果不存在会抛出异常。
|
||||
* 另外在MyModelUtil.mapToColumnName有一级缓存,对于查询过的对象字段都会放到缓存中,
|
||||
* 下次映射转换的时候,会直接从缓存获取。
|
||||
*
|
||||
* @param inFilterField 参与(In-list)过滤的Java字段。
|
||||
* @param inFilterValues 参与(In-list)过滤的Java字段值集合。
|
||||
* @param orderBy 排序字段。
|
||||
* @param <T> in 属性字段的类型。
|
||||
* @return 构建后的Example对象。
|
||||
* @param fieldName Java实体对象的字段名。
|
||||
* @return 对应的数据表字段名。
|
||||
*/
|
||||
protected <T> Example makeDefaultInListExample(String inFilterField, Collection<T> inFilterValues, String orderBy) {
|
||||
Set<T> inFilterValueSet;
|
||||
Example e = new Example(modelClass);
|
||||
if (StringUtils.isNotBlank(orderBy)) {
|
||||
e.setOrderByClause(orderBy);
|
||||
protected String safeMapToColumnName(String fieldName) {
|
||||
String columnName = MyModelUtil.mapToColumnName(fieldName, modelClass);
|
||||
if (columnName == null) {
|
||||
throw new InvalidDataFieldException(modelClass.getSimpleName(), fieldName);
|
||||
}
|
||||
if (inFilterValues instanceof Set) {
|
||||
inFilterValueSet = (Set<T>) inFilterValues;
|
||||
} else {
|
||||
inFilterValueSet = new HashSet<>(inFilterValues.size());
|
||||
inFilterValueSet.addAll(inFilterValues);
|
||||
return columnName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 因为Mybatis Plus在update的时候,不能将实体对象中值为null的字段,更新为null,
|
||||
* 而且忽略更新,在全部更新场景下,这个是非常重要的,所以我们写了这个函数绕开这一问题。
|
||||
* 该函数会遍历实体对象中,所有不包含@Transient注解,没有transient修饰符的字段,如果
|
||||
* 当前对象的该字段值为null,则会调用UpdateWrapper的set方法,将该字段赋值为null。
|
||||
* 相比于其他重载方法,该方法会将参数中的主键id,设置到UpdateWrapper的过滤条件中。
|
||||
*
|
||||
* @param o 实体对象。
|
||||
* @param id 实体对象的主键值。
|
||||
* @return 创建后的UpdateWrapper。
|
||||
*/
|
||||
protected UpdateWrapper<M> createUpdateQueryForNullValue(M o, K id) {
|
||||
UpdateWrapper<M> uw = createUpdateQueryForNullValue(o, modelClass);
|
||||
try {
|
||||
M filter = modelClass.newInstance();
|
||||
this.setIdFieldMethod.invoke(filter, id);
|
||||
uw.setEntity(filter);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to call reflection code of BaseService.createUpdateQueryForNullValue.", e);
|
||||
throw new MyRuntimeException(e);
|
||||
}
|
||||
Example.Criteria c = e.createCriteria();
|
||||
c.andIn(inFilterField, inFilterValueSet);
|
||||
if (deletedFlagFieldName != null) {
|
||||
c.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
return uw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 因为Mybatis Plus在update的时候,不能将实体对象中值为null的字段,更新为null,
|
||||
* 而且忽略更新,在全部更新场景下,这个是非常重要的,所以我们写了这个函数绕开这一问题。
|
||||
* 该函数会遍历实体对象中,所有不包含@Transient注解,没有transient修饰符的字段,如果
|
||||
* 当前对象的该字段值为null,则会调用UpdateWrapper的set方法,将该字段赋值为null。
|
||||
*
|
||||
* @param o 实体对象。
|
||||
* @return 创建后的UpdateWrapper。
|
||||
*/
|
||||
protected UpdateWrapper<M> createUpdateQueryForNullValue(M o) {
|
||||
return createUpdateQueryForNullValue(o, modelClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* 因为Mybatis Plus在update的时候,不能将实体对象中值为null的字段,更新为null,
|
||||
* 而且忽略更新,在全部更新场景下,这个是非常重要的,所以我们写了这个函数绕开这一问题。
|
||||
* 该函数会遍历实体对象中,所有不包含@Transient注解,没有transient修饰符的字段,如果
|
||||
* 当前对象的该字段值为null,则会调用UpdateWrapper的set方法,将该字段赋值为null。
|
||||
*
|
||||
* @param o 实体对象。
|
||||
* @param clazz 实体对象的class。
|
||||
* @return 创建后的UpdateWrapper。
|
||||
*/
|
||||
public static <T> UpdateWrapper<T> createUpdateQueryForNullValue(T o, Class<T> clazz) {
|
||||
UpdateWrapper<T> uw = new UpdateWrapper<>();
|
||||
Field[] fields = ReflectUtil.getFields(clazz);
|
||||
List<String> nullColumnList = new LinkedList<>();
|
||||
for (Field field : fields) {
|
||||
TableField tableField = field.getAnnotation(TableField.class);
|
||||
if (tableField == null || tableField.exist()) {
|
||||
int modifiers = field.getModifiers();
|
||||
// transient类型的字段不能作为查询条件,静态字段和逻辑删除都不考虑。
|
||||
int transientMask = 128;
|
||||
if ((modifiers & transientMask) == 1
|
||||
|| Modifier.isStatic(modifiers)
|
||||
|| field.getAnnotation(TableLogic.class) != null) {
|
||||
continue;
|
||||
}
|
||||
// 仅当实体对象参数中,当前字段值为null的时候,才会赋值给UpdateWrapper。
|
||||
// 以便在后续的更新中,可以将这些null字段的值设置到数据库表对应的字段中。
|
||||
if (ReflectUtil.getFieldValue(o, field) == null) {
|
||||
nullColumnList.add(MyModelUtil.safeMapToColumnName(field.getName(), clazz));
|
||||
}
|
||||
}
|
||||
}
|
||||
return e;
|
||||
if (CollectionUtils.isNotEmpty(nullColumnList)) {
|
||||
for (String nullColumn : nullColumnList) {
|
||||
uw.set(nullColumn, null);
|
||||
}
|
||||
}
|
||||
return uw;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -1329,7 +1302,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
relationStruct.service = ApplicationContextHolder.getBean(
|
||||
StringUtils.uncapitalize(relationOneToOne.slaveServiceName()));
|
||||
} else {
|
||||
relationStruct.service = (BaseService<Object, Object>)
|
||||
relationStruct.service = (BaseService<Object, Serializable>)
|
||||
ApplicationContextHolder.getBean(relationOneToOne.slaveServiceClass());
|
||||
}
|
||||
relationOneToOneStructList.add(relationStruct);
|
||||
@@ -1345,7 +1318,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
relationStruct.service = ApplicationContextHolder.getBean(
|
||||
StringUtils.uncapitalize(relationOneToMany.slaveServiceName()));
|
||||
} else {
|
||||
relationStruct.service = (BaseService<Object, Object>)
|
||||
relationStruct.service = (BaseService<Object, Serializable>)
|
||||
ApplicationContextHolder.getBean(relationOneToMany.slaveServiceClass());
|
||||
}
|
||||
relationOneToManyStructList.add(relationStruct);
|
||||
@@ -1375,7 +1348,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
relationStruct.service = ApplicationContextHolder.getBean(
|
||||
StringUtils.uncapitalize(relationOneToManyAggregation.slaveServiceName()));
|
||||
} else {
|
||||
relationStruct.service = (BaseService<Object, Object>)
|
||||
relationStruct.service = (BaseService<Object, Serializable>)
|
||||
ApplicationContextHolder.getBean(relationOneToManyAggregation.slaveServiceClass());
|
||||
}
|
||||
relationOneToManyAggrStructList.add(relationStruct);
|
||||
@@ -1391,7 +1364,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
relationStruct.service = ApplicationContextHolder.getBean(
|
||||
StringUtils.uncapitalize(relationManyToManyAggregation.slaveServiceName()));
|
||||
} else {
|
||||
relationStruct.service = (BaseService<Object, Object>)
|
||||
relationStruct.service = (BaseService<Object, Serializable>)
|
||||
ApplicationContextHolder.getBean(relationManyToManyAggregation.slaveServiceClass());
|
||||
}
|
||||
relationManyToManyAggrStructList.add(relationStruct);
|
||||
@@ -1424,7 +1397,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
relationStruct.service = ApplicationContextHolder.getBean(
|
||||
StringUtils.uncapitalize(relationDict.slaveServiceName()));
|
||||
} else {
|
||||
relationStruct.service = (BaseService<Object, Object>)
|
||||
relationStruct.service = (BaseService<Object, Serializable>)
|
||||
ApplicationContextHolder.getBean(relationDict.slaveServiceClass());
|
||||
}
|
||||
relationDictStructList.add(relationStruct);
|
||||
@@ -1621,7 +1594,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
private Field relationField;
|
||||
private Field masterIdField;
|
||||
private Field equalOneToOneRelationField;
|
||||
private BaseService<Object, Object> service;
|
||||
private BaseService<Object, Serializable> service;
|
||||
private BaseDaoMapper<Object> manyToManyMapper;
|
||||
private Map<Object, String> dictMap;
|
||||
private RelationDict relationDict;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.common.core.base.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -10,7 +11,7 @@ import java.util.List;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface IBaseDictService<M, K> extends IBaseService<M, K> {
|
||||
public interface IBaseDictService<M, K extends Serializable> extends IBaseService<M, K> {
|
||||
|
||||
/**
|
||||
* 重新加载数据库中所有当前表数据到系统内存。
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.orange.demo.common.core.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.orange.demo.common.core.object.MyRelationParam;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -12,15 +14,15 @@ import java.util.*;
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface IBaseService<M, K> {
|
||||
public interface IBaseService<M, K extends Serializable> extends IService<M>{
|
||||
|
||||
/**
|
||||
* 基于主键Id删除数据。如果包含逻辑删除字段,则进行逻辑删除。
|
||||
* 根据过滤条件删除数据。
|
||||
*
|
||||
* @param id 主键Id值。
|
||||
* @return true删除成功,false数据不存在。
|
||||
* @param filter 过滤对象。
|
||||
* @return 删除数量。
|
||||
*/
|
||||
boolean removeById(K id);
|
||||
Integer removeBy(M filter);
|
||||
|
||||
/**
|
||||
* 判断指定字段的数据是否存在,且仅仅存在一条记录。
|
||||
@@ -40,14 +42,6 @@ public interface IBaseService<M, K> {
|
||||
*/
|
||||
boolean existId(K id);
|
||||
|
||||
/**
|
||||
* 获取主键Id关联的数据。
|
||||
*
|
||||
* @param id 主键Id。
|
||||
* @return 主键关联的数据,不存在返回null。
|
||||
*/
|
||||
M getById(K id);
|
||||
|
||||
/**
|
||||
* 返回符合 filterField = filterValue 条件的一条数据。
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user