commit 5135f009a93c122726da3ac12e6de8e7d502cfe2 Author: Qing Date: Wed Feb 14 16:47:29 2024 +0800 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..790203f --- /dev/null +++ b/.gitignore @@ -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* + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a62ec28 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..cb5ad2e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# jc-club + diff --git a/jc-club-subject/jc-club-application/jc-club-application-controller/pom.xml b/jc-club-subject/jc-club-application/jc-club-application-controller/pom.xml new file mode 100644 index 0000000..396dcb6 --- /dev/null +++ b/jc-club-subject/jc-club-application/jc-club-application-controller/pom.xml @@ -0,0 +1,38 @@ + + 4.0.0 + + com.landaiqing + jc-club-subject + 1.0-SNAPSHOT + ../../pom.xml + + + jc-club-application-controller + jar + + jc-club-application-controller + http://maven.apache.org + + + UTF-8 + + + + + org.springframework.boot + spring-boot-starter-web + 2.4.2 + + + com.landaiqing + jc-club-infra + 1.0-SNAPSHOT + + + com.landaiqing + jc-club-domain + 1.0-SNAPSHOT + + + diff --git a/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/controller/SubjectCategoryController.java b/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/controller/SubjectCategoryController.java new file mode 100644 index 0000000..829cf66 --- /dev/null +++ b/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/controller/SubjectCategoryController.java @@ -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 + * @author landaiqing + * @date: 2024/2/13 20:19 + */ + @PostMapping("/add") + public Result 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> + * @author landaiqing + * @date: 2024/2/13 20:19 + */ + @PostMapping("/queryPrimaryCategory") + public Result> queryPrimaryCategory(@RequestBody SubjectCategoryDTO subjectCategoryDTO) { + try { + SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE. + convertDtoToCategoryBO(subjectCategoryDTO); + List subjectCategoryBOList = subjectCategoryDomainService.queryCategory(subjectCategoryBO); + List 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> + * @author landaiqing + * @date: 2024/2/13 20:19 + */ + @PostMapping("/queryCategoryByPrimary") + public Result> 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 subjectCategoryBOList = subjectCategoryDomainService.queryCategory(subjectCategoryBO); + List 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 + * @author landaiqing + * @date: 2024/2/14 14:42 + */ + @PostMapping("/update") + public Result 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 + * @author landaiqing + * @date: 2024/2/14 15:05 + */ + @PostMapping("/delete") + public Result 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("删除分类失败"); + } + } + +} diff --git a/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/controller/SubjectController.java b/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/controller/SubjectController.java new file mode 100644 index 0000000..99e836f --- /dev/null +++ b/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/controller/SubjectController.java @@ -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(); + } +} diff --git a/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/convert/SubjectCategoryDTOConverter.java b/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/convert/SubjectCategoryDTOConverter.java new file mode 100644 index 0000000..cad6682 --- /dev/null +++ b/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/convert/SubjectCategoryDTOConverter.java @@ -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 convertBoToCategoryDTOList(List subjectCategoryDTO); + +} diff --git a/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/dto/SubjectCategoryDTO.java b/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/dto/SubjectCategoryDTO.java new file mode 100644 index 0000000..dac5c94 --- /dev/null +++ b/jc-club-subject/jc-club-application/jc-club-application-controller/src/main/java/com/landaiqing/subject/application/dto/SubjectCategoryDTO.java @@ -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; + + + +} + diff --git a/jc-club-subject/jc-club-application/jc-club-application-job/pom.xml b/jc-club-subject/jc-club-application/jc-club-application-job/pom.xml new file mode 100644 index 0000000..43a5731 --- /dev/null +++ b/jc-club-subject/jc-club-application/jc-club-application-job/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + + com.landaiqing + jc-club-subject + 1.0-SNAPSHOT + ../../pom.xml + + + jc-club-application-job + jar + + jc-club-application-job + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + 3.8.1 + test + + + diff --git a/jc-club-subject/jc-club-application/jc-club-application-mq/pom.xml b/jc-club-subject/jc-club-application/jc-club-application-mq/pom.xml new file mode 100644 index 0000000..76d7d3c --- /dev/null +++ b/jc-club-subject/jc-club-application/jc-club-application-mq/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + + com.landaiqing + jc-club-subject + 1.0-SNAPSHOT + ../../pom.xml + + + jc-club-application-mq + jar + + jc-club-application-mq + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + 3.8.1 + test + + + diff --git a/jc-club-subject/jc-club-application/pom.xml b/jc-club-subject/jc-club-application/pom.xml new file mode 100644 index 0000000..a7fab34 --- /dev/null +++ b/jc-club-subject/jc-club-application/pom.xml @@ -0,0 +1,28 @@ + + 4.0.0 + + com.landaiqing + jc-club-subject + 1.0-SNAPSHOT + + + jc-club-application + jar + + jc-club-application + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + 3.8.1 + test + + + diff --git a/jc-club-subject/jc-club-common/pom.xml b/jc-club-subject/jc-club-common/pom.xml new file mode 100644 index 0000000..e570d5d --- /dev/null +++ b/jc-club-subject/jc-club-common/pom.xml @@ -0,0 +1,58 @@ + + 4.0.0 + + com.landaiqing + jc-club-subject + 1.0-SNAPSHOT + + + jc-club-common + jar + + jc-club-common + http://maven.apache.org + + + UTF-8 + + + + + org.projectlombok + lombok + 1.18.16 + + + org.mapstruct + mapstruct + 1.4.2.Final + + + org.mapstruct + mapstruct-processor + 1.4.2.Final + + + + org.springframework.boot + spring-boot-starter-log4j2 + 2.4.2 + + + com.alibaba + fastjson + 1.2.79 + + + com.google.guava + guava + 19.0 + + + org.apache.commons + commons-lang3 + 3.11 + + + diff --git a/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/entity/Result.java b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/entity/Result.java new file mode 100644 index 0000000..5718100 --- /dev/null +++ b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/entity/Result.java @@ -0,0 +1,51 @@ +package com.landaiqing.subject.common.entity; + +import com.landaiqing.subject.common.enums.ResultCodeEnum; +import lombok.Data; + +@Data +public class Result { + + 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 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 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; + } + +} diff --git a/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/CategoryTypeEnum.java b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/CategoryTypeEnum.java new file mode 100644 index 0000000..b16df5d --- /dev/null +++ b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/CategoryTypeEnum.java @@ -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; + } +} diff --git a/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/IsDeletedFlagEnum.java b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/IsDeletedFlagEnum.java new file mode 100644 index 0000000..efd0c90 --- /dev/null +++ b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/IsDeletedFlagEnum.java @@ -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; + } +} diff --git a/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/ResultCodeEnum.java b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/ResultCodeEnum.java new file mode 100644 index 0000000..ee7947a --- /dev/null +++ b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/ResultCodeEnum.java @@ -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; + } +} diff --git a/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/SubjectInfoTypeEnum.java b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/SubjectInfoTypeEnum.java new file mode 100644 index 0000000..821003b --- /dev/null +++ b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/SubjectInfoTypeEnum.java @@ -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; + } + +} diff --git a/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/SubjectLikedStatusEnum.java b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/SubjectLikedStatusEnum.java new file mode 100644 index 0000000..0fcab56 --- /dev/null +++ b/jc-club-subject/jc-club-common/src/main/java/com/landaiqing/subject/common/enums/SubjectLikedStatusEnum.java @@ -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; + } + +} diff --git a/jc-club-subject/jc-club-domain/pom.xml b/jc-club-subject/jc-club-domain/pom.xml new file mode 100644 index 0000000..c9b1b12 --- /dev/null +++ b/jc-club-subject/jc-club-domain/pom.xml @@ -0,0 +1,27 @@ + + 4.0.0 + + com.landaiqing + jc-club-subject + 1.0-SNAPSHOT + + + jc-club-domain + jar + + jc-club-domain + http://maven.apache.org + + + UTF-8 + + + + + com.landaiqing + jc-club-infra + 1.0-SNAPSHOT + + + diff --git a/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/convert/SubjectCategoryConverter.java b/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/convert/SubjectCategoryConverter.java new file mode 100644 index 0000000..227c421 --- /dev/null +++ b/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/convert/SubjectCategoryConverter.java @@ -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 convertBoToCategory(List categoryList); + +} diff --git a/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/entity/SubjectCategoryBO.java b/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/entity/SubjectCategoryBO.java new file mode 100644 index 0000000..52800c6 --- /dev/null +++ b/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/entity/SubjectCategoryBO.java @@ -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; + + +} + diff --git a/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/service/SubjectCategoryDomainService.java b/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/service/SubjectCategoryDomainService.java new file mode 100644 index 0000000..59dbcc9 --- /dev/null +++ b/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/service/SubjectCategoryDomainService.java @@ -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 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); +} diff --git a/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/service/impl/SubjectCategoryDomainServiceImpl.java b/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/service/impl/SubjectCategoryDomainServiceImpl.java new file mode 100644 index 0000000..60a1c03 --- /dev/null +++ b/jc-club-subject/jc-club-domain/src/main/java/com/landaiqing/subject/domain/service/impl/SubjectCategoryDomainServiceImpl.java @@ -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 + * @author landaiqing + * @date: 2024/2/14 15:14 + */ + @Override + public List queryCategory(SubjectCategoryBO subjectCategoryBO) { + SubjectCategory subjectCategory = SubjectCategoryConverter.INSTANCE.convertBoToCategory(subjectCategoryBO); + subjectCategory.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode()); + subjectCategory.setCategoryType(CategoryTypeEnum.PRIMARY.getCode()); + List subjectCategoryList = subjectCategoryService.queryCategory(subjectCategory); + List 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; + } +} diff --git a/jc-club-subject/jc-club-infra/pom.xml b/jc-club-subject/jc-club-infra/pom.xml new file mode 100644 index 0000000..e9a409c --- /dev/null +++ b/jc-club-subject/jc-club-infra/pom.xml @@ -0,0 +1,51 @@ + + 4.0.0 + + com.landaiqing + jc-club-subject + 1.0-SNAPSHOT + + + jc-club-infra + jar + + jc-club-infra + http://maven.apache.org + + + UTF-8 + + + + + + org.springframework.boot + spring-boot-starter-jdbc + 2.4.2 + + + + com.alibaba + druid-spring-boot-starter + 1.1.21 + + + + mysql + mysql-connector-java + 8.0.33 + + + + com.baomidou + mybatis-plus-boot-starter + 3.4.0 + + + com.landaiqing + jc-club-common + 1.0-SNAPSHOT + + + diff --git a/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/entity/SubjectCategory.java b/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/entity/SubjectCategory.java new file mode 100644 index 0000000..625c54e --- /dev/null +++ b/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/entity/SubjectCategory.java @@ -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; + +} + diff --git a/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/mapper/SubjectCategoryDao.java b/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/mapper/SubjectCategoryDao.java new file mode 100644 index 0000000..049216e --- /dev/null +++ b/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/mapper/SubjectCategoryDao.java @@ -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 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param subjectCategory 实例对象 + * @return 影响行数 + */ + int update(SubjectCategory subjectCategory); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Long id); + + List queryCategory(SubjectCategory subjectCategory); +} + diff --git a/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/service/SubjectCategoryService.java b/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/service/SubjectCategoryService.java new file mode 100644 index 0000000..8c84bae --- /dev/null +++ b/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/service/SubjectCategoryService.java @@ -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 queryCategory(SubjectCategory subjectCategory); +} diff --git a/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/service/impl/SubjectCategoryServiceImpl.java b/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/service/impl/SubjectCategoryServiceImpl.java new file mode 100644 index 0000000..5658933 --- /dev/null +++ b/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/service/impl/SubjectCategoryServiceImpl.java @@ -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 queryCategory(SubjectCategory subjectCategory) { + return this.subjectCategoryDao.queryCategory(subjectCategory); + } +} diff --git a/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/utils/DruidEncryptUtil.java b/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/utils/DruidEncryptUtil.java new file mode 100644 index 0000000..69f9aa0 --- /dev/null +++ b/jc-club-subject/jc-club-infra/src/main/java/com/landaiqing/subject/infra/basic/utils/DruidEncryptUtil.java @@ -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); + } +} diff --git a/jc-club-subject/jc-club-infra/src/main/resources/mapper/SubjectCategoryDao.xml b/jc-club-subject/jc-club-infra/src/main/resources/mapper/SubjectCategoryDao.xml new file mode 100644 index 0000000..21d6f88 --- /dev/null +++ b/jc-club-subject/jc-club-infra/src/main/resources/mapper/SubjectCategoryDao.xml @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 into subject_category(category_name, category_type, image_url, parent_id, created_by, created_time, + update_by, update_time) + values + + (#{entity.categoryName}, #{entity.categoryType}, #{entity.imageUrl}, #{entity.parentId}, + #{entity.createdBy}, #{entity.createdTime}, #{entity.updateBy}, #{entity.updateTime}) + + + + + insert into subject_category(category_name, category_type, image_url, parent_id, created_by, created_time, + update_by, update_time) + values + + (#{entity.categoryName}, #{entity.categoryType}, #{entity.imageUrl}, #{entity.parentId}, + #{entity.createdBy}, #{entity.createdTime}, #{entity.updateBy}, #{entity.updateTime}) + + 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) + + + + + + update subject_category + + + category_name = #{categoryName}, + + + category_type = #{categoryType}, + + + image_url = #{imageUrl}, + + + parent_id = #{parentId}, + + + created_by = #{createdBy}, + + + created_time = #{createdTime}, + + + update_by = #{updateBy}, + + + update_time = #{updateTime}, + + + is_deleted = #{isDeleted}, + + + where id = #{id} + + + + + delete from subject_category where id = #{id} + + + + diff --git a/jc-club-subject/jc-club-starter/pom.xml b/jc-club-subject/jc-club-starter/pom.xml new file mode 100644 index 0000000..67cefce --- /dev/null +++ b/jc-club-subject/jc-club-starter/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + + com.landaiqing + jc-club-subject + 1.0-SNAPSHOT + + + jc-club-starter + jar + + jc-club-starter + http://maven.apache.org + + + UTF-8 + + + + + org.springframework.boot + spring-boot-starter-web + 2.4.2 + + + spring-boot-starter-logging + org.springframework.boot + + + + + com.landaiqing + jc-club-application-controller + 1.0-SNAPSHOT + + + com.landaiqing + jc-club-infra + 1.0-SNAPSHOT + + + diff --git a/jc-club-subject/jc-club-starter/src/main/java/com/landaiqing/subject/SubjectApplication.java b/jc-club-subject/jc-club-starter/src/main/java/com/landaiqing/subject/SubjectApplication.java new file mode 100644 index 0000000..b2fb55d --- /dev/null +++ b/jc-club-subject/jc-club-starter/src/main/java/com/landaiqing/subject/SubjectApplication.java @@ -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); + } +} diff --git a/jc-club-subject/jc-club-starter/src/main/resources/application.yml b/jc-club-subject/jc-club-starter/src/main/resources/application.yml new file mode 100644 index 0000000..98de145 --- /dev/null +++ b/jc-club-subject/jc-club-starter/src/main/resources/application.yml @@ -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 + + diff --git a/jc-club-subject/jc-club-starter/src/main/resources/log4j2-spring.xml b/jc-club-subject/jc-club-starter/src/main/resources/log4j2-spring.xml new file mode 100644 index 0000000..b45d532 --- /dev/null +++ b/jc-club-subject/jc-club-starter/src/main/resources/log4j2-spring.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jc-club-subject/jc-club-subject-api/pom.xml b/jc-club-subject/jc-club-subject-api/pom.xml new file mode 100644 index 0000000..2399aee --- /dev/null +++ b/jc-club-subject/jc-club-subject-api/pom.xml @@ -0,0 +1,28 @@ + + 4.0.0 + + com.landaiqing + jc-club-subject + 1.0-SNAPSHOT + + + jc-club-subject-api + jar + + jc-club-subject-api + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + 3.8.1 + test + + + diff --git a/jc-club-subject/pom.xml b/jc-club-subject/pom.xml new file mode 100644 index 0000000..a3dbe01 --- /dev/null +++ b/jc-club-subject/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + 鸡翅club-题目领域服务 + com.landaiqing + jc-club-subject + 1.0-SNAPSHOT + pom + jc-club-subject + http://maven.apache.org + + + jc-club-subject-api + jc-club-application + jc-club-common + jc-club-domain + jc-club-infra + jc-club-starter + jc-club-application/jc-club-application-controller + jc-club-application/jc-club-application-job + jc-club-application/jc-club-application-mq + + + + + UTF-8 + + + + + org.springframework.boot + spring-boot-dependencies + 2.4.2 + pom + import + + + + + + central + aliyun maven + https://maven.aliyun.com/nexus/content/groups/public/ + default + + true + + + true + + + +