Initial commit
This commit is contained in:
31
.gitignore
vendored
Normal file
31
.gitignore
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
### Java template
|
||||
|
||||
#IDEA
|
||||
.idea/
|
||||
target/
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
73
LICENSE
Normal file
73
LICENSE
Normal file
@@ -0,0 +1,73 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright 2024 JC-Club
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@@ -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>
|
@@ -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("删除分类失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -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();
|
||||
}
|
||||
}
|
@@ -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);
|
||||
|
||||
}
|
@@ -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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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>
|
@@ -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>
|
28
jc-club-subject/jc-club-application/pom.xml
Normal file
28
jc-club-subject/jc-club-application/pom.xml
Normal 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>
|
58
jc-club-subject/jc-club-common/pom.xml
Normal file
58
jc-club-subject/jc-club-common/pom.xml
Normal 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>
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
27
jc-club-subject/jc-club-domain/pom.xml
Normal file
27
jc-club-subject/jc-club-domain/pom.xml
Normal 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>
|
@@ -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);
|
||||
|
||||
}
|
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
51
jc-club-subject/jc-club-infra/pom.xml
Normal file
51
jc-club-subject/jc-club-infra/pom.xml
Normal 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>
|
@@ -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;
|
||||
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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>
|
||||
|
43
jc-club-subject/jc-club-starter/pom.xml
Normal file
43
jc-club-subject/jc-club-starter/pom.xml
Normal 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>
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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
|
||||
|
||||
|
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--Configuration后面的status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出-->
|
||||
<!--monitorInterval:Log4j能够自动检测修改配置 文件和重新配置本身,设置间隔秒数-->
|
||||
<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并引入的appender,appender才会生效-->
|
||||
<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>
|
28
jc-club-subject/jc-club-subject-api/pom.xml
Normal file
28
jc-club-subject/jc-club-subject-api/pom.xml
Normal 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
53
jc-club-subject/pom.xml
Normal 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>
|
Reference in New Issue
Block a user