commit:1.5多应用版本

This commit is contained in:
Jerry
2021-03-31 09:43:36 +08:00
parent 060cb450be
commit 71d07cefb3
1343 changed files with 11695 additions and 71470 deletions

View File

@@ -18,7 +18,7 @@ import javax.sql.DataSource;
*/
@Configuration
@EnableTransactionManagement
@MapperScan(value = {"com.orange.demo.*.dao"})
@MapperScan(value = {"com.orange.demo.*.dao", "com.orange.demo.common.*.dao"})
public class DataSourceConfig {
@Bean(initMethod = "init", destroyMethod = "close")

View File

@@ -6,7 +6,7 @@ import com.orange.demo.common.core.base.controller.BaseController;
import com.orange.demo.common.core.base.service.IBaseDictService;
import com.orange.demo.common.core.util.MyModelUtil;
import com.orange.demo.common.core.object.*;
import com.orange.demo.courseclassinterface.vo.AreaCodeVo;
import com.orange.demo.courseclassapi.vo.AreaCodeVo;
import com.orange.demo.courseclassservice.model.AreaCode;
import com.orange.demo.courseclassservice.service.AreaCodeService;
import org.apache.commons.collections4.CollectionUtils;
@@ -41,7 +41,7 @@ public class AreaCodeController extends BaseController<AreaCode, AreaCodeVo, Lon
*/
@GetMapping("/listDict")
public ResponseResult<List<Map<String, Object>>> listDict() {
List<AreaCode> resultList = areaCodeService.getAllList();
List<AreaCode> resultList = areaCodeService.getAllListFromCache();
return ResponseResult.success(BeanQuery.select(
"parentId as parentId", "areaId as id", "areaName as name").executeFrom(resultList));
}

View File

@@ -9,8 +9,8 @@ import com.orange.demo.common.core.upload.UploadStoreInfo;
import com.github.pagehelper.page.PageMethod;
import com.orange.demo.courseclassservice.model.*;
import com.orange.demo.courseclassservice.service.*;
import com.orange.demo.courseclassinterface.dto.*;
import com.orange.demo.courseclassinterface.vo.*;
import com.orange.demo.courseclassapi.dto.*;
import com.orange.demo.courseclassapi.vo.*;
import com.orange.demo.common.core.object.*;
import com.orange.demo.common.core.util.*;
import com.orange.demo.common.core.constant.*;
@@ -277,7 +277,7 @@ public class CourseController extends BaseController<Course, CourseVo, Long> {
}
// 根据字段注解中的存储类型,通过工厂方法获取匹配的上传下载实现类,从而解耦。
BaseUpDownloader upDownloader = upDownloaderFactory.get(storeInfo.getStoreType());
UploadResponseInfo responseInfo = upDownloader.doUpload(appConfig.getServiceContextPath(),
UploadResponseInfo responseInfo = upDownloader.doUpload(appConfig.getServiceContextPath(),
appConfig.getUploadFileBaseDir(), Course.class.getSimpleName(), fieldName, asImage, uploadFile);
if (responseInfo.getUploadFailed()) {
ResponseResult.output(HttpServletResponse.SC_FORBIDDEN,
@@ -354,6 +354,20 @@ public class CourseController extends BaseController<Course, CourseVo, Long> {
return super.baseExistId(courseId);
}
/**
* 根据主键Id删除数据。
*
* @param courseId 主键Id。
* @return 删除数量。
*/
@ApiOperation(hidden = true, value = "deleteById")
@PostMapping("/deleteById")
public ResponseResult<Integer> deleteById(@RequestParam Long courseId) throws Exception {
Course filter = new Course();
filter.setCourseId(courseId);
return super.baseDeleteBy(filter);
}
/**
* 删除符合过滤条件的数据。
*

View File

@@ -8,16 +8,17 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import com.orange.demo.common.core.base.controller.BaseController;
import com.orange.demo.common.core.base.service.IBaseDictService;
import com.orange.demo.common.core.constant.ErrorCodeEnum;
import com.orange.demo.common.core.object.*;
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.validator.UpdateGroup;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.orange.demo.courseclassinterface.dto.GradeDto;
import com.orange.demo.courseclassinterface.vo.GradeVo;
import com.orange.demo.courseclassapi.dto.GradeDto;
import com.orange.demo.courseclassapi.vo.GradeVo;
import com.orange.demo.courseclassservice.model.Grade;
import com.orange.demo.courseclassservice.service.GradeService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -130,6 +131,10 @@ public class GradeController extends BaseController<Grade, GradeVo, Integer> {
@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));
}
@@ -202,6 +207,20 @@ public class GradeController extends BaseController<Grade, GradeVo, Integer> {
return super.baseExistId(gradeId);
}
/**
* 根据主键Id删除数据。
*
* @param gradeId 主键Id。
* @return 删除数量。
*/
@ApiOperation(hidden = true, value = "deleteById")
@PostMapping("/deleteById")
public ResponseResult<Integer> deleteById(@RequestParam Integer gradeId) throws Exception {
Grade filter = new Grade();
filter.setGradeId(gradeId);
return super.baseDeleteBy(filter);
}
/**
* 删除符合过滤条件的数据。
*

View File

@@ -4,8 +4,8 @@ import cn.jimmyshi.beanquery.BeanQuery;
import com.github.pagehelper.page.PageMethod;
import com.orange.demo.courseclassservice.model.*;
import com.orange.demo.courseclassservice.service.*;
import com.orange.demo.courseclassinterface.dto.*;
import com.orange.demo.courseclassinterface.vo.*;
import com.orange.demo.courseclassapi.dto.*;
import com.orange.demo.courseclassapi.vo.*;
import com.orange.demo.common.core.object.*;
import com.orange.demo.common.core.util.*;
import com.orange.demo.common.core.constant.*;
@@ -232,6 +232,20 @@ public class SchoolInfoController extends BaseController<SchoolInfo, SchoolInfoV
return super.baseExistId(schoolId);
}
/**
* 根据主键Id删除数据。
*
* @param schoolId 主键Id。
* @return 删除数量。
*/
@ApiOperation(hidden = true, value = "deleteById")
@PostMapping("/deleteById")
public ResponseResult<Integer> deleteById(@RequestParam Long schoolId) throws Exception {
SchoolInfo filter = new SchoolInfo();
filter.setSchoolId(schoolId);
return super.baseDeleteBy(filter);
}
/**
* 删除符合过滤条件的数据。
*

View File

@@ -3,8 +3,8 @@ package com.orange.demo.courseclassservice.controller;
import com.github.pagehelper.page.PageMethod;
import com.orange.demo.courseclassservice.model.*;
import com.orange.demo.courseclassservice.service.*;
import com.orange.demo.courseclassinterface.dto.*;
import com.orange.demo.courseclassinterface.vo.*;
import com.orange.demo.courseclassapi.dto.*;
import com.orange.demo.courseclassapi.vo.*;
import com.orange.demo.common.core.object.*;
import com.orange.demo.common.core.util.*;
import com.orange.demo.common.core.constant.*;
@@ -503,6 +503,20 @@ public class StudentClassController extends BaseController<StudentClass, Student
return super.baseExistId(classId);
}
/**
* 根据主键Id删除数据。
*
* @param classId 主键Id。
* @return 删除数量。
*/
@ApiOperation(hidden = true, value = "deleteById")
@PostMapping("/deleteById")
public ResponseResult<Integer> deleteById(@RequestParam Long classId) throws Exception {
StudentClass filter = new StudentClass();
filter.setClassId(classId);
return super.baseDeleteBy(filter);
}
/**
* 删除符合过滤条件的数据。
*

View File

@@ -4,8 +4,8 @@ import cn.jimmyshi.beanquery.BeanQuery;
import com.github.pagehelper.page.PageMethod;
import com.orange.demo.courseclassservice.model.*;
import com.orange.demo.courseclassservice.service.*;
import com.orange.demo.courseclassinterface.dto.*;
import com.orange.demo.courseclassinterface.vo.*;
import com.orange.demo.courseclassapi.dto.*;
import com.orange.demo.courseclassapi.vo.*;
import com.orange.demo.common.core.object.*;
import com.orange.demo.common.core.util.*;
import com.orange.demo.common.core.constant.*;
@@ -244,6 +244,20 @@ public class StudentController extends BaseController<Student, StudentVo, Long>
return super.baseExistId(studentId);
}
/**
* 根据主键Id删除数据。
*
* @param studentId 主键Id。
* @return 删除数量。
*/
@ApiOperation(hidden = true, value = "deleteById")
@PostMapping("/deleteById")
public ResponseResult<Integer> deleteById(@RequestParam Long studentId) throws Exception {
Student filter = new Student();
filter.setStudentId(studentId);
return super.baseDeleteBy(filter);
}
/**
* 删除符合过滤条件的数据。
*

View File

@@ -20,11 +20,13 @@
<association property="classCourse" column="course_id" foreignColumn="course_id"
notNullColumn="course_id" resultMap="com.orange.demo.courseclassservice.dao.ClassCourseMapper.BaseResultMap" />
</resultMap>
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
<sql id="filterRef">
<!-- 这里必须加上全包名否则当filterRef被其他Mapper.xml包含引用的时候就会调用Mapper.xml中的该SQL片段 -->
<include refid="com.orange.demo.courseclassservice.dao.CourseMapper.inputFilterRef"/>
</sql>
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
<sql id="inputFilterRef">
<if test="courseFilter != null">

View File

@@ -7,11 +7,13 @@
<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.courseclassservice.dao.SchoolInfoMapper.inputFilterRef"/>
</sql>
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
<sql id="inputFilterRef">
<if test="schoolInfoFilter != null">

View File

@@ -12,12 +12,14 @@
<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.courseclassservice.dao.StudentClassMapper.inputFilterRef"/>
AND zz_class.status = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
</sql>
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
<sql id="inputFilterRef">
<if test="studentClassFilter != null">

View File

@@ -18,11 +18,13 @@
<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.courseclassservice.dao.StudentMapper.inputFilterRef"/>
</sql>
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
<sql id="inputFilterRef">
<if test="studentFilter != null">

View File

@@ -1,13 +1,13 @@
package com.orange.demo.courseclassservice.model;
import com.orange.demo.courseclassinterface.constant.CourseDifficult;
import com.orange.demo.courseclassapi.vo.CourseVo;
import com.orange.demo.courseclassapi.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.courseclassinterface.vo.CourseVo;
import lombok.Data;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

View File

@@ -1,8 +1,8 @@
package com.orange.demo.courseclassservice.model;
import com.orange.demo.courseclassapi.vo.SchoolInfoVo;
import com.orange.demo.common.core.annotation.RelationDict;
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
import com.orange.demo.courseclassinterface.vo.SchoolInfoVo;
import lombok.Data;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

View File

@@ -1,5 +1,6 @@
package com.orange.demo.courseclassservice.model;
import com.orange.demo.courseclassapi.vo.StudentVo;
import com.orange.demo.application.common.constant.Gender;
import com.orange.demo.application.common.constant.ExpLevel;
import com.orange.demo.application.common.constant.StudentStatus;
@@ -7,7 +8,6 @@ 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.util.MyCommonUtil;
import com.orange.demo.courseclassinterface.vo.StudentVo;
import lombok.Data;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

View File

@@ -1,11 +1,11 @@
package com.orange.demo.courseclassservice.model;
import com.orange.demo.courseclassinterface.constant.ClassLevel;
import com.orange.demo.courseclassapi.vo.StudentClassVo;
import com.orange.demo.courseclassapi.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.courseclassinterface.vo.StudentClassVo;
import lombok.Data;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

View File

@@ -8,10 +8,9 @@ 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 tk.mybatis.mapper.entity.Example;
import javax.annotation.PostConstruct;
import java.util.Collection;
import java.util.List;
/**
* 行政区划的Service类。
@@ -30,22 +29,16 @@ public class AreaCodeServiceImpl extends BaseDictService<AreaCode, Long> impleme
this.dictionaryCache = MapTreeDictionaryCache.create(AreaCode::getAreaId, AreaCode::getParentId);
}
@PostConstruct
public void init() {
this.reloadCachedData(true);
}
@Override
protected BaseDaoMapper<AreaCode> mapper() {
return areaCodeMapper;
}
/**
* 加载数据库数据到内存缓存。
*/
@Override
public void loadCachedData() {
Example e = new Example(AreaCode.class);
e.orderBy("areaLevel");
List<AreaCode> areaCodeList = areaCodeMapper.selectByExample(e);
dictionaryCache.putAll(areaCodeList);
}
/**
* 根据上级行政区划Id获取其下级行政区划列表。
*

View File

@@ -10,6 +10,7 @@ import com.orange.demo.common.core.object.TokenData;
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
import com.orange.demo.common.core.base.service.BaseService;
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -143,7 +144,8 @@ public class CourseServiceImpl extends BaseService<Course, Long> implements Cour
@Override
public List<Course> getCourseListWithRelation(Course filter, String orderBy) {
List<Course> resultList = courseMapper.getCourseList(null, null, filter, orderBy);
this.buildRelationForDataList(resultList, MyRelationParam.normal());
int batchSize = resultList instanceof Page ? 0 : 1000;
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
return resultList;
}
@@ -163,7 +165,8 @@ public class CourseServiceImpl extends BaseService<Course, Long> implements Cour
String inFilterField, Set<M> inFilterValues, Course filter, String orderBy) {
List<Course> resultList =
courseMapper.getCourseList(inFilterField, inFilterValues, filter, orderBy);
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly());
int batchSize = resultList instanceof Page ? 0 : 1000;
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly(), batchSize);
return resultList;
}

View File

@@ -9,6 +9,7 @@ import com.orange.demo.common.core.object.CallResult;
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
import com.orange.demo.common.core.base.service.BaseService;
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -125,7 +126,8 @@ public class SchoolInfoServiceImpl extends BaseService<SchoolInfo, Long> impleme
@Override
public List<SchoolInfo> getSchoolInfoListWithRelation(SchoolInfo filter, String orderBy) {
List<SchoolInfo> resultList = schoolInfoMapper.getSchoolInfoList(null, null, filter, orderBy);
this.buildRelationForDataList(resultList, MyRelationParam.normal());
int batchSize = resultList instanceof Page ? 0 : 1000;
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
return resultList;
}
@@ -145,7 +147,8 @@ public class SchoolInfoServiceImpl extends BaseService<SchoolInfo, Long> impleme
String inFilterField, Set<M> inFilterValues, SchoolInfo filter, String orderBy) {
List<SchoolInfo> resultList =
schoolInfoMapper.getSchoolInfoList(inFilterField, inFilterValues, filter, orderBy);
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly());
int batchSize = resultList instanceof Page ? 0 : 1000;
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly(), batchSize);
return resultList;
}

View File

@@ -11,6 +11,7 @@ import com.orange.demo.common.core.constant.GlobalDeletedFlag;
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
import com.orange.demo.common.core.base.service.BaseService;
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -151,7 +152,8 @@ public class StudentClassServiceImpl extends BaseService<StudentClass, Long> imp
@Override
public List<StudentClass> getStudentClassListWithRelation(StudentClass filter, String orderBy) {
List<StudentClass> resultList = studentClassMapper.getStudentClassList(null, null, filter, orderBy);
this.buildRelationForDataList(resultList, MyRelationParam.normal());
int batchSize = resultList instanceof Page ? 0 : 1000;
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
return resultList;
}
@@ -171,7 +173,8 @@ public class StudentClassServiceImpl extends BaseService<StudentClass, Long> imp
String inFilterField, Set<M> inFilterValues, StudentClass filter, String orderBy) {
List<StudentClass> resultList =
studentClassMapper.getStudentClassList(inFilterField, inFilterValues, filter, orderBy);
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly());
int batchSize = resultList instanceof Page ? 0 : 1000;
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly(), batchSize);
return resultList;
}

View File

@@ -10,6 +10,7 @@ import com.orange.demo.common.core.object.CallResult;
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
import com.orange.demo.common.core.base.service.BaseService;
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -142,7 +143,8 @@ public class StudentServiceImpl extends BaseService<Student, Long> implements St
@Override
public List<Student> getStudentListWithRelation(Student filter, String orderBy) {
List<Student> resultList = studentMapper.getStudentList(null, null, filter, orderBy);
this.buildRelationForDataList(resultList, MyRelationParam.normal());
int batchSize = resultList instanceof Page ? 0 : 1000;
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
return resultList;
}
@@ -162,7 +164,8 @@ public class StudentServiceImpl extends BaseService<Student, Long> implements St
String inFilterField, Set<M> inFilterValues, Student filter, String orderBy) {
List<Student> resultList =
studentMapper.getStudentList(inFilterField, inFilterValues, filter, orderBy);
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly());
int batchSize = resultList instanceof Page ? 0 : 1000;
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly(), batchSize);
return resultList;
}

View File

@@ -23,7 +23,7 @@
</property>
<property name="LOG_PATTERN_EX">
<!-- 下面注释中 %X{PtxId}, SpanId: %X{PspanId} 为PinPoint 中的traceid -->
[%-5p] [%d{YYYY-MM-dd HH:mm:ss}] 请求Id[%X{traceId}] [%t] ==> [TxId: %X{PtxId}, SpanId: %X{PspanId}] %msg%n
[%-5p] [%d{YYYY-MM-dd HH:mm:ss}] T:[%X{traceId}] S:[%X{sessionId}] U:[%X{userId}] [%t] ==> [TxId: %X{PtxId}, SpanId: %X{PspanId}] %msg%n
</property>
<!-- 日志保留天数 -->
<property name="EVERY_FILE_COUNT">31</property>