Initial commit

This commit is contained in:
2024-02-14 16:47:29 +08:00
commit 5135f009a9
36 changed files with 1777 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>jc-club-application-controller</artifactId>
<packaging>jar</packaging>
<name>jc-club-application-controller</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-infra</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-domain</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,155 @@
package com.landaiqing.subject.application.controller;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Preconditions;
import com.landaiqing.subject.application.convert.SubjectCategoryDTOConverter;
import com.landaiqing.subject.application.dto.SubjectCategoryDTO;
import com.landaiqing.subject.common.entity.Result;
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
import com.landaiqing.subject.domain.service.SubjectCategoryDomainService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 刷题分类controller
*
* @author landaiqing
* @date 2024/2/7
*/
@RestController
@RequestMapping("/subject/category")
@Slf4j
public class SubjectCategoryController {
@Resource
private SubjectCategoryDomainService subjectCategoryDomainService;
/**
* @description: 新增分类
* @param: [subjectCategoryDTO]
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
* @author landaiqing
* @date: 2024/2/13 20:19
*/
@PostMapping("/add")
public Result<Boolean> add(@RequestBody SubjectCategoryDTO subjectCategoryDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectCategoryController.add.dto:{}", JSON.toJSONString(subjectCategoryDTO));
}
Preconditions.checkNotNull(subjectCategoryDTO.getCategoryType(), "分类类型不能为空!");
Preconditions.checkArgument(!StringUtils.isBlank(subjectCategoryDTO.getCategoryName()), "分类的名称不能为空!");
Preconditions.checkNotNull(subjectCategoryDTO.getParentId(), "分类父级不能为空!");
SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE.convertDtoToCategoryBO(subjectCategoryDTO);
subjectCategoryDomainService.add(subjectCategoryBO);
return Result.ok(true);
} catch (Exception e) {
log.error("SubjectCategoryController.add.error:{}", e.getMessage(), e);
return Result.fail(e.getMessage());
}
}
/**
* @description: 查询岗位大类
* @param: [subjectCategoryDTO]
* @return: com.landaiqing.subject.common.entity.Result<java.util.List < com.landaiqing.subject.application.dto.SubjectCategoryDTO>>
* @author landaiqing
* @date: 2024/2/13 20:19
*/
@PostMapping("/queryPrimaryCategory")
public Result<List<SubjectCategoryDTO>> queryPrimaryCategory(@RequestBody SubjectCategoryDTO subjectCategoryDTO) {
try {
SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE.
convertDtoToCategoryBO(subjectCategoryDTO);
List<SubjectCategoryBO> subjectCategoryBOList = subjectCategoryDomainService.queryCategory(subjectCategoryBO);
List<SubjectCategoryDTO> subjectCategoryDTOList = SubjectCategoryDTOConverter.INSTANCE.
convertBoToCategoryDTOList(subjectCategoryBOList);
return Result.ok(subjectCategoryDTOList);
} catch (Exception e) {
log.error("SubjectCategoryController.queryPrimaryCategory.error:{}", e.getMessage(), e);
return Result.fail("查询失败");
}
}
/**
* @description: 根据分类id查二级分类
* @param: [subjectCategoryDTO]
* @return: com.landaiqing.subject.common.entity.Result<java.util.List < com.landaiqing.subject.application.dto.SubjectCategoryDTO>>
* @author landaiqing
* @date: 2024/2/13 20:19
*/
@PostMapping("/queryCategoryByPrimary")
public Result<List<SubjectCategoryDTO>> queryCategoryByPrimary(@RequestBody SubjectCategoryDTO subjectCategoryDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectCategoryController.queryCategoryByPrimary.dto:{}"
, JSON.toJSONString(subjectCategoryDTO));
}
Preconditions.checkNotNull(subjectCategoryDTO.getParentId(), "分类id不能为空");
SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE.
convertDtoToCategoryBO(subjectCategoryDTO);
List<SubjectCategoryBO> subjectCategoryBOList = subjectCategoryDomainService.queryCategory(subjectCategoryBO);
List<SubjectCategoryDTO> subjectCategoryDTOList = SubjectCategoryDTOConverter.INSTANCE.
convertBoToCategoryDTOList(subjectCategoryBOList);
return Result.ok(subjectCategoryDTOList);
} catch (Exception e) {
log.error("SubjectCategoryController.queryPrimaryCategory.error:{}", e.getMessage(), e);
return Result.fail("查询失败");
}
}
/**
* @description: 更新分类
* @param: [subjectCategoryDTO]
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
* @author landaiqing
* @date: 2024/2/14 14:42
*/
@PostMapping("/update")
public Result<Boolean> update(@RequestBody SubjectCategoryDTO subjectCategoryDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectCategoryController.update.dto:{}"
, JSON.toJSONString(subjectCategoryDTO));
}
SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE.convertDtoToCategoryBO(subjectCategoryDTO);
Boolean result = subjectCategoryDomainService.update(subjectCategoryBO);
return Result.ok(result);
} catch (Exception e) {
log.error("SubjectCategoryController.update.error:{}", e.getMessage(), e);
return Result.fail("更新分类失败");
}
}
/**
* @description: 删除分类
* @param: [subjectCategoryDTO]
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
* @author landaiqing
* @date: 2024/2/14 15:05
*/
@PostMapping("/delete")
public Result<Boolean> delete(@RequestBody SubjectCategoryDTO subjectCategoryDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectCategoryController.delete.dto:{}"
, JSON.toJSONString(subjectCategoryDTO));
}
SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE.convertDtoToCategoryBO(subjectCategoryDTO);
Boolean result = subjectCategoryDomainService.delete(subjectCategoryBO);
return Result.ok(result);
} catch (Exception e) {
log.error("SubjectCategoryController.delete.error:{}", e.getMessage(), e);
return Result.fail("删除分类失败");
}
}
}

View File

@@ -0,0 +1,26 @@
package com.landaiqing.subject.application.controller;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import com.landaiqing.subject.infra.basic.service.SubjectCategoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 刷题controller
*
* @author: landaiqing
* @date: 2024/2/7
*/
@RestController
public class SubjectController {
@Resource
private SubjectCategoryService subjectCategoryService;
@GetMapping("/test")
public String test(){
SubjectCategory subjectCategory = subjectCategoryService.queryById(1L);
return subjectCategory.getCategoryName();
}
}

View File

@@ -0,0 +1,25 @@
package com.landaiqing.subject.application.convert;
import com.landaiqing.subject.application.dto.SubjectCategoryDTO;
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 题目分类dto转换器
*
* @author: landaiqing
* @date: 2024/2/13
*/
@Mapper
public interface SubjectCategoryDTOConverter {
SubjectCategoryDTOConverter INSTANCE = Mappers.getMapper(SubjectCategoryDTOConverter.class);
SubjectCategoryBO convertDtoToCategoryBO(SubjectCategoryDTO subjectCategoryDTO);
SubjectCategoryDTO convertBoToCategoryDTO(SubjectCategoryBO subjectCategoryBO);
List<SubjectCategoryDTO> convertBoToCategoryDTOList(List<SubjectCategoryBO> subjectCategoryDTO);
}

View File

@@ -0,0 +1,49 @@
package com.landaiqing.subject.application.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 题目分类(SubjectCategory)实体类
*
* @author makejava
* @since 2024-02-07 16:17:17
*/
@Data
public class SubjectCategoryDTO implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 分类名称
*/
private String categoryName;
/**
* 分类类型
*/
private Integer categoryType;
/**
* 图标连接
*/
private String imageUrl;
/**
* 父级id
*/
private Long parentId;
/**
* 数量
*/
private Integer count;
}

View File

@@ -0,0 +1,29 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>jc-club-application-job</artifactId>
<packaging>jar</packaging>
<name>jc-club-application-job</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,29 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>jc-club-application-mq</artifactId>
<packaging>jar</packaging>
<name>jc-club-application-mq</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,28 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>jc-club-application</artifactId>
<packaging>jar</packaging>
<name>jc-club-application</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,58 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>jc-club-common</artifactId>
<packaging>jar</packaging>
<name>jc-club-common</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.79</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,51 @@
package com.landaiqing.subject.common.entity;
import com.landaiqing.subject.common.enums.ResultCodeEnum;
import lombok.Data;
@Data
public class Result<T> {
private Boolean success;
private Integer code;
private String message;
private T data;
public static Result ok(){
Result result = new Result();
result.setSuccess(true);
result.setCode(ResultCodeEnum.SUCCESS.getCode());
result.setMessage(ResultCodeEnum.SUCCESS.getDesc());
return result;
}
public static <T> Result ok(T data){
Result result = new Result();
result.setSuccess(true);
result.setCode(ResultCodeEnum.SUCCESS.getCode());
result.setMessage(ResultCodeEnum.SUCCESS.getDesc());
result.setData(data);
return result;
}
public static Result fail(){
Result result = new Result();
result.setSuccess(false);
result.setCode(ResultCodeEnum.FAIL.getCode());
result.setMessage(ResultCodeEnum.FAIL.getDesc());
return result;
}
public static <T> Result fail(T data){
Result result = new Result();
result.setSuccess(false);
result.setCode(ResultCodeEnum.FAIL.getCode());
result.setMessage(ResultCodeEnum.FAIL.getDesc());
result.setData(data);
return result;
}
}

View File

@@ -0,0 +1,30 @@
package com.landaiqing.subject.common.enums;
import lombok.Getter;
/**
* @description: 分类类型枚举
*
* @author landaiqing
* @date: 2024/2/14 15:02
*/
@Getter
public enum CategoryTypeEnum {
PRIMARY(1,"岗位大类"),
SECOND(0,"二级分类");
private int code;
private String desc;
CategoryTypeEnum(int code, String desc){
this.code=code;
this.desc=desc;
}
public static CategoryTypeEnum getByCode(int codeVal){
for(CategoryTypeEnum resultCodeEnum: CategoryTypeEnum.values()){
if(resultCodeEnum.code==codeVal){
return resultCodeEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,29 @@
package com.landaiqing.subject.common.enums;
import lombok.Getter;
/**
* @description: 删除状态枚举
*
* @author landaiqing
* @date: 2024/2/14 15:02
*/
@Getter
public enum IsDeletedFlagEnum {
DELETED(1,"已删除"),
UN_DELETED(0,"未删除");
private int code;
private String desc;
IsDeletedFlagEnum(int code, String desc){
this.code=code;
this.desc=desc;
}
public static IsDeletedFlagEnum getByCode(int codeVal){
for(IsDeletedFlagEnum resultCodeEnum: IsDeletedFlagEnum.values()){
if(resultCodeEnum.code==codeVal){
return resultCodeEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,24 @@
package com.landaiqing.subject.common.enums;
import lombok.Getter;
@Getter
public enum ResultCodeEnum {
SUCCESS(200,"成功"),
FAIL(500,"失败");
private int code;
private String desc;
ResultCodeEnum(int code,String desc){
this.code=code;
this.desc=desc;
}
public static ResultCodeEnum getByCode(int codeVal){
for(ResultCodeEnum resultCodeEnum:ResultCodeEnum.values()){
if(resultCodeEnum.code==codeVal){
return resultCodeEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,38 @@
package com.landaiqing.subject.common.enums;
import lombok.Getter;
/**
* 题目类型枚举
* 1单选 2多选 3判断 4简答
* @author: ChickenWing
* @date: 2023/10/3
*/
@Getter
public enum SubjectInfoTypeEnum {
RADIO(1,"单选"),
MULTIPLE(2,"多选"),
JUDGE(3,"判断"),
BRIEF(4,"简答"),
;
public int code;
public String desc;
SubjectInfoTypeEnum(int code, String desc){
this.code = code;
this.desc = desc;
}
public static SubjectInfoTypeEnum getByCode(int codeVal){
for(SubjectInfoTypeEnum resultCodeEnum : SubjectInfoTypeEnum.values()){
if(resultCodeEnum.code == codeVal){
return resultCodeEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,35 @@
package com.landaiqing.subject.common.enums;
import lombok.Getter;
/**
* 题目点赞枚举
*
* @author: ChickenWing
* @date: 2023/10/3
*/
@Getter
public enum SubjectLikedStatusEnum {
LIKED(1, "点赞"),
UN_LIKED(0, "取消点赞");
public int code;
public String desc;
SubjectLikedStatusEnum(int code, String desc) {
this.code = code;
this.desc = desc;
}
public static SubjectLikedStatusEnum getByCode(int codeVal) {
for (SubjectLikedStatusEnum resultCodeEnum : SubjectLikedStatusEnum.values()) {
if (resultCodeEnum.code == codeVal) {
return resultCodeEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,27 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>jc-club-domain</artifactId>
<packaging>jar</packaging>
<name>jc-club-domain</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-infra</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,17 @@
package com.landaiqing.subject.domain.convert;
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SubjectCategoryConverter {
SubjectCategoryConverter INSTANCE = Mappers.getMapper(SubjectCategoryConverter.class);
SubjectCategory convertBoToCategory(SubjectCategoryBO subjectCategoryBO);
List<SubjectCategoryBO> convertBoToCategory(List<SubjectCategory> categoryList);
}

View File

@@ -0,0 +1,39 @@
package com.landaiqing.subject.domain.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 题目分类(SubjectCategory)实体类
*
* @author makejava
* @since 2024-02-07 16:17:17
*/
@Data
public class SubjectCategoryBO implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 分类名称
*/
private String categoryName;
/**
* 分类类型
*/
private Integer categoryType;
/**
* 图标连接
*/
private String imageUrl;
/**
* 父级id
*/
private Long parentId;
}

View File

@@ -0,0 +1,38 @@
package com.landaiqing.subject.domain.service;
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
import java.util.List;
public interface SubjectCategoryDomainService {
/**
* 新增分类
*/
void add(SubjectCategoryBO subjectCategoryBO);
/**
* 查询岗位大类
*
* @param subjectCategoryBO
* @return
*/
List<SubjectCategoryBO> queryCategory(SubjectCategoryBO subjectCategoryBO);
/**
* @description: 更新分类
* @param: [subjectCategoryBO]
* @return: java.lang.Boolean
* @author landaiqing
* @date: 2024/2/14 14:47
*/
Boolean update(SubjectCategoryBO subjectCategoryBO);
/**
* @description: 删除分类
* @param: [subjectCategoryBO]
* @return: java.lang.Boolean
* @author landaiqing
* @date: 2024/2/14 14:58
*/
Boolean delete(SubjectCategoryBO subjectCategoryBO);
}

View File

@@ -0,0 +1,90 @@
package com.landaiqing.subject.domain.service.impl;
import com.alibaba.fastjson.JSON;
import com.landaiqing.subject.common.enums.CategoryTypeEnum;
import com.landaiqing.subject.common.enums.IsDeletedFlagEnum;
import com.landaiqing.subject.domain.convert.SubjectCategoryConverter;
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
import com.landaiqing.subject.domain.service.SubjectCategoryDomainService;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import com.landaiqing.subject.infra.basic.service.SubjectCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
@Slf4j
public class SubjectCategoryDomainServiceImpl implements SubjectCategoryDomainService {
@Resource
private SubjectCategoryService subjectCategoryService;
/**
* @description: 新增分类
* @param: [subjectCategoryBO]
* @return: void
* @author landaiqing
* @date: 2024/2/14 15:14
*/
@Override
public void add(SubjectCategoryBO subjectCategoryBO) {
if (log.isInfoEnabled()) {
log.info("SubjectCategoryController.add.bo:{}", JSON.toJSONString(subjectCategoryBO));
}
SubjectCategory subjectCategory = SubjectCategoryConverter.INSTANCE
.convertBoToCategory(subjectCategoryBO);
subjectCategory.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
subjectCategoryService.insert(subjectCategory);
}
/**
* @description: 查询岗位大类
* @param: [subjectCategoryBO]
* @return: java.util.List<com.landaiqing.subject.domain.entity.SubjectCategoryBO>
* @author landaiqing
* @date: 2024/2/14 15:14
*/
@Override
public List<SubjectCategoryBO> queryCategory(SubjectCategoryBO subjectCategoryBO) {
SubjectCategory subjectCategory = SubjectCategoryConverter.INSTANCE.convertBoToCategory(subjectCategoryBO);
subjectCategory.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
subjectCategory.setCategoryType(CategoryTypeEnum.PRIMARY.getCode());
List<SubjectCategory> subjectCategoryList = subjectCategoryService.queryCategory(subjectCategory);
List<SubjectCategoryBO> boList = SubjectCategoryConverter.INSTANCE
.convertBoToCategory(subjectCategoryList);
if (log.isInfoEnabled()) {
log.info("SubjectCategoryController.queryPrimaryCategory.boList:{}", JSON.toJSONString(boList));
}
return boList;
}
/**
* @description: 更新分类
* @param: [subjectCategoryBO]
* @return: java.lang.Boolean
* @author landaiqing
* @date: 2024/2/14 14:46
*/
@Override
public Boolean update(SubjectCategoryBO subjectCategoryBO) {
SubjectCategory subjectCategory = SubjectCategoryConverter.INSTANCE.convertBoToCategory(subjectCategoryBO);
int count = subjectCategoryService.update(subjectCategory);
return count > 0;
}
/**
* @description: 删除分类
* @param: [subjectCategoryBO]
* @return: java.lang.Boolean
* @author landaiqing
* @date: 2024/2/14 15:04
*/
@Override
public Boolean delete(SubjectCategoryBO subjectCategoryBO) {
SubjectCategory subjectCategory = SubjectCategoryConverter.INSTANCE.convertBoToCategory(subjectCategoryBO);
subjectCategory.setIsDeleted(IsDeletedFlagEnum.DELETED.getCode());
int count = subjectCategoryService.update(subjectCategory);
return count > 0;
}
}

View File

@@ -0,0 +1,51 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>jc-club-infra</artifactId>
<packaging>jar</packaging>
<name>jc-club-infra</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!--jdbcStarter-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.4.2</version>
</dependency>
<!--druid连接池-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.21</version>
</dependency>
<!--mysql-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
<!--mybatis plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,59 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 题目分类(SubjectCategory)实体类
*
* @author makejava
* @since 2024-02-07 16:17:17
*/
@Data
public class SubjectCategory implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 分类名称
*/
private String categoryName;
/**
* 分类类型
*/
private Integer categoryType;
/**
* 图标连接
*/
private String imageUrl;
/**
* 父级id
*/
private Long parentId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否删除 0: 未删除 1: 已删除
*/
private Integer isDeleted;
}

View File

@@ -0,0 +1,74 @@
package com.landaiqing.subject.infra.basic.mapper;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 题目分类(SubjectCategory)表数据库访问层
*
* @author makejava
* @since 2024-02-07 16:17:16
*/
public interface SubjectCategoryDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectCategory queryById(Long id);
/**
* 统计总行数
*
* @param subjectCategory 查询条件
* @return 总行数
*/
long count(SubjectCategory subjectCategory);
/**
* 新增数据
*
* @param subjectCategory 实例对象
* @return 影响行数
*/
int insert(SubjectCategory subjectCategory);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<SubjectCategory> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<SubjectCategory> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<SubjectCategory> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<SubjectCategory> entities);
/**
* 修改数据
*
* @param subjectCategory 实例对象
* @return 影响行数
*/
int update(SubjectCategory subjectCategory);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
List<SubjectCategory> queryCategory(SubjectCategory subjectCategory);
}

View File

@@ -0,0 +1,52 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import java.util.List;
/**
* 题目分类(SubjectCategory)表服务接口
*
* @author makejava
* @since 2024-02-07 16:17:20
*/
public interface SubjectCategoryService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectCategory queryById(Long id);
/**
* 新增数据
*
* @param subjectCategory 实例对象
* @return 实例对象
*/
SubjectCategory insert(SubjectCategory subjectCategory);
/**
* 修改数据
*
* @param subjectCategory 实例对象
* @return 实例对象
*/
int update(SubjectCategory subjectCategory);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
/**
* 查询岗位大类
* @return
*/
List<SubjectCategory> queryCategory(SubjectCategory subjectCategory);
}

View File

@@ -0,0 +1,78 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.alibaba.fastjson.JSON;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import com.landaiqing.subject.infra.basic.mapper.SubjectCategoryDao;
import com.landaiqing.subject.infra.basic.service.SubjectCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 题目分类(SubjectCategory)表服务实现类
*
* @author makejava
* @since 2024-02-07 16:17:20
*/
@Service("subjectCategoryService")
@Slf4j
public class SubjectCategoryServiceImpl implements SubjectCategoryService {
@Resource
private SubjectCategoryDao subjectCategoryDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectCategory queryById(Long id) {
return this.subjectCategoryDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectCategory 实例对象
* @return 实例对象
*/
@Override
public SubjectCategory insert(SubjectCategory subjectCategory) {
if (log.isInfoEnabled()) {
log.info("SubjectCategoryController.add.subjectCategory:{}", JSON.toJSONString(subjectCategory));
}
this.subjectCategoryDao.insert(subjectCategory);
return subjectCategory;
}
/**
* 修改数据
*
* @param subjectCategory 实例对象
* @return 实例对象
*/
@Override
public int update(SubjectCategory subjectCategory) {
return this.subjectCategoryDao.update(subjectCategory);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectCategoryDao.deleteById(id) > 0;
}
@Override
public List<SubjectCategory> queryCategory(SubjectCategory subjectCategory) {
return this.subjectCategoryDao.queryCategory(subjectCategory);
}
}

View File

@@ -0,0 +1,48 @@
package com.landaiqing.subject.infra.basic.utils;
import com.alibaba.druid.filter.config.ConfigTools;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
/**
* 数据库加密util
*
* @author: landaiqing
* @date: 2024/2/7
*/
public class DruidEncryptUtil {
private static String publicKey;
private static String privateKey;
static {
try {
String[] keyPair = ConfigTools.genKeyPair(512);
privateKey=keyPair[0];
System.out.println("privateKey:"+privateKey);
publicKey=keyPair[1];
System.out.println("publicKey:"+publicKey);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (NoSuchProviderException e) {
throw new RuntimeException(e);
}
}
public static String encrypt(String plainText) throws Exception {
String encrypt = ConfigTools.encrypt(privateKey, plainText);
System.out.println("encrypt:"+encrypt);
return encrypt;
}
public static String decrypt(String encryptText) throws Exception {
String decrypt = ConfigTools.decrypt(publicKey, encryptText);
System.out.println("decrypt:"+decrypt);
return decrypt;
}
public static void main(String[] args) throws Exception {
String encrypt = encrypt("1611");
System.out.println("encrypt:"+encrypt);
}
}

View File

@@ -0,0 +1,188 @@
<?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.landaiqing.subject.infra.basic.mapper.SubjectCategoryDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectCategory" id="SubjectCategoryMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="categoryName" column="category_name" jdbcType="VARCHAR"/>
<result property="categoryType" column="category_type" jdbcType="INTEGER"/>
<result property="imageUrl" column="image_url" jdbcType="VARCHAR"/>
<result property="parentId" column="parent_id" jdbcType="INTEGER"/>
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="SubjectCategoryMap">
select id,
category_name,
category_type,
image_url,
parent_id,
created_by,
created_time,
update_by,
update_time
from subject_category
where id = #{id}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from subject_category
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="categoryName != null and categoryName != ''">
and category_name = #{categoryName}
</if>
<if test="categoryType != null">
and category_type = #{categoryType}
</if>
<if test="imageUrl != null and imageUrl != ''">
and image_url = #{imageUrl}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<!--查询分类-->
<select id="queryCategory" resultMap="SubjectCategoryMap">
select * from subject_category
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="categoryName != null and categoryName != ''">
and category_name = #{categoryName}
</if>
<if test="categoryType != null">
and category_type = #{categoryType}
</if>
<if test="imageUrl != null and imageUrl != ''">
and image_url = #{imageUrl}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into subject_category(category_name, category_type, image_url, parent_id, created_by, created_time,
update_by, update_time, is_deleted)
values (#{categoryName}, #{categoryType}, #{imageUrl}, #{parentId}, #{createdBy}, #{createdTime}, #{updateBy},
#{updateTime}, #{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_category(category_name, category_type, image_url, parent_id, created_by, created_time,
update_by, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.categoryName}, #{entity.categoryType}, #{entity.imageUrl}, #{entity.parentId},
#{entity.createdBy}, #{entity.createdTime}, #{entity.updateBy}, #{entity.updateTime})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_category(category_name, category_type, image_url, parent_id, created_by, created_time,
update_by, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.categoryName}, #{entity.categoryType}, #{entity.imageUrl}, #{entity.parentId},
#{entity.createdBy}, #{entity.createdTime}, #{entity.updateBy}, #{entity.updateTime})
</foreach>
on duplicate key update
category_name = values(category_name),
category_type = values(category_type),
image_url = values(image_url),
parent_id = values(parent_id),
created_by = values(created_by),
created_time = values(created_time),
update_by = values(update_by),
update_time = values(update_time)
</insert>
<!--通过主键修改数据-->
<update id="update">
update subject_category
<set>
<if test="categoryName != null and categoryName != ''">
category_name = #{categoryName},
</if>
<if test="categoryType != null">
category_type = #{categoryType},
</if>
<if test="imageUrl != null and imageUrl != ''">
image_url = #{imageUrl},
</if>
<if test="parentId != null">
parent_id = #{parentId},
</if>
<if test="createdBy != null and createdBy != ''">
created_by = #{createdBy},
</if>
<if test="createdTime != null">
created_time = #{createdTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from subject_category where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,43 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>jc-club-starter</artifactId>
<packaging>jar</packaging>
<name>jc-club-starter</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.4.2</version>
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-logging</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-application-controller</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-infra</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,21 @@
package com.landaiqing.subject;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
/**
* 刷题微服务启动类
*
* @author: landaiqing
* @date: 2024/2/7
*/
@SpringBootApplication
@ComponentScan("com.landaiqing")
@MapperScan("com.landaiqing.**.mapper")
public class SubjectApplication {
public static void main(String[] args) {
SpringApplication.run(SubjectApplication.class);
}
}

View File

@@ -0,0 +1,34 @@
server:
port: 3000
spring:
datasource:
username: root
password: KDEXuVoWQo5HqGrcNtddAVewaH/HhW5KA5ZOqFSxzvv9/UsRALTvVG/cDT7Dpyqd39i8MqRbrpIxxCrGKK0IHg==
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/jc-club?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=true
type: com.alibaba.druid.pool.DruidDataSource
druid:
initial-size: 20
min-idle: 20
max-active: 100
max-wait: 60000
connectionProperties: config.decrypt=true;config.decrypt.key=${publicKey};
stat-view-servlet:
enabled: true
url-pattern: /druid/*
login-username: admin
login-password: 123456
filter:
stat:
enabled: true
slow-sql-millis: 2000
log-slow-sql: true
wall:
enabled: true
config:
enabled: true
publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANTIIARobM6yJvDThAMZo6W185Kr4MMNqJosKZiJLbpEz2F5dQAmJSjpyyYe7o4s4Pbekspk9LD5PNOSs6U4TvsCAwEAAQ==
logging:
config: classpath:log4j2-spring.xml

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Configuration后面的status这个用于设置log4j2自身内部的信息输出可以不设置当设置成trace时你会看到log4j2内部各种详细输出-->
<!--monitorIntervalLog4j能够自动检测修改配置 文件和重新配置本身,设置间隔秒数-->
<configuration status="INFO" monitorInterval="5">
<!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
<!--变量配置-->
<Properties>
<!-- 格式化输出:%date表示日期%thread表示线程名%-5level级别从左显示5个字符宽度 %msg日志消息%n是换行符-->
<!-- %logger{36} 表示 Logger 名字最长36个字符 -->
<property name="LOG_PATTERN" value="%date{HH:mm:ss.SSS} %X{PFTID} [%thread] %-5level %logger{36} - %msg%n" />
<!-- 定义日志存储的路径 -->
<property name="FILE_PATH" value="../log" />
<property name="FILE_NAME" value="jcClub.log" />
</Properties>
<!--https://logging.apache.org/log4j/2.x/manual/appenders.html-->
<appenders>
<console name="Console" target="SYSTEM_OUT">
<!--输出日志的格式-->
<PatternLayout pattern="${LOG_PATTERN}"/>
<!--控制台只输出level及其以上级别的信息onMatch其他的直接拒绝onMismatch-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
</console>
<!--文件会打印出所有信息这个log每次运行程序会自动清空由append属性决定适合临时测试用-->
<File name="fileLog" fileName="${FILE_PATH}/temp.log" append="false">
<PatternLayout pattern="${LOG_PATTERN}"/>
</File>
<!-- 这个会打印出所有的info及以下级别的信息每次大小超过size则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
<RollingFile name="RollingFileInfo" fileName="${FILE_PATH}/info.log" filePattern="${FILE_PATH}/${FILE_NAME}-INFO-%d{yyyy-MM-dd}_%i.log.gz">
<!--控制台只输出level及以上级别的信息onMatch其他的直接拒绝onMismatch-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="${LOG_PATTERN}"/>
<Policies>
<!--interval属性用来指定多久滚动一次默认是1 hour-->
<TimeBasedTriggeringPolicy interval="1"/>
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>
<!-- DefaultRolloverStrategy属性如不设置则默认为最多同一文件夹下7个文件开始覆盖-->
<DefaultRolloverStrategy max="15"/>
</RollingFile>
<!-- 这个会打印出所有的warn及以下级别的信息每次大小超过size则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
<RollingFile name="RollingFileWarn" fileName="${FILE_PATH}/warn.log" filePattern="${FILE_PATH}/${FILE_NAME}-WARN-%d{yyyy-MM-dd}_%i.log.gz">
<!--控制台只输出level及以上级别的信息onMatch其他的直接拒绝onMismatch-->
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="${LOG_PATTERN}"/>
<Policies>
<!--interval属性用来指定多久滚动一次默认是1 hour-->
<TimeBasedTriggeringPolicy interval="1"/>
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>
<!-- DefaultRolloverStrategy属性如不设置则默认为最多同一文件夹下7个文件开始覆盖-->
<DefaultRolloverStrategy max="15"/>
</RollingFile>
<!-- 这个会打印出所有的error及以下级别的信息每次大小超过size则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
<RollingFile name="RollingFileError" fileName="${FILE_PATH}/error.log" filePattern="${FILE_PATH}/${FILE_NAME}-ERROR-%d{yyyy-MM-dd}_%i.log.gz">
<!--控制台只输出level及以上级别的信息onMatch其他的直接拒绝onMismatch-->
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="${LOG_PATTERN}"/>
<Policies>
<!--interval属性用来指定多久滚动一次默认是1 hour-->
<TimeBasedTriggeringPolicy interval="1"/>
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>
<!-- DefaultRolloverStrategy属性如不设置则默认为最多同一文件夹下7个文件开始覆盖-->
<DefaultRolloverStrategy max="15"/>
</RollingFile>
</appenders>
<!--Logger节点用来单独指定日志的形式比如要为指定包下的class指定不同的日志级别等。-->
<!--然后定义loggers只有定义了logger并引入的appenderappender才会生效-->
<loggers>
<root level="info">
<appender-ref ref="Console"/>
<appender-ref ref="RollingFileInfo"/>
<appender-ref ref="RollingFileWarn"/>
<appender-ref ref="RollingFileError"/>
<appender-ref ref="fileLog"/>
</root>
</loggers>
</configuration>

View File

@@ -0,0 +1,28 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>jc-club-subject-api</artifactId>
<packaging>jar</packaging>
<name>jc-club-subject-api</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

53
jc-club-subject/pom.xml Normal file
View File

@@ -0,0 +1,53 @@
<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">
<modelVersion>4.0.0</modelVersion>
<description>鸡翅club-题目领域服务</description>
<groupId>com.landaiqing</groupId>
<artifactId>jc-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>jc-club-subject</name>
<url>http://maven.apache.org</url>
<modules>
<module>jc-club-subject-api</module>
<module>jc-club-application</module>
<module>jc-club-common</module>
<module>jc-club-domain</module>
<module>jc-club-infra</module>
<module>jc-club-starter</module>
<module>jc-club-application/jc-club-application-controller</module>
<module>jc-club-application/jc-club-application-job</module>
<module>jc-club-application/jc-club-application-mq</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.4.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>