mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 18:46:36 +08:00
commit:单体工程目录
This commit is contained in:
26
orange-demo-single/orange-demo-single-service/.gitignore
vendored
Normal file
26
orange-demo-single/orange-demo-single-service/.gitignore
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
/.mvn/*
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/build/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
17
orange-demo-single/orange-demo-single-service/README.md
Normal file
17
orange-demo-single/orange-demo-single-service/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
### 服务接口文档
|
||||
---
|
||||
- Knife4j
|
||||
- 服务启动后,Knife4j的文档入口地址 [http://localhost:8082/doc.html#/plus](http://localhost:8082/doc.html#/plus)
|
||||
- Postman
|
||||
- 无需启动服务,即可将当前工程的接口导出成Postman格式。在工程的common/common-tools/模块下,找到ExportApiApp文件,并执行main函数。
|
||||
|
||||
### 服务启动环境依赖
|
||||
---
|
||||
|
||||
执行docker-compose up -d 命令启动下面依赖的服务。
|
||||
执行docker-compose down 命令停止下面服务。
|
||||
|
||||
- Redis
|
||||
- 版本:4
|
||||
- 端口: 6379
|
||||
- 推荐客户端工具 [AnotherRedisDesktopManager](https://github.com/qishibo/AnotherRedisDesktopManager)
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.orange.demo</groupId>
|
||||
<artifactId>OrangeSingleDemo</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>application-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>application-common</name>
|
||||
<packaging>jar</packaging>
|
||||
</project>
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orange.demo.application.common.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 设备类型常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public final class DeviceType {
|
||||
|
||||
/**
|
||||
* iOS。
|
||||
*/
|
||||
public static final int IOS = 0;
|
||||
/**
|
||||
* Android。
|
||||
*/
|
||||
public static final int ANDROID = 1;
|
||||
/**
|
||||
* PC。
|
||||
*/
|
||||
public static final int PC = 2;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(3);
|
||||
static {
|
||||
DICT_MAP.put(IOS, "iOS");
|
||||
DICT_MAP.put(ANDROID, "Android");
|
||||
DICT_MAP.put(PC, "PC");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private DeviceType() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orange.demo.application.common.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 经验等级常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public final class ExpLevel {
|
||||
|
||||
/**
|
||||
* 初级学员。
|
||||
*/
|
||||
public static final int LOWER = 0;
|
||||
/**
|
||||
* 中级学员。
|
||||
*/
|
||||
public static final int MIDDLE = 1;
|
||||
/**
|
||||
* 高级学员。
|
||||
*/
|
||||
public static final int HIGH = 2;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(3);
|
||||
static {
|
||||
DICT_MAP.put(LOWER, "初级学员");
|
||||
DICT_MAP.put(MIDDLE, "中级学员");
|
||||
DICT_MAP.put(HIGH, "高级学员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private ExpLevel() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.orange.demo.application.common.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 性别常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public final class Gender {
|
||||
|
||||
/**
|
||||
* 男。
|
||||
*/
|
||||
public static final int MALE = 1;
|
||||
/**
|
||||
* 女。
|
||||
*/
|
||||
public static final int FEMALE = 0;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(2);
|
||||
static {
|
||||
DICT_MAP.put(MALE, "男");
|
||||
DICT_MAP.put(FEMALE, "女");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private Gender() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.orange.demo.application.common.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 学生行为常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public final class StudentActionType {
|
||||
|
||||
/**
|
||||
* 充值。
|
||||
*/
|
||||
public static final int RECHARGE = 0;
|
||||
/**
|
||||
* 购课。
|
||||
*/
|
||||
public static final int BUY_COURSE = 1;
|
||||
/**
|
||||
* 上课签到。
|
||||
*/
|
||||
public static final int SIGNIN_COURSE = 2;
|
||||
/**
|
||||
* 上课签退。
|
||||
*/
|
||||
public static final int SIGNOUT_COURSE = 3;
|
||||
/**
|
||||
* 看视频课。
|
||||
*/
|
||||
public static final int WATCH_VIDEO = 4;
|
||||
/**
|
||||
* 做作业。
|
||||
*/
|
||||
public static final int DO_PAPER = 5;
|
||||
/**
|
||||
* 刷题。
|
||||
*/
|
||||
public static final int REFRESH_EXERCISE = 6;
|
||||
/**
|
||||
* 献花。
|
||||
*/
|
||||
public static final int PRESENT_FLOWER = 7;
|
||||
/**
|
||||
* 购买视频。
|
||||
*/
|
||||
public static final int BUY_VIDEO_COURSE = 8;
|
||||
/**
|
||||
* 购买鲜花。
|
||||
*/
|
||||
public static final int BUY_FLOWER = 9;
|
||||
/**
|
||||
* 购买作业。
|
||||
*/
|
||||
public static final int BUY_PAPER = 10;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(11);
|
||||
static {
|
||||
DICT_MAP.put(RECHARGE, "充值");
|
||||
DICT_MAP.put(BUY_COURSE, "购课");
|
||||
DICT_MAP.put(SIGNIN_COURSE, "上课签到");
|
||||
DICT_MAP.put(SIGNOUT_COURSE, "上课签退");
|
||||
DICT_MAP.put(WATCH_VIDEO, "看视频课");
|
||||
DICT_MAP.put(DO_PAPER, "做作业");
|
||||
DICT_MAP.put(REFRESH_EXERCISE, "刷题");
|
||||
DICT_MAP.put(PRESENT_FLOWER, "献花");
|
||||
DICT_MAP.put(BUY_VIDEO_COURSE, "购买视频");
|
||||
DICT_MAP.put(BUY_FLOWER, "购买鲜花");
|
||||
DICT_MAP.put(BUY_PAPER, "购买作业");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private StudentActionType() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orange.demo.application.common.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 学生状态常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public final class StudentStatus {
|
||||
|
||||
/**
|
||||
* 正常。
|
||||
*/
|
||||
public static final int NORMAL = 0;
|
||||
/**
|
||||
* 锁定。
|
||||
*/
|
||||
public static final int LOCKED = 1;
|
||||
/**
|
||||
* 注销。
|
||||
*/
|
||||
public static final int DELETED = 2;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(3);
|
||||
static {
|
||||
DICT_MAP.put(NORMAL, "正常");
|
||||
DICT_MAP.put(LOCKED, "锁定");
|
||||
DICT_MAP.put(DELETED, "注销");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private StudentStatus() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orange.demo.application.common.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 学科常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public final class Subject {
|
||||
|
||||
/**
|
||||
* 语文。
|
||||
*/
|
||||
public static final int CHINESE = 0;
|
||||
/**
|
||||
* 数学。
|
||||
*/
|
||||
public static final int MATCH = 1;
|
||||
/**
|
||||
* 英语。
|
||||
*/
|
||||
public static final int ENGLISH = 2;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(3);
|
||||
static {
|
||||
DICT_MAP.put(CHINESE, "语文");
|
||||
DICT_MAP.put(MATCH, "数学");
|
||||
DICT_MAP.put(ENGLISH, "英语");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private Subject() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.orange.demo</groupId>
|
||||
<artifactId>OrangeSingleDemo</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>application-webadmin</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>application</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<!-- 业务组件依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.orange.demo</groupId>
|
||||
<artifactId>common-redis</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.orange.demo</groupId>
|
||||
<artifactId>common-sequence</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.orange.demo</groupId>
|
||||
<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>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.orange.demo.webadmin;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* 应用服务启动类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@EnableAsync
|
||||
@SpringBootApplication
|
||||
@ComponentScan("com.orange.demo")
|
||||
public class WebAdminApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WebAdminApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
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;
|
||||
import com.orange.demo.common.core.object.ResponseResult;
|
||||
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 行政区划数据访问接口类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "行政区划数据访问接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/areaCode")
|
||||
public class AreaCodeController {
|
||||
|
||||
@Autowired
|
||||
private AreaCodeService areaCodeService;
|
||||
|
||||
/**
|
||||
* 按照字典的形式返回行政区划列表。
|
||||
*
|
||||
* @return 字典形式的行政区划列表。
|
||||
*/
|
||||
@GetMapping("/listDict")
|
||||
public ResponseResult<List<Map<String, Object>>> listDict() {
|
||||
List<AreaCode> resultList = areaCodeService.getAllListFromCache();
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"parentId as parentId", "areaId as id", "areaName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据上级行政区划Id获取其下级行政区划列表。
|
||||
*
|
||||
* @param parentId 上级行政区划Id。
|
||||
* @return 按照字典的形式返回下级行政区划列表。
|
||||
*/
|
||||
@GetMapping("/listDictByParentId")
|
||||
public ResponseResult<List<Map<String, Object>>> listDictByParentId(@RequestParam(required = false) Long parentId) {
|
||||
Collection<AreaCode> resultList = areaCodeService.getListByParentId(parentId);
|
||||
if (CollectionUtils.isEmpty(resultList)) {
|
||||
return ResponseResult.success(new LinkedList<>());
|
||||
}
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"parentId as parentId", "areaId as id", "areaName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典Id集合,获取查询后的字典数据。
|
||||
*
|
||||
* @param dictIds 字典Id集合。
|
||||
* @return 字典形式的行政区划列表。
|
||||
*/
|
||||
@PostMapping("/listDictByIds")
|
||||
public ResponseResult<List<Map<String, Object>>> listDictByIds(
|
||||
@MyRequestBody(elementType = Long.class) List<Long> dictIds) {
|
||||
List<AreaCode> resultList = areaCodeService.getInList(new HashSet<>(dictIds));
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"parentId as parentId", "areaId as id", "areaName as name").executeFrom(resultList));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
package com.orange.demo.webadmin.app.controller;
|
||||
|
||||
import cn.jimmyshi.beanquery.BeanQuery;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.orange.demo.common.core.upload.BaseUpDownloader;
|
||||
import com.orange.demo.common.core.upload.UpDownloaderFactory;
|
||||
import com.orange.demo.common.core.upload.UploadResponseInfo;
|
||||
import com.orange.demo.common.core.upload.UploadStoreInfo;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.orange.demo.webadmin.app.vo.*;
|
||||
import com.orange.demo.webadmin.app.dto.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
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 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.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 课程数据操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "课程数据管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/course")
|
||||
public class CourseController {
|
||||
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private ApplicationConfig appConfig;
|
||||
@Autowired
|
||||
private SessionCacheHelper cacheHelper;
|
||||
@Autowired
|
||||
private UpDownloaderFactory upDownloaderFactory;
|
||||
|
||||
/**
|
||||
* 新增课程数据数据。
|
||||
*
|
||||
* @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);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
Course course = MyModelUtil.copyTo(courseDto, Course.class);
|
||||
// 验证关联Id的数据合法性
|
||||
CallResult callResult = courseService.verifyRelatedData(course, null);
|
||||
if (!callResult.isSuccess()) {
|
||||
errorMessage = callResult.getErrorMessage();
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
course = courseService.saveNew(course);
|
||||
return ResponseResult.success(course.getCourseId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新课程数据数据。
|
||||
*
|
||||
* @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);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
Course course = MyModelUtil.copyTo(courseDto, Course.class);
|
||||
Course originalCourse = courseService.getById(course.getCourseId());
|
||||
if (originalCourse == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
CallResult callResult = courseService.verifyRelatedData(course, originalCourse);
|
||||
if (!callResult.isSuccess()) {
|
||||
errorMessage = callResult.getErrorMessage();
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
if (!courseService.update(course, originalCourse)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程数据数据。
|
||||
*
|
||||
* @param courseId 删除对象主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long courseId) {
|
||||
String errorMessage;
|
||||
if (MyCommonUtil.existBlankArgument(courseId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
Course originalCourse = courseService.getById(courseId);
|
||||
if (originalCourse == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
if (!courseService.remove(courseId)) {
|
||||
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出符合过滤条件的课程数据列表。
|
||||
*
|
||||
* @param courseDtoFilter 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<CourseVo>> list(
|
||||
@MyRequestBody CourseDto courseDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
Course courseFilter = MyModelUtil.copyTo(courseDtoFilter, Course.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, Course.class);
|
||||
List<Course> courseList = courseService.getCourseListWithRelation(courseFilter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(courseList, Course.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看指定课程数据对象详情。
|
||||
*
|
||||
* @param courseId 指定对象主键Id。
|
||||
* @return 应答结果对象,包含对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<CourseVo> view(@RequestParam Long courseId) {
|
||||
if (MyCommonUtil.existBlankArgument(courseId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
Course course = courseService.getByIdWithRelation(courseId, MyRelationParam.full());
|
||||
if (course == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
CourseVo courseVo = Course.INSTANCE.fromModel(course);
|
||||
return ResponseResult.success(courseVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 附件文件下载。
|
||||
* 这里将图片和其他类型的附件文件放到不同的父目录下,主要为了便于今后图片文件的迁移。
|
||||
*
|
||||
* @param courseId 附件所在记录的主键Id。
|
||||
* @param fieldName 附件所属的字段名。
|
||||
* @param filename 文件名。如果没有提供该参数,就从当前记录的指定字段中读取。
|
||||
* @param asImage 下载文件是否为图片。
|
||||
* @param response Http 应答对象。
|
||||
*/
|
||||
@GetMapping("/download")
|
||||
public void download(
|
||||
@RequestParam(required = false) Long courseId,
|
||||
@RequestParam String fieldName,
|
||||
@RequestParam String filename,
|
||||
@RequestParam Boolean asImage,
|
||||
HttpServletResponse response) {
|
||||
if (MyCommonUtil.existBlankArgument(fieldName, filename, asImage)) {
|
||||
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
return;
|
||||
}
|
||||
// 使用try来捕获异常,是为了保证一旦出现异常可以返回500的错误状态,便于调试。
|
||||
// 否则有可能给前端返回的是200的错误码。
|
||||
try {
|
||||
// 如果请求参数中没有包含主键Id,就判断该文件是否为当前session上传的。
|
||||
if (courseId == null) {
|
||||
if (!cacheHelper.existSessionUploadFile(filename)) {
|
||||
ResponseResult.output(HttpServletResponse.SC_FORBIDDEN);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Course course = courseService.getById(courseId);
|
||||
if (course == null) {
|
||||
ResponseResult.output(HttpServletResponse.SC_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
String fieldJsonData = (String) ReflectUtil.getFieldValue(course, fieldName);
|
||||
if (fieldJsonData == null) {
|
||||
ResponseResult.output(HttpServletResponse.SC_BAD_REQUEST);
|
||||
return;
|
||||
}
|
||||
if (!BaseUpDownloader.containFile(fieldJsonData, filename)) {
|
||||
ResponseResult.output(HttpServletResponse.SC_FORBIDDEN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
UploadStoreInfo storeInfo = MyModelUtil.getUploadStoreInfo(Course.class, fieldName);
|
||||
if (!storeInfo.isSupportUpload()) {
|
||||
ResponseResult.output(HttpServletResponse.SC_NOT_IMPLEMENTED,
|
||||
ResponseResult.error(ErrorCodeEnum.INVALID_UPLOAD_FIELD));
|
||||
return;
|
||||
}
|
||||
BaseUpDownloader upDownloader = upDownloaderFactory.get(storeInfo.getStoreType());
|
||||
upDownloader.doDownload(appConfig.getUploadFileBaseDir(),
|
||||
Course.class.getSimpleName(), fieldName, filename, asImage, response);
|
||||
} catch (Exception e) {
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传操作。
|
||||
*
|
||||
* @param fieldName 上传文件名。
|
||||
* @param asImage 是否作为图片上传。如果是图片,今后下载的时候无需权限验证。否则就是附件上传,下载时需要权限验证。
|
||||
* @param uploadFile 上传文件对象。
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public void upload(
|
||||
@RequestParam String fieldName,
|
||||
@RequestParam Boolean asImage,
|
||||
@RequestParam("uploadFile") MultipartFile uploadFile) throws Exception {
|
||||
UploadStoreInfo storeInfo = MyModelUtil.getUploadStoreInfo(Course.class, fieldName);
|
||||
// 这里就会判断参数中指定的字段,是否支持上传操作。
|
||||
if (!storeInfo.isSupportUpload()) {
|
||||
ResponseResult.output(HttpServletResponse.SC_FORBIDDEN,
|
||||
ResponseResult.error(ErrorCodeEnum.INVALID_UPLOAD_FIELD));
|
||||
return;
|
||||
}
|
||||
// 根据字段注解中的存储类型,通过工厂方法获取匹配的上传下载实现类,从而解耦。
|
||||
BaseUpDownloader upDownloader = upDownloaderFactory.get(storeInfo.getStoreType());
|
||||
UploadResponseInfo responseInfo = upDownloader.doUpload(null,
|
||||
appConfig.getUploadFileBaseDir(), Course.class.getSimpleName(), fieldName, asImage, uploadFile);
|
||||
if (responseInfo.getUploadFailed()) {
|
||||
ResponseResult.output(HttpServletResponse.SC_FORBIDDEN,
|
||||
ResponseResult.error(ErrorCodeEnum.UPLOAD_FAILED, responseInfo.getErrorMessage()));
|
||||
return;
|
||||
}
|
||||
cacheHelper.putSessionUploadFile(responseInfo.getFilename());
|
||||
ResponseResult.output(ResponseResult.success(responseInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 以字典形式返回全部课程数据数据集合。字典的键值为[courseId, courseName]。
|
||||
* 白名单接口,登录用户均可访问。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @return 应答结果对象,包含的数据为 List<Map<String, String>>,map中包含两条记录,key的值分别是id和name,value对应具体数据。
|
||||
*/
|
||||
@GetMapping("/listDict")
|
||||
public ResponseResult<List<Map<String, Object>>> listDict(Course filter) {
|
||||
List<Course> resultList = courseService.getListByFilter(filter);
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"courseId as id", "courseName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典Id集合,获取查询后的字典数据。
|
||||
*
|
||||
* @param dictIds 字典Id集合。
|
||||
* @return 应答结果对象,包含字典形式的数据集合。
|
||||
*/
|
||||
@PostMapping("/listDictByIds")
|
||||
public ResponseResult<List<Map<String, Object>>> listDictByIds(
|
||||
@MyRequestBody(elementType = Long.class) List<Long> dictIds) {
|
||||
List<Course> resultList = courseService.getInList(new HashSet<>(dictIds));
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"courseId as id", "courseName as name").executeFrom(resultList));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.orange.demo.webadmin.app.controller;
|
||||
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.orange.demo.webadmin.app.vo.*;
|
||||
import com.orange.demo.webadmin.app.dto.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
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.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 课程统计操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "课程统计管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/courseTransStats")
|
||||
public class CourseTransStatsController {
|
||||
|
||||
@Autowired
|
||||
private CourseTransStatsService courseTransStatsService;
|
||||
|
||||
/**
|
||||
* 列出符合过滤条件的课程统计列表。
|
||||
*
|
||||
* @param courseTransStatsDtoFilter 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<CourseTransStatsVo>> list(
|
||||
@MyRequestBody CourseTransStatsDto courseTransStatsDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
CourseTransStats courseTransStatsFilter = MyModelUtil.copyTo(courseTransStatsDtoFilter, CourseTransStats.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, CourseTransStats.class);
|
||||
List<CourseTransStats> courseTransStatsList = courseTransStatsService.getCourseTransStatsListWithRelation(courseTransStatsFilter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(courseTransStatsList, CourseTransStats.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分组列出符合过滤条件的课程统计列表。
|
||||
*
|
||||
* @param courseTransStatsDtoFilter 过滤对象。
|
||||
* @param groupParam 分组参数。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/listWithGroup")
|
||||
public ResponseResult<MyPageData<CourseTransStatsVo>> listWithGroup(
|
||||
@MyRequestBody CourseTransStatsDto courseTransStatsDtoFilter,
|
||||
@MyRequestBody(required = true) MyGroupParam groupParam,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, CourseTransStats.class);
|
||||
groupParam = MyGroupParam.buildGroupBy(groupParam, CourseTransStats.class);
|
||||
if (groupParam == null) {
|
||||
return ResponseResult.error(
|
||||
ErrorCodeEnum.INVALID_ARGUMENT_FORMAT, "数据参数错误,分组参数不能为空!");
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
CourseTransStats filter = MyModelUtil.copyTo(courseTransStatsDtoFilter, CourseTransStats.class);
|
||||
MyGroupCriteria criteria = groupParam.getGroupCriteria();
|
||||
List<CourseTransStats> resultList = courseTransStatsService.getGroupedCourseTransStatsListWithRelation(
|
||||
filter, criteria.getGroupSelect(), criteria.getGroupBy(), orderBy);
|
||||
// 分页连同对象数据转换copy工作,下面的方法一并完成。
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(resultList, CourseTransStats.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看指定课程统计对象详情。
|
||||
*
|
||||
* @param statsId 指定对象主键Id。
|
||||
* @return 应答结果对象,包含对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<CourseTransStatsVo> view(@RequestParam Long statsId) {
|
||||
if (MyCommonUtil.existBlankArgument(statsId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
CourseTransStats courseTransStats = courseTransStatsService.getByIdWithRelation(statsId, MyRelationParam.full());
|
||||
if (courseTransStats == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
CourseTransStatsVo courseTransStatsVo = CourseTransStats.INSTANCE.fromModel(courseTransStats);
|
||||
return ResponseResult.success(courseTransStatsVo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.orange.demo.webadmin.app.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import cn.jimmyshi.beanquery.BeanQuery;
|
||||
import com.orange.demo.webadmin.app.dto.GradeDto;
|
||||
import com.orange.demo.webadmin.app.model.Grade;
|
||||
import com.orange.demo.webadmin.app.service.GradeService;
|
||||
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.orange.demo.common.core.util.MyModelUtil;
|
||||
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;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 年级操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "年级管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/grade")
|
||||
public class GradeController {
|
||||
|
||||
@Autowired
|
||||
private GradeService gradeService;
|
||||
|
||||
/**
|
||||
* 新增年级数据。
|
||||
*
|
||||
* @param gradeDto 新增对象。
|
||||
* @return 应答结果对象,包含新增对象主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"gradeDto.gradeId"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Integer> add(@MyRequestBody GradeDto gradeDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(gradeDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
Grade grade = MyModelUtil.copyTo(gradeDto, Grade.class);
|
||||
grade = gradeService.saveNew(grade);
|
||||
return ResponseResult.success(grade.getGradeId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新年级数据。
|
||||
*
|
||||
* @param gradeDto 更新对象。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(@MyRequestBody GradeDto gradeDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(gradeDto, Default.class, UpdateGroup.class);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
Grade grade = MyModelUtil.copyTo(gradeDto, Grade.class);
|
||||
Grade originalGrade = gradeService.getById(grade.getGradeId());
|
||||
if (originalGrade == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
if (!gradeService.update(grade, originalGrade)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除年级数据。
|
||||
*
|
||||
* @param gradeId 删除对象主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Integer gradeId) {
|
||||
if (MyCommonUtil.existBlankArgument(gradeId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!gradeService.remove(gradeId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 白名单接口,登录用户均可访问。以字典形式返回全部年级数据集合。
|
||||
* 所有数据全部取自于缓存,对于数据库中存在,但是缓存中不存在的数据,不会返回。
|
||||
*
|
||||
* @return 应答结果对象,包含字典形式的数据集合。
|
||||
*/
|
||||
@GetMapping("/listDict")
|
||||
public ResponseResult<List<Map<String, Object>>> listDict() {
|
||||
List<Grade> resultList = gradeService.getAllListFromCache();
|
||||
if (CollectionUtils.isEmpty(resultList)) {
|
||||
gradeService.reloadCachedData(true);
|
||||
resultList = gradeService.getAllList();
|
||||
}
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"gradeId as id", "gradeName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 白名单接口,登录用户均可访问。以字典形式返回全部年级数据集合。
|
||||
* fullResultList中的字典列表全部取自于数据库,而cachedResultList全部取自于缓存,前端负责比对。
|
||||
*
|
||||
* @return 应答结果对象,包含字典形式的数据集合。
|
||||
*/
|
||||
@GetMapping("/listAll")
|
||||
public ResponseResult<JSONObject> listAll() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("fullResultList", BeanQuery.select(
|
||||
"gradeId as id", "gradeName as name").executeFrom(gradeService.getAllList()));
|
||||
jsonObject.put("cachedResultList", BeanQuery.select(
|
||||
"gradeId as id", "gradeName as name").executeFrom(gradeService.getAllListFromCache()));
|
||||
return ResponseResult.success(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典Id集合,获取查询后的字典数据。
|
||||
*
|
||||
* @param dictIds 字典Id集合。
|
||||
* @return 应答结果对象,包含字典形式的数据集合。
|
||||
*/
|
||||
@PostMapping("/listDictByIds")
|
||||
public ResponseResult<List<Map<String, Object>>> listDictByIds(
|
||||
@MyRequestBody(elementType = Integer.class) List<Integer> dictIds) {
|
||||
List<Grade> resultList = gradeService.getInList(new HashSet<>(dictIds));
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"gradeId as id", "gradeName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将当前字典表的数据重新加载到缓存中。
|
||||
* 由于缓存的数据更新,在add/update/delete等接口均有同步处理。因此该接口仅当同步过程中出现问题时,
|
||||
* 可手工调用,或者每天晚上定时同步一次。
|
||||
*/
|
||||
@GetMapping("/reloadCachedData")
|
||||
public ResponseResult<Boolean> reloadCachedData() {
|
||||
gradeService.reloadCachedData(true);
|
||||
return ResponseResult.success(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package com.orange.demo.webadmin.app.controller;
|
||||
|
||||
import cn.jimmyshi.beanquery.BeanQuery;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.orange.demo.webadmin.app.vo.*;
|
||||
import com.orange.demo.webadmin.app.dto.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
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 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.*;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 校区数据操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "校区数据管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/schoolInfo")
|
||||
public class SchoolInfoController {
|
||||
|
||||
@Autowired
|
||||
private SchoolInfoService schoolInfoService;
|
||||
|
||||
/**
|
||||
* 新增校区数据数据。
|
||||
*
|
||||
* @param schoolInfoDto 新增对象。
|
||||
* @return 应答结果对象,包含新增对象主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"schoolInfoDto.schoolId"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody SchoolInfoDto schoolInfoDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(schoolInfoDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SchoolInfo schoolInfo = MyModelUtil.copyTo(schoolInfoDto, SchoolInfo.class);
|
||||
// 验证关联Id的数据合法性
|
||||
CallResult callResult = schoolInfoService.verifyRelatedData(schoolInfo, null);
|
||||
if (!callResult.isSuccess()) {
|
||||
errorMessage = callResult.getErrorMessage();
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
schoolInfo = schoolInfoService.saveNew(schoolInfo);
|
||||
return ResponseResult.success(schoolInfo.getSchoolId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新校区数据数据。
|
||||
*
|
||||
* @param schoolInfoDto 更新对象。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(@MyRequestBody SchoolInfoDto schoolInfoDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(schoolInfoDto, Default.class, UpdateGroup.class);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SchoolInfo schoolInfo = MyModelUtil.copyTo(schoolInfoDto, SchoolInfo.class);
|
||||
SchoolInfo originalSchoolInfo = schoolInfoService.getById(schoolInfo.getSchoolId());
|
||||
if (originalSchoolInfo == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
CallResult callResult = schoolInfoService.verifyRelatedData(schoolInfo, originalSchoolInfo);
|
||||
if (!callResult.isSuccess()) {
|
||||
errorMessage = callResult.getErrorMessage();
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
if (!schoolInfoService.update(schoolInfo, originalSchoolInfo)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除校区数据数据。
|
||||
*
|
||||
* @param schoolId 删除对象主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long schoolId) {
|
||||
String errorMessage;
|
||||
if (MyCommonUtil.existBlankArgument(schoolId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
SchoolInfo originalSchoolInfo = schoolInfoService.getById(schoolId);
|
||||
if (originalSchoolInfo == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
if (!schoolInfoService.remove(schoolId)) {
|
||||
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出符合过滤条件的校区数据列表。
|
||||
*
|
||||
* @param schoolInfoDtoFilter 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<SchoolInfoVo>> list(
|
||||
@MyRequestBody SchoolInfoDto schoolInfoDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SchoolInfo schoolInfoFilter = MyModelUtil.copyTo(schoolInfoDtoFilter, SchoolInfo.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SchoolInfo.class);
|
||||
List<SchoolInfo> schoolInfoList = schoolInfoService.getSchoolInfoListWithRelation(schoolInfoFilter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(schoolInfoList, SchoolInfo.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看指定校区数据对象详情。
|
||||
*
|
||||
* @param schoolId 指定对象主键Id。
|
||||
* @return 应答结果对象,包含对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<SchoolInfoVo> view(@RequestParam Long schoolId) {
|
||||
if (MyCommonUtil.existBlankArgument(schoolId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
SchoolInfo schoolInfo = schoolInfoService.getByIdWithRelation(schoolId, MyRelationParam.full());
|
||||
if (schoolInfo == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
SchoolInfoVo schoolInfoVo = SchoolInfo.INSTANCE.fromModel(schoolInfo);
|
||||
return ResponseResult.success(schoolInfoVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 以字典形式返回全部校区数据数据集合。字典的键值为[schoolId, schoolName]。
|
||||
* 白名单接口,登录用户均可访问。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @return 应答结果对象,包含的数据为 List<Map<String, String>>,map中包含两条记录,key的值分别是id和name,value对应具体数据。
|
||||
*/
|
||||
@GetMapping("/listDict")
|
||||
public ResponseResult<List<Map<String, Object>>> listDict(SchoolInfo filter) {
|
||||
List<SchoolInfo> resultList = schoolInfoService.getListByFilter(filter);
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"schoolId as id", "schoolName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典Id集合,获取查询后的字典数据。
|
||||
*
|
||||
* @param dictIds 字典Id集合。
|
||||
* @return 应答结果对象,包含字典形式的数据集合。
|
||||
*/
|
||||
@PostMapping("/listDictByIds")
|
||||
public ResponseResult<List<Map<String, Object>>> listDictByIds(
|
||||
@MyRequestBody(elementType = Long.class) List<Long> dictIds) {
|
||||
List<SchoolInfo> resultList = schoolInfoService.getInList(new HashSet<>(dictIds));
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"schoolId as id", "schoolName as name").executeFrom(resultList));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.orange.demo.webadmin.app.controller;
|
||||
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.orange.demo.webadmin.app.vo.*;
|
||||
import com.orange.demo.webadmin.app.dto.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
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.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生行为统计操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "学生行为统计管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/studentActionStats")
|
||||
public class StudentActionStatsController {
|
||||
|
||||
@Autowired
|
||||
private StudentActionStatsService studentActionStatsService;
|
||||
|
||||
/**
|
||||
* 列出符合过滤条件的学生行为统计列表。
|
||||
*
|
||||
* @param studentActionStatsDtoFilter 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<StudentActionStatsVo>> list(
|
||||
@MyRequestBody StudentActionStatsDto studentActionStatsDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
StudentActionStats studentActionStatsFilter = MyModelUtil.copyTo(studentActionStatsDtoFilter, StudentActionStats.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, StudentActionStats.class);
|
||||
List<StudentActionStats> studentActionStatsList = studentActionStatsService.getStudentActionStatsListWithRelation(studentActionStatsFilter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(studentActionStatsList, StudentActionStats.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分组列出符合过滤条件的学生行为统计列表。
|
||||
*
|
||||
* @param studentActionStatsDtoFilter 过滤对象。
|
||||
* @param groupParam 分组参数。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/listWithGroup")
|
||||
public ResponseResult<MyPageData<StudentActionStatsVo>> listWithGroup(
|
||||
@MyRequestBody StudentActionStatsDto studentActionStatsDtoFilter,
|
||||
@MyRequestBody(required = true) MyGroupParam groupParam,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, StudentActionStats.class);
|
||||
groupParam = MyGroupParam.buildGroupBy(groupParam, StudentActionStats.class);
|
||||
if (groupParam == null) {
|
||||
return ResponseResult.error(
|
||||
ErrorCodeEnum.INVALID_ARGUMENT_FORMAT, "数据参数错误,分组参数不能为空!");
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
StudentActionStats filter = MyModelUtil.copyTo(studentActionStatsDtoFilter, StudentActionStats.class);
|
||||
MyGroupCriteria criteria = groupParam.getGroupCriteria();
|
||||
List<StudentActionStats> resultList = studentActionStatsService.getGroupedStudentActionStatsListWithRelation(
|
||||
filter, criteria.getGroupSelect(), criteria.getGroupBy(), orderBy);
|
||||
// 分页连同对象数据转换copy工作,下面的方法一并完成。
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(resultList, StudentActionStats.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看指定学生行为统计对象详情。
|
||||
*
|
||||
* @param statsId 指定对象主键Id。
|
||||
* @return 应答结果对象,包含对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<StudentActionStatsVo> view(@RequestParam Long statsId) {
|
||||
if (MyCommonUtil.existBlankArgument(statsId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
StudentActionStats studentActionStats = studentActionStatsService.getByIdWithRelation(statsId, MyRelationParam.full());
|
||||
if (studentActionStats == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
StudentActionStatsVo studentActionStatsVo = StudentActionStats.INSTANCE.fromModel(studentActionStats);
|
||||
return ResponseResult.success(studentActionStatsVo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.orange.demo.webadmin.app.controller;
|
||||
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.orange.demo.webadmin.app.vo.*;
|
||||
import com.orange.demo.webadmin.app.dto.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
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 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.*;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 学生行为流水操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "学生行为流水管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/studentActionTrans")
|
||||
public class StudentActionTransController {
|
||||
|
||||
@Autowired
|
||||
private StudentActionTransService studentActionTransService;
|
||||
|
||||
/**
|
||||
* 新增学生行为流水数据。
|
||||
*
|
||||
* @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);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
StudentActionTrans studentActionTrans = MyModelUtil.copyTo(studentActionTransDto, StudentActionTrans.class);
|
||||
// 验证关联Id的数据合法性
|
||||
CallResult callResult = studentActionTransService.verifyRelatedData(studentActionTrans, null);
|
||||
if (!callResult.isSuccess()) {
|
||||
errorMessage = callResult.getErrorMessage();
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
studentActionTrans = studentActionTransService.saveNew(studentActionTrans);
|
||||
return ResponseResult.success(studentActionTrans.getTransId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新学生行为流水数据。
|
||||
*
|
||||
* @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);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
StudentActionTrans studentActionTrans = MyModelUtil.copyTo(studentActionTransDto, StudentActionTrans.class);
|
||||
StudentActionTrans originalStudentActionTrans = studentActionTransService.getById(studentActionTrans.getTransId());
|
||||
if (originalStudentActionTrans == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
CallResult callResult = studentActionTransService.verifyRelatedData(studentActionTrans, originalStudentActionTrans);
|
||||
if (!callResult.isSuccess()) {
|
||||
errorMessage = callResult.getErrorMessage();
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
if (!studentActionTransService.update(studentActionTrans, originalStudentActionTrans)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除学生行为流水数据。
|
||||
*
|
||||
* @param transId 删除对象主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long transId) {
|
||||
String errorMessage;
|
||||
if (MyCommonUtil.existBlankArgument(transId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
StudentActionTrans originalStudentActionTrans = studentActionTransService.getById(transId);
|
||||
if (originalStudentActionTrans == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
if (!studentActionTransService.remove(transId)) {
|
||||
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出符合过滤条件的学生行为流水列表。
|
||||
*
|
||||
* @param studentActionTransDtoFilter 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<StudentActionTransVo>> list(
|
||||
@MyRequestBody StudentActionTransDto studentActionTransDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
StudentActionTrans studentActionTransFilter = MyModelUtil.copyTo(studentActionTransDtoFilter, StudentActionTrans.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, StudentActionTrans.class);
|
||||
List<StudentActionTrans> studentActionTransList = studentActionTransService.getStudentActionTransListWithRelation(studentActionTransFilter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(studentActionTransList, StudentActionTrans.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看指定学生行为流水对象详情。
|
||||
*
|
||||
* @param transId 指定对象主键Id。
|
||||
* @return 应答结果对象,包含对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<StudentActionTransVo> view(@RequestParam Long transId) {
|
||||
if (MyCommonUtil.existBlankArgument(transId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
StudentActionTrans studentActionTrans = studentActionTransService.getByIdWithRelation(transId, MyRelationParam.full());
|
||||
if (studentActionTrans == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
StudentActionTransVo studentActionTransVo = StudentActionTrans.INSTANCE.fromModel(studentActionTrans);
|
||||
return ResponseResult.success(studentActionTransVo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,442 @@
|
||||
package com.orange.demo.webadmin.app.controller;
|
||||
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.orange.demo.webadmin.app.vo.*;
|
||||
import com.orange.demo.webadmin.app.dto.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
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 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.*;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.groups.Default;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 班级数据操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "班级数据管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/studentClass")
|
||||
public class StudentClassController {
|
||||
|
||||
@Autowired
|
||||
private StudentClassService studentClassService;
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private StudentService studentService;
|
||||
|
||||
/**
|
||||
* 新增班级数据数据。
|
||||
*
|
||||
* @param studentClassDto 新增对象。
|
||||
* @return 应答结果对象,包含新增对象主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"studentClassDto.classId"})
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody StudentClassDto studentClassDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(studentClassDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
StudentClass studentClass = MyModelUtil.copyTo(studentClassDto, StudentClass.class);
|
||||
// 验证关联Id的数据合法性
|
||||
CallResult callResult = studentClassService.verifyRelatedData(studentClass, null);
|
||||
if (!callResult.isSuccess()) {
|
||||
errorMessage = callResult.getErrorMessage();
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
studentClass = studentClassService.saveNew(studentClass);
|
||||
return ResponseResult.success(studentClass.getClassId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新班级数据数据。
|
||||
*
|
||||
* @param studentClassDto 更新对象。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(@MyRequestBody StudentClassDto studentClassDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(studentClassDto, Default.class, UpdateGroup.class);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
StudentClass studentClass = MyModelUtil.copyTo(studentClassDto, StudentClass.class);
|
||||
StudentClass originalStudentClass = studentClassService.getById(studentClass.getClassId());
|
||||
if (originalStudentClass == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
CallResult callResult = studentClassService.verifyRelatedData(studentClass, originalStudentClass);
|
||||
if (!callResult.isSuccess()) {
|
||||
errorMessage = callResult.getErrorMessage();
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
if (!studentClassService.update(studentClass, originalStudentClass)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除班级数据数据。
|
||||
*
|
||||
* @param classId 删除对象主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long classId) {
|
||||
String errorMessage;
|
||||
if (MyCommonUtil.existBlankArgument(classId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
StudentClass originalStudentClass = studentClassService.getById(classId);
|
||||
if (originalStudentClass == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
if (!studentClassService.remove(classId)) {
|
||||
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出符合过滤条件的班级数据列表。
|
||||
*
|
||||
* @param studentClassDtoFilter 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<StudentClassVo>> list(
|
||||
@MyRequestBody StudentClassDto studentClassDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
StudentClass studentClassFilter = MyModelUtil.copyTo(studentClassDtoFilter, StudentClass.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, StudentClass.class);
|
||||
List<StudentClass> studentClassList = studentClassService.getStudentClassListWithRelation(studentClassFilter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(studentClassList, StudentClass.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看指定班级数据对象详情。
|
||||
*
|
||||
* @param classId 指定对象主键Id。
|
||||
* @return 应答结果对象,包含对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<StudentClassVo> view(@RequestParam Long classId) {
|
||||
if (MyCommonUtil.existBlankArgument(classId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
StudentClass studentClass = studentClassService.getByIdWithRelation(classId, MyRelationParam.full());
|
||||
if (studentClass == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
StudentClassVo studentClassVo = StudentClass.INSTANCE.fromModel(studentClass);
|
||||
return ResponseResult.success(studentClassVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出不与指定班级数据存在多对多关系的 [课程数据] 列表数据。通常用于查看添加新 [课程数据] 对象的候选列表。
|
||||
*
|
||||
* @param classId 主表关联字段。
|
||||
* @param courseDtoFilter [课程数据] 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,返回符合条件的数据列表。
|
||||
*/
|
||||
@PostMapping("/listNotInClassCourse")
|
||||
public ResponseResult<MyPageData<CourseVo>> listNotInClassCourse(
|
||||
@MyRequestBody Long classId,
|
||||
@MyRequestBody CourseDto courseDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
ResponseResult<Void> verifyResult = this.doClassCourseVerify(classId);
|
||||
if (!verifyResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(verifyResult);
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
Course filter = MyModelUtil.copyTo(courseDtoFilter, Course.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, Course.class);
|
||||
List<Course> courseList =
|
||||
courseService.getNotInCourseListByClassId(classId, filter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(courseList, Course.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出与指定班级数据存在多对多关系的 [课程数据] 列表数据。
|
||||
*
|
||||
* @param classId 主表关联字段。
|
||||
* @param courseDtoFilter [课程数据] 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,返回符合条件的数据列表。
|
||||
*/
|
||||
@PostMapping("/listClassCourse")
|
||||
public ResponseResult<MyPageData<CourseVo>> listClassCourse(
|
||||
@MyRequestBody Long classId,
|
||||
@MyRequestBody CourseDto courseDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
ResponseResult<Void> verifyResult = this.doClassCourseVerify(classId);
|
||||
if (!verifyResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(verifyResult);
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
Course filter = MyModelUtil.copyTo(courseDtoFilter, Course.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, Course.class);
|
||||
List<Course> courseList =
|
||||
courseService.getCourseListByClassId(classId, filter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(courseList, Course.INSTANCE));
|
||||
}
|
||||
|
||||
private ResponseResult<Void> doClassCourseVerify(Long classId) {
|
||||
if (MyCommonUtil.existBlankArgument(classId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!studentClassService.existId(classId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加班级数据和 [课程数据] 对象的多对多关联关系数据。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param classCourseDtoList 关联对象列表。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/addClassCourse")
|
||||
public ResponseResult<Void> addClassCourse(
|
||||
@MyRequestBody Long classId,
|
||||
@MyRequestBody(elementType = ClassCourseDto.class) List<ClassCourseDto> classCourseDtoList) {
|
||||
if (MyCommonUtil.existBlankArgument(classId, classCourseDtoList)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
for (ClassCourseDto classCourse : classCourseDtoList) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(classCourse);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
}
|
||||
Set<Long> courseIdSet =
|
||||
classCourseDtoList.stream().map(ClassCourseDto::getCourseId).collect(Collectors.toSet());
|
||||
if (!studentClassService.existId(classId)
|
||||
|| !courseService.existUniqueKeyList("courseId", courseIdSet)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
List<ClassCourse> classCourseList =
|
||||
MyModelUtil.copyCollectionTo(classCourseDtoList, ClassCourse.class);
|
||||
studentClassService.addClassCourseList(classCourseList, classId);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新指定班级数据和指定 [课程数据] 的多对多关联数据。
|
||||
*
|
||||
* @param classCourseDto 对多对中间表对象。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/updateClassCourse")
|
||||
public ResponseResult<Void> updateClassCourse(
|
||||
@MyRequestBody ClassCourseDto classCourseDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(classCourseDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
ClassCourse classCourse = MyModelUtil.copyTo(classCourseDto, ClassCourse.class);
|
||||
if (!studentClassService.updateClassCourse(classCourse)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示班级数据和指定 [课程数据] 的多对多关联详情数据。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param courseId 从表主键Id。
|
||||
* @return 应答结果对象,包括中间表详情。
|
||||
*/
|
||||
@GetMapping("/viewClassCourse")
|
||||
public ResponseResult<ClassCourseVo> viewClassCourse(
|
||||
@RequestParam Long classId, @RequestParam Long courseId) {
|
||||
if (MyCommonUtil.existBlankArgument(classId, courseId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
ClassCourse classCourse = studentClassService.getClassCourse(classId, courseId);
|
||||
if (classCourse == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
ClassCourseVo classCourseVo = MyModelUtil.copyTo(classCourse, ClassCourseVo.class);
|
||||
return ResponseResult.success(classCourseVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除指定班级数据和指定 [课程数据] 的多对多关联关系。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param courseId 从表主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/deleteClassCourse")
|
||||
public ResponseResult<Void> deleteClassCourse(
|
||||
@MyRequestBody Long classId, @MyRequestBody Long courseId) {
|
||||
if (MyCommonUtil.existBlankArgument(classId, courseId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!studentClassService.removeClassCourse(classId, courseId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出不与指定班级数据存在多对多关系的 [学生数据] 列表数据。通常用于查看添加新 [学生数据] 对象的候选列表。
|
||||
*
|
||||
* @param classId 主表关联字段。
|
||||
* @param studentDtoFilter [学生数据] 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,返回符合条件的数据列表。
|
||||
*/
|
||||
@PostMapping("/listNotInClassStudent")
|
||||
public ResponseResult<MyPageData<StudentVo>> listNotInClassStudent(
|
||||
@MyRequestBody Long classId,
|
||||
@MyRequestBody StudentDto studentDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
ResponseResult<Void> verifyResult = this.doClassStudentVerify(classId);
|
||||
if (!verifyResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(verifyResult);
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
Student filter = MyModelUtil.copyTo(studentDtoFilter, Student.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, Student.class);
|
||||
List<Student> studentList =
|
||||
studentService.getNotInStudentListByClassId(classId, filter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(studentList, Student.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出与指定班级数据存在多对多关系的 [学生数据] 列表数据。
|
||||
*
|
||||
* @param classId 主表关联字段。
|
||||
* @param studentDtoFilter [学生数据] 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,返回符合条件的数据列表。
|
||||
*/
|
||||
@PostMapping("/listClassStudent")
|
||||
public ResponseResult<MyPageData<StudentVo>> listClassStudent(
|
||||
@MyRequestBody Long classId,
|
||||
@MyRequestBody StudentDto studentDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
ResponseResult<Void> verifyResult = this.doClassStudentVerify(classId);
|
||||
if (!verifyResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(verifyResult);
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
Student filter = MyModelUtil.copyTo(studentDtoFilter, Student.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, Student.class);
|
||||
List<Student> studentList =
|
||||
studentService.getStudentListByClassId(classId, filter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(studentList, Student.INSTANCE));
|
||||
}
|
||||
|
||||
private ResponseResult<Void> doClassStudentVerify(Long classId) {
|
||||
if (MyCommonUtil.existBlankArgument(classId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!studentClassService.existId(classId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加班级数据和 [学生数据] 对象的多对多关联关系数据。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param classStudentDtoList 关联对象列表。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/addClassStudent")
|
||||
public ResponseResult<Void> addClassStudent(
|
||||
@MyRequestBody Long classId,
|
||||
@MyRequestBody(elementType = ClassStudentDto.class) List<ClassStudentDto> classStudentDtoList) {
|
||||
if (MyCommonUtil.existBlankArgument(classId, classStudentDtoList)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
for (ClassStudentDto classStudent : classStudentDtoList) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(classStudent);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
}
|
||||
Set<Long> studentIdSet =
|
||||
classStudentDtoList.stream().map(ClassStudentDto::getStudentId).collect(Collectors.toSet());
|
||||
if (!studentClassService.existId(classId)
|
||||
|| !studentService.existUniqueKeyList("studentId", studentIdSet)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
List<ClassStudent> classStudentList =
|
||||
MyModelUtil.copyCollectionTo(classStudentDtoList, ClassStudent.class);
|
||||
studentClassService.addClassStudentList(classStudentList, classId);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除指定班级数据和指定 [学生数据] 的多对多关联关系。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param studentId 从表主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/deleteClassStudent")
|
||||
public ResponseResult<Void> deleteClassStudent(
|
||||
@MyRequestBody Long classId, @MyRequestBody Long studentId) {
|
||||
if (MyCommonUtil.existBlankArgument(classId, studentId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!studentClassService.removeClassStudent(classId, studentId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package com.orange.demo.webadmin.app.controller;
|
||||
|
||||
import cn.jimmyshi.beanquery.BeanQuery;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.orange.demo.webadmin.app.vo.*;
|
||||
import com.orange.demo.webadmin.app.dto.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
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 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.*;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 学生数据操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Api(tags = "学生数据管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/app/student")
|
||||
public class StudentController {
|
||||
|
||||
@Autowired
|
||||
private StudentService studentService;
|
||||
|
||||
/**
|
||||
* 新增学生数据数据。
|
||||
*
|
||||
* @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);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
Student student = MyModelUtil.copyTo(studentDto, Student.class);
|
||||
// 验证关联Id的数据合法性
|
||||
CallResult callResult = studentService.verifyRelatedData(student, null);
|
||||
if (!callResult.isSuccess()) {
|
||||
errorMessage = callResult.getErrorMessage();
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
student = studentService.saveNew(student);
|
||||
return ResponseResult.success(student.getStudentId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新学生数据数据。
|
||||
*
|
||||
* @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);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
Student student = MyModelUtil.copyTo(studentDto, Student.class);
|
||||
Student originalStudent = studentService.getById(student.getStudentId());
|
||||
if (originalStudent == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
CallResult callResult = studentService.verifyRelatedData(student, originalStudent);
|
||||
if (!callResult.isSuccess()) {
|
||||
errorMessage = callResult.getErrorMessage();
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
if (!studentService.update(student, originalStudent)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除学生数据数据。
|
||||
*
|
||||
* @param studentId 删除对象主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long studentId) {
|
||||
String errorMessage;
|
||||
if (MyCommonUtil.existBlankArgument(studentId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
Student originalStudent = studentService.getById(studentId);
|
||||
if (originalStudent == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
if (!studentService.remove(studentId)) {
|
||||
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出符合过滤条件的学生数据列表。
|
||||
*
|
||||
* @param studentDtoFilter 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<StudentVo>> list(
|
||||
@MyRequestBody StudentDto studentDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
Student studentFilter = MyModelUtil.copyTo(studentDtoFilter, Student.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, Student.class);
|
||||
List<Student> studentList = studentService.getStudentListWithRelation(studentFilter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(studentList, Student.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看指定学生数据对象详情。
|
||||
*
|
||||
* @param studentId 指定对象主键Id。
|
||||
* @return 应答结果对象,包含对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<StudentVo> view(@RequestParam Long studentId) {
|
||||
if (MyCommonUtil.existBlankArgument(studentId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
Student student = studentService.getByIdWithRelation(studentId, MyRelationParam.full());
|
||||
if (student == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
StudentVo studentVo = Student.INSTANCE.fromModel(student);
|
||||
return ResponseResult.success(studentVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 以字典形式返回全部学生数据数据集合。字典的键值为[studentId, studentName]。
|
||||
* 白名单接口,登录用户均可访问。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @return 应答结果对象,包含的数据为 List<Map<String, String>>,map中包含两条记录,key的值分别是id和name,value对应具体数据。
|
||||
*/
|
||||
@GetMapping("/listDict")
|
||||
public ResponseResult<List<Map<String, Object>>> listDict(Student filter) {
|
||||
List<Student> resultList = studentService.getListByFilter(filter);
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"studentId as id", "studentName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典Id集合,获取查询后的字典数据。
|
||||
*
|
||||
* @param dictIds 字典Id集合。
|
||||
* @return 应答结果对象,包含字典形式的数据集合。
|
||||
*/
|
||||
@PostMapping("/listDictByIds")
|
||||
public ResponseResult<List<Map<String, Object>>> listDictByIds(
|
||||
@MyRequestBody(elementType = Long.class) List<Long> dictIds) {
|
||||
List<Student> resultList = studentService.getInList(new HashSet<>(dictIds));
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"studentId as id", "studentName as name").executeFrom(resultList));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.AreaCode;
|
||||
|
||||
/**
|
||||
* 行政区划数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface AreaCodeMapper extends BaseDaoMapper<AreaCode> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.ClassCourse;
|
||||
|
||||
/**
|
||||
* 数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface ClassCourseMapper extends BaseDaoMapper<ClassCourse> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.ClassStudent;
|
||||
|
||||
/**
|
||||
* 数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface ClassStudentMapper extends BaseDaoMapper<ClassStudent> {
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.Course;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 课程数据数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface CourseMapper extends BaseDaoMapper<Course> {
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
* @param courseFilter 主表过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
List<Course> getCourseList(
|
||||
@Param("courseFilter") Course courseFilter, @Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 根据关联主表Id,获取关联从表数据列表。
|
||||
*
|
||||
* @param classId 关联主表Id。
|
||||
* @param courseFilter 从表过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 从表数据列表。
|
||||
*/
|
||||
List<Course> getCourseListByClassId(
|
||||
@Param("classId") Long classId,
|
||||
@Param("courseFilter") Course courseFilter,
|
||||
@Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 根据关联主表Id,获取关联从表中没有和主表建立关联关系的数据列表。
|
||||
*
|
||||
* @param classId 关联主表Id。
|
||||
* @param courseFilter 过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 与主表没有建立关联的从表数据列表。
|
||||
*/
|
||||
List<Course> getNotInCourseListByClassId(
|
||||
@Param("classId") Long classId,
|
||||
@Param("courseFilter") Course courseFilter,
|
||||
@Param("orderBy") String orderBy);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.CourseTransStats;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 课程统计数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface CourseTransStatsMapper extends BaseDaoMapper<CourseTransStats> {
|
||||
|
||||
/**
|
||||
* 获取分组计算后的数据对象列表。
|
||||
*
|
||||
* @param courseTransStatsFilter 主表过滤对象。
|
||||
* @param groupSelect 分组显示字段列表字符串,SELECT从句的参数。
|
||||
* @param groupBy 分组字段列表字符串,GROUP BY从句的参数。
|
||||
* @param orderBy 排序字符串,ORDER BY从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
List<CourseTransStats> getGroupedCourseTransStatsList(
|
||||
@Param("courseTransStatsFilter") CourseTransStats courseTransStatsFilter,
|
||||
@Param("groupSelect") String groupSelect,
|
||||
@Param("groupBy") String groupBy,
|
||||
@Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
* @param courseTransStatsFilter 主表过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
List<CourseTransStats> getCourseTransStatsList(
|
||||
@Param("courseTransStatsFilter") CourseTransStats courseTransStatsFilter, @Param("orderBy") String orderBy);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.Grade;
|
||||
|
||||
/**
|
||||
* 年级数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface GradeMapper extends BaseDaoMapper<Grade> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.MaterialEdition;
|
||||
|
||||
/**
|
||||
* 数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface MaterialEditionMapper extends BaseDaoMapper<MaterialEdition> {
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.SchoolInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 校区数据数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface SchoolInfoMapper extends BaseDaoMapper<SchoolInfo> {
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
* @param schoolInfoFilter 主表过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
List<SchoolInfo> getSchoolInfoList(
|
||||
@Param("schoolInfoFilter") SchoolInfo schoolInfoFilter, @Param("orderBy") String orderBy);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.StudentActionStats;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生行为统计数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface StudentActionStatsMapper extends BaseDaoMapper<StudentActionStats> {
|
||||
|
||||
/**
|
||||
* 获取分组计算后的数据对象列表。
|
||||
*
|
||||
* @param studentActionStatsFilter 主表过滤对象。
|
||||
* @param groupSelect 分组显示字段列表字符串,SELECT从句的参数。
|
||||
* @param groupBy 分组字段列表字符串,GROUP BY从句的参数。
|
||||
* @param orderBy 排序字符串,ORDER BY从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
List<StudentActionStats> getGroupedStudentActionStatsList(
|
||||
@Param("studentActionStatsFilter") StudentActionStats studentActionStatsFilter,
|
||||
@Param("groupSelect") String groupSelect,
|
||||
@Param("groupBy") String groupBy,
|
||||
@Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
* @param studentActionStatsFilter 主表过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
List<StudentActionStats> getStudentActionStatsList(
|
||||
@Param("studentActionStatsFilter") StudentActionStats studentActionStatsFilter, @Param("orderBy") String orderBy);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.StudentActionTrans;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生行为流水数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface StudentActionTransMapper extends BaseDaoMapper<StudentActionTrans> {
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
* @param studentActionTransFilter 主表过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
List<StudentActionTrans> getStudentActionTransList(
|
||||
@Param("studentActionTransFilter") StudentActionTrans studentActionTransFilter, @Param("orderBy") String orderBy);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.StudentClass;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 班级数据数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface StudentClassMapper extends BaseDaoMapper<StudentClass> {
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
* @param studentClassFilter 主表过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
List<StudentClass> getStudentClassList(
|
||||
@Param("studentClassFilter") StudentClass studentClassFilter, @Param("orderBy") String orderBy);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.orange.demo.webadmin.app.dao;
|
||||
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.webadmin.app.model.Student;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生数据数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface StudentMapper extends BaseDaoMapper<Student> {
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
* @param studentFilter 主表过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
List<Student> getStudentList(
|
||||
@Param("studentFilter") Student studentFilter, @Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 根据关联主表Id,获取关联从表数据列表。
|
||||
*
|
||||
* @param classId 关联主表Id。
|
||||
* @param studentFilter 从表过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 从表数据列表。
|
||||
*/
|
||||
List<Student> getStudentListByClassId(
|
||||
@Param("classId") Long classId,
|
||||
@Param("studentFilter") Student studentFilter,
|
||||
@Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 根据关联主表Id,获取关联从表中没有和主表建立关联关系的数据列表。
|
||||
*
|
||||
* @param classId 关联主表Id。
|
||||
* @param studentFilter 过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 与主表没有建立关联的从表数据列表。
|
||||
*/
|
||||
List<Student> getNotInStudentListByClassId(
|
||||
@Param("classId") Long classId,
|
||||
@Param("studentFilter") Student studentFilter,
|
||||
@Param("orderBy") String orderBy);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.AreaCodeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.AreaCode">
|
||||
<id column="area_id" jdbcType="BIGINT" property="areaId"/>
|
||||
<result column="area_name" jdbcType="VARCHAR" property="areaName"/>
|
||||
<result column="area_level" jdbcType="INTEGER" property="areaLevel"/>
|
||||
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.ClassCourseMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.ClassCourse">
|
||||
<id column="class_id" jdbcType="BIGINT" property="classId"/>
|
||||
<id column="course_id" jdbcType="BIGINT" property="courseId"/>
|
||||
<result column="course_order" jdbcType="TINYINT" property="courseOrder"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.ClassStudentMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.ClassStudent">
|
||||
<id column="class_id" jdbcType="BIGINT" property="classId"/>
|
||||
<id column="student_id" jdbcType="BIGINT" property="studentId"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.CourseMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.Course">
|
||||
<id column="course_id" jdbcType="BIGINT" property="courseId"/>
|
||||
<result column="course_name" jdbcType="VARCHAR" property="courseName"/>
|
||||
<result column="price" jdbcType="DECIMAL" property="price"/>
|
||||
<result column="description" jdbcType="VARCHAR" property="description"/>
|
||||
<result column="difficulty" jdbcType="INTEGER" property="difficulty"/>
|
||||
<result column="grade_id" jdbcType="TINYINT" property="gradeId"/>
|
||||
<result column="subject_id" jdbcType="TINYINT" property="subjectId"/>
|
||||
<result column="class_hour" jdbcType="INTEGER" property="classHour"/>
|
||||
<result column="picture_url" jdbcType="VARCHAR" property="pictureUrl"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="BaseResultMapWithClassCourse" type="com.orange.demo.webadmin.app.model.Course" extends="BaseResultMap">
|
||||
<association property="classCourse" column="course_id" foreignColumn="course_id"
|
||||
notNullColumn="course_id" resultMap="com.orange.demo.webadmin.app.dao.ClassCourseMapper.BaseResultMap" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.orange.demo.webadmin.app.dao.CourseMapper.inputFilterRef"/>
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
<sql id="inputFilterRef">
|
||||
<if test="courseFilter != null">
|
||||
<if test="courseFilter.courseName != null and courseFilter.courseName != ''">
|
||||
<bind name = "safeCourseCourseName" value = "'%' + courseFilter.courseName + '%'" />
|
||||
AND zz_course.course_name LIKE #{safeCourseCourseName}
|
||||
</if>
|
||||
<if test="courseFilter.priceStart != null">
|
||||
AND zz_course.price >= #{courseFilter.priceStart}
|
||||
</if>
|
||||
<if test="courseFilter.priceEnd != null">
|
||||
AND zz_course.price <= #{courseFilter.priceEnd}
|
||||
</if>
|
||||
<if test="courseFilter.difficulty != null">
|
||||
AND zz_course.difficulty = #{courseFilter.difficulty}
|
||||
</if>
|
||||
<if test="courseFilter.gradeId != null">
|
||||
AND zz_course.grade_id = #{courseFilter.gradeId}
|
||||
</if>
|
||||
<if test="courseFilter.subjectId != null">
|
||||
AND zz_course.subject_id = #{courseFilter.subjectId}
|
||||
</if>
|
||||
<if test="courseFilter.classHourStart != null">
|
||||
AND zz_course.class_hour >= #{courseFilter.classHourStart}
|
||||
</if>
|
||||
<if test="courseFilter.classHourEnd != null">
|
||||
AND zz_course.class_hour <= #{courseFilter.classHourEnd}
|
||||
</if>
|
||||
<if test="courseFilter.createTimeStart != null and courseFilter.createTimeStart != ''">
|
||||
AND zz_course.create_time >= #{courseFilter.createTimeStart}
|
||||
</if>
|
||||
<if test="courseFilter.createTimeEnd != null and courseFilter.createTimeEnd != ''">
|
||||
AND zz_course.create_time <= #{courseFilter.createTimeEnd}
|
||||
</if>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getCourseList" resultMap="BaseResultMap" parameterType="com.orange.demo.webadmin.app.model.Course">
|
||||
SELECT * FROM zz_course
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getCourseListByClassId" resultMap="BaseResultMapWithClassCourse">
|
||||
SELECT
|
||||
zz_course.*,
|
||||
zz_class_course.*
|
||||
FROM
|
||||
zz_course,
|
||||
zz_class_course
|
||||
<where>
|
||||
AND zz_class_course.class_id = #{classId}
|
||||
AND zz_class_course.course_id = zz_course.course_id
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getNotInCourseListByClassId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
zz_course.*
|
||||
FROM
|
||||
zz_course
|
||||
<where>
|
||||
AND NOT EXISTS (SELECT * FROM zz_class_course
|
||||
WHERE zz_class_course.class_id = #{classId} AND zz_class_course.course_id = zz_course.course_id)
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.CourseTransStatsMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.CourseTransStats">
|
||||
<id column="stats_id" jdbcType="BIGINT" property="statsId"/>
|
||||
<result column="stats_date" jdbcType="DATE" property="statsDate"/>
|
||||
<result column="subject_id" jdbcType="TINYINT" property="subjectId"/>
|
||||
<result column="grade_id" jdbcType="TINYINT" property="gradeId"/>
|
||||
<result column="grade_name" jdbcType="VARCHAR" property="gradeName"/>
|
||||
<result column="course_id" jdbcType="BIGINT" property="courseId"/>
|
||||
<result column="course_name" jdbcType="VARCHAR" property="courseName"/>
|
||||
<result column="student_attend_count" jdbcType="INTEGER" property="studentAttendCount"/>
|
||||
<result column="student_flower_amount" jdbcType="INTEGER" property="studentFlowerAmount"/>
|
||||
<result column="student_flower_count" jdbcType="INTEGER" property="studentFlowerCount"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.orange.demo.webadmin.app.dao.CourseTransStatsMapper.inputFilterRef"/>
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
<sql id="inputFilterRef">
|
||||
<if test="courseTransStatsFilter != null">
|
||||
<if test="courseTransStatsFilter.statsDateStart != null and courseTransStatsFilter.statsDateStart != ''">
|
||||
AND zz_course_trans_stats.stats_date >= #{courseTransStatsFilter.statsDateStart}
|
||||
</if>
|
||||
<if test="courseTransStatsFilter.statsDateEnd != null and courseTransStatsFilter.statsDateEnd != ''">
|
||||
AND zz_course_trans_stats.stats_date <= #{courseTransStatsFilter.statsDateEnd}
|
||||
</if>
|
||||
<if test="courseTransStatsFilter.subjectId != null">
|
||||
AND zz_course_trans_stats.subject_id = #{courseTransStatsFilter.subjectId}
|
||||
</if>
|
||||
<if test="courseTransStatsFilter.gradeId != null">
|
||||
AND zz_course_trans_stats.grade_id = #{courseTransStatsFilter.gradeId}
|
||||
</if>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getGroupedCourseTransStatsList" resultMap="BaseResultMap" parameterType="com.orange.demo.webadmin.app.model.CourseTransStats">
|
||||
SELECT * FROM
|
||||
(SELECT
|
||||
SUM(student_attend_count) student_attend_count,
|
||||
SUM(student_flower_amount) student_flower_amount,
|
||||
SUM(student_flower_count) student_flower_count,
|
||||
${groupSelect}
|
||||
FROM zz_course_trans_stats
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
GROUP BY ${groupBy}) zz_course_trans_stats
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getCourseTransStatsList" resultMap="BaseResultMap" parameterType="com.orange.demo.webadmin.app.model.CourseTransStats">
|
||||
SELECT * FROM zz_course_trans_stats
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.GradeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.Grade">
|
||||
<id column="grade_id" jdbcType="INTEGER" property="gradeId"/>
|
||||
<result column="grade_name" jdbcType="VARCHAR" property="gradeName"/>
|
||||
<result column="status" jdbcType="INTEGER" property="status"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.MaterialEditionMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.MaterialEdition">
|
||||
<id column="edition_id" jdbcType="INTEGER" property="editionId"/>
|
||||
<result column="edition_name" jdbcType="VARCHAR" property="editionName"/>
|
||||
<result column="status" jdbcType="INTEGER" property="status"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.SchoolInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.SchoolInfo">
|
||||
<id column="school_id" jdbcType="BIGINT" property="schoolId"/>
|
||||
<result column="school_name" jdbcType="VARCHAR" property="schoolName"/>
|
||||
<result column="province_id" jdbcType="BIGINT" property="provinceId"/>
|
||||
<result column="city_id" jdbcType="BIGINT" property="cityId"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.orange.demo.webadmin.app.dao.SchoolInfoMapper.inputFilterRef"/>
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
<sql id="inputFilterRef">
|
||||
<if test="schoolInfoFilter != null">
|
||||
<if test="schoolInfoFilter.schoolName != null and schoolInfoFilter.schoolName != ''">
|
||||
<bind name = "safeSchoolInfoSchoolName" value = "'%' + schoolInfoFilter.schoolName + '%'" />
|
||||
AND zz_school_info.school_name LIKE #{safeSchoolInfoSchoolName}
|
||||
</if>
|
||||
<if test="schoolInfoFilter.provinceId != null">
|
||||
AND zz_school_info.province_id = #{schoolInfoFilter.provinceId}
|
||||
</if>
|
||||
<if test="schoolInfoFilter.cityId != null">
|
||||
AND zz_school_info.city_id = #{schoolInfoFilter.cityId}
|
||||
</if>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getSchoolInfoList" resultMap="BaseResultMap" parameterType="com.orange.demo.webadmin.app.model.SchoolInfo">
|
||||
SELECT * FROM zz_school_info
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.StudentActionStatsMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.StudentActionStats">
|
||||
<id column="stats_id" jdbcType="BIGINT" property="statsId"/>
|
||||
<result column="stats_date" jdbcType="DATE" property="statsDate"/>
|
||||
<result column="stats_month" jdbcType="DATE" property="statsMonth"/>
|
||||
<result column="grade_id" jdbcType="INTEGER" property="gradeId"/>
|
||||
<result column="province_id" jdbcType="BIGINT" property="provinceId"/>
|
||||
<result column="city_id" jdbcType="BIGINT" property="cityId"/>
|
||||
<result column="buy_course_amount" jdbcType="INTEGER" property="buyCourseAmount"/>
|
||||
<result column="buy_course_count" jdbcType="INTEGER" property="buyCourseCount"/>
|
||||
<result column="buy_video_amount" jdbcType="INTEGER" property="buyVideoAmount"/>
|
||||
<result column="buy_video_count" jdbcType="INTEGER" property="buyVideoCount"/>
|
||||
<result column="buy_paper_amount" jdbcType="INTEGER" property="buyPaperAmount"/>
|
||||
<result column="buy_paper_count" jdbcType="INTEGER" property="buyPaperCount"/>
|
||||
<result column="buy_flower_amount" jdbcType="INTEGER" property="buyFlowerAmount"/>
|
||||
<result column="buy_flower_count" jdbcType="INTEGER" property="buyFlowerCount"/>
|
||||
<result column="recharge_coin_amount" jdbcType="INTEGER" property="rechargeCoinAmount"/>
|
||||
<result column="recharge_coin_count" jdbcType="INTEGER" property="rechargeCoinCount"/>
|
||||
<result column="do_course_count" jdbcType="INTEGER" property="doCourseCount"/>
|
||||
<result column="watch_video_count" jdbcType="INTEGER" property="watchVideoCount"/>
|
||||
<result column="watch_video_total_second" jdbcType="INTEGER" property="watchVideoTotalSecond"/>
|
||||
<result column="do_exercise_count" jdbcType="INTEGER" property="doExerciseCount"/>
|
||||
<result column="do_exercise_correct_count" jdbcType="INTEGER" property="doExerciseCorrectCount"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.orange.demo.webadmin.app.dao.StudentActionStatsMapper.inputFilterRef"/>
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
<sql id="inputFilterRef">
|
||||
<if test="studentActionStatsFilter != null">
|
||||
<if test="studentActionStatsFilter.statsDateStart != null and studentActionStatsFilter.statsDateStart != ''">
|
||||
AND zz_student_action_stats.stats_date >= #{studentActionStatsFilter.statsDateStart}
|
||||
</if>
|
||||
<if test="studentActionStatsFilter.statsDateEnd != null and studentActionStatsFilter.statsDateEnd != ''">
|
||||
AND zz_student_action_stats.stats_date <= #{studentActionStatsFilter.statsDateEnd}
|
||||
</if>
|
||||
<if test="studentActionStatsFilter.gradeId != null">
|
||||
AND zz_student_action_stats.grade_id = #{studentActionStatsFilter.gradeId}
|
||||
</if>
|
||||
<if test="studentActionStatsFilter.provinceId != null">
|
||||
AND zz_student_action_stats.province_id = #{studentActionStatsFilter.provinceId}
|
||||
</if>
|
||||
<if test="studentActionStatsFilter.cityId != null">
|
||||
AND zz_student_action_stats.city_id = #{studentActionStatsFilter.cityId}
|
||||
</if>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getGroupedStudentActionStatsList" resultMap="BaseResultMap" parameterType="com.orange.demo.webadmin.app.model.StudentActionStats">
|
||||
SELECT * FROM
|
||||
(SELECT
|
||||
SUM(buy_course_amount) buy_course_amount,
|
||||
COUNT(buy_course_count) buy_course_count,
|
||||
SUM(buy_video_amount) buy_video_amount,
|
||||
COUNT(buy_video_count) buy_video_count,
|
||||
SUM(buy_paper_amount) buy_paper_amount,
|
||||
COUNT(buy_paper_count) buy_paper_count,
|
||||
SUM(buy_flower_amount) buy_flower_amount,
|
||||
COUNT(buy_flower_count) buy_flower_count,
|
||||
SUM(recharge_coin_amount) recharge_coin_amount,
|
||||
COUNT(recharge_coin_count) recharge_coin_count,
|
||||
SUM(do_course_count) do_course_count,
|
||||
SUM(watch_video_count) watch_video_count,
|
||||
SUM(watch_video_total_second) watch_video_total_second,
|
||||
SUM(do_exercise_count) do_exercise_count,
|
||||
SUM(do_exercise_correct_count) do_exercise_correct_count,
|
||||
${groupSelect}
|
||||
FROM zz_student_action_stats
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
GROUP BY ${groupBy}) zz_student_action_stats
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getStudentActionStatsList" resultMap="BaseResultMap" parameterType="com.orange.demo.webadmin.app.model.StudentActionStats">
|
||||
SELECT * FROM zz_student_action_stats
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.StudentActionTransMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.StudentActionTrans">
|
||||
<id column="trans_id" jdbcType="BIGINT" property="transId"/>
|
||||
<result column="student_id" jdbcType="BIGINT" property="studentId"/>
|
||||
<result column="student_name" jdbcType="VARCHAR" property="studentName"/>
|
||||
<result column="school_id" jdbcType="BIGINT" property="schoolId"/>
|
||||
<result column="grade_id" jdbcType="INTEGER" property="gradeId"/>
|
||||
<result column="action_type" jdbcType="TINYINT" property="actionType"/>
|
||||
<result column="device_type" jdbcType="TINYINT" property="deviceType"/>
|
||||
<result column="watch_video_seconds" jdbcType="INTEGER" property="watchVideoSeconds"/>
|
||||
<result column="flower_count" jdbcType="INTEGER" property="flowerCount"/>
|
||||
<result column="paper_count" jdbcType="INTEGER" property="paperCount"/>
|
||||
<result column="video_count" jdbcType="INTEGER" property="videoCount"/>
|
||||
<result column="course_count" jdbcType="INTEGER" property="courseCount"/>
|
||||
<result column="coin_count" jdbcType="INTEGER" property="coinCount"/>
|
||||
<result column="exercise_correct_flag" jdbcType="TINYINT" property="exerciseCorrectFlag"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.orange.demo.webadmin.app.dao.StudentActionTransMapper.inputFilterRef"/>
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
<sql id="inputFilterRef">
|
||||
<if test="studentActionTransFilter != null">
|
||||
<if test="studentActionTransFilter.studentId != null">
|
||||
AND zz_student_action_trans.student_id = #{studentActionTransFilter.studentId}
|
||||
</if>
|
||||
<if test="studentActionTransFilter.schoolId != null">
|
||||
AND zz_student_action_trans.school_id = #{studentActionTransFilter.schoolId}
|
||||
</if>
|
||||
<if test="studentActionTransFilter.gradeId != null">
|
||||
AND zz_student_action_trans.grade_id = #{studentActionTransFilter.gradeId}
|
||||
</if>
|
||||
<if test="studentActionTransFilter.actionType != null">
|
||||
AND zz_student_action_trans.action_type = #{studentActionTransFilter.actionType}
|
||||
</if>
|
||||
<if test="studentActionTransFilter.deviceType != null">
|
||||
AND zz_student_action_trans.device_type = #{studentActionTransFilter.deviceType}
|
||||
</if>
|
||||
<if test="studentActionTransFilter.createTimeStart != null and studentActionTransFilter.createTimeStart != ''">
|
||||
AND zz_student_action_trans.create_time >= #{studentActionTransFilter.createTimeStart}
|
||||
</if>
|
||||
<if test="studentActionTransFilter.createTimeEnd != null and studentActionTransFilter.createTimeEnd != ''">
|
||||
AND zz_student_action_trans.create_time <= #{studentActionTransFilter.createTimeEnd}
|
||||
</if>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getStudentActionTransList" resultMap="BaseResultMap" parameterType="com.orange.demo.webadmin.app.model.StudentActionTrans">
|
||||
SELECT * FROM zz_student_action_trans
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.StudentClassMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.StudentClass">
|
||||
<id column="class_id" jdbcType="BIGINT" property="classId"/>
|
||||
<result column="class_name" jdbcType="VARCHAR" property="className"/>
|
||||
<result column="school_id" jdbcType="BIGINT" property="schoolId"/>
|
||||
<result column="leader_id" jdbcType="BIGINT" property="leaderId"/>
|
||||
<result column="finish_class_hour" jdbcType="INTEGER" property="finishClassHour"/>
|
||||
<result column="class_level" jdbcType="TINYINT" property="classLevel"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="status" jdbcType="TINYINT" property="status"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.orange.demo.webadmin.app.dao.StudentClassMapper.inputFilterRef"/>
|
||||
AND zz_class.status = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
<sql id="inputFilterRef">
|
||||
<if test="studentClassFilter != null">
|
||||
<if test="studentClassFilter.className != null and studentClassFilter.className != ''">
|
||||
AND zz_class.class_name = #{studentClassFilter.className}
|
||||
</if>
|
||||
<if test="studentClassFilter.schoolId != null">
|
||||
AND zz_class.school_id = #{studentClassFilter.schoolId}
|
||||
</if>
|
||||
<if test="studentClassFilter.classLevel != null">
|
||||
AND zz_class.class_level = #{studentClassFilter.classLevel}
|
||||
</if>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getStudentClassList" resultMap="BaseResultMap" parameterType="com.orange.demo.webadmin.app.model.StudentClass">
|
||||
SELECT * FROM zz_class
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orange.demo.webadmin.app.dao.StudentMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orange.demo.webadmin.app.model.Student">
|
||||
<id column="student_id" jdbcType="BIGINT" property="studentId"/>
|
||||
<result column="login_mobile" jdbcType="VARCHAR" property="loginMobile"/>
|
||||
<result column="student_name" jdbcType="VARCHAR" property="studentName"/>
|
||||
<result column="province_id" jdbcType="BIGINT" property="provinceId"/>
|
||||
<result column="city_id" jdbcType="BIGINT" property="cityId"/>
|
||||
<result column="district_id" jdbcType="BIGINT" property="districtId"/>
|
||||
<result column="gender" jdbcType="INTEGER" property="gender"/>
|
||||
<result column="birthday" jdbcType="DATE" property="birthday"/>
|
||||
<result column="experience_level" jdbcType="TINYINT" property="experienceLevel"/>
|
||||
<result column="total_coin" jdbcType="INTEGER" property="totalCoin"/>
|
||||
<result column="left_coin" jdbcType="INTEGER" property="leftCoin"/>
|
||||
<result column="grade_id" jdbcType="INTEGER" property="gradeId"/>
|
||||
<result column="school_id" jdbcType="BIGINT" property="schoolId"/>
|
||||
<result column="register_time" jdbcType="TIMESTAMP" property="registerTime"/>
|
||||
<result column="status" jdbcType="TINYINT" property="status"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.orange.demo.webadmin.app.dao.StudentMapper.inputFilterRef"/>
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
<sql id="inputFilterRef">
|
||||
<if test="studentFilter != null">
|
||||
<if test="studentFilter.provinceId != null">
|
||||
AND zz_student.province_id = #{studentFilter.provinceId}
|
||||
</if>
|
||||
<if test="studentFilter.cityId != null">
|
||||
AND zz_student.city_id = #{studentFilter.cityId}
|
||||
</if>
|
||||
<if test="studentFilter.districtId != null">
|
||||
AND zz_student.district_id = #{studentFilter.districtId}
|
||||
</if>
|
||||
<if test="studentFilter.birthdayStart != null and studentFilter.birthdayStart != ''">
|
||||
AND zz_student.birthday >= #{studentFilter.birthdayStart}
|
||||
</if>
|
||||
<if test="studentFilter.birthdayEnd != null and studentFilter.birthdayEnd != ''">
|
||||
AND zz_student.birthday <= #{studentFilter.birthdayEnd}
|
||||
</if>
|
||||
<if test="studentFilter.gradeId != null">
|
||||
AND zz_student.grade_id = #{studentFilter.gradeId}
|
||||
</if>
|
||||
<if test="studentFilter.schoolId != null">
|
||||
AND zz_student.school_id = #{studentFilter.schoolId}
|
||||
</if>
|
||||
<if test="studentFilter.registerTimeStart != null and studentFilter.registerTimeStart != ''">
|
||||
AND zz_student.register_time >= #{studentFilter.registerTimeStart}
|
||||
</if>
|
||||
<if test="studentFilter.registerTimeEnd != null and studentFilter.registerTimeEnd != ''">
|
||||
AND zz_student.register_time <= #{studentFilter.registerTimeEnd}
|
||||
</if>
|
||||
<if test="studentFilter.status != null">
|
||||
AND zz_student.status = #{studentFilter.status}
|
||||
</if>
|
||||
<if test="studentFilter.searchString != null and studentFilter.searchString != ''">
|
||||
<bind name = "safeStudentSearchString" value = "'%' + studentFilter.searchString + '%'" />
|
||||
AND CONCAT(IFNULL(zz_student.login_mobile,''), IFNULL(zz_student.student_name,'')) LIKE #{safeStudentSearchString}
|
||||
</if>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getStudentList" resultMap="BaseResultMap" parameterType="com.orange.demo.webadmin.app.model.Student">
|
||||
SELECT * FROM zz_student
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getStudentListByClassId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
zz_student.*
|
||||
FROM
|
||||
zz_student,
|
||||
zz_class_student
|
||||
<where>
|
||||
AND zz_class_student.class_id = #{classId}
|
||||
AND zz_class_student.student_id = zz_student.student_id
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getNotInStudentListByClassId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
zz_student.*
|
||||
FROM
|
||||
zz_student
|
||||
<where>
|
||||
AND NOT EXISTS (SELECT * FROM zz_class_student
|
||||
WHERE zz_class_student.class_id = #{classId} AND zz_class_student.student_id = zz_student.student_id)
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,41 @@
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* ClassCourseDto对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* ClassStudentDto对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.orange.demo.webadmin.app.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
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.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* CourseDto对象。
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* 年级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;
|
||||
|
||||
/**
|
||||
* 课时数量。
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.orange.demo.webadmin.app.dto;
|
||||
|
||||
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.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* CourseTransStatsDto对象。
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* 年级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;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* GradeDto对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* SchoolInfoDto对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
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.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* StudentActionStatsDto对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.orange.demo.webadmin.app.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
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.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* StudentActionTransDto对象。
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* 设备类型(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;
|
||||
|
||||
/**
|
||||
* 看视频秒数。
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.orange.demo.webadmin.app.dto;
|
||||
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* StudentClassDto对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.orange.demo.webadmin.app.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
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.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* StudentDto对象。
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* 生日。
|
||||
*/
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 总共充值学币数量。
|
||||
*/
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 行政区划实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_area_code")
|
||||
public class AreaCode {
|
||||
|
||||
/**
|
||||
* 行政区划主键Id
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "area_id")
|
||||
private Long areaId;
|
||||
|
||||
/**
|
||||
* 行政区划名称
|
||||
*/
|
||||
@Column(name = "area_name")
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 行政区划级别 (1: 省级别 2: 市级别 3: 区级别)
|
||||
*/
|
||||
@Column(name = "area_level")
|
||||
private Integer areaLevel;
|
||||
|
||||
/**
|
||||
* 父级行政区划Id
|
||||
*/
|
||||
@Column(name = "parent_id")
|
||||
private Long parentId;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* ClassCourse实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_class_course")
|
||||
public class ClassCourse {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "class_id")
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 课程Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "course_id")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程顺序(数值越小越靠前)。
|
||||
*/
|
||||
@Column(name = "course_order")
|
||||
private Integer courseOrder;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* ClassStudent实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_class_student")
|
||||
public class ClassStudent {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "class_id")
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "student_id")
|
||||
private Long studentId;
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
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;
|
||||
import com.orange.demo.common.core.annotation.UploadFlagColumn;
|
||||
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.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;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Course实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_course")
|
||||
public class Course {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "course_id")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称。
|
||||
*/
|
||||
@Column(name = "course_name")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 课程价格。
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 课程描述。
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 课程难度(0: 容易 1: 普通 2: 很难)。
|
||||
*/
|
||||
private Integer difficulty;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@Column(name = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 学科Id。
|
||||
*/
|
||||
@Column(name = "subject_id")
|
||||
private Integer subjectId;
|
||||
|
||||
/**
|
||||
* 课时数量。
|
||||
*/
|
||||
@Column(name = "class_hour")
|
||||
private Integer classHour;
|
||||
|
||||
/**
|
||||
* 多张课程图片地址。
|
||||
*/
|
||||
@UploadFlagColumn(storeType = UploadStoreTypeEnum.LOCAL_SYSTEM)
|
||||
@Column(name = "picture_url")
|
||||
private String pictureUrl;
|
||||
|
||||
/**
|
||||
* 创建用户Id。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 最后修改时间。
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* price 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
private BigDecimal priceStart;
|
||||
|
||||
/**
|
||||
* price 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
private BigDecimal priceEnd;
|
||||
|
||||
/**
|
||||
* classHour 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
private Integer classHourStart;
|
||||
|
||||
/**
|
||||
* classHour 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
private Integer classHourEnd;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
private String createTimeStart;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
private String createTimeEnd;
|
||||
|
||||
/**
|
||||
* courseId 的多对多关联表数据对象。
|
||||
*/
|
||||
@Transient
|
||||
private ClassCourse classCourse;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "gradeId",
|
||||
slaveServiceName = "gradeService",
|
||||
slaveModelClass = Grade.class,
|
||||
slaveIdField = "gradeId",
|
||||
slaveNameField = "gradeName")
|
||||
@Transient
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "difficulty",
|
||||
constantDictClass = CourseDifficult.class)
|
||||
@Transient
|
||||
private Map<String, Object> difficultyDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "subjectId",
|
||||
constantDictClass = Subject.class)
|
||||
@Transient
|
||||
private Map<String, Object> subjectIdDictMap;
|
||||
|
||||
@Mapper
|
||||
public interface CourseModelMapper extends BaseModelMapper<CourseVo, Course> {
|
||||
/**
|
||||
* 转换Vo对象到实体对象。
|
||||
*
|
||||
* @param courseVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Mapping(target = "classCourse", expression = "java(mapToBean(courseVo.getClassCourse(), com.orange.demo.webadmin.app.model.ClassCourse.class))")
|
||||
@Override
|
||||
Course toModel(CourseVo courseVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param course 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Mapping(target = "classCourse", expression = "java(beanToMap(course.getClassCourse(), false))")
|
||||
@Override
|
||||
CourseVo fromModel(Course course);
|
||||
}
|
||||
public static final CourseModelMapper INSTANCE = Mappers.getMapper(CourseModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.orange.demo.application.common.constant.Subject;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* CourseTransStats实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_course_trans_stats")
|
||||
public class CourseTransStats {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "stats_id")
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 统计日期。
|
||||
*/
|
||||
@Column(name = "stats_date")
|
||||
private Date statsDate;
|
||||
|
||||
/**
|
||||
* 科目Id。
|
||||
*/
|
||||
@Column(name = "subject_id")
|
||||
private Integer subjectId;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@Column(name = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 年级名称。
|
||||
*/
|
||||
@Column(name = "grade_name")
|
||||
private String gradeName;
|
||||
|
||||
/**
|
||||
* 课程Id。
|
||||
*/
|
||||
@Column(name = "course_id")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称。
|
||||
*/
|
||||
@Column(name = "course_name")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 学生上课次数。
|
||||
*/
|
||||
@Column(name = "student_attend_count")
|
||||
private Integer studentAttendCount;
|
||||
|
||||
/**
|
||||
* 学生献花数量。
|
||||
*/
|
||||
@Column(name = "student_flower_amount")
|
||||
private Integer studentFlowerAmount;
|
||||
|
||||
/**
|
||||
* 学生献花次数。
|
||||
*/
|
||||
@Column(name = "student_flower_count")
|
||||
private Integer studentFlowerCount;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
private String statsDateStart;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
private String statsDateEnd;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "gradeId",
|
||||
slaveServiceName = "gradeService",
|
||||
slaveModelClass = Grade.class,
|
||||
slaveIdField = "gradeId",
|
||||
slaveNameField = "gradeName")
|
||||
@Transient
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "subjectId",
|
||||
constantDictClass = Subject.class)
|
||||
@Transient
|
||||
private Map<String, Object> subjectIdDictMap;
|
||||
|
||||
@Mapper
|
||||
public interface CourseTransStatsModelMapper extends BaseModelMapper<CourseTransStatsVo, CourseTransStats> {
|
||||
/**
|
||||
* 转换Vo对象到实体对象。
|
||||
*
|
||||
* @param courseTransStatsVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Override
|
||||
CourseTransStats toModel(CourseTransStatsVo courseTransStatsVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param courseTransStats 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Override
|
||||
CourseTransStatsVo fromModel(CourseTransStats courseTransStats);
|
||||
}
|
||||
public static final CourseTransStatsModelMapper INSTANCE = Mappers.getMapper(CourseTransStatsModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* Grade实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_grade")
|
||||
public class Grade {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 年级名称。
|
||||
*/
|
||||
@Column(name = "grade_name")
|
||||
private String gradeName;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@DeletedFlagColumn
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* MaterialEdition实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_material_edition")
|
||||
public class MaterialEdition {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "edition_id")
|
||||
private Integer editionId;
|
||||
|
||||
/**
|
||||
* 教材版本名称。
|
||||
*/
|
||||
@Column(name = "edition_name")
|
||||
private String editionName;
|
||||
|
||||
/**
|
||||
* 是否正在使用(0:不是,1:是)。
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* SchoolInfo实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_school_info")
|
||||
public class SchoolInfo {
|
||||
|
||||
/**
|
||||
* 学校Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "school_id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学校名称。
|
||||
*/
|
||||
@Column(name = "school_name")
|
||||
private String schoolName;
|
||||
|
||||
/**
|
||||
* 所在省Id。
|
||||
*/
|
||||
@Column(name = "province_id")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 所在城市Id。
|
||||
*/
|
||||
@Column(name = "city_id")
|
||||
private Long cityId;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "provinceId",
|
||||
slaveServiceName = "areaCodeService",
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "cityId",
|
||||
slaveServiceName = "areaCodeService",
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
|
||||
@Mapper
|
||||
public interface SchoolInfoModelMapper extends BaseModelMapper<SchoolInfoVo, SchoolInfo> {
|
||||
/**
|
||||
* 转换Vo对象到实体对象。
|
||||
*
|
||||
* @param schoolInfoVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Override
|
||||
SchoolInfo toModel(SchoolInfoVo schoolInfoVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param schoolInfo 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Override
|
||||
SchoolInfoVo fromModel(SchoolInfo schoolInfo);
|
||||
}
|
||||
public static final SchoolInfoModelMapper INSTANCE = Mappers.getMapper(SchoolInfoModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
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 com.orange.demo.common.core.util.MyCommonUtil;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* Student实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_student")
|
||||
public class Student {
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "student_id")
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 登录手机。
|
||||
*/
|
||||
@Column(name = "login_mobile")
|
||||
private String loginMobile;
|
||||
|
||||
/**
|
||||
* 学生姓名。
|
||||
*/
|
||||
@Column(name = "student_name")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 所在省份Id。
|
||||
*/
|
||||
@Column(name = "province_id")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 所在城市Id。
|
||||
*/
|
||||
@Column(name = "city_id")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* 区县Id。
|
||||
*/
|
||||
@Column(name = "district_id")
|
||||
private Long districtId;
|
||||
|
||||
/**
|
||||
* 学生性别 (0: 女生 1: 男生)。
|
||||
*/
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 生日。
|
||||
*/
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)。
|
||||
*/
|
||||
@Column(name = "experience_level")
|
||||
private Integer experienceLevel;
|
||||
|
||||
/**
|
||||
* 总共充值学币数量。
|
||||
*/
|
||||
@Column(name = "total_coin")
|
||||
private Integer totalCoin;
|
||||
|
||||
/**
|
||||
* 可用学币数量。
|
||||
*/
|
||||
@Column(name = "left_coin")
|
||||
private Integer leftCoin;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@Column(name = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 校区Id。
|
||||
*/
|
||||
@Column(name = "school_id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 注册时间。
|
||||
*/
|
||||
@Column(name = "register_time")
|
||||
private Date registerTime;
|
||||
|
||||
/**
|
||||
* 学生状态 (0: 正常 1: 锁定 2: 注销)。
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* birthday 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
private String birthdayStart;
|
||||
|
||||
/**
|
||||
* birthday 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
private String birthdayEnd;
|
||||
|
||||
/**
|
||||
* registerTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
private String registerTimeStart;
|
||||
|
||||
/**
|
||||
* registerTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
private String registerTimeEnd;
|
||||
|
||||
/**
|
||||
* login_mobile / student_name LIKE搜索字符串。
|
||||
*/
|
||||
@Transient
|
||||
private String searchString;
|
||||
|
||||
public void setSearchString(String searchString) {
|
||||
this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
|
||||
}
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "provinceId",
|
||||
slaveServiceName = "areaCodeService",
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "cityId",
|
||||
slaveServiceName = "areaCodeService",
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "districtId",
|
||||
slaveServiceName = "areaCodeService",
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
private Map<String, Object> districtIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "gradeId",
|
||||
slaveServiceName = "gradeService",
|
||||
slaveModelClass = Grade.class,
|
||||
slaveIdField = "gradeId",
|
||||
slaveNameField = "gradeName")
|
||||
@Transient
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "schoolId",
|
||||
slaveServiceName = "schoolInfoService",
|
||||
slaveModelClass = SchoolInfo.class,
|
||||
slaveIdField = "schoolId",
|
||||
slaveNameField = "schoolName")
|
||||
@Transient
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "gender",
|
||||
constantDictClass = Gender.class)
|
||||
@Transient
|
||||
private Map<String, Object> genderDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "experienceLevel",
|
||||
constantDictClass = ExpLevel.class)
|
||||
@Transient
|
||||
private Map<String, Object> experienceLevelDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "status",
|
||||
constantDictClass = StudentStatus.class)
|
||||
@Transient
|
||||
private Map<String, Object> statusDictMap;
|
||||
|
||||
@Mapper
|
||||
public interface StudentModelMapper extends BaseModelMapper<StudentVo, Student> {
|
||||
/**
|
||||
* 转换Vo对象到实体对象。
|
||||
*
|
||||
* @param studentVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Override
|
||||
Student toModel(StudentVo studentVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param student 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Override
|
||||
StudentVo fromModel(Student student);
|
||||
}
|
||||
public static final StudentModelMapper INSTANCE = Mappers.getMapper(StudentModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* StudentActionStats实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_student_action_stats")
|
||||
public class StudentActionStats {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "stats_id")
|
||||
private Long statsId;
|
||||
|
||||
/**
|
||||
* 统计日期。
|
||||
*/
|
||||
@Column(name = "stats_date")
|
||||
private Date statsDate;
|
||||
|
||||
/**
|
||||
* 统计小时。
|
||||
*/
|
||||
@Column(name = "stats_month")
|
||||
private Date statsMonth;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@Column(name = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 学生所在省Id。
|
||||
*/
|
||||
@Column(name = "province_id")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 学生所在城市Id。
|
||||
*/
|
||||
@Column(name = "city_id")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* 购课学币数量。
|
||||
*/
|
||||
@Column(name = "buy_course_amount")
|
||||
private Integer buyCourseAmount;
|
||||
|
||||
/**
|
||||
* 购买课程次数。
|
||||
*/
|
||||
@Column(name = "buy_course_count")
|
||||
private Integer buyCourseCount;
|
||||
|
||||
/**
|
||||
* 购买视频学币数量。
|
||||
*/
|
||||
@Column(name = "buy_video_amount")
|
||||
private Integer buyVideoAmount;
|
||||
|
||||
/**
|
||||
* 购买视频次数。
|
||||
*/
|
||||
@Column(name = "buy_video_count")
|
||||
private Integer buyVideoCount;
|
||||
|
||||
/**
|
||||
* 购买作业学币数量。
|
||||
*/
|
||||
@Column(name = "buy_paper_amount")
|
||||
private Integer buyPaperAmount;
|
||||
|
||||
/**
|
||||
* 购买作业次数。
|
||||
*/
|
||||
@Column(name = "buy_paper_count")
|
||||
private Integer buyPaperCount;
|
||||
|
||||
/**
|
||||
* 购买献花数量。
|
||||
*/
|
||||
@Column(name = "buy_flower_amount")
|
||||
private Integer buyFlowerAmount;
|
||||
|
||||
/**
|
||||
* 购买献花次数。
|
||||
*/
|
||||
@Column(name = "buy_flower_count")
|
||||
private Integer buyFlowerCount;
|
||||
|
||||
/**
|
||||
* 充值学币数量。
|
||||
*/
|
||||
@Column(name = "recharge_coin_amount")
|
||||
private Integer rechargeCoinAmount;
|
||||
|
||||
/**
|
||||
* 充值学币次数。
|
||||
*/
|
||||
@Column(name = "recharge_coin_count")
|
||||
private Integer rechargeCoinCount;
|
||||
|
||||
/**
|
||||
* 线下课程上课次数。
|
||||
*/
|
||||
@Column(name = "do_course_count")
|
||||
private Integer doCourseCount;
|
||||
|
||||
/**
|
||||
* 观看视频次数。
|
||||
*/
|
||||
@Column(name = "watch_video_count")
|
||||
private Integer watchVideoCount;
|
||||
|
||||
/**
|
||||
* 购买献花消费学币数量。
|
||||
*/
|
||||
@Column(name = "watch_video_total_second")
|
||||
private Integer watchVideoTotalSecond;
|
||||
|
||||
/**
|
||||
* 做题数量。
|
||||
*/
|
||||
@Column(name = "do_exercise_count")
|
||||
private Integer doExerciseCount;
|
||||
|
||||
/**
|
||||
* 做题正确的数量。
|
||||
*/
|
||||
@Column(name = "do_exercise_correct_count")
|
||||
private Integer doExerciseCorrectCount;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
private String statsDateStart;
|
||||
|
||||
/**
|
||||
* statsDate 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
private String statsDateEnd;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "gradeId",
|
||||
slaveServiceName = "gradeService",
|
||||
slaveModelClass = Grade.class,
|
||||
slaveIdField = "gradeId",
|
||||
slaveNameField = "gradeName")
|
||||
@Transient
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "provinceId",
|
||||
slaveServiceName = "areaCodeService",
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "cityId",
|
||||
slaveServiceName = "areaCodeService",
|
||||
slaveModelClass = AreaCode.class,
|
||||
slaveIdField = "areaId",
|
||||
slaveNameField = "areaName")
|
||||
@Transient
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
|
||||
@Mapper
|
||||
public interface StudentActionStatsModelMapper extends BaseModelMapper<StudentActionStatsVo, StudentActionStats> {
|
||||
/**
|
||||
* 转换Vo对象到实体对象。
|
||||
*
|
||||
* @param studentActionStatsVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Override
|
||||
StudentActionStats toModel(StudentActionStatsVo studentActionStatsVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param studentActionStats 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Override
|
||||
StudentActionStatsVo fromModel(StudentActionStats studentActionStats);
|
||||
}
|
||||
public static final StudentActionStatsModelMapper INSTANCE = Mappers.getMapper(StudentActionStatsModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
import com.orange.demo.application.common.constant.StudentActionType;
|
||||
import com.orange.demo.application.common.constant.DeviceType;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* StudentActionTrans实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_student_action_trans")
|
||||
public class StudentActionTrans {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "trans_id")
|
||||
private Long transId;
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@Column(name = "student_id")
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 学生名称。
|
||||
*/
|
||||
@Column(name = "student_name")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 学生校区。
|
||||
*/
|
||||
@Column(name = "school_id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@Column(name = "grade_id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)。
|
||||
*/
|
||||
@Column(name = "action_type")
|
||||
private Integer actionType;
|
||||
|
||||
/**
|
||||
* 设备类型(0: iOS 1: Android 2: PC)。
|
||||
*/
|
||||
@Column(name = "device_type")
|
||||
private Integer deviceType;
|
||||
|
||||
/**
|
||||
* 看视频秒数。
|
||||
*/
|
||||
@Column(name = "watch_video_seconds")
|
||||
private Integer watchVideoSeconds;
|
||||
|
||||
/**
|
||||
* 购买献花数量。
|
||||
*/
|
||||
@Column(name = "flower_count")
|
||||
private Integer flowerCount;
|
||||
|
||||
/**
|
||||
* 购买作业数量。
|
||||
*/
|
||||
@Column(name = "paper_count")
|
||||
private Integer paperCount;
|
||||
|
||||
/**
|
||||
* 购买视频数量。
|
||||
*/
|
||||
@Column(name = "video_count")
|
||||
private Integer videoCount;
|
||||
|
||||
/**
|
||||
* 购买课程数量。
|
||||
*/
|
||||
@Column(name = "course_count")
|
||||
private Integer courseCount;
|
||||
|
||||
/**
|
||||
* 充值学币数量。
|
||||
*/
|
||||
@Column(name = "coin_count")
|
||||
private Integer coinCount;
|
||||
|
||||
/**
|
||||
* 做题是否正确标记。
|
||||
*/
|
||||
@Column(name = "exercise_correct_flag")
|
||||
private Integer exerciseCorrectFlag;
|
||||
|
||||
/**
|
||||
* 发生时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@Transient
|
||||
private String createTimeStart;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@Transient
|
||||
private String createTimeEnd;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "schoolId",
|
||||
slaveServiceName = "schoolInfoService",
|
||||
slaveModelClass = SchoolInfo.class,
|
||||
slaveIdField = "schoolId",
|
||||
slaveNameField = "schoolName")
|
||||
@Transient
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "gradeId",
|
||||
slaveServiceName = "gradeService",
|
||||
slaveModelClass = Grade.class,
|
||||
slaveIdField = "gradeId",
|
||||
slaveNameField = "gradeName")
|
||||
@Transient
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "actionType",
|
||||
constantDictClass = StudentActionType.class)
|
||||
@Transient
|
||||
private Map<String, Object> actionTypeDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "deviceType",
|
||||
constantDictClass = DeviceType.class)
|
||||
@Transient
|
||||
private Map<String, Object> deviceTypeDictMap;
|
||||
|
||||
@Mapper
|
||||
public interface StudentActionTransModelMapper extends BaseModelMapper<StudentActionTransVo, StudentActionTrans> {
|
||||
/**
|
||||
* 转换Vo对象到实体对象。
|
||||
*
|
||||
* @param studentActionTransVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Override
|
||||
StudentActionTrans toModel(StudentActionTransVo studentActionTransVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param studentActionTrans 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Override
|
||||
StudentActionTransVo fromModel(StudentActionTrans studentActionTrans);
|
||||
}
|
||||
public static final StudentActionTransModelMapper INSTANCE = Mappers.getMapper(StudentActionTransModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.orange.demo.webadmin.app.model;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* StudentClass实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zz_class")
|
||||
public class StudentClass {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "class_id")
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 班级名称。
|
||||
*/
|
||||
@Column(name = "class_name")
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 学校Id。
|
||||
*/
|
||||
@Column(name = "school_id")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学生班长Id。
|
||||
*/
|
||||
@Column(name = "leader_id")
|
||||
private Long leaderId;
|
||||
|
||||
/**
|
||||
* 已完成课时数量。
|
||||
*/
|
||||
@Column(name = "finish_class_hour")
|
||||
private Integer finishClassHour;
|
||||
|
||||
/**
|
||||
* 班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)。
|
||||
*/
|
||||
@Column(name = "class_level")
|
||||
private Integer classLevel;
|
||||
|
||||
/**
|
||||
* 创建用户。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 班级创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@DeletedFlagColumn
|
||||
private Integer status;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "schoolId",
|
||||
slaveServiceName = "schoolInfoService",
|
||||
slaveModelClass = SchoolInfo.class,
|
||||
slaveIdField = "schoolId",
|
||||
slaveNameField = "schoolName")
|
||||
@Transient
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "leaderId",
|
||||
slaveServiceName = "studentService",
|
||||
slaveModelClass = Student.class,
|
||||
slaveIdField = "studentId",
|
||||
slaveNameField = "studentName")
|
||||
@Transient
|
||||
private Map<String, Object> leaderIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "classLevel",
|
||||
constantDictClass = ClassLevel.class)
|
||||
@Transient
|
||||
private Map<String, Object> classLevelDictMap;
|
||||
|
||||
@Mapper
|
||||
public interface StudentClassModelMapper extends BaseModelMapper<StudentClassVo, StudentClass> {
|
||||
/**
|
||||
* 转换Vo对象到实体对象。
|
||||
*
|
||||
* @param studentClassVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Override
|
||||
StudentClass toModel(StudentClassVo studentClassVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param studentClass 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Override
|
||||
StudentClassVo fromModel(StudentClass studentClass);
|
||||
}
|
||||
public static final StudentClassModelMapper INSTANCE = Mappers.getMapper(StudentClassModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orange.demo.webadmin.app.model.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 班级级别常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public final class ClassLevel {
|
||||
|
||||
/**
|
||||
* 初级班。
|
||||
*/
|
||||
public static final int NORMAL = 0;
|
||||
/**
|
||||
* 中级班。
|
||||
*/
|
||||
public static final int MIDDLE = 1;
|
||||
/**
|
||||
* 高级班。
|
||||
*/
|
||||
public static final int HIGH = 2;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(3);
|
||||
static {
|
||||
DICT_MAP.put(NORMAL, "初级班");
|
||||
DICT_MAP.put(MIDDLE, "中级班");
|
||||
DICT_MAP.put(HIGH, "高级班");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private ClassLevel() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.orange.demo.webadmin.app.model.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 班级状态常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public final class ClassStatus {
|
||||
|
||||
/**
|
||||
* 正常。
|
||||
*/
|
||||
public static final int NORAML = 1;
|
||||
/**
|
||||
* 解散。
|
||||
*/
|
||||
public static final int DELETED = -1;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(2);
|
||||
static {
|
||||
DICT_MAP.put(NORAML, "正常");
|
||||
DICT_MAP.put(DELETED, "解散");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private ClassStatus() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orange.demo.webadmin.app.model.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 课程难度常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public final class CourseDifficult {
|
||||
|
||||
/**
|
||||
* 容易。
|
||||
*/
|
||||
public static final int NORMAL = 0;
|
||||
/**
|
||||
* 普通。
|
||||
*/
|
||||
public static final int MIDDLE = 1;
|
||||
/**
|
||||
* 困难。
|
||||
*/
|
||||
public static final int HIGH = 2;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(3);
|
||||
static {
|
||||
DICT_MAP.put(NORMAL, "容易");
|
||||
DICT_MAP.put(MIDDLE, "普通");
|
||||
DICT_MAP.put(HIGH, "困难");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private CourseDifficult() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.orange.demo.webadmin.app.service;
|
||||
|
||||
import com.orange.demo.common.core.base.service.IBaseDictService;
|
||||
import com.orange.demo.webadmin.app.model.AreaCode;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 行政区划的Service接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface AreaCodeService extends IBaseDictService<AreaCode, Long> {
|
||||
|
||||
/**
|
||||
* 根据上级行政区划Id,获取其下级行政区划列表。
|
||||
*
|
||||
* @param parentId 上级行政区划Id。
|
||||
* @return 下级行政区划列表。
|
||||
*/
|
||||
Collection<AreaCode> getListByParentId(Long parentId);
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.orange.demo.webadmin.app.service;
|
||||
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.object.CallResult;
|
||||
import com.orange.demo.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 课程数据数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface CourseService extends IBaseService<Course, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param course 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
Course saveNew(Course course);
|
||||
|
||||
/**
|
||||
* 更新数据对象。
|
||||
*
|
||||
* @param course 更新的对象。
|
||||
* @param originalCourse 原有数据对象。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean update(Course course, Course originalCourse);
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param courseId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long courseId);
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getCourseListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<Course> getCourseList(Course filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getCourseList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<Course> getCourseListWithRelation(Course filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 在多对多关系中,当前Service的数据表为从表,返回不与指定主表主键Id存在对多对关系的列表。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param filter 从表的过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<Course> getNotInCourseListByClassId(Long classId, Course filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 在多对多关系中,当前Service的数据表为从表,返回与指定主表主键Id存在对多对关系的列表。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param filter 从表的过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<Course> getCourseListByClassId(Long classId, Course filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param course 最新数据对象。
|
||||
* @param originalCourse 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
CallResult verifyRelatedData(Course course, Course originalCourse);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.orange.demo.webadmin.app.service;
|
||||
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 课程统计数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface CourseTransStatsService extends IBaseService<CourseTransStats, Long> {
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getCourseTransStatsListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<CourseTransStats> getCourseTransStatsList(CourseTransStats filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getCourseTransStatsList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<CourseTransStats> getCourseTransStatsListWithRelation(CourseTransStats filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取分组过滤后的数据查询结果,以及关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param groupSelect 分组显示列表参数。位于SQL语句SELECT的后面。
|
||||
* @param groupBy 分组参数。位于SQL语句的GROUP BY后面。
|
||||
* @param orderBy 排序字符串,ORDER BY从句的参数。
|
||||
* @return 分组过滤结果集。
|
||||
*/
|
||||
List<CourseTransStats> getGroupedCourseTransStatsListWithRelation(
|
||||
CourseTransStats filter, String groupSelect, String groupBy, String orderBy);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orange.demo.webadmin.app.service;
|
||||
|
||||
import com.orange.demo.common.core.base.service.IBaseDictService;
|
||||
import com.orange.demo.webadmin.app.model.Grade;
|
||||
|
||||
/**
|
||||
* 年级字典数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface GradeService extends IBaseDictService<Grade, Integer> {
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.orange.demo.webadmin.app.service;
|
||||
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.object.CallResult;
|
||||
import com.orange.demo.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 校区数据数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface SchoolInfoService extends IBaseService<SchoolInfo, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param schoolInfo 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
SchoolInfo saveNew(SchoolInfo schoolInfo);
|
||||
|
||||
/**
|
||||
* 更新数据对象。
|
||||
*
|
||||
* @param schoolInfo 更新的对象。
|
||||
* @param originalSchoolInfo 原有数据对象。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean update(SchoolInfo schoolInfo, SchoolInfo originalSchoolInfo);
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param schoolId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long schoolId);
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getSchoolInfoListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<SchoolInfo> getSchoolInfoList(SchoolInfo filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getSchoolInfoList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<SchoolInfo> getSchoolInfoListWithRelation(SchoolInfo filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param schoolInfo 最新数据对象。
|
||||
* @param originalSchoolInfo 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
CallResult verifyRelatedData(SchoolInfo schoolInfo, SchoolInfo originalSchoolInfo);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.orange.demo.webadmin.app.service;
|
||||
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生行为统计数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface StudentActionStatsService extends IBaseService<StudentActionStats, Long> {
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getStudentActionStatsListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<StudentActionStats> getStudentActionStatsList(StudentActionStats filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getStudentActionStatsList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<StudentActionStats> getStudentActionStatsListWithRelation(StudentActionStats filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取分组过滤后的数据查询结果,以及关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param groupSelect 分组显示列表参数。位于SQL语句SELECT的后面。
|
||||
* @param groupBy 分组参数。位于SQL语句的GROUP BY后面。
|
||||
* @param orderBy 排序字符串,ORDER BY从句的参数。
|
||||
* @return 分组过滤结果集。
|
||||
*/
|
||||
List<StudentActionStats> getGroupedStudentActionStatsListWithRelation(
|
||||
StudentActionStats filter, String groupSelect, String groupBy, String orderBy);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.orange.demo.webadmin.app.service;
|
||||
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.object.CallResult;
|
||||
import com.orange.demo.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生行为流水数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface StudentActionTransService extends IBaseService<StudentActionTrans, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param studentActionTrans 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
StudentActionTrans saveNew(StudentActionTrans studentActionTrans);
|
||||
|
||||
/**
|
||||
* 更新数据对象。
|
||||
*
|
||||
* @param studentActionTrans 更新的对象。
|
||||
* @param originalStudentActionTrans 原有数据对象。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean update(StudentActionTrans studentActionTrans, StudentActionTrans originalStudentActionTrans);
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param transId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long transId);
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getStudentActionTransListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<StudentActionTrans> getStudentActionTransList(StudentActionTrans filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getStudentActionTransList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<StudentActionTrans> getStudentActionTransListWithRelation(StudentActionTrans filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param studentActionTrans 最新数据对象。
|
||||
* @param originalStudentActionTrans 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
CallResult verifyRelatedData(StudentActionTrans studentActionTrans, StudentActionTrans originalStudentActionTrans);
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.orange.demo.webadmin.app.service;
|
||||
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.object.CallResult;
|
||||
import com.orange.demo.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 班级数据数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface StudentClassService extends IBaseService<StudentClass, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param studentClass 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
StudentClass saveNew(StudentClass studentClass);
|
||||
|
||||
/**
|
||||
* 更新数据对象。
|
||||
*
|
||||
* @param studentClass 更新的对象。
|
||||
* @param originalStudentClass 原有数据对象。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean update(StudentClass studentClass, StudentClass originalStudentClass);
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param classId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long classId);
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getStudentClassListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<StudentClass> getStudentClassList(StudentClass filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getStudentClassList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<StudentClass> getStudentClassListWithRelation(StudentClass filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 批量添加多对多关联关系。
|
||||
*
|
||||
* @param classCourseList 多对多关联表对象集合。
|
||||
* @param classId 主表Id。
|
||||
*/
|
||||
void addClassCourseList(List<ClassCourse> classCourseList, Long classId);
|
||||
|
||||
/**
|
||||
* 更新中间表数据。
|
||||
*
|
||||
* @param classCourse 中间表对象。
|
||||
* @return 更新成功与否。
|
||||
*/
|
||||
boolean updateClassCourse(ClassCourse classCourse);
|
||||
|
||||
/**
|
||||
* 获取中间表数据。
|
||||
*
|
||||
* @param classId 主表Id。
|
||||
* @param courseId 从表Id。
|
||||
* @return 中间表对象。
|
||||
*/
|
||||
ClassCourse getClassCourse(Long classId, Long courseId);
|
||||
|
||||
/**
|
||||
* 移除单条多对多关系。
|
||||
*
|
||||
* @param classId 主表Id。
|
||||
* @param courseId 从表Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean removeClassCourse(Long classId, Long courseId);
|
||||
|
||||
/**
|
||||
* 批量添加多对多关联关系。
|
||||
*
|
||||
* @param classStudentList 多对多关联表对象集合。
|
||||
* @param classId 主表Id。
|
||||
*/
|
||||
void addClassStudentList(List<ClassStudent> classStudentList, Long classId);
|
||||
|
||||
/**
|
||||
* 移除单条多对多关系。
|
||||
*
|
||||
* @param classId 主表Id。
|
||||
* @param studentId 从表Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean removeClassStudent(Long classId, Long studentId);
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param studentClass 最新数据对象。
|
||||
* @param originalStudentClass 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
CallResult verifyRelatedData(StudentClass studentClass, StudentClass originalStudentClass);
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.orange.demo.webadmin.app.service;
|
||||
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.object.CallResult;
|
||||
import com.orange.demo.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生数据数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
public interface StudentService extends IBaseService<Student, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param student 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
Student saveNew(Student student);
|
||||
|
||||
/**
|
||||
* 更新数据对象。
|
||||
*
|
||||
* @param student 更新的对象。
|
||||
* @param originalStudent 原有数据对象。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean update(Student student, Student originalStudent);
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param studentId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long studentId);
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getStudentListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<Student> getStudentList(Student filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getStudentList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<Student> getStudentListWithRelation(Student filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 在多对多关系中,当前Service的数据表为从表,返回不与指定主表主键Id存在对多对关系的列表。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param filter 从表的过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<Student> getNotInStudentListByClassId(Long classId, Student filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 在多对多关系中,当前Service的数据表为从表,返回与指定主表主键Id存在对多对关系的列表。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param filter 从表的过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<Student> getStudentListByClassId(Long classId, Student filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param student 最新数据对象。
|
||||
* @param originalStudent 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
CallResult verifyRelatedData(Student student, Student originalStudent);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.orange.demo.webadmin.app.service.AreaCodeService;
|
||||
import com.orange.demo.webadmin.app.dao.AreaCodeMapper;
|
||||
import com.orange.demo.webadmin.app.model.AreaCode;
|
||||
import com.orange.demo.common.core.cache.MapTreeDictionaryCache;
|
||||
import com.orange.demo.common.core.base.service.BaseDictService;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 行政区划的Service类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Service("areaCodeService")
|
||||
public class AreaCodeServiceImpl extends BaseDictService<AreaCode, Long> implements AreaCodeService {
|
||||
|
||||
@Autowired
|
||||
private AreaCodeMapper areaCodeMapper;
|
||||
|
||||
public AreaCodeServiceImpl() {
|
||||
super();
|
||||
this.dictionaryCache = MapTreeDictionaryCache.create(AreaCode::getAreaId, AreaCode::getParentId);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.reloadCachedData(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BaseDaoMapper<AreaCode> mapper() {
|
||||
return areaCodeMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据上级行政区划Id,获取其下级行政区划列表。
|
||||
*
|
||||
* @param parentId 上级行政区划Id。
|
||||
* @return 下级行政区划列表。
|
||||
*/
|
||||
@Override
|
||||
public Collection<AreaCode> getListByParentId(Long parentId) {
|
||||
return ((MapTreeDictionaryCache<Long, AreaCode>) dictionaryCache).getListByParentId(parentId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.core.object.TokenData;
|
||||
import com.orange.demo.common.core.object.MyRelationParam;
|
||||
import com.orange.demo.common.core.object.CallResult;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 课程数据数据操作服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("courseService")
|
||||
public class CourseServiceImpl extends BaseService<Course, Long> implements CourseService {
|
||||
|
||||
@Autowired
|
||||
private CourseMapper courseMapper;
|
||||
@Autowired
|
||||
private ClassCourseMapper classCourseMapper;
|
||||
@Autowired
|
||||
private GradeService gradeService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<Course> mapper() {
|
||||
return courseMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param course 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Course saveNew(Course course) {
|
||||
course.setCourseId(idGenerator.nextLongId());
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
course.setCreateUserId(tokenData.getUserId());
|
||||
Date now = new Date();
|
||||
course.setCreateTime(now);
|
||||
course.setUpdateTime(now);
|
||||
courseMapper.insert(course);
|
||||
return course;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据对象。
|
||||
*
|
||||
* @param course 更新的对象。
|
||||
* @param originalCourse 原有数据对象。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(Course course, Course originalCourse) {
|
||||
course.setCreateUserId(originalCourse.getCreateUserId());
|
||||
course.setCreateTime(originalCourse.getCreateTime());
|
||||
course.setUpdateTime(new Date());
|
||||
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
|
||||
return courseMapper.updateByPrimaryKey(course) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param courseId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long courseId) {
|
||||
// 这里先删除主数据
|
||||
if (!this.removeById(courseId)) {
|
||||
return false;
|
||||
}
|
||||
// 开始删除多对多父表的关联
|
||||
ClassCourse classCourse = new ClassCourse();
|
||||
classCourse.setCourseId(courseId);
|
||||
classCourseMapper.delete(classCourse);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getCourseListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<Course> getCourseList(Course filter, String orderBy) {
|
||||
return courseMapper.getCourseList(filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getCourseList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<Course> getCourseListWithRelation(Course filter, String orderBy) {
|
||||
List<Course> resultList = courseMapper.getCourseList(filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在多对多关系中,当前Service的数据表为从表,返回不与指定主表主键Id存在对多对关系的列表。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param filter 从表的过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<Course> getNotInCourseListByClassId(Long classId, Course filter, String orderBy) {
|
||||
List<Course> resultList =
|
||||
courseMapper.getNotInCourseListByClassId(classId, filter, orderBy);
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly());
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在多对多关系中,当前Service的数据表为从表,返回与指定主表主键Id存在对多对关系的列表。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param filter 从表的过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<Course> getCourseListByClassId(Long classId, Course filter, String orderBy) {
|
||||
List<Course> resultList =
|
||||
courseMapper.getCourseListByClassId(classId, filter, orderBy);
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly());
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param course 最新数据对象。
|
||||
* @param originalCourse 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(Course course, Course originalCourse) {
|
||||
String errorMessageFormat = "数据验证失败,关联的%s并不存在,请刷新后重试!";
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(course, originalCourse, Course::getGradeId)
|
||||
&& !gradeService.existId(course.getGradeId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "所属年级"));
|
||||
}
|
||||
return CallResult.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.core.object.MyRelationParam;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.github.pagehelper.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 课程统计数据操作服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("courseTransStatsService")
|
||||
public class CourseTransStatsServiceImpl extends BaseService<CourseTransStats, Long> implements CourseTransStatsService {
|
||||
|
||||
@Autowired
|
||||
private CourseTransStatsMapper courseTransStatsMapper;
|
||||
@Autowired
|
||||
private GradeService gradeService;
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<CourseTransStats> mapper() {
|
||||
return courseTransStatsMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getCourseTransStatsListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<CourseTransStats> getCourseTransStatsList(CourseTransStats filter, String orderBy) {
|
||||
return courseTransStatsMapper.getCourseTransStatsList(filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getCourseTransStatsList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<CourseTransStats> getCourseTransStatsListWithRelation(CourseTransStats filter, String orderBy) {
|
||||
List<CourseTransStats> resultList = courseTransStatsMapper.getCourseTransStatsList(filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分组过滤后的数据查询结果,以及关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param groupSelect 分组显示列表参数。位于SQL语句SELECT的后面。
|
||||
* @param groupBy 分组参数。位于SQL语句的GROUP BY后面。
|
||||
* @param orderBy 排序字符串,ORDER BY从句的参数。
|
||||
* @return 分组过滤结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<CourseTransStats> getGroupedCourseTransStatsListWithRelation(
|
||||
CourseTransStats filter, String groupSelect, String groupBy, String orderBy) {
|
||||
List<CourseTransStats> resultList =
|
||||
courseTransStatsMapper.getGroupedCourseTransStatsList(filter, groupSelect, groupBy, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
// NOTE: 这里只是包含了关联数据,聚合计算数据没有包含。
|
||||
// 主要原因是,由于聚合字段通常被视为普通字段使用,不会在group by的从句中出现,语义上也不会在此关联。
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.orange.demo.common.core.base.service.BaseDictService;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.redis.cache.RedisDictionaryCache;
|
||||
import com.orange.demo.webadmin.app.service.GradeService;
|
||||
import com.orange.demo.webadmin.app.dao.GradeMapper;
|
||||
import com.orange.demo.webadmin.app.model.Grade;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 年级字典数据操作服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("gradeService")
|
||||
public class GradeServiceImpl extends BaseDictService<Grade, Integer> implements GradeService {
|
||||
|
||||
@Autowired
|
||||
private GradeMapper gradeMapper;
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
public GradeServiceImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.dictionaryCache = RedisDictionaryCache.create(
|
||||
redissonClient, "Grade", Grade.class, Grade::getGradeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<Grade> mapper() {
|
||||
return gradeMapper;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.core.object.MyRelationParam;
|
||||
import com.orange.demo.common.core.object.CallResult;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 校区数据数据操作服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("schoolInfoService")
|
||||
public class SchoolInfoServiceImpl extends BaseService<SchoolInfo, Long> implements SchoolInfoService {
|
||||
|
||||
@Autowired
|
||||
private SchoolInfoMapper schoolInfoMapper;
|
||||
@Autowired
|
||||
private AreaCodeService areaCodeService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<SchoolInfo> mapper() {
|
||||
return schoolInfoMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param schoolInfo 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public SchoolInfo saveNew(SchoolInfo schoolInfo) {
|
||||
schoolInfo.setSchoolId(idGenerator.nextLongId());
|
||||
schoolInfoMapper.insert(schoolInfo);
|
||||
return schoolInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据对象。
|
||||
*
|
||||
* @param schoolInfo 更新的对象。
|
||||
* @param originalSchoolInfo 原有数据对象。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SchoolInfo schoolInfo, SchoolInfo originalSchoolInfo) {
|
||||
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
|
||||
return schoolInfoMapper.updateByPrimaryKey(schoolInfo) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param schoolId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long schoolId) {
|
||||
// 这里先删除主数据
|
||||
return this.removeById(schoolId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getSchoolInfoListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<SchoolInfo> getSchoolInfoList(SchoolInfo filter, String orderBy) {
|
||||
return schoolInfoMapper.getSchoolInfoList(filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getSchoolInfoList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<SchoolInfo> getSchoolInfoListWithRelation(SchoolInfo filter, String orderBy) {
|
||||
List<SchoolInfo> resultList = schoolInfoMapper.getSchoolInfoList(filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param schoolInfo 最新数据对象。
|
||||
* @param originalSchoolInfo 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(SchoolInfo schoolInfo, SchoolInfo originalSchoolInfo) {
|
||||
String errorMessageFormat = "数据验证失败,关联的%s并不存在,请刷新后重试!";
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(schoolInfo, originalSchoolInfo, SchoolInfo::getProvinceId)
|
||||
&& !areaCodeService.existId(schoolInfo.getProvinceId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "所在省份"));
|
||||
}
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(schoolInfo, originalSchoolInfo, SchoolInfo::getCityId)
|
||||
&& !areaCodeService.existId(schoolInfo.getCityId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "所在城市"));
|
||||
}
|
||||
return CallResult.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.core.object.MyRelationParam;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.github.pagehelper.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生行为统计数据操作服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("studentActionStatsService")
|
||||
public class StudentActionStatsServiceImpl extends BaseService<StudentActionStats, Long> implements StudentActionStatsService {
|
||||
|
||||
@Autowired
|
||||
private StudentActionStatsMapper studentActionStatsMapper;
|
||||
@Autowired
|
||||
private GradeService gradeService;
|
||||
@Autowired
|
||||
private AreaCodeService areaCodeService;
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<StudentActionStats> mapper() {
|
||||
return studentActionStatsMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getStudentActionStatsListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<StudentActionStats> getStudentActionStatsList(StudentActionStats filter, String orderBy) {
|
||||
return studentActionStatsMapper.getStudentActionStatsList(filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getStudentActionStatsList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<StudentActionStats> getStudentActionStatsListWithRelation(StudentActionStats filter, String orderBy) {
|
||||
List<StudentActionStats> resultList = studentActionStatsMapper.getStudentActionStatsList(filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分组过滤后的数据查询结果,以及关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param groupSelect 分组显示列表参数。位于SQL语句SELECT的后面。
|
||||
* @param groupBy 分组参数。位于SQL语句的GROUP BY后面。
|
||||
* @param orderBy 排序字符串,ORDER BY从句的参数。
|
||||
* @return 分组过滤结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<StudentActionStats> getGroupedStudentActionStatsListWithRelation(
|
||||
StudentActionStats filter, String groupSelect, String groupBy, String orderBy) {
|
||||
List<StudentActionStats> resultList =
|
||||
studentActionStatsMapper.getGroupedStudentActionStatsList(filter, groupSelect, groupBy, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
// NOTE: 这里只是包含了关联数据,聚合计算数据没有包含。
|
||||
// 主要原因是,由于聚合字段通常被视为普通字段使用,不会在group by的从句中出现,语义上也不会在此关联。
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.core.object.MyRelationParam;
|
||||
import com.orange.demo.common.core.object.CallResult;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生行为流水数据操作服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("studentActionTransService")
|
||||
public class StudentActionTransServiceImpl extends BaseService<StudentActionTrans, Long> implements StudentActionTransService {
|
||||
|
||||
@Autowired
|
||||
private StudentActionTransMapper studentActionTransMapper;
|
||||
@Autowired
|
||||
private SchoolInfoService schoolInfoService;
|
||||
@Autowired
|
||||
private GradeService gradeService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<StudentActionTrans> mapper() {
|
||||
return studentActionTransMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param studentActionTrans 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public StudentActionTrans saveNew(StudentActionTrans studentActionTrans) {
|
||||
studentActionTrans.setTransId(idGenerator.nextLongId());
|
||||
studentActionTransMapper.insert(studentActionTrans);
|
||||
return studentActionTrans;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据对象。
|
||||
*
|
||||
* @param studentActionTrans 更新的对象。
|
||||
* @param originalStudentActionTrans 原有数据对象。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(StudentActionTrans studentActionTrans, StudentActionTrans originalStudentActionTrans) {
|
||||
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
|
||||
return studentActionTransMapper.updateByPrimaryKey(studentActionTrans) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param transId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long transId) {
|
||||
// 这里先删除主数据
|
||||
return this.removeById(transId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getStudentActionTransListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<StudentActionTrans> getStudentActionTransList(StudentActionTrans filter, String orderBy) {
|
||||
return studentActionTransMapper.getStudentActionTransList(filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getStudentActionTransList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<StudentActionTrans> getStudentActionTransListWithRelation(StudentActionTrans filter, String orderBy) {
|
||||
List<StudentActionTrans> resultList = studentActionTransMapper.getStudentActionTransList(filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param studentActionTrans 最新数据对象。
|
||||
* @param originalStudentActionTrans 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(StudentActionTrans studentActionTrans, StudentActionTrans originalStudentActionTrans) {
|
||||
String errorMessageFormat = "数据验证失败,关联的%s并不存在,请刷新后重试!";
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(studentActionTrans, originalStudentActionTrans, StudentActionTrans::getSchoolId)
|
||||
&& !schoolInfoService.existId(studentActionTrans.getSchoolId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "学生校区"));
|
||||
}
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(studentActionTrans, originalStudentActionTrans, StudentActionTrans::getGradeId)
|
||||
&& !gradeService.existId(studentActionTrans.getGradeId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "学生年级"));
|
||||
}
|
||||
return CallResult.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orange.demo.common.core.object.TokenData;
|
||||
import com.orange.demo.common.core.object.MyRelationParam;
|
||||
import com.orange.demo.common.core.object.CallResult;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.orange.demo.common.core.util.MyModelUtil;
|
||||
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 班级数据数据操作服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("studentClassService")
|
||||
public class StudentClassServiceImpl extends BaseService<StudentClass, Long> implements StudentClassService {
|
||||
|
||||
@Autowired
|
||||
private StudentClassMapper studentClassMapper;
|
||||
@Autowired
|
||||
private ClassCourseMapper classCourseMapper;
|
||||
@Autowired
|
||||
private ClassStudentMapper classStudentMapper;
|
||||
@Autowired
|
||||
private SchoolInfoService schoolInfoService;
|
||||
@Autowired
|
||||
private StudentService studentService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<StudentClass> mapper() {
|
||||
return studentClassMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param studentClass 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public StudentClass saveNew(StudentClass studentClass) {
|
||||
studentClass.setClassId(idGenerator.nextLongId());
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
studentClass.setCreateUserId(tokenData.getUserId());
|
||||
studentClass.setCreateTime(new Date());
|
||||
studentClass.setStatus(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.setDefaultValue(studentClass, "finishClassHour", 0);
|
||||
studentClassMapper.insert(studentClass);
|
||||
return studentClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据对象。
|
||||
*
|
||||
* @param studentClass 更新的对象。
|
||||
* @param originalStudentClass 原有数据对象。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(StudentClass studentClass, StudentClass originalStudentClass) {
|
||||
studentClass.setCreateUserId(originalStudentClass.getCreateUserId());
|
||||
studentClass.setCreateTime(originalStudentClass.getCreateTime());
|
||||
studentClass.setStatus(GlobalDeletedFlag.NORMAL);
|
||||
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
|
||||
return studentClassMapper.updateByPrimaryKey(studentClass) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param classId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long classId) {
|
||||
// 这里先删除主数据
|
||||
if (!this.removeById(classId)) {
|
||||
return false;
|
||||
}
|
||||
// 开始删除多对多子表的关联
|
||||
ClassCourse classCourse = new ClassCourse();
|
||||
classCourse.setClassId(classId);
|
||||
classCourseMapper.delete(classCourse);
|
||||
ClassStudent classStudent = new ClassStudent();
|
||||
classStudent.setClassId(classId);
|
||||
classStudentMapper.delete(classStudent);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getStudentClassListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<StudentClass> getStudentClassList(StudentClass filter, String orderBy) {
|
||||
return studentClassMapper.getStudentClassList(filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getStudentClassList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<StudentClass> getStudentClassListWithRelation(StudentClass filter, String orderBy) {
|
||||
List<StudentClass> resultList = studentClassMapper.getStudentClassList(filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加多对多关联关系。
|
||||
*
|
||||
* @param classCourseList 多对多关联表对象集合。
|
||||
* @param classId 主表Id。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void addClassCourseList(List<ClassCourse> classCourseList, Long classId) {
|
||||
for (ClassCourse classCourse : classCourseList) {
|
||||
classCourse.setClassId(classId);
|
||||
MyModelUtil.setDefaultValue(classCourse, "courseOrder", 0);
|
||||
}
|
||||
classCourseMapper.insertList(classCourseList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新中间表数据。
|
||||
*
|
||||
* @param classCourse 中间表对象。
|
||||
* @return 更新成功与否。
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取中间表数据。
|
||||
*
|
||||
* @param classId 主表Id。
|
||||
* @param courseId 从表Id。
|
||||
* @return 中间表对象。
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除单条多对多关系。
|
||||
*
|
||||
* @param classId 主表Id。
|
||||
* @param courseId 从表Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean removeClassCourse(Long classId, Long courseId) {
|
||||
ClassCourse filter = new ClassCourse();
|
||||
filter.setClassId(classId);
|
||||
filter.setCourseId(courseId);
|
||||
return classCourseMapper.delete(filter) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加多对多关联关系。
|
||||
*
|
||||
* @param classStudentList 多对多关联表对象集合。
|
||||
* @param classId 主表Id。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void addClassStudentList(List<ClassStudent> classStudentList, Long classId) {
|
||||
for (ClassStudent classStudent : classStudentList) {
|
||||
classStudent.setClassId(classId);
|
||||
}
|
||||
classStudentMapper.insertList(classStudentList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除单条多对多关系。
|
||||
*
|
||||
* @param classId 主表Id。
|
||||
* @param studentId 从表Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean removeClassStudent(Long classId, Long studentId) {
|
||||
ClassStudent filter = new ClassStudent();
|
||||
filter.setClassId(classId);
|
||||
filter.setStudentId(studentId);
|
||||
return classStudentMapper.delete(filter) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param studentClass 最新数据对象。
|
||||
* @param originalStudentClass 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(StudentClass studentClass, StudentClass originalStudentClass) {
|
||||
String errorMessageFormat = "数据验证失败,关联的%s并不存在,请刷新后重试!";
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(studentClass, originalStudentClass, StudentClass::getSchoolId)
|
||||
&& !schoolInfoService.existId(studentClass.getSchoolId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "所属校区"));
|
||||
}
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(studentClass, originalStudentClass, StudentClass::getLeaderId)
|
||||
&& !studentService.existId(studentClass.getLeaderId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "学生班长"));
|
||||
}
|
||||
return CallResult.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package com.orange.demo.webadmin.app.service.impl;
|
||||
|
||||
import com.orange.demo.application.common.constant.StudentStatus;
|
||||
import com.orange.demo.webadmin.app.service.*;
|
||||
import com.orange.demo.webadmin.app.dao.*;
|
||||
import com.orange.demo.webadmin.app.model.*;
|
||||
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orange.demo.common.core.object.MyRelationParam;
|
||||
import com.orange.demo.common.core.object.CallResult;
|
||||
import com.orange.demo.common.core.base.service.BaseService;
|
||||
import com.orange.demo.common.core.util.MyModelUtil;
|
||||
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生数据数据操作服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("studentService")
|
||||
public class StudentServiceImpl extends BaseService<Student, Long> implements StudentService {
|
||||
|
||||
@Autowired
|
||||
private StudentMapper studentMapper;
|
||||
@Autowired
|
||||
private ClassStudentMapper classStudentMapper;
|
||||
@Autowired
|
||||
private AreaCodeService areaCodeService;
|
||||
@Autowired
|
||||
private GradeService gradeService;
|
||||
@Autowired
|
||||
private SchoolInfoService schoolInfoService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<Student> mapper() {
|
||||
return studentMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象。
|
||||
*
|
||||
* @param student 新增对象。
|
||||
* @return 返回新增对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Student saveNew(Student student) {
|
||||
student.setStudentId(idGenerator.nextLongId());
|
||||
student.setRegisterTime(new Date());
|
||||
MyModelUtil.setDefaultValue(student, "totalCoin", 0);
|
||||
MyModelUtil.setDefaultValue(student, "leftCoin", 0);
|
||||
MyModelUtil.setDefaultValue(student, "status", StudentStatus.NORMAL);
|
||||
studentMapper.insert(student);
|
||||
return student;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据对象。
|
||||
*
|
||||
* @param student 更新的对象。
|
||||
* @param originalStudent 原有数据对象。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(Student student, Student originalStudent) {
|
||||
student.setRegisterTime(originalStudent.getRegisterTime());
|
||||
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
|
||||
return studentMapper.updateByPrimaryKey(student) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param studentId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long studentId) {
|
||||
// 这里先删除主数据
|
||||
if (!this.removeById(studentId)) {
|
||||
return false;
|
||||
}
|
||||
// 开始删除多对多父表的关联
|
||||
ClassStudent classStudent = new ClassStudent();
|
||||
classStudent.setStudentId(studentId);
|
||||
classStudentMapper.delete(classStudent);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getStudentListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<Student> getStudentList(Student filter, String orderBy) {
|
||||
return studentMapper.getStudentList(filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getStudentList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<Student> getStudentListWithRelation(Student filter, String orderBy) {
|
||||
List<Student> resultList = studentMapper.getStudentList(filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在多对多关系中,当前Service的数据表为从表,返回不与指定主表主键Id存在对多对关系的列表。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param filter 从表的过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<Student> getNotInStudentListByClassId(Long classId, Student filter, String orderBy) {
|
||||
List<Student> resultList =
|
||||
studentMapper.getNotInStudentListByClassId(classId, filter, orderBy);
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly());
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在多对多关系中,当前Service的数据表为从表,返回与指定主表主键Id存在对多对关系的列表。
|
||||
*
|
||||
* @param classId 主表主键Id。
|
||||
* @param filter 从表的过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<Student> getStudentListByClassId(Long classId, Student filter, String orderBy) {
|
||||
List<Student> resultList =
|
||||
studentMapper.getStudentListByClassId(classId, filter, orderBy);
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly());
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param student 最新数据对象。
|
||||
* @param originalStudent 原有数据对象。
|
||||
* @return 数据全部正确返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(Student student, Student originalStudent) {
|
||||
String errorMessageFormat = "数据验证失败,关联的%s并不存在,请刷新后重试!";
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(student, originalStudent, Student::getProvinceId)
|
||||
&& !areaCodeService.existId(student.getProvinceId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "所在省份"));
|
||||
}
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(student, originalStudent, Student::getCityId)
|
||||
&& !areaCodeService.existId(student.getCityId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "所在城市"));
|
||||
}
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(student, originalStudent, Student::getDistrictId)
|
||||
&& !areaCodeService.existId(student.getDistrictId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "所在区县"));
|
||||
}
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(student, originalStudent, Student::getGradeId)
|
||||
&& !gradeService.existId(student.getGradeId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "年级"));
|
||||
}
|
||||
//这里是基于字典的验证。
|
||||
if (this.needToVerify(student, originalStudent, Student::getSchoolId)
|
||||
&& !schoolInfoService.existId(student.getSchoolId())) {
|
||||
return CallResult.error(String.format(errorMessageFormat, "所属校区"));
|
||||
}
|
||||
return CallResult.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 行政区划DomainVO对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* ClassCourseVO对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* ClassStudentVO对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* CourseTransStatsVO对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* CourseVO对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* GradeVO对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@ApiModel("GradeVO实体对象")
|
||||
@Data
|
||||
public class GradeVo {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 年级名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "年级名称")
|
||||
private String gradeName;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* SchoolInfoVO对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* StudentActionStatsVO对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* StudentActionTransVO对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* StudentClassVO对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.orange.demo.webadmin.app.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* StudentVO对象。
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.orange.demo.webadmin.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 应用程序自定义的程序属性配置文件。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "application")
|
||||
public class ApplicationConfig {
|
||||
|
||||
/**
|
||||
* token的Http Request Header的key
|
||||
*/
|
||||
private String tokenHeaderKey;
|
||||
/**
|
||||
* token在过期之前,但是已经需要被刷新时,response返回的header信息的key。
|
||||
*/
|
||||
private String refreshedTokenHeaderKey;
|
||||
/**
|
||||
* token 加密用的密钥,该值的长度最少10个字符(过短会报错)。
|
||||
*/
|
||||
private String tokenSigningKey;
|
||||
/**
|
||||
* 令牌的过期时间,单位毫秒
|
||||
*/
|
||||
private Long expiration;
|
||||
/**
|
||||
* 用户密码被重置之后的缺省密码
|
||||
*/
|
||||
private String defaultUserPassword;
|
||||
/**
|
||||
* 上传文件的基础目录
|
||||
*/
|
||||
private String uploadFileBaseDir;
|
||||
/**
|
||||
* 授信ip列表,没有填写表示全部信任。多个ip之间逗号分隔,如: http://10.10.10.1:8080,http://10.10.10.2:8080
|
||||
*/
|
||||
private String credentialIpList;
|
||||
/**
|
||||
* Session的用户权限在Redis中的过期时间(秒)。
|
||||
* 缺省值是 one day
|
||||
*/
|
||||
private int sessionExpiredSeconds = 86400;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.orange.demo.webadmin.config;
|
||||
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
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 javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* 数据源配置Bean对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@MapperScan(value = {"com.orange.demo.webadmin.*.dao", "com.orange.demo.common.*.dao"})
|
||||
public class DataSourceConfig {
|
||||
|
||||
@Bean(initMethod = "init", destroyMethod = "close")
|
||||
@Primary
|
||||
@ConfigurationProperties(prefix = "spring.datasource.druid")
|
||||
public DataSource druidDataSource() {
|
||||
return DruidDataSourceBuilder.create().build();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user