mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 18:46:36 +08:00
commit:修改微服务工程目录名称
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?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>course-class</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>course-class-interface</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>course-class-interface</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<!-- 通用业务依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.orange.demo</groupId>
|
||||
<artifactId>application-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- 通用组件依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.orange.demo</groupId>
|
||||
<artifactId>common-core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.orange.demo.courseclassinterface.client;
|
||||
|
||||
import com.orange.demo.common.core.base.client.BaseClient;
|
||||
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.orange.demo.common.core.object.MyQueryParam;
|
||||
import com.orange.demo.common.core.object.ResponseResult;
|
||||
import com.orange.demo.courseclassinterface.dto.AreaCodeDto;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 行政区划远程访问接口类。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@FeignClient(name = "system-service", fallbackFactory = AreaCodeClient.AreaCodeClientFallbackFactory.class)
|
||||
public interface AreaCodeClient extends BaseClient<AreaCodeDto, Long> {
|
||||
|
||||
/**
|
||||
* 根据主键Id集合,返回给定的数据集合。
|
||||
*
|
||||
* @param areaCodeIds 待获取的主键Id列表。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 获取的对象列表。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/areaCode/listByIds")
|
||||
ResponseResult<List<AreaCodeDto>> listByIds(
|
||||
@RequestParam("areaCodeIds") Set<Long> areaCodeIds,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 根据主键Id返回给定的数据。
|
||||
*
|
||||
* @param areaId 待获取的主键Id。
|
||||
* @param withDict 是否获取表实体关联的字典数据。
|
||||
* @return 获取的对象。
|
||||
*/
|
||||
@Override
|
||||
@GetMapping("/areaCode/getById")
|
||||
ResponseResult<AreaCodeDto> getById(
|
||||
@RequestParam("areaId") Long areaId,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id,是否全部存在。
|
||||
*
|
||||
* @param areaIds 主键Id。
|
||||
* @return 应答结果对象,包含true全部存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@GetMapping("/areaCode/existIds")
|
||||
ResponseResult<Boolean> existIds(@RequestParam("areaIds") Set<Long> areaIds);
|
||||
|
||||
/**
|
||||
* 给定主键Id是否存在。
|
||||
*
|
||||
* @param areaId 参数主键Id。
|
||||
* @return 应答结果对象,包含true,否则false。
|
||||
*/
|
||||
@Override
|
||||
@GetMapping("/areaCode/existId")
|
||||
ResponseResult<Boolean> existId(@RequestParam("areaId") Long areaId);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/areaCode/listBy")
|
||||
ResponseResult<List<AreaCodeDto>> listBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的单条数据对象。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/areaCode/getBy")
|
||||
ResponseResult<AreaCodeDto> getBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 以id、name的形式返回所有字典数据的列表。
|
||||
*
|
||||
* @return 字典数据列表,返回形式为 List<Map<String, Object>>,map中包含两条记录,分别是id和name。
|
||||
*/
|
||||
@PostMapping("/areaCode/listDictAreaCode")
|
||||
ResponseResult<List<Map<String, Object>>> listDictAreaCode();
|
||||
|
||||
/**
|
||||
* 以id、name的形式返回所有字典数据的列表。
|
||||
*
|
||||
* @param parentId 主键的ParentId,用于对主键数据进行过滤。
|
||||
* @return 字典数据列表,返回形式为 List<Map<String, Object>>,map中包含两条记录,分别是id和name。
|
||||
*/
|
||||
@PostMapping("/areaCode/listDictAreaCodeByParentId")
|
||||
ResponseResult<List<Map<String, Object>>> listDictAreaCodeByParentId(@RequestParam("parentId") Long parentId);
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
class AreaCodeClientFallbackFactory implements FallbackFactory<AreaCodeClient>, AreaCodeClient {
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<AreaCodeDto>> listByIds(Set<Long> areaCodeIds, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<AreaCodeDto> getById(Long areaId, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existIds(Set<Long> areaIds) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existId(Long areaId) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<AreaCodeDto>> listBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<AreaCodeDto> getBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<Map<String, Object>>> listDictAreaCode() {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<Map<String, Object>>> listDictAreaCodeByParentId(Long parentId) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AreaCodeClient create(Throwable throwable) {
|
||||
log.error("Exception For Feign Remote Call.", throwable);
|
||||
return new AreaCodeClientFallbackFactory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.orange.demo.courseclassinterface.client;
|
||||
|
||||
import com.orange.demo.common.core.config.FeignConfig;
|
||||
import com.orange.demo.common.core.base.client.BaseClient;
|
||||
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.orange.demo.common.core.object.*;
|
||||
import com.orange.demo.courseclassinterface.dto.CourseDto;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 课程数据服务远程数据操作访问接口。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@FeignClient(
|
||||
name = "course-class",
|
||||
configuration = FeignConfig.class,
|
||||
fallbackFactory = CourseClient.CourseClientFallbackFactory.class)
|
||||
public interface CourseClient extends BaseClient<CourseDto, Long> {
|
||||
|
||||
/**
|
||||
* 基于主键的(In-list)条件获取远程数据接口。
|
||||
*
|
||||
* @param courseIds 主键Id集合。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象的数据集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/course/listByIds")
|
||||
ResponseResult<List<CourseDto>> listByIds(
|
||||
@RequestParam("courseIds") Set<Long> courseIds,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 基于主键Id,获取远程对象。
|
||||
*
|
||||
* @param courseId 主键Id。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象数据。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/course/getById")
|
||||
ResponseResult<CourseDto> getById(
|
||||
@RequestParam("courseId") Long courseId,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id,是否都存在。
|
||||
*
|
||||
* @param courseIds 主键Id集合。
|
||||
* @return 应答结果对象,包含true全部存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/course/existIds")
|
||||
ResponseResult<Boolean> existIds(@RequestParam("courseIds") Set<Long> courseIds);
|
||||
|
||||
/**
|
||||
* 判断主键Id是否存在。
|
||||
*
|
||||
* @param courseId 参数主键Id。
|
||||
* @return 应答结果对象,包含true表示存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/course/existId")
|
||||
ResponseResult<Boolean> existId(@RequestParam("courseId") Long courseId);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/course/listBy")
|
||||
ResponseResult<List<CourseDto>> listBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的单条数据对象。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/course/getBy")
|
||||
ResponseResult<CourseDto> getBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
* 和listBy接口相比,以Map列表的方式返回的主要目的是,降低服务之间的耦合度。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含主对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/course/listMapBy")
|
||||
ResponseResult<List<Map<String, Object>>> listMapBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据数量。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含结果数量。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/course/countBy")
|
||||
ResponseResult<Integer> countBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程对象中符合查询条件的分组聚合计算Map列表。
|
||||
*
|
||||
* @param aggregationParam 聚合参数。
|
||||
* @return 应该结果对象,包含聚合计算后的分组Map列表。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/course/aggregateBy")
|
||||
ResponseResult<List<Map<String, Object>>> aggregateBy(@RequestBody MyAggregationParam aggregationParam);
|
||||
|
||||
@Component("CourseClassCourseClientFallbackFactory")
|
||||
@Slf4j
|
||||
class CourseClientFallbackFactory implements FallbackFactory<CourseClient>, CourseClient {
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<CourseDto>> listByIds(
|
||||
Set<Long> courseIds, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<CourseDto> getById(
|
||||
Long courseId, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existIds(Set<Long> courseIds) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existId(Long courseId) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<CourseDto>> listBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<CourseDto> getBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<Map<String, Object>>> listMapBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Integer> countBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<Map<String, Object>>> aggregateBy(MyAggregationParam aggregationParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseClient create(Throwable throwable) {
|
||||
log.error("Exception For Feign Remote Call.", throwable);
|
||||
return new CourseClientFallbackFactory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.orange.demo.courseclassinterface.client;
|
||||
|
||||
import com.orange.demo.common.core.config.FeignConfig;
|
||||
import com.orange.demo.common.core.base.client.BaseClient;
|
||||
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.orange.demo.common.core.object.*;
|
||||
import com.orange.demo.courseclassinterface.dto.GradeDto;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 服务远程数据操作访问接口。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@FeignClient(
|
||||
name = "course-class",
|
||||
configuration = FeignConfig.class,
|
||||
fallbackFactory = GradeClient.GradeClientFallbackFactory.class)
|
||||
public interface GradeClient extends BaseClient<GradeDto, Integer> {
|
||||
|
||||
/**
|
||||
* 基于主键的(in list)条件获取远程数据接口。
|
||||
*
|
||||
* @param gradeIds 主键Id集合。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象的数据集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/grade/listByIds")
|
||||
ResponseResult<List<GradeDto>> listByIds(
|
||||
@RequestParam("gradeIds") Set<Integer> gradeIds,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 基于主键Id,获取远程对象。
|
||||
*
|
||||
* @param gradeId 主键Id。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象数据。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/grade/getById")
|
||||
ResponseResult<GradeDto> getById(
|
||||
@RequestParam("gradeId") Integer gradeId,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id,是否全部存在。
|
||||
*
|
||||
* @param gradeIds 主键Id集合。
|
||||
* @return 应答结果对象,包含true全部存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/grade/existIds")
|
||||
ResponseResult<Boolean> existIds(Set<Integer> gradeIds);
|
||||
|
||||
/**
|
||||
* 给定主键Id是否存在。
|
||||
*
|
||||
* @param gradeId 参数主键Id。
|
||||
* @return 应答结果对象,包含true表示存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/grade/existId")
|
||||
ResponseResult<Boolean> existId(@RequestParam("gradeId") Integer gradeId);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/grade/listBy")
|
||||
ResponseResult<List<GradeDto>> listBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的单条数据对象。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/grade/getBy")
|
||||
ResponseResult<GradeDto> getBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
@Component("CourseClassGradeClientFallbackFactory")
|
||||
@Slf4j
|
||||
class GradeClientFallbackFactory implements FallbackFactory<GradeClient>, GradeClient {
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<GradeDto>> listByIds(
|
||||
Set<Integer> gradeIds, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<GradeDto> getById(
|
||||
Integer gradeId, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existIds(Set<Integer> gradeIds) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existId(Integer gradeId) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<GradeDto>> listBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<GradeDto> getBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GradeClient create(Throwable throwable) {
|
||||
log.error("Exception For Feign Remote Call.", throwable);
|
||||
return new GradeClientFallbackFactory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.orange.demo.courseclassinterface.client;
|
||||
|
||||
import com.orange.demo.common.core.config.FeignConfig;
|
||||
import com.orange.demo.common.core.base.client.BaseClient;
|
||||
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.orange.demo.common.core.object.*;
|
||||
import com.orange.demo.courseclassinterface.dto.SchoolInfoDto;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 校区数据服务远程数据操作访问接口。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@FeignClient(
|
||||
name = "course-class",
|
||||
configuration = FeignConfig.class,
|
||||
fallbackFactory = SchoolInfoClient.SchoolInfoClientFallbackFactory.class)
|
||||
public interface SchoolInfoClient extends BaseClient<SchoolInfoDto, Long> {
|
||||
|
||||
/**
|
||||
* 基于主键的(In-list)条件获取远程数据接口。
|
||||
*
|
||||
* @param schoolIds 主键Id集合。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象的数据集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/schoolInfo/listByIds")
|
||||
ResponseResult<List<SchoolInfoDto>> listByIds(
|
||||
@RequestParam("schoolIds") Set<Long> schoolIds,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 基于主键Id,获取远程对象。
|
||||
*
|
||||
* @param schoolId 主键Id。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象数据。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/schoolInfo/getById")
|
||||
ResponseResult<SchoolInfoDto> getById(
|
||||
@RequestParam("schoolId") Long schoolId,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id,是否都存在。
|
||||
*
|
||||
* @param schoolIds 主键Id集合。
|
||||
* @return 应答结果对象,包含true全部存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/schoolInfo/existIds")
|
||||
ResponseResult<Boolean> existIds(@RequestParam("schoolIds") Set<Long> schoolIds);
|
||||
|
||||
/**
|
||||
* 判断主键Id是否存在。
|
||||
*
|
||||
* @param schoolId 参数主键Id。
|
||||
* @return 应答结果对象,包含true表示存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/schoolInfo/existId")
|
||||
ResponseResult<Boolean> existId(@RequestParam("schoolId") Long schoolId);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/schoolInfo/listBy")
|
||||
ResponseResult<List<SchoolInfoDto>> listBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的单条数据对象。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/schoolInfo/getBy")
|
||||
ResponseResult<SchoolInfoDto> getBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
* 和listBy接口相比,以Map列表的方式返回的主要目的是,降低服务之间的耦合度。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含主对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/schoolInfo/listMapBy")
|
||||
ResponseResult<List<Map<String, Object>>> listMapBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据数量。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含结果数量。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/schoolInfo/countBy")
|
||||
ResponseResult<Integer> countBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程对象中符合查询条件的分组聚合计算Map列表。
|
||||
*
|
||||
* @param aggregationParam 聚合参数。
|
||||
* @return 应该结果对象,包含聚合计算后的分组Map列表。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/schoolInfo/aggregateBy")
|
||||
ResponseResult<List<Map<String, Object>>> aggregateBy(@RequestBody MyAggregationParam aggregationParam);
|
||||
|
||||
@Component("CourseClassSchoolInfoClientFallbackFactory")
|
||||
@Slf4j
|
||||
class SchoolInfoClientFallbackFactory implements FallbackFactory<SchoolInfoClient>, SchoolInfoClient {
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<SchoolInfoDto>> listByIds(
|
||||
Set<Long> schoolIds, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<SchoolInfoDto> getById(
|
||||
Long schoolId, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existIds(Set<Long> schoolIds) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existId(Long schoolId) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<SchoolInfoDto>> listBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<SchoolInfoDto> getBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<Map<String, Object>>> listMapBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Integer> countBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<Map<String, Object>>> aggregateBy(MyAggregationParam aggregationParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchoolInfoClient create(Throwable throwable) {
|
||||
log.error("Exception For Feign Remote Call.", throwable);
|
||||
return new SchoolInfoClientFallbackFactory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.orange.demo.courseclassinterface.client;
|
||||
|
||||
import com.orange.demo.common.core.config.FeignConfig;
|
||||
import com.orange.demo.common.core.base.client.BaseClient;
|
||||
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.orange.demo.common.core.object.*;
|
||||
import com.orange.demo.courseclassinterface.dto.StudentClassDto;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 班级数据服务远程数据操作访问接口。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@FeignClient(
|
||||
name = "course-class",
|
||||
configuration = FeignConfig.class,
|
||||
fallbackFactory = StudentClassClient.StudentClassClientFallbackFactory.class)
|
||||
public interface StudentClassClient extends BaseClient<StudentClassDto, Long> {
|
||||
|
||||
/**
|
||||
* 基于主键的(In-list)条件获取远程数据接口。
|
||||
*
|
||||
* @param classIds 主键Id集合。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象的数据集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/studentClass/listByIds")
|
||||
ResponseResult<List<StudentClassDto>> listByIds(
|
||||
@RequestParam("classIds") Set<Long> classIds,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 基于主键Id,获取远程对象。
|
||||
*
|
||||
* @param classId 主键Id。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象数据。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/studentClass/getById")
|
||||
ResponseResult<StudentClassDto> getById(
|
||||
@RequestParam("classId") Long classId,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id,是否都存在。
|
||||
*
|
||||
* @param classIds 主键Id集合。
|
||||
* @return 应答结果对象,包含true全部存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/studentClass/existIds")
|
||||
ResponseResult<Boolean> existIds(@RequestParam("classIds") Set<Long> classIds);
|
||||
|
||||
/**
|
||||
* 判断主键Id是否存在。
|
||||
*
|
||||
* @param classId 参数主键Id。
|
||||
* @return 应答结果对象,包含true表示存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/studentClass/existId")
|
||||
ResponseResult<Boolean> existId(@RequestParam("classId") Long classId);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/studentClass/listBy")
|
||||
ResponseResult<List<StudentClassDto>> listBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的单条数据对象。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/studentClass/getBy")
|
||||
ResponseResult<StudentClassDto> getBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
* 和listBy接口相比,以Map列表的方式返回的主要目的是,降低服务之间的耦合度。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含主对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/studentClass/listMapBy")
|
||||
ResponseResult<List<Map<String, Object>>> listMapBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据数量。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含结果数量。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/studentClass/countBy")
|
||||
ResponseResult<Integer> countBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程对象中符合查询条件的分组聚合计算Map列表。
|
||||
*
|
||||
* @param aggregationParam 聚合参数。
|
||||
* @return 应该结果对象,包含聚合计算后的分组Map列表。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/studentClass/aggregateBy")
|
||||
ResponseResult<List<Map<String, Object>>> aggregateBy(@RequestBody MyAggregationParam aggregationParam);
|
||||
|
||||
@Component("CourseClassStudentClassClientFallbackFactory")
|
||||
@Slf4j
|
||||
class StudentClassClientFallbackFactory implements FallbackFactory<StudentClassClient>, StudentClassClient {
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<StudentClassDto>> listByIds(
|
||||
Set<Long> classIds, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<StudentClassDto> getById(
|
||||
Long classId, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existIds(Set<Long> classIds) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existId(Long classId) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<StudentClassDto>> listBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<StudentClassDto> getBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<Map<String, Object>>> listMapBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Integer> countBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<Map<String, Object>>> aggregateBy(MyAggregationParam aggregationParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StudentClassClient create(Throwable throwable) {
|
||||
log.error("Exception For Feign Remote Call.", throwable);
|
||||
return new StudentClassClientFallbackFactory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.orange.demo.courseclassinterface.client;
|
||||
|
||||
import com.orange.demo.common.core.config.FeignConfig;
|
||||
import com.orange.demo.common.core.base.client.BaseClient;
|
||||
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
||||
import com.orange.demo.common.core.object.*;
|
||||
import com.orange.demo.courseclassinterface.dto.StudentDto;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 学生数据服务远程数据操作访问接口。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@FeignClient(
|
||||
name = "course-class",
|
||||
configuration = FeignConfig.class,
|
||||
fallbackFactory = StudentClient.StudentClientFallbackFactory.class)
|
||||
public interface StudentClient extends BaseClient<StudentDto, Long> {
|
||||
|
||||
/**
|
||||
* 基于主键的(In-list)条件获取远程数据接口。
|
||||
*
|
||||
* @param studentIds 主键Id集合。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象的数据集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/student/listByIds")
|
||||
ResponseResult<List<StudentDto>> listByIds(
|
||||
@RequestParam("studentIds") Set<Long> studentIds,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 基于主键Id,获取远程对象。
|
||||
*
|
||||
* @param studentId 主键Id。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象数据。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/student/getById")
|
||||
ResponseResult<StudentDto> getById(
|
||||
@RequestParam("studentId") Long studentId,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id,是否都存在。
|
||||
*
|
||||
* @param studentIds 主键Id集合。
|
||||
* @return 应答结果对象,包含true全部存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/student/existIds")
|
||||
ResponseResult<Boolean> existIds(@RequestParam("studentIds") Set<Long> studentIds);
|
||||
|
||||
/**
|
||||
* 判断主键Id是否存在。
|
||||
*
|
||||
* @param studentId 参数主键Id。
|
||||
* @return 应答结果对象,包含true表示存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/student/existId")
|
||||
ResponseResult<Boolean> existId(@RequestParam("studentId") Long studentId);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/student/listBy")
|
||||
ResponseResult<List<StudentDto>> listBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的单条数据对象。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/student/getBy")
|
||||
ResponseResult<StudentDto> getBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
* 和listBy接口相比,以Map列表的方式返回的主要目的是,降低服务之间的耦合度。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含主对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/student/listMapBy")
|
||||
ResponseResult<List<Map<String, Object>>> listMapBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据数量。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含结果数量。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/student/countBy")
|
||||
ResponseResult<Integer> countBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程对象中符合查询条件的分组聚合计算Map列表。
|
||||
*
|
||||
* @param aggregationParam 聚合参数。
|
||||
* @return 应该结果对象,包含聚合计算后的分组Map列表。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/student/aggregateBy")
|
||||
ResponseResult<List<Map<String, Object>>> aggregateBy(@RequestBody MyAggregationParam aggregationParam);
|
||||
|
||||
@Component("CourseClassStudentClientFallbackFactory")
|
||||
@Slf4j
|
||||
class StudentClientFallbackFactory implements FallbackFactory<StudentClient>, StudentClient {
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<StudentDto>> listByIds(
|
||||
Set<Long> studentIds, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<StudentDto> getById(
|
||||
Long studentId, Boolean withDict) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existIds(Set<Long> studentIds) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Boolean> existId(Long studentId) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<StudentDto>> listBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<StudentDto> getBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<Map<String, Object>>> listMapBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<Integer> countBy(MyQueryParam queryParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<Map<String, Object>>> aggregateBy(MyAggregationParam aggregationParam) {
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StudentClient create(Throwable throwable) {
|
||||
log.error("Exception For Feign Remote Call.", throwable);
|
||||
return new StudentClientFallbackFactory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orange.demo.courseclassinterface.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 班级级别常量字典对象。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
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.courseclassinterface.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 班级状态常量字典对象。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
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.courseclassinterface.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 课程难度常量字典对象。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
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,33 @@
|
||||
package com.orange.demo.courseclassinterface.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 行政区划Dto。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
public class AreaCodeDto {
|
||||
|
||||
/**
|
||||
* 行政区划主键Id
|
||||
*/
|
||||
private Long areaId;
|
||||
|
||||
/**
|
||||
* 行政区划名称
|
||||
*/
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 行政区划级别 (1: 省级别 2: 市级别 3: 区级别)
|
||||
*/
|
||||
private Integer areaLevel;
|
||||
|
||||
/**
|
||||
* 父级行政区划Id
|
||||
*/
|
||||
private Long parentId;
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.orange.demo.courseclassinterface.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
import com.orange.demo.courseclassinterface.constant.CourseDifficult;
|
||||
import com.orange.demo.application.common.constant.Subject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* CourseDto对象。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
public class CourseDto {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称。
|
||||
*/
|
||||
@NotBlank(message = "数据验证失败,课程名称不能为空!")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 课程价格。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,课程价格不能为空!")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 课程描述。
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 课程难度(0: 容易 1: 普通 2: 很难)。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,课程难度不能为空!")
|
||||
@ConstDictRef(constDictClass = CourseDifficult.class, message = "数据验证失败,课程难度为无效值!")
|
||||
private Integer difficulty;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,所属年级不能为空!")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 学科Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,所属学科不能为空!")
|
||||
@ConstDictRef(constDictClass = Subject.class, message = "数据验证失败,所属学科为无效值!")
|
||||
private Integer subjectId;
|
||||
|
||||
/**
|
||||
* 课时数量。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,课时数量不能为空!")
|
||||
private Integer classHour;
|
||||
|
||||
/**
|
||||
* 多张课程图片地址。
|
||||
*/
|
||||
@NotBlank(message = "数据验证失败,课程图片不能为空!")
|
||||
private String pictureUrl;
|
||||
|
||||
/**
|
||||
* 创建用户Id。
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 最后修改时间。
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* price 范围过滤起始值(>=)。
|
||||
*/
|
||||
private BigDecimal priceStart;
|
||||
|
||||
/**
|
||||
* price 范围过滤结束值(<=)。
|
||||
*/
|
||||
private BigDecimal priceEnd;
|
||||
|
||||
/**
|
||||
* classHour 范围过滤起始值(>=)。
|
||||
*/
|
||||
private Integer classHourStart;
|
||||
|
||||
/**
|
||||
* classHour 范围过滤结束值(<=)。
|
||||
*/
|
||||
private Integer classHourEnd;
|
||||
|
||||
/**
|
||||
* updateTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
private String updateTimeStart;
|
||||
|
||||
/**
|
||||
* updateTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
private String updateTimeEnd;
|
||||
|
||||
/**
|
||||
* gradeId 字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
/**
|
||||
* difficulty 常量字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> difficultyDictMap;
|
||||
|
||||
/**
|
||||
* subjectId 常量字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> subjectIdDictMap;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.orange.demo.courseclassinterface.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* GradeDto对象。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
public class GradeDto {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,主键Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 年级名称。
|
||||
*/
|
||||
@NotBlank(message = "数据验证失败,年级名称不能为空!")
|
||||
private String gradeName;
|
||||
|
||||
/**
|
||||
* 是否正在使用(0:不是,1:是)。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,是否正在使用(0:不是,1:是)不能为空!")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.orange.demo.courseclassinterface.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* SchoolInfoDto对象。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
public class SchoolInfoDto {
|
||||
|
||||
/**
|
||||
* 学校Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,学校Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学校名称。
|
||||
*/
|
||||
@NotBlank(message = "数据验证失败,学校名称不能为空!")
|
||||
private String schoolName;
|
||||
|
||||
/**
|
||||
* 所在省Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 所在城市Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,所在城市不能为空!")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* provinceId 字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
/**
|
||||
* cityId 字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.orange.demo.courseclassinterface.dto;
|
||||
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||
import com.orange.demo.courseclassinterface.constant.ClassLevel;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* StudentClassDto对象。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
public class StudentClassDto {
|
||||
|
||||
/**
|
||||
* 班级Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,班级Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 班级名称。
|
||||
*/
|
||||
@NotBlank(message = "数据验证失败,班级名称不能为空!")
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 学校Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,所属校区不能为空!")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 学生班长Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,班长不能为空!")
|
||||
private Long leaderId;
|
||||
|
||||
/**
|
||||
* 已完成课时数量。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,已完成课时不能为空!")
|
||||
private Integer finishClassHour;
|
||||
|
||||
/**
|
||||
* 班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,班级级别不能为空!")
|
||||
@ConstDictRef(constDictClass = ClassLevel.class, message = "数据验证失败,班级级别为无效值!")
|
||||
private Integer classLevel;
|
||||
|
||||
/**
|
||||
* 创建用户。
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 班级创建时间。
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* schoolId 字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
/**
|
||||
* leaderId 字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> leaderIdDictMap;
|
||||
|
||||
/**
|
||||
* classLevel 常量字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> classLevelDictMap;
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.orange.demo.courseclassinterface.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 lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* StudentDto对象。
|
||||
*
|
||||
* @author Orange Team
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
public class StudentDto {
|
||||
|
||||
/**
|
||||
* 学生Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,学生Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 登录手机。
|
||||
*/
|
||||
@NotBlank(message = "数据验证失败,手机号码不能为空!")
|
||||
private String loginMobile;
|
||||
|
||||
/**
|
||||
* 学生姓名。
|
||||
*/
|
||||
@NotBlank(message = "数据验证失败,姓名不能为空!")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 所在省份Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,所在省份不能为空!")
|
||||
private Long provinceId;
|
||||
|
||||
/**
|
||||
* 所在城市Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,所在城市不能为空!")
|
||||
private Long cityId;
|
||||
|
||||
/**
|
||||
* 区县Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,所在区县不能为空!")
|
||||
private Long districtId;
|
||||
|
||||
/**
|
||||
* 学生性别 (0: 女生 1: 男生)。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,性别不能为空!")
|
||||
@ConstDictRef(constDictClass = Gender.class, message = "数据验证失败,性别为无效值!")
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 生日。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,生日不能为空!")
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,经验等级不能为空!")
|
||||
@ConstDictRef(constDictClass = ExpLevel.class, message = "数据验证失败,经验等级为无效值!")
|
||||
private Integer experienceLevel;
|
||||
|
||||
/**
|
||||
* 总共充值学币数量。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,充值学币不能为空!")
|
||||
private Integer totalCoin;
|
||||
|
||||
/**
|
||||
* 可用学币数量。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,剩余学币不能为空!")
|
||||
private Integer leftCoin;
|
||||
|
||||
/**
|
||||
* 年级Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,年级不能为空!")
|
||||
private Integer gradeId;
|
||||
|
||||
/**
|
||||
* 校区Id。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,所属校区不能为空!")
|
||||
private Long schoolId;
|
||||
|
||||
/**
|
||||
* 注册时间。
|
||||
*/
|
||||
private Date registerTime;
|
||||
|
||||
/**
|
||||
* 学生状态 (0: 正常 1: 锁定 2: 注销)。
|
||||
*/
|
||||
@NotNull(message = "数据验证失败,状态 不能为空!")
|
||||
@ConstDictRef(constDictClass = StudentStatus.class, message = "数据验证失败,状态 为无效值!")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* birthday 范围过滤起始值(>=)。
|
||||
*/
|
||||
private String birthdayStart;
|
||||
|
||||
/**
|
||||
* birthday 范围过滤结束值(<=)。
|
||||
*/
|
||||
private String birthdayEnd;
|
||||
|
||||
/**
|
||||
* registerTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
private String registerTimeStart;
|
||||
|
||||
/**
|
||||
* registerTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
private String registerTimeEnd;
|
||||
|
||||
/**
|
||||
* true LIKE搜索字符串。
|
||||
*/
|
||||
private String searchString;
|
||||
|
||||
/**
|
||||
* provinceId 字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> provinceIdDictMap;
|
||||
|
||||
/**
|
||||
* cityId 字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> cityIdDictMap;
|
||||
|
||||
/**
|
||||
* districtId 字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> districtIdDictMap;
|
||||
|
||||
/**
|
||||
* gradeId 字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> gradeIdDictMap;
|
||||
|
||||
/**
|
||||
* schoolId 字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> schoolIdDictMap;
|
||||
|
||||
/**
|
||||
* gender 常量字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> genderDictMap;
|
||||
|
||||
/**
|
||||
* experienceLevel 常量字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> experienceLevelDictMap;
|
||||
|
||||
/**
|
||||
* status 常量字典关联数据。
|
||||
*/
|
||||
private Map<String, Object> statusDictMap;
|
||||
}
|
||||
Reference in New Issue
Block a user