feat: 修改模块名称

This commit is contained in:
2024-02-19 19:48:33 +08:00
parent 2176bf8bd7
commit 9be9287a3e
218 changed files with 130 additions and 130 deletions

View File

@@ -0,0 +1,53 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<description>QingYu club-题目领域服务</description>
<groupId>com.landaiqing</groupId>
<artifactId>qing-yu-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>qing-yu-club-subject</name>
<url>http://maven.apache.org</url>
<modules>
<module>qing-yu-club-subject-api</module>
<module>qing-yu-club-application</module>
<module>qing-yu-club-common</module>
<module>qing-yu-club-domain</module>
<module>qing-yu-club-infra</module>
<module>qing-yu-club-starter</module>
<module>qing-yu-club-application/qing-yu-club-application-controller</module>
<module>qing-yu-club-application/qing-yu-club-application-job</module>
<module>qing-yu-club-application/qing-yu-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>

View File

@@ -0,0 +1,28 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>qing-yu-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>qing-yu-club-application</artifactId>
<packaging>jar</packaging>
<name>qing-yu-club-application</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,42 @@
<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>qing-yu-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>qing-yu-club-application-controller</artifactId>
<packaging>jar</packaging>
<name>qing-yu-club-application-controller</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</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>qing-yu-club-infra</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.landaiqing</groupId>
<artifactId>qing-yu-club-domain</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,37 @@
package com.landaiqing.subject.application.config;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import java.util.List;
/**
* @Classname GlobalConfig
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.application.config
* @Author: landaiqing
* @CreateTime: 2024-02-16 15:57
* @Description: MVC全局处理
* @Version: 1.0
*/
@Configuration
public class GlobalConfig extends WebMvcConfigurationSupport {
@Override
protected void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
super.configureMessageConverters(converters);
converters.add(mappingJackson2HttpMessageConverter());
}
private MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter(){
ObjectMapper objectMapper=new ObjectMapper();
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS,false);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
MappingJackson2HttpMessageConverter converter=new MappingJackson2HttpMessageConverter(objectMapper);
return converter;
}
}

View File

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

View File

@@ -0,0 +1,119 @@
package com.landaiqing.subject.application.controller;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Preconditions;
import com.landaiqing.subject.application.convert.SubjectAnswerDTOConverter;
import com.landaiqing.subject.application.convert.SubjectInfoDTOConverter;
import com.landaiqing.subject.application.dto.SubjectInfoDTO;
import com.landaiqing.subject.common.entity.PageResult;
import com.landaiqing.subject.common.entity.Result;
import com.landaiqing.subject.domain.entity.SubjectAnswerBO;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.domain.service.SubjectInfoDomainService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 刷题controller
*
* @author: landaiqing
* @date: 2024/2/7
*/
@RestController
@RequestMapping("/subject/")
@Slf4j
public class SubjectController {
@Resource
private SubjectInfoDomainService subjectInfoDomainService;
/**
* @description: 新增题目
* @param: [subjectInfoDTO]
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
* @author landaiqing
* @date: 2024/2/15 15:06
*/
@PostMapping("/add")
public Result<Boolean> add(@RequestBody SubjectInfoDTO subjectInfoDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectController.add.dto:{}", JSON.toJSONString(subjectInfoDTO));
}
Preconditions.checkArgument(!StringUtils.isBlank(subjectInfoDTO.getSubjectName()), "题目的名称不能为空!");
Preconditions.checkNotNull(subjectInfoDTO.getSubjectDifficult(), "题目难度不能为空!");
Preconditions.checkNotNull(subjectInfoDTO.getSubjectType(), "题目类型不能为空!");
Preconditions.checkNotNull(subjectInfoDTO.getSubjectScore(), "分数不能为空!");
Preconditions.checkArgument(!CollectionUtils.isEmpty(subjectInfoDTO.getCategoryIds()), "分类id不能为空");
Preconditions.checkArgument(!CollectionUtils.isEmpty(subjectInfoDTO.getLabelIds()), "标签id不能为空");
SubjectInfoBO subjectInfoBO = SubjectInfoDTOConverter.INSTANCE.convertDtoToBO(subjectInfoDTO);
List<SubjectAnswerBO> subjectAnswerBOS = SubjectAnswerDTOConverter.INSTANCE.convertListDtoToBO(subjectInfoDTO.getOptionList());
subjectInfoBO.setOptionList(subjectAnswerBOS);
subjectInfoDomainService.add(subjectInfoBO);
return Result.ok(true);
} catch (Exception e) {
log.error("SubjectController.add.error:{}", e.getMessage(), e);
return Result.fail("新增题目失败!");
}
}
/**
* @description: 查询题目列表
* @param: [subjectInfoDTO]
* @return: com.landaiqing.subject.common.entity.Result<com.landaiqing.subject.common.entity.PageResult < com.landaiqing.subject.application.dto.SubjectInfoDTO>>
* @author landaiqing
* @date: 2024/2/16 12:16
*/
@PostMapping("/getSubjectPage")
public Result<PageResult<SubjectInfoDTO>> getSubjectPage(@RequestBody SubjectInfoDTO subjectInfoDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectController.getSubjectPage.dto:{}", JSON.toJSONString(subjectInfoDTO));
}
Preconditions.checkNotNull(subjectInfoDTO.getCategoryId(), "分类id不能为空");
Preconditions.checkNotNull(subjectInfoDTO.getLabelId(), "标签id不能为空");
SubjectInfoBO subjectInfoBO = SubjectInfoDTOConverter.INSTANCE.convertDtoToBO(subjectInfoDTO);
PageResult<SubjectInfoBO> boPageResult = subjectInfoDomainService.getSubjectPage(subjectInfoBO);
return Result.ok(boPageResult);
} catch (Exception e) {
log.error("SubjectController.getSubjectPage.error:{}", e.getMessage(), e);
return Result.fail("查询题目列表失败!");
}
}
/**
* @description: 查询题目详情
* @param: [subjectInfoDTO]
* @return: com.landaiqing.subject.common.entity.Result<com.landaiqing.subject.application.dto.SubjectInfoDTO>
* @author landaiqing
* @date: 2024/2/16 15:44
*/
@PostMapping("/querySubjectInfo")
public Result<SubjectInfoDTO> querySubjectInfo(@RequestBody SubjectInfoDTO subjectInfoDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectController.querySubjectInfo.dto:{}", JSON.toJSONString(subjectInfoDTO));
}
Preconditions.checkNotNull(subjectInfoDTO.getId(), "题目id不能为空");
SubjectInfoBO subjectInfoBO = SubjectInfoDTOConverter.INSTANCE.convertDtoToBO(subjectInfoDTO);
SubjectInfoBO boResult = subjectInfoDomainService.querySubjectInfo(subjectInfoBO);
SubjectInfoDTO dtoResult = SubjectInfoDTOConverter.INSTANCE.convertBOToDTO(boResult);
return Result.ok(dtoResult);
} catch (Exception e) {
log.error("SubjectController.querySubjectInfo.error:{}", e.getMessage(), e);
return Result.fail("查询题目详情失败!");
}
}
}

View File

@@ -0,0 +1,130 @@
package com.landaiqing.subject.application.controller;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Preconditions;
import com.landaiqing.subject.application.convert.SubjectLabelDTOConverter;
import com.landaiqing.subject.application.dto.SubjectLabelDTO;
import com.landaiqing.subject.common.entity.Result;
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
import com.landaiqing.subject.domain.service.SubjectLabelDomainService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @Classname SubjectLabelController
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.application.controller
* @Author: landaiqing
* @CreateTime: 2024-02-14 17:03
* @Description: 标签controller
* @Version: 1.0
*/
@RestController
@RequestMapping("/subject/label")
@Slf4j
public class SubjectLabelController {
@Resource
private SubjectLabelDomainService subjectLabelDomainService;
/**
* @description: 新增标签
* @param: [subjectLabelDTO]
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
* @author landaiqing
* @date: 2024/2/14 17:46
*/
@PostMapping("/add")
public Result<Boolean> add(@RequestBody SubjectLabelDTO subjectLabelDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectLabelController.add.dto:{}", JSON.toJSONString(subjectLabelDTO));
}
Preconditions.checkArgument(!StringUtils.isBlank(subjectLabelDTO.getLabelName()), "标签的名称不能为空!");
SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDtoToLabelBO(subjectLabelDTO);
Boolean result = subjectLabelDomainService.add(subjectLabelBO);
return Result.ok(result);
} catch (Exception e) {
log.error("SubjectLabelController.add.error:{}", e.getMessage(), e);
return Result.fail("新增标签失败!");
}
}
/**
* @description: 更新标签
* @param: [subjectLabelDTO]
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
* @author landaiqing
* @date: 2024/2/14 17:53
*/
@PostMapping("/update")
public Result<Boolean> update(@RequestBody SubjectLabelDTO subjectLabelDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectLabelController.update.dto:{}", JSON.toJSONString(subjectLabelDTO));
}
Preconditions.checkNotNull(subjectLabelDTO.getId(), "标签id不能为空");
SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDtoToLabelBO(subjectLabelDTO);
Boolean result = subjectLabelDomainService.update(subjectLabelBO);
return Result.ok(result);
} catch (Exception e) {
log.error("SubjectLabelController.update.error:{}", e.getMessage(), e);
return Result.fail("更新标签失败");
}
}
/**
* @description: 删除标签
* @param: [subjectLabelDTO]
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
* @author landaiqing
* @date: 2024/2/14 17:53
*/
@PostMapping("/delete")
public Result<Boolean> delete(@RequestBody SubjectLabelDTO subjectLabelDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectLabelController.delete.dto:{}", JSON.toJSONString(subjectLabelDTO));
}
Preconditions.checkNotNull(subjectLabelDTO.getId(), "标签id不能为空");
SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDtoToLabelBO(subjectLabelDTO);
Boolean result = subjectLabelDomainService.delete(subjectLabelBO);
return Result.ok(result);
} catch (Exception e) {
log.error("SubjectLabelController.delete.error:{}", e.getMessage(), e);
return Result.fail("删除标签失败");
}
}
/**
* @description: 查询分类下的标签
* @param: [subjectLabelDTO]
* @return: com.landaiqing.subject.common.entity.Result<java.util.List<com.landaiqing.subject.application.dto.SubjectLabelDTO>>
* @author landaiqing
* @date: 2024/2/14 18:57
*/
@PostMapping("/queryLabelByCategoryId")
public Result<List<SubjectLabelDTO>> queryLabelByCategoryId(@RequestBody SubjectLabelDTO subjectLabelDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SubjectLabelController.queryLabelByCategoryId.dto:{}",
JSON.toJSONString(subjectLabelDTO));
}
Preconditions.checkNotNull(subjectLabelDTO.getCategoryId(), "分类id不能为空");
SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDtoToLabelBO(subjectLabelDTO);
List<SubjectLabelBO> resultList = subjectLabelDomainService.queryLabelByCategoryId(subjectLabelBO);
List<SubjectLabelDTO> subjectLabelDTOS = SubjectLabelDTOConverter.INSTANCE.convertBOToLabelDTOList(resultList);
return Result.ok(subjectLabelDTOS);
} catch (Exception e) {
log.error("SubjectLabelController.queryLabelByCategoryId.error:{}", e.getMessage(), e);
return Result.fail("查询标签失败");
}
}
}

View File

@@ -0,0 +1,26 @@
package com.landaiqing.subject.application.convert;
import com.landaiqing.subject.application.dto.SubjectAnswerDTO;
import com.landaiqing.subject.application.dto.SubjectInfoDTO;
import com.landaiqing.subject.domain.entity.SubjectAnswerBO;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 题目答案dto转换器
*
* @author: landaiqing
* @date: 2024/2/13
*/
@Mapper
public interface SubjectAnswerDTOConverter {
SubjectAnswerDTOConverter INSTANCE = Mappers.getMapper(SubjectAnswerDTOConverter.class);
SubjectAnswerBO convertDtoToBO(SubjectAnswerDTO subjectAnswerDTO);
List<SubjectAnswerBO> convertListDtoToBO(List<SubjectAnswerDTO> dtoList);
}

View File

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

View File

@@ -0,0 +1,26 @@
package com.landaiqing.subject.application.convert;
import com.landaiqing.subject.application.dto.SubjectCategoryDTO;
import com.landaiqing.subject.application.dto.SubjectInfoDTO;
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 题目分类dto转换器
*
* @author: landaiqing
* @date: 2024/2/13
*/
@Mapper
public interface SubjectInfoDTOConverter {
SubjectInfoDTOConverter INSTANCE = Mappers.getMapper(SubjectInfoDTOConverter.class);
SubjectInfoBO convertDtoToBO(SubjectInfoDTO subjectInfoDTO);
SubjectInfoDTO convertBOToDTO(SubjectInfoBO subjectInfoBO);
}

View File

@@ -0,0 +1,26 @@
package com.landaiqing.subject.application.convert;
import com.landaiqing.subject.application.dto.SubjectLabelDTO;
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 标签dto转换器
*
* @author: landaiqing
* @date: 2024/2/14
*/
@Mapper
public interface SubjectLabelDTOConverter {
SubjectLabelDTOConverter INSTANCE = Mappers.getMapper(SubjectLabelDTOConverter.class);
SubjectLabelBO convertDtoToLabelBO(SubjectLabelDTO subjectLabelDTO);
List<SubjectLabelDTO> convertBOToLabelDTOList(List<SubjectLabelBO> boList);
}

View File

@@ -0,0 +1,34 @@
package com.landaiqing.subject.application.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 题目答案DTO
*
* @author landaiqing
* @since 2024-02-14 16:59:04
*/
@Data
public class SubjectAnswerDTO implements Serializable {
/**
* 答案选项标识
*/
private Integer optionType;
/**
* 答案
*/
private String optionContent;
/**
* 是否正确
*/
private Integer isCorrect;
}

View File

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

View File

@@ -0,0 +1,78 @@
package com.landaiqing.subject.application.dto;
import com.landaiqing.subject.common.entity.PageInfo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 题目DTO
*
* @author landaiqing
* @since 2024-02-14 16:59:04
*/
@Data
public class SubjectInfoDTO extends PageInfo implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目名称
*/
private String subjectName;
/**
* 题目难度
*/
private Integer subjectDifficult;
/**
* 出题人名
*/
private String settleName;
/**
* 题目类型 1单选 2多选 3判断 4简答
*/
private Integer subjectType;
/**
* 题目分数
*/
private Integer subjectScore;
/**
* 题目解析
*/
private String subjectParse;
private Integer isDeleted;
/**
* 题目答案
*/
private String subjectAnswer;
/**
* 分类id
*/
private List<Integer> categoryIds;
/**
* 标签id
*/
private List<Integer> labelIds;
/**
* 答案选项
*/
private List<SubjectAnswerDTO> optionList;
private Long categoryId;
private Long labelId;
/**
* 标签名称
*/
private List<String> labelName;
}

View File

@@ -0,0 +1,35 @@
package com.landaiqing.subject.application.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 题目标签DTO
*
* @author landaiqing
* @since 2024-02-14 17:08:06
*/
@Data
public class SubjectLabelDTO implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 分类id
*/
private Long categoryId;
/**
* 标签分类
*/
private String labelName;
/**
* 排序
*/
private Integer sortNum;
}

View File

@@ -0,0 +1,33 @@
<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>qing-yu-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>qing-yu-club-application-job</artifactId>
<packaging>jar</packaging>
<name>qing-yu-club-application-job</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,33 @@
<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>qing-yu-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>qing-yu-club-application-mq</artifactId>
<packaging>jar</packaging>
<name>qing-yu-club-application-mq</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,62 @@
<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>qing-yu-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>qing-yu-club-common</artifactId>
<packaging>jar</packaging>
<name>qing-yu-club-common</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.79</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,37 @@
package com.landaiqing.subject.common.entity;
import lombok.Data;
import java.io.Serializable;
/**
* @Classname PageInfo
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.common.entity
* @Author: landaiqing
* @CreateTime: 2024-02-16 11:52
* @Description: 分页请求实体
* @Version: 1.0
*/
@Data
public class PageInfo implements Serializable {
private Integer pageNo = 1;
private Integer pageSize = 20;
public Integer getPageNo() {
if (pageNo == null || pageNo <= 1) {
return 1;
}
return pageNo;
}
public Integer getPageSize() {
if (pageSize == null || pageSize < 1 || pageSize > Integer.MAX_VALUE) {
return 20;
}
return pageSize;
}
}

View File

@@ -0,0 +1,57 @@
package com.landaiqing.subject.common.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
/**
* @Classname PageResult
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.common.entity
* @Author: landaiqing
* @CreateTime: 2024-02-16 11:56
* @Description: 分页返回的实体
* @Version: 1.0
*/
@Data
public class PageResult<T> implements Serializable {
private Integer pageNo = 1;
private Integer pageSize = 20;
private Integer total = 0;
private Integer totalPages = 0;
private List<T> result = Collections.emptyList();
private Integer start = 1;
private Integer end = 0;
public void setRecords(List<T> result) {
this.result = result;
if (result != null && result.size() > 0) {
setTotal(result.size());
}
}
public void setTotal(Integer total) {
this.total = total;
if (pageSize > 0) {
this.totalPages = (total / this.pageSize) + (total % this.pageSize == 0 ? 0 : 1);
} else {
this.totalPages = 0;
}
this.start = (this.pageSize > 0 ? (this.pageNo - 1) * this.pageSize : 0) + 1;
this.end = (this.start - 1 + this.pageSize * (this.pageNo > 0 ? 1 : 0));
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public void setPageNo(Integer pageNo) {
this.pageNo = pageNo;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,39 @@
<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>qing-yu-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>qing-yu-club-domain</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<packaging>jar</packaging>
<name>qing-yu-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>qing-yu-club-infra</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,15 @@
package com.landaiqing.subject.domain.convert;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.infra.basic.entity.SubjectBrief;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface BriefSubjectConverter {
BriefSubjectConverter INSTANCE = Mappers.getMapper(BriefSubjectConverter.class);
SubjectBrief convertBoToEntity(SubjectInfoBO subjectInfoBO);
}

View File

@@ -0,0 +1,17 @@
package com.landaiqing.subject.domain.convert;
import com.landaiqing.subject.domain.entity.SubjectAnswerBO;
import com.landaiqing.subject.infra.basic.entity.SubjectJudge;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface JudgeSubjectConverter {
JudgeSubjectConverter INSTANCE = Mappers.getMapper(JudgeSubjectConverter.class);
List<SubjectAnswerBO> convertEntityToBoList(List<SubjectJudge> subjectJudgeList);
}

View File

@@ -0,0 +1,20 @@
package com.landaiqing.subject.domain.convert;
import com.landaiqing.subject.domain.entity.SubjectAnswerBO;
import com.landaiqing.subject.infra.basic.entity.SubjectMultiple;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface MultipleSubjectConverter {
MultipleSubjectConverter INSTANCE = Mappers.getMapper(MultipleSubjectConverter.class);
SubjectMultiple convertBoToEntity(SubjectAnswerBO subjectAnswerBO);
List<SubjectAnswerBO> convertEntityToBoList(List<SubjectMultiple> subjectMultipleList);
}

View File

@@ -0,0 +1,19 @@
package com.landaiqing.subject.domain.convert;
import com.landaiqing.subject.domain.entity.SubjectAnswerBO;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.infra.basic.entity.SubjectInfo;
import com.landaiqing.subject.infra.basic.entity.SubjectRadio;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface RadioSubjectConverter {
RadioSubjectConverter INSTANCE = Mappers.getMapper(RadioSubjectConverter.class);
SubjectRadio convertBoToEntity(SubjectAnswerBO subjectAnswerBO);
List<SubjectAnswerBO> convertEntityToBoList(List<SubjectRadio> subjectRadioList);
}

View File

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

View File

@@ -0,0 +1,23 @@
package com.landaiqing.subject.domain.convert;
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.domain.entity.SubjectOptionBO;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import com.landaiqing.subject.infra.basic.entity.SubjectInfo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SubjectInfoConverter {
SubjectInfoConverter INSTANCE = Mappers.getMapper(SubjectInfoConverter.class);
SubjectInfo convertBoToInfo(SubjectInfoBO subjectInfoBO);
SubjectInfoBO convertOptionToBO(SubjectOptionBO subjectOptionBO);
SubjectInfoBO convertOptionAndInfoToBO(SubjectOptionBO subjectOptionBO,SubjectInfo subjectInfo);
List<SubjectInfoBO> convertListInfoBoToBO(List<SubjectInfo> subjectInfoList);
}

View File

@@ -0,0 +1,19 @@
package com.landaiqing.subject.domain.convert;
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import com.landaiqing.subject.infra.basic.entity.SubjectLabel;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SubjectLabelConverter {
SubjectLabelConverter INSTANCE = Mappers.getMapper(SubjectLabelConverter.class);
SubjectLabel convertBoToLabel(SubjectLabelBO subjectLabelBO);
List<SubjectLabelBO> convertLabelToBoList(List<SubjectLabel> subjectLabelList);
}

View File

@@ -0,0 +1,33 @@
package com.landaiqing.subject.domain.entity;
import lombok.Data;
import java.io.Serializable;
/**
* 题目答案DTO
*
* @author landaiqing
* @since 2024-02-14 16:59:04
*/
@Data
public class SubjectAnswerBO implements Serializable {
/**
* 答案选项标识
*/
private Integer optionType;
/**
* 答案
*/
private String optionContent;
/**
* 是否正确
*/
private Integer isCorrect;
}

View File

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

View File

@@ -0,0 +1,81 @@
package com.landaiqing.subject.domain.entity;
import com.landaiqing.subject.common.entity.PageInfo;
import com.landaiqing.subject.common.entity.PageResult;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 题目BO
*
* @author landaiqing
* @since 2024-02-14 16:59:04
*/
@Data
public class SubjectInfoBO extends PageInfo implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目名称
*/
private String subjectName;
/**
* 题目难度
*/
private Integer subjectDifficult;
/**
* 出题人名
*/
private String settleName;
/**
* 题目类型 1单选 2多选 3判断 4简答
*/
private Integer subjectType;
/**
* 题目分数
*/
private Integer subjectScore;
/**
* 题目解析
*/
private String subjectParse;
private Integer isDeleted;
/**
* 题目答案
*/
private String subjectAnswer;
/**
* 分类id
*/
private List<Integer> categoryIds;
/**
* 标签名称
*/
private List<String> labelName;
/**
* 标签id
*/
private List<Integer> labelIds;
/**
* 答案选项
*/
private List<SubjectAnswerBO> optionList;
private Long categoryId;
private Long labelId;
}

View File

@@ -0,0 +1,35 @@
package com.landaiqing.subject.domain.entity;
import lombok.Data;
import java.io.Serializable;
/**
* 题目标签Bo
*
* @author landaiqing
* @since 2024-02-14 17:08:06
*/
@Data
public class SubjectLabelBO implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 分类id
*/
private Long categoryId;
/**
* 标签分类
*/
private String labelName;
/**
* 排序
*/
private Integer sortNum;
}

View File

@@ -0,0 +1,27 @@
package com.landaiqing.subject.domain.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 题目dto
*
* @author: landaiqing
*/
@Data
public class SubjectOptionBO implements Serializable {
/**
* 题目答案
*/
private String subjectAnswer;
/**
* 答案选项
*/
private List<SubjectAnswerBO> optionList;
}

View File

@@ -0,0 +1,50 @@
package com.landaiqing.subject.domain.handler.subject;
import com.landaiqing.subject.common.enums.IsDeletedFlagEnum;
import com.landaiqing.subject.common.enums.SubjectInfoTypeEnum;
import com.landaiqing.subject.domain.convert.BriefSubjectConverter;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.domain.entity.SubjectOptionBO;
import com.landaiqing.subject.infra.basic.entity.SubjectBrief;
import com.landaiqing.subject.infra.basic.service.SubjectBriefService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @Classname RadioTypeHandler
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.domain.handler.subject
* @Author: landaiqing
* @CreateTime: 2024-02-15 15:59
* @Description: 简答题目的策略类
* @Version: 1.0
*/
@Component
public class BriefTypeHandler implements SubjectTypeHandler {
@Resource
private SubjectBriefService subjectBriefService;
@Override
public SubjectInfoTypeEnum getHandlerType() {
return SubjectInfoTypeEnum.BRIEF;
}
@Override
public void add(SubjectInfoBO subjectInfoBO) {
//简答题目的插入
SubjectBrief subjectBrief = BriefSubjectConverter.INSTANCE.convertBoToEntity(subjectInfoBO);
subjectBrief.setSubjectId(subjectInfoBO.getId().intValue());
subjectBrief.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
subjectBriefService.insert(subjectBrief);
}
@Override
public SubjectOptionBO query(int subjectId) {
SubjectBrief subjectBrief = new SubjectBrief();
subjectBrief.setSubjectId(subjectId);
SubjectBrief result = subjectBriefService.queryByCondition(subjectBrief);
SubjectOptionBO subjectOptionBO = new SubjectOptionBO();
subjectOptionBO.setSubjectAnswer(result.getSubjectAnswer());
return subjectOptionBO;
}
}

View File

@@ -0,0 +1,57 @@
package com.landaiqing.subject.domain.handler.subject;
import com.landaiqing.subject.common.enums.IsDeletedFlagEnum;
import com.landaiqing.subject.common.enums.SubjectInfoTypeEnum;
import com.landaiqing.subject.domain.convert.JudgeSubjectConverter;
import com.landaiqing.subject.domain.entity.SubjectAnswerBO;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.domain.entity.SubjectOptionBO;
import com.landaiqing.subject.infra.basic.entity.SubjectJudge;
import com.landaiqing.subject.infra.basic.service.SubjectJudgeService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
* @Classname RadioTypeHandler
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.domain.handler.subject
* @Author: landaiqing
* @CreateTime: 2024-02-15 15:59
* @Description: 判断题目的策略类
* @Version: 1.0
*/
@Component
public class JudgeTypeHandler implements SubjectTypeHandler {
@Resource
private SubjectJudgeService subjectJudgeService;
@Override
public SubjectInfoTypeEnum getHandlerType() {
return SubjectInfoTypeEnum.JUDGE;
}
@Override
public void add(SubjectInfoBO subjectInfoBO) {
//判断题目的插入
SubjectJudge subjectJudge = new SubjectJudge();
SubjectAnswerBO subjectAnswerBO = subjectInfoBO.getOptionList().get(0);
subjectJudge.setSubjectId(subjectInfoBO.getId());
subjectJudge.setIsCorrect(subjectAnswerBO.getIsCorrect());
subjectJudge.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
subjectJudgeService.insert(subjectJudge);
}
@Override
public SubjectOptionBO query(int subjectId) {
SubjectJudge subjectJudge = new SubjectJudge();
subjectJudge.setSubjectId((long) subjectId);
List<SubjectJudge> result = subjectJudgeService.queryByCondition(subjectJudge);
List<SubjectAnswerBO> subjectAnswerBOList = JudgeSubjectConverter.INSTANCE.convertEntityToBoList(result);
SubjectOptionBO subjectOptionBO = new SubjectOptionBO();
subjectOptionBO.setOptionList(subjectAnswerBOList);
return subjectOptionBO;
}
}

View File

@@ -0,0 +1,59 @@
package com.landaiqing.subject.domain.handler.subject;
import com.landaiqing.subject.common.enums.IsDeletedFlagEnum;
import com.landaiqing.subject.common.enums.SubjectInfoTypeEnum;
import com.landaiqing.subject.domain.convert.MultipleSubjectConverter;
import com.landaiqing.subject.domain.entity.SubjectAnswerBO;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.domain.entity.SubjectOptionBO;
import com.landaiqing.subject.infra.basic.entity.SubjectMultiple;
import com.landaiqing.subject.infra.basic.service.SubjectMultipleService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;
/**
* @Classname RadioTypeHandler
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.domain.handler.subject
* @Author: landaiqing
* @CreateTime: 2024-02-15 15:59
* @Description: 多选题目的策略类
* @Version: 1.0
*/
@Component
public class MultipleTypeHandler implements SubjectTypeHandler {
@Resource
private SubjectMultipleService subjectMultipleService;
@Override
public SubjectInfoTypeEnum getHandlerType() {
return SubjectInfoTypeEnum.MULTIPLE;
}
@Override
public void add(SubjectInfoBO subjectInfoBO) {
//多选题目的插入
List<SubjectMultiple> subjectMultipleList = new LinkedList<>();
subjectInfoBO.getOptionList().forEach(option -> {
SubjectMultiple subjectMultiple = MultipleSubjectConverter.INSTANCE.convertBoToEntity(option);
subjectMultiple.setSubjectId(subjectInfoBO.getId());
subjectMultiple.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
subjectMultipleList.add(subjectMultiple);
});
subjectMultipleService.batchInsert(subjectMultipleList);
}
@Override
public SubjectOptionBO query(int subjectId) {
SubjectMultiple subjectMultiple = new SubjectMultiple();
subjectMultiple.setSubjectId(Long.valueOf(subjectId));
List<SubjectMultiple> result = subjectMultipleService.queryByCondition(subjectMultiple);
List<SubjectAnswerBO> subjectAnswerBOList = MultipleSubjectConverter.INSTANCE.convertEntityToBoList(result);
SubjectOptionBO subjectOptionBO = new SubjectOptionBO();
subjectOptionBO.setOptionList(subjectAnswerBOList);
return subjectOptionBO;
}
}

View File

@@ -0,0 +1,63 @@
package com.landaiqing.subject.domain.handler.subject;
import com.google.common.base.Preconditions;
import com.landaiqing.subject.common.enums.IsDeletedFlagEnum;
import com.landaiqing.subject.common.enums.SubjectInfoTypeEnum;
import com.landaiqing.subject.domain.convert.RadioSubjectConverter;
import com.landaiqing.subject.domain.entity.SubjectAnswerBO;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.domain.entity.SubjectOptionBO;
import com.landaiqing.subject.infra.basic.entity.SubjectRadio;
import com.landaiqing.subject.infra.basic.service.SubjectRadioService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;
/**
* @Classname RadioTypeHandler
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.domain.handler.subject
* @Author: landaiqing
* @CreateTime: 2024-02-15 15:59
* @Description: 单选题目的策略类
* @Version: 1.0
*/
@Component
public class RadioTypeHandler implements SubjectTypeHandler {
@Resource
private SubjectRadioService subjectRadioService;
@Override
public SubjectInfoTypeEnum getHandlerType() {
return SubjectInfoTypeEnum.RADIO;
}
@Override
public void add(SubjectInfoBO subjectInfoBO) {
//单选题目的插入
List<SubjectRadio> subjectRadioList = new LinkedList<>();
if (subjectInfoBO.getOptionList() == null && subjectInfoBO.getOptionList().size() < 0) {
return;
}
subjectInfoBO.getOptionList().forEach(option -> {
SubjectRadio subjectRadio = RadioSubjectConverter.INSTANCE.convertBoToEntity(option);
subjectRadio.setId(subjectInfoBO.getId());
subjectRadio.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
subjectRadioList.add(subjectRadio);
});
subjectRadioService.batchInsert(subjectRadioList);
}
@Override
public SubjectOptionBO query(int subjectId) {
SubjectRadio subjectRadio = new SubjectRadio();
subjectRadio.setSubjectId(Long.valueOf(subjectId));
List<SubjectRadio> result = subjectRadioService.queryByCondition(subjectRadio);
List<SubjectAnswerBO> subjectAnswerBOList = RadioSubjectConverter.INSTANCE.convertEntityToBoList(result);
SubjectOptionBO subjectOptionBO = new SubjectOptionBO();
subjectOptionBO.setOptionList(subjectAnswerBOList);
return subjectOptionBO;
}
}

View File

@@ -0,0 +1,28 @@
package com.landaiqing.subject.domain.handler.subject;
import com.landaiqing.subject.common.enums.SubjectInfoTypeEnum;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.domain.entity.SubjectOptionBO;
import org.springframework.stereotype.Component;
@Component
public interface SubjectTypeHandler {
/**
* @description: 枚举身份的识别
* @param: []
* @return: com.landaiqing.subject.common.enums.SubjectInfoTypeEnum
* @author landaiqing
* @date: 2024/2/15 16:26
*/
SubjectInfoTypeEnum getHandlerType();
/**
* @description: 实际题目的插入
* @param: [subjectInfoBO]
* @return: void
* @author landaiqing
* @date: 2024/2/15 15:58
*/
void add (SubjectInfoBO subjectInfoBO);
SubjectOptionBO query(int subjectId);
}

View File

@@ -0,0 +1,39 @@
package com.landaiqing.subject.domain.handler.subject;
import com.landaiqing.subject.common.enums.SubjectInfoTypeEnum;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Classname SubjectTypeFactory
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.domain.handler.subject
* @Author: landaiqing
* @CreateTime: 2024-02-15 16:05
* @Description: 题目类型工厂
* @Version: 1.0
*/
@Component
public class SubjectTypeHandlerFactory implements InitializingBean {
@Resource
private List<SubjectTypeHandler> subjectTypeHandlerList;
private Map<SubjectInfoTypeEnum,SubjectTypeHandler> handlerMap =new HashMap<>();
public SubjectTypeHandler getHandler(int subjectType){
SubjectInfoTypeEnum subjectInfoTypeEnum = SubjectInfoTypeEnum.getByCode(subjectType);
return handlerMap.get(subjectInfoTypeEnum);
}
@Override
public void afterPropertiesSet() throws Exception {
for(SubjectTypeHandler subjectTypeHandler : subjectTypeHandlerList){
handlerMap.put(subjectTypeHandler.getHandlerType(),subjectTypeHandler);
}
}
}

View File

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

View File

@@ -0,0 +1,37 @@
package com.landaiqing.subject.domain.service;
import com.landaiqing.subject.common.entity.PageResult;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
import java.util.List;
/**
* @description: 题目领域服务
*
* @author landaiqing
* @date: 2024/2/14 17:22
*/
public interface SubjectInfoDomainService {
/**
* 新增题目
*/
void add(SubjectInfoBO subjectInfoBO);
/**
* @description: 分页查询
* @param: [subjectInfoBO]
* @return: com.landaiqing.subject.common.entity.PageResult<com.landaiqing.subject.domain.entity.SubjectInfoBO>
* @author landaiqing
* @date: 2024/2/16 12:22
*/
PageResult<SubjectInfoBO> getSubjectPage(SubjectInfoBO subjectInfoBO);
/**
* @description: 查询题目信息
* @param: [subjectInfoBO]
* @return: com.landaiqing.subject.domain.entity.SubjectInfoBO
* @author landaiqing
* @date: 2024/2/16 13:54
*/
SubjectInfoBO querySubjectInfo(SubjectInfoBO subjectInfoBO);
}

View File

@@ -0,0 +1,34 @@
package com.landaiqing.subject.domain.service;
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
import java.util.List;
/**
* @description: 题目标签领域服务
*
* @author landaiqing
* @date: 2024/2/14 17:22
*/
public interface SubjectLabelDomainService {
/**
* 新增标签
*/
Boolean add(SubjectLabelBO subjectLabelBO);
/**
* 更新标签
*/
Boolean update(SubjectLabelBO subjectLabelBO);
/**
* 删除标签
*/
Boolean delete(SubjectLabelBO subjectLabelBO);
/**
* 查询分类下标签
*/
List<SubjectLabelBO> queryLabelByCategoryId(SubjectLabelBO subjectLabelBO);
}

View File

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

View File

@@ -0,0 +1,123 @@
package com.landaiqing.subject.domain.service.impl;
import com.alibaba.fastjson.JSON;
import com.landaiqing.subject.common.entity.PageResult;
import com.landaiqing.subject.common.enums.IsDeletedFlagEnum;
import com.landaiqing.subject.domain.convert.SubjectInfoConverter;
import com.landaiqing.subject.domain.entity.SubjectInfoBO;
import com.landaiqing.subject.domain.entity.SubjectOptionBO;
import com.landaiqing.subject.domain.handler.subject.SubjectTypeHandler;
import com.landaiqing.subject.domain.handler.subject.SubjectTypeHandlerFactory;
import com.landaiqing.subject.domain.service.SubjectInfoDomainService;
import com.landaiqing.subject.infra.basic.entity.SubjectInfo;
import com.landaiqing.subject.infra.basic.entity.SubjectLabel;
import com.landaiqing.subject.infra.basic.entity.SubjectMapping;
import com.landaiqing.subject.infra.basic.service.SubjectInfoService;
import com.landaiqing.subject.infra.basic.service.SubjectLabelService;
import com.landaiqing.subject.infra.basic.service.SubjectMappingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
public class SubjectInfoDomainServiceImpl implements SubjectInfoDomainService {
@Resource
private SubjectInfoService subjectInfoService;
@Resource
private SubjectMappingService subjectMappingService;
@Resource
private SubjectTypeHandlerFactory subjectTypeHandlerFactory;
@Resource
private SubjectLabelService subjectLabelService;
/**
* @description: 新增标签
* @param: [subjectLabelBO]
* @return: java.lang.Boolean
* @author landaiqing
* @date: 2024/2/14 17:27
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void add(SubjectInfoBO subjectInfoBO) {
if (log.isInfoEnabled()) {
log.info("SubjectInfoDomainServiceImpl.add.bo:{}", JSON.toJSONString(subjectInfoBO));
}
SubjectInfo subjectInfo = SubjectInfoConverter.INSTANCE.convertBoToInfo(subjectInfoBO);
subjectInfo.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
subjectInfoService.insert(subjectInfo);
SubjectTypeHandler handler = subjectTypeHandlerFactory.getHandler(subjectInfo.getSubjectType());
subjectInfoBO.setId(subjectInfo.getId());
handler.add(subjectInfoBO);
List<Integer> categoryIds = subjectInfoBO.getCategoryIds();
List<Integer> labelIds = subjectInfoBO.getLabelIds();
List<SubjectMapping> mappingList = new LinkedList<>();
categoryIds.forEach(categoryId -> {
labelIds.forEach(labelId -> {
SubjectMapping subjectMapping = new SubjectMapping();
subjectMapping.setSubjectId(subjectInfo.getId());
subjectMapping.setCategoryId(Long.valueOf(categoryId));
subjectMapping.setLabelId(Long.valueOf(labelId));
subjectMapping.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
mappingList.add(subjectMapping);
});
});
subjectMappingService.batchInsert(mappingList);
}
/**
* @description: 分页查询
* @param: [subjectInfoBO]
* @return: com.landaiqing.subject.common.entity.PageResult<com.landaiqing.subject.domain.entity.SubjectInfoBO>
* @author landaiqing
* @date: 2024/2/16 12:21
*/
@Override
public PageResult<SubjectInfoBO> getSubjectPage(SubjectInfoBO subjectInfoBO) {
PageResult<SubjectInfoBO> pageResult = new PageResult<>();
pageResult.setPageNo(subjectInfoBO.getPageNo());
pageResult.setPageSize(subjectInfoBO.getPageSize());
int start = (subjectInfoBO.getPageNo() - 1) * subjectInfoBO.getPageSize();
SubjectInfo subjectInfo = SubjectInfoConverter.INSTANCE.convertBoToInfo(subjectInfoBO);
int count = subjectInfoService.countByCondition(subjectInfo, subjectInfoBO.getLabelId(), subjectInfoBO.getCategoryId());
if (count == 0) {
return pageResult;
}
List<SubjectInfo> subjectInfoList = subjectInfoService.queryPage(subjectInfo, subjectInfoBO.getCategoryId(), subjectInfoBO.getLabelId(),
start, subjectInfoBO.getPageSize());
List<SubjectInfoBO> subjectInfoBOS = SubjectInfoConverter.INSTANCE.convertListInfoBoToBO(subjectInfoList);
pageResult.setRecords(subjectInfoBOS);
pageResult.setTotal(count);
return pageResult;
}
@Override
public SubjectInfoBO querySubjectInfo(SubjectInfoBO subjectInfoBO) {
SubjectInfo subjectInfo = subjectInfoService.queryById(subjectInfoBO.getId());
Integer subjectType = subjectInfo.getSubjectType();
SubjectTypeHandler handler = subjectTypeHandlerFactory.getHandler(subjectInfo.getSubjectType());
SubjectOptionBO optionBO = handler.query(subjectInfo.getId().intValue());
SubjectInfoBO bo = SubjectInfoConverter.INSTANCE.convertOptionAndInfoToBO(optionBO, subjectInfo);
SubjectMapping subjectMapping = new SubjectMapping();
subjectMapping.setSubjectId(subjectInfo.getId());
subjectMapping.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
List<SubjectMapping> mappingList = subjectMappingService.queryLabelId(subjectMapping);
List<Long> labelIdList = mappingList.stream().map(SubjectMapping::getLabelId).collect(Collectors.toList());
List<SubjectLabel> labelList = subjectLabelService.batchQueryById(labelIdList);
List<String> labelNameList = labelList.stream().map(SubjectLabel::getLabelName).collect(Collectors.toList());
bo.setLabelName(labelNameList);
return bo;
}
}

View File

@@ -0,0 +1,131 @@
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.SubjectLabelConverter;
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
import com.landaiqing.subject.domain.service.SubjectLabelDomainService;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import com.landaiqing.subject.infra.basic.entity.SubjectLabel;
import com.landaiqing.subject.infra.basic.entity.SubjectMapping;
import com.landaiqing.subject.infra.basic.service.SubjectCategoryService;
import com.landaiqing.subject.infra.basic.service.SubjectLabelService;
import com.landaiqing.subject.infra.basic.service.SubjectMappingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
public class SubjectLabelDomainServiceImpl implements SubjectLabelDomainService {
@Resource
private SubjectLabelService subjectLabelService;
@Resource
private SubjectMappingService subjectMappingService;
@Resource
private SubjectCategoryService subjectCategoryService;
/**
* @description: 新增标签
* @param: [subjectLabelBO]
* @return: java.lang.Boolean
* @author landaiqing
* @date: 2024/2/14 17:27
*/
@Override
public Boolean add(SubjectLabelBO subjectLabelBO) {
if (log.isInfoEnabled()) {
log.info("SubjectLabelDomainServiceImpl.add.bo:{}", JSON.toJSONString(subjectLabelBO));
}
SubjectLabel subjectLabel = SubjectLabelConverter.INSTANCE
.convertBoToLabel(subjectLabelBO);
subjectLabel.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
int count = subjectLabelService.insert(subjectLabel);
return count > 0;
}
/**
* @description: 更新标签
* @param: [subjectLabelBO]
* @return: java.lang.Boolean
* @author landaiqing
* @date: 2024/2/14 18:33
*/
@Override
public Boolean update(SubjectLabelBO subjectLabelBO) {
if (log.isInfoEnabled()) {
log.info("SubjectLabelDomainServiceImpl.update.bo:{}", JSON.toJSONString(subjectLabelBO));
}
SubjectLabel subjectLabel = SubjectLabelConverter.INSTANCE
.convertBoToLabel(subjectLabelBO);
int count = subjectLabelService.update(subjectLabel);
return count > 0;
}
/**
* @description: 删除标签
* @param: [subjectLabelBO]
* @return: java.lang.Boolean
* @author landaiqing
* @date: 2024/2/14 18:58
*/
@Override
public Boolean delete(SubjectLabelBO subjectLabelBO) {
if (log.isInfoEnabled()) {
log.info("SubjectLabelDomainServiceImpl.update.bo:{}", JSON.toJSONString(subjectLabelBO));
}
SubjectLabel subjectLabel = SubjectLabelConverter.INSTANCE
.convertBoToLabel(subjectLabelBO);
subjectLabel.setIsDeleted(IsDeletedFlagEnum.DELETED.getCode());
int count = subjectLabelService.update(subjectLabel);
return count > 0;
}
/**
* @description: 查询分类下的标签
* @param: [subjectLabelBO]
* @return: java.util.List<com.landaiqing.subject.domain.entity.SubjectLabelBO>
* @author landaiqing
* @date: 2024/2/14 19:08
*/
@Override
public List<SubjectLabelBO> queryLabelByCategoryId(SubjectLabelBO subjectLabelBO) {
//如果当前分类是1级分类则查询所有标签
SubjectCategory subjectCategory = subjectCategoryService.queryById(subjectLabelBO.getCategoryId());
if(CategoryTypeEnum.PRIMARY.getCode()==subjectCategory.getCategoryType()){
SubjectLabel subjectLabel=new SubjectLabel();
subjectLabel.setCategoryId(subjectLabelBO.getCategoryId());
List<SubjectLabel> labelList= subjectLabelService.queryByCondition(subjectLabel);
List<SubjectLabelBO> boList = SubjectLabelConverter.INSTANCE.convertLabelToBoList(labelList);
return boList;
}
Long categoryId = subjectLabelBO.getCategoryId();
SubjectMapping subjectMapping = new SubjectMapping();
subjectMapping.setCategoryId(categoryId);
subjectMapping.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
List<SubjectMapping> mappingList = subjectMappingService.queryLabelId(subjectMapping);
if (CollectionUtils.isEmpty(mappingList)) {
return Collections.emptyList();
}
List<Long> labelIdList = mappingList.stream().map(SubjectMapping::getLabelId).collect(Collectors.toList());
List<SubjectLabel> labelList = subjectLabelService.batchQueryById(labelIdList);
List<SubjectLabelBO> boList = new LinkedList<>();
labelList.forEach(label -> {
SubjectLabelBO bo = new SubjectLabelBO();
bo.setId(label.getId());
bo.setLabelName(label.getLabelName());
bo.setCategoryId(categoryId);
bo.setSortNum(label.getSortNum());
boList.add(bo);
});
return boList;
}
}

View File

@@ -0,0 +1,55 @@
<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>qing-yu-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>qing-yu-club-infra</artifactId>
<packaging>jar</packaging>
<name>qing-yu-club-infra</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</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>qing-yu-club-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,17 @@
package com.landaiqing.subject.infra.basic.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisConfiguration {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor(){
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
mybatisPlusInterceptor.addInnerInterceptor(new MybatisPlusAllSqlLog());
return mybatisPlusInterceptor;
}
}

View File

@@ -0,0 +1,116 @@
package com.landaiqing.subject.infra.basic.config;
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.TypeHandlerRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import java.sql.SQLException;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
public class MybatisPlusAllSqlLog implements InnerInterceptor {
public static final Logger log = LoggerFactory.getLogger("sys-sql");
@Override
public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
logInfo(boundSql, ms, parameter);
}
@Override
public void beforeUpdate(Executor executor, MappedStatement ms, Object parameter) throws SQLException {
BoundSql boundSql = ms.getBoundSql(parameter);
logInfo(boundSql, ms, parameter);
}
private static void logInfo(BoundSql boundSql, MappedStatement ms, Object parameter) {
try {
log.info("parameter = " + parameter);
// 获取到节点的id,即sql语句的id
String sqlId = ms.getId();
log.info("sqlId = " + sqlId);
// 获取节点的配置
Configuration configuration = ms.getConfiguration();
// 获取到最终的sql语句
String sql = getSql(configuration, boundSql, sqlId);
log.info("完整的sql:{}", sql);
} catch (Exception e) {
log.error("异常:{}", e.getLocalizedMessage(), e);
}
}
// 封装了一下sql语句使得结果返回完整xml路径下的sql语句节点id + sql语句
public static String getSql(Configuration configuration, BoundSql boundSql, String sqlId) {
return sqlId + ":" + showSql(configuration, boundSql);
}
// 进行?的替换
public static String showSql(Configuration configuration, BoundSql boundSql) {
// 获取参数
Object parameterObject = boundSql.getParameterObject();
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
// sql语句中多个空格都用一个空格代替
String sql = boundSql.getSql().replaceAll("[\\s]+", " ");
if (!CollectionUtils.isEmpty(parameterMappings) && parameterObject != null) {
// 获取类型处理器注册器类型处理器的功能是进行java类型和数据库类型的转换
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
// 如果根据parameterObject.getClass()可以找到对应的类型,则替换
if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
sql = sql.replaceFirst("\\?",
Matcher.quoteReplacement(getParameterValue(parameterObject)));
} else {
// MetaObject主要是封装了originalObject对象提供了get和set的方法用于获取和设置originalObject的属性值,主要支持对JavaBean、Collection、Map三种类型对象的操作
MetaObject metaObject = configuration.newMetaObject(parameterObject);
for (ParameterMapping parameterMapping : parameterMappings) {
String propertyName = parameterMapping.getProperty();
if (metaObject.hasGetter(propertyName)) {
Object obj = metaObject.getValue(propertyName);
sql = sql.replaceFirst("\\?",
Matcher.quoteReplacement(getParameterValue(obj)));
} else if (boundSql.hasAdditionalParameter(propertyName)) {
// 该分支是动态sql
Object obj = boundSql.getAdditionalParameter(propertyName);
sql = sql.replaceFirst("\\?",
Matcher.quoteReplacement(getParameterValue(obj)));
} else {
// 打印出缺失,提醒该参数缺失并防止错位
sql = sql.replaceFirst("\\?", "缺失");
}
}
}
}
return sql;
}
// 如果参数是String则添加单引号 如果是日期,则转换为时间格式器并加单引号; 对参数是null和不是null的情况作了处理
private static String getParameterValue(Object obj) {
String value;
if (obj instanceof String) {
value = "'" + obj.toString() + "'";
} else if (obj instanceof Date) {
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT,
DateFormat.DEFAULT, Locale.CHINA);
value = "'" + formatter.format(new Date()) + "'";
} else {
if (obj != null) {
value = obj.toString();
} else {
value = "";
}
}
return value;
}
}

View File

@@ -0,0 +1,52 @@
package com.landaiqing.subject.infra.basic.config;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Properties;
@Intercepts({
@Signature(type = Executor.class, method = "update", args = {MappedStatement.class,
Object.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class,
Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class})})
public class SqlStatementInterceptor implements Interceptor {
public static final Logger log = LoggerFactory.getLogger("sys-sql");
@Override
public Object intercept(Invocation invocation) throws Throwable {
long startTime = System.currentTimeMillis();
try {
return invocation.proceed();
} finally {
long timeConsuming = System.currentTimeMillis() - startTime;
log.info("执行SQL:{}ms", timeConsuming);
if (timeConsuming > 999 && timeConsuming < 5000) {
log.info("执行SQL大于1s:{}ms", timeConsuming);
} else if (timeConsuming >= 5000 && timeConsuming < 10000) {
log.info("执行SQL大于5s:{}ms", timeConsuming);
} else if (timeConsuming >= 10000) {
log.info("执行SQL大于10s:{}ms", timeConsuming);
}
}
}
@Override
public Object plugin(Object target) {
return Plugin.wrap(target, this);
}
@Override
public void setProperties(Properties properties) {
}
}

View File

@@ -0,0 +1,49 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 简答题(SubjectBrief)实体类
*
* @author landaiqing
* @since 2024-02-15 14:29:44
*/
@Data
public class SubjectBrief implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目id
*/
private Integer subjectId;
/**
* 题目答案
*/
private String subjectAnswer;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

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

View File

@@ -0,0 +1,67 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 题目信息表(SubjectInfo)实体类
*
* @author landaiqing
* @since 2024-02-14 16:59:04
*/
@Data
public class SubjectInfo implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目名称
*/
private String subjectName;
/**
* 题目难度
*/
private Integer subjectDifficult;
/**
* 出题人名
*/
private String settleName;
/**
* 题目类型 1单选 2多选 3判断 4简答
*/
private Integer subjectType;
/**
* 题目分数
*/
private Integer subjectScore;
/**
* 题目解析
*/
private String subjectParse;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 修改人
*/
private String updateBy;
/**
* 修改时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,49 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 判断题(SubjectJudge)实体类
*
* @author landaiqing
* @since 2024-02-15 14:32:25
*/
@Data
public class SubjectJudge implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目id
*/
private Long subjectId;
/**
* 是否正确
*/
private Integer isCorrect;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,51 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 题目标签表(SubjectLabel)实体类
*
* @author landaiqing
* @since 2024-02-14 17:08:06
*/
@Data
public class SubjectLabel implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 标签分类
*/
private String labelName;
/**
* 排序
*/
private Integer sortNum;
private Long categoryId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,123 @@
package com.landaiqing.subject.infra.basic.entity;
import java.util.Date;
import java.io.Serializable;
/**
* 题目分类关系表(SubjectMapping)实体类
*
* @author landaiqing
* @since 2024-02-14 18:44:42
*/
public class SubjectMapping implements Serializable {
private static final long serialVersionUID = -84040462903129597L;
/**
* 主键
*/
private Long id;
/**
* 题目id
*/
private Long subjectId;
/**
* 分类id
*/
private Long categoryId;
/**
* 标签id
*/
private Long labelId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 修改人
*/
private String updateBy;
/**
* 修改时间
*/
private Date updateTime;
private Integer isDeleted;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getSubjectId() {
return subjectId;
}
public void setSubjectId(Long subjectId) {
this.subjectId = subjectId;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getLabelId() {
return labelId;
}
public void setLabelId(Long labelId) {
this.labelId = labelId;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(Integer isDeleted) {
this.isDeleted = isDeleted;
}
}

View File

@@ -0,0 +1,57 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 多选题信息表(SubjectMultiple)实体类
*
* @author landaiqing
* @since 2024-02-15 14:32:48
*/
@Data
public class SubjectMultiple implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目id
*/
private Long subjectId;
/**
* 选项类型
*/
private Long optionType;
/**
* 选项内容
*/
private String optionContent;
/**
* 是否正确
*/
private Integer isCorrect;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,56 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 单选题信息表(SubjectRadio)实体类
*
* @author landaiqing
* @since 2024-02-15 14:33:07
*/
@Data
public class SubjectRadio implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目id
*/
private Long subjectId;
/**
* a,b,c,d
*/
private Integer optionType;
/**
* 选项内容
*/
private String optionContent;
/**
* 是否正确
*/
private Integer isCorrect;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 修改人
*/
private String updateBy;
/**
* 修改时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,50 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectBrief;
/**
* 简答题(SubjectBrief)表服务接口
*
* @author landaiqing
* @since 2024-02-15 14:29:45
*/
public interface SubjectBriefService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectBrief queryById(Long id);
/**
* 新增数据
*
* @param subjectBrief 实例对象
* @return 实例对象
*/
SubjectBrief insert(SubjectBrief subjectBrief);
/**
* 修改数据
*
* @param subjectBrief 实例对象
* @return 实例对象
*/
SubjectBrief update(SubjectBrief subjectBrief);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
/**
* 条件查询
*/
SubjectBrief queryByCondition(SubjectBrief subjectBrief);
}

View File

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

View File

@@ -0,0 +1,51 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectInfo;
import java.util.List;
/**
* 题目信息表(SubjectInfo)表服务接口
*
* @author landaiqing
* @since 2024-02-14 16:59:04
*/
public interface SubjectInfoService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectInfo queryById(Long id);
/**
* 新增数据
*
* @param subjectInfo 实例对象
* @return 实例对象
*/
SubjectInfo insert(SubjectInfo subjectInfo);
/**
* 修改数据
*
* @param subjectInfo 实例对象
* @return 实例对象
*/
SubjectInfo update(SubjectInfo subjectInfo);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
int countByCondition(SubjectInfo subjectInfo, Long labelId, Long categoryId);
List<SubjectInfo> queryPage(SubjectInfo subjectInfo, Long categoryId, Long labelId, int start, Integer pageSize);
}

View File

@@ -0,0 +1,49 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectJudge;
import java.util.List;
/**
* 判断题(SubjectJudge)表服务接口
*
* @author landaiqing
* @since 2024-02-15 14:32:25
*/
public interface SubjectJudgeService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectJudge queryById(Long id);
/**
* 新增数据
*
* @param subjectJudge 实例对象
* @return 实例对象
*/
SubjectJudge insert(SubjectJudge subjectJudge);
/**
* 修改数据
*
* @param subjectJudge 实例对象
* @return 实例对象
*/
SubjectJudge update(SubjectJudge subjectJudge);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
List<SubjectJudge> queryByCondition(SubjectJudge subjectJudge);
}

View File

@@ -0,0 +1,54 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectLabel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 题目标签表(SubjectLabel)表服务接口
*
* @author landaiqing
* @since 2024-02-14 17:08:07
*/
public interface SubjectLabelService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectLabel queryById(Long id);
/**
* 新增数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
int insert(SubjectLabel subjectLabel);
/**
* 修改数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
int update(SubjectLabel subjectLabel);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
List<SubjectLabel> batchQueryById(@Param("list") List<Long> labelIdList);
List<SubjectLabel> queryByCondition(SubjectLabel subjectLabel);
}

View File

@@ -0,0 +1,66 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectMapping;
import java.util.List;
/**
* 题目分类关系表(SubjectMapping)表服务接口
*
* @author landaiqing
* @since 2024-02-14 18:44:42
*/
public interface SubjectMappingService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectMapping queryById(Long id);
/**
* 新增数据
*
* @param subjectMapping 实例对象
* @return 实例对象
*/
SubjectMapping insert(SubjectMapping subjectMapping);
/**
* 修改数据
*
* @param subjectMapping 实例对象
* @return 实例对象
*/
int update(SubjectMapping subjectMapping);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
/**
* @description: 查询分类下的标签
* @param: [subjectMapping]
* @return: java.util.List<com.landaiqing.subject.infra.basic.entity.SubjectMapping>
* @author landaiqing
* @date: 2024/2/14 19:13
*/
List<SubjectMapping> queryLabelId(SubjectMapping subjectMapping);
/**
* @description: 批量插入
* @param: [mappingList]
* @return: void
* @author landaiqing
* @date: 2024/2/15 17:33
*/
void batchInsert(List<SubjectMapping> mappingList);
}

View File

@@ -0,0 +1,51 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectMultiple;
import java.util.List;
/**
* 多选题信息表(SubjectMultiple)表服务接口
*
* @author landaiqing
* @since 2024-02-15 14:32:48
*/
public interface SubjectMultipleService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectMultiple queryById(Long id);
/**
* 新增数据
*
* @param subjectMultiple 实例对象
* @return 实例对象
*/
SubjectMultiple insert(SubjectMultiple subjectMultiple);
/**
* 修改数据
*
* @param subjectMultiple 实例对象
* @return 实例对象
*/
SubjectMultiple update(SubjectMultiple subjectMultiple);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
void batchInsert(List<SubjectMultiple> subjectMultipleList);
List<SubjectMultiple> queryByCondition(SubjectMultiple subjectMultiple);
}

View File

@@ -0,0 +1,56 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectRadio;
import java.util.List;
/**
* 单选题信息表(SubjectRadio)表服务接口
*
* @author landaiqing
* @since 2024-02-15 14:33:07
*/
public interface SubjectRadioService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectRadio queryById(Long id);
/**
* 新增数据
*
* @param subjectRadio 实例对象
* @return 实例对象
*/
SubjectRadio insert(SubjectRadio subjectRadio);
/**
* 批量插入
*
* @param subjectRadioList 实例对象
* @return 实例对象
*/
void batchInsert(List<SubjectRadio> subjectRadioList);
/**
* 修改数据
*
* @param subjectRadio 实例对象
* @return 实例对象
*/
SubjectRadio update(SubjectRadio subjectRadio);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
List<SubjectRadio> queryByCondition(SubjectRadio subjectRadio);
}

View File

@@ -0,0 +1,72 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectBrief;
import com.landaiqing.subject.infra.basic.mapper.SubjectBriefDao;
import com.landaiqing.subject.infra.basic.service.SubjectBriefService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 简答题(SubjectBrief)表服务实现类
*
* @author landaiqing
* @since 2024-02-15 14:29:45
*/
@Service("subjectBriefService")
public class SubjectBriefServiceImpl implements SubjectBriefService {
@Resource
private SubjectBriefDao subjectBriefDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectBrief queryById(Long id) {
return this.subjectBriefDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectBrief 实例对象
* @return 实例对象
*/
@Override
public SubjectBrief insert(SubjectBrief subjectBrief) {
this.subjectBriefDao.insert(subjectBrief);
return subjectBrief;
}
/**
* 修改数据
*
* @param subjectBrief 实例对象
* @return 实例对象
*/
@Override
public SubjectBrief update(SubjectBrief subjectBrief) {
this.subjectBriefDao.update(subjectBrief);
return this.queryById(subjectBrief.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectBriefDao.deleteById(id) > 0;
}
@Override
public SubjectBrief queryByCondition(SubjectBrief subjectBrief) {
return this.subjectBriefDao.queryAllByLimit(subjectBrief);
}
}

View File

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

View File

@@ -0,0 +1,79 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectInfo;
import com.landaiqing.subject.infra.basic.mapper.SubjectInfoDao;
import com.landaiqing.subject.infra.basic.service.SubjectInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 题目信息表(SubjectInfo)表服务实现类
*
* @author landaiqing
* @since 2024-02-14 16:59:04
*/
@Service("subjectInfoService")
public class SubjectInfoServiceImpl implements SubjectInfoService {
@Resource
private SubjectInfoDao subjectInfoDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectInfo queryById(Long id) {
return this.subjectInfoDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectInfo 实例对象
* @return 实例对象
*/
@Override
public SubjectInfo insert(SubjectInfo subjectInfo) {
this.subjectInfoDao.insert(subjectInfo);
return subjectInfo;
}
/**
* 修改数据
*
* @param subjectInfo 实例对象
* @return 实例对象
*/
@Override
public SubjectInfo update(SubjectInfo subjectInfo) {
this.subjectInfoDao.update(subjectInfo);
return this.queryById(subjectInfo.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectInfoDao.deleteById(id) > 0;
}
@Override
public int countByCondition(SubjectInfo subjectInfo, Long labelId, Long categoryId) {
return this.subjectInfoDao.countByCondition(subjectInfo,labelId,categoryId);
}
@Override
public List<SubjectInfo> queryPage(SubjectInfo subjectInfo, Long categoryId, Long labelId, int start, Integer pageSize) {
return this.subjectInfoDao.queryPage(subjectInfo,categoryId,labelId,start,pageSize);
}
}

View File

@@ -0,0 +1,74 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectJudge;
import com.landaiqing.subject.infra.basic.mapper.SubjectJudgeDao;
import com.landaiqing.subject.infra.basic.service.SubjectJudgeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 判断题(SubjectJudge)表服务实现类
*
* @author landaiqing
* @since 2024-02-15 14:32:25
*/
@Service("subjectJudgeService")
public class SubjectJudgeServiceImpl implements SubjectJudgeService {
@Resource
private SubjectJudgeDao subjectJudgeDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectJudge queryById(Long id) {
return this.subjectJudgeDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectJudge 实例对象
* @return 实例对象
*/
@Override
public SubjectJudge insert(SubjectJudge subjectJudge) {
this.subjectJudgeDao.insert(subjectJudge);
return subjectJudge;
}
/**
* 修改数据
*
* @param subjectJudge 实例对象
* @return 实例对象
*/
@Override
public SubjectJudge update(SubjectJudge subjectJudge) {
this.subjectJudgeDao.update(subjectJudge);
return this.queryById(subjectJudge.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectJudgeDao.deleteById(id) > 0;
}
@Override
public List<SubjectJudge> queryByCondition(SubjectJudge subjectJudge) {
return this.subjectJudgeDao.queryAllByLimit(subjectJudge);
}
}

View File

@@ -0,0 +1,79 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectLabel;
import com.landaiqing.subject.infra.basic.mapper.SubjectLabelDao;
import com.landaiqing.subject.infra.basic.service.SubjectLabelService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 题目标签表(SubjectLabel)表服务实现类
*
* @author landaiqing
* @since 2024-02-14 17:08:07
*/
@Service("subjectLabelService")
public class SubjectLabelServiceImpl implements SubjectLabelService {
@Resource
private SubjectLabelDao subjectLabelDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectLabel queryById(Long id) {
return this.subjectLabelDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
@Override
public int insert(SubjectLabel subjectLabel) {
return this.subjectLabelDao.insert(subjectLabel);
}
/**
* 修改数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
@Override
public int update(SubjectLabel subjectLabel) {
return this.subjectLabelDao.update(subjectLabel);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectLabelDao.deleteById(id) > 0;
}
@Override
public List<SubjectLabel> batchQueryById(List<Long> labelIdList) {
return this.subjectLabelDao.batchQueryById(labelIdList);
}
@Override
public List<SubjectLabel> queryByCondition(SubjectLabel subjectLabel) {
return this.subjectLabelDao.queryByCondition(subjectLabel);
}
}

View File

@@ -0,0 +1,85 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectMapping;
import com.landaiqing.subject.infra.basic.mapper.SubjectMappingDao;
import com.landaiqing.subject.infra.basic.service.SubjectMappingService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 题目分类关系表(SubjectMapping)表服务实现类
*
* @author landaiqing
* @since 2024-02-14 18:44:42
*/
@Service("subjectMappingService")
public class SubjectMappingServiceImpl implements SubjectMappingService {
@Resource
private SubjectMappingDao subjectMappingDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectMapping queryById(Long id) {
return this.subjectMappingDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectMapping 实例对象
* @return 实例对象
*/
@Override
public SubjectMapping insert(SubjectMapping subjectMapping) {
this.subjectMappingDao.insert(subjectMapping);
return subjectMapping;
}
/**
* 修改数据
*
* @param subjectMapping 实例对象
* @return 实例对象
*/
@Override
public int update(SubjectMapping subjectMapping) {
return this.subjectMappingDao.update(subjectMapping);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectMappingDao.deleteById(id) > 0;
}
/**
* @description: 查询分类下的标签
* @param: [subjectMapping]
* @return: java.util.List<com.landaiqing.subject.infra.basic.entity.SubjectMapping>
* @author landaiqing
* @date: 2024/2/14 19:13
*/
@Override
public List<SubjectMapping> queryLabelId(SubjectMapping subjectMapping) {
return this.subjectMappingDao.queryDistinctLabelId(subjectMapping);
}
@Override
public void batchInsert(List<SubjectMapping> mappingList) {
this.subjectMappingDao.insertBatch(mappingList);
}
}

View File

@@ -0,0 +1,78 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectMultiple;
import com.landaiqing.subject.infra.basic.mapper.SubjectMultipleDao;
import com.landaiqing.subject.infra.basic.service.SubjectMultipleService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 多选题信息表(SubjectMultiple)表服务实现类
*
* @author landaiqing
* @since 2024-02-15 14:32:49
*/
@Service("subjectMultipleService")
public class SubjectMultipleServiceImpl implements SubjectMultipleService {
@Resource
private SubjectMultipleDao subjectMultipleDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectMultiple queryById(Long id) {
return this.subjectMultipleDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectMultiple 实例对象
* @return 实例对象
*/
@Override
public SubjectMultiple insert(SubjectMultiple subjectMultiple) {
this.subjectMultipleDao.insert(subjectMultiple);
return subjectMultiple;
}
/**
* 修改数据
*
* @param subjectMultiple 实例对象
* @return 实例对象
*/
@Override
public SubjectMultiple update(SubjectMultiple subjectMultiple) {
this.subjectMultipleDao.update(subjectMultiple);
return this.queryById(subjectMultiple.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectMultipleDao.deleteById(id) > 0;
}
@Override
public void batchInsert(List<SubjectMultiple> subjectMultipleList) {
this.subjectMultipleDao.insertBatch(subjectMultipleList);
}
@Override
public List<SubjectMultiple> queryByCondition(SubjectMultiple subjectMultiple) {
return this.subjectMultipleDao.queryAllByLimit(subjectMultiple);
}
}

View File

@@ -0,0 +1,77 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectRadio;
import com.landaiqing.subject.infra.basic.mapper.SubjectRadioDao;
import com.landaiqing.subject.infra.basic.service.SubjectRadioService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 单选题信息表(SubjectRadio)表服务实现类
*
* @author landaiqing
* @since 2024-02-15 14:33:07
*/
@Service("subjectRadioService")
public class SubjectRadioServiceImpl implements SubjectRadioService {
@Resource
private SubjectRadioDao subjectRadioDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectRadio queryById(Long id) {
return this.subjectRadioDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectRadio 实例对象
* @return 实例对象
*/
@Override
public SubjectRadio insert(SubjectRadio subjectRadio) {
this.subjectRadioDao.insert(subjectRadio);
return subjectRadio;
}
@Override
public void batchInsert(List<SubjectRadio> subjectRadioList) {
this.subjectRadioDao.insertBatch(subjectRadioList);
}
/**
* 修改数据
*
* @param subjectRadio 实例对象
* @return 实例对象
*/
@Override
public SubjectRadio update(SubjectRadio subjectRadio) {
this.subjectRadioDao.update(subjectRadio);
return this.queryById(subjectRadio.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectRadioDao.deleteById(id) > 0;
}
@Override
public List<SubjectRadio> queryByCondition(SubjectRadio subjectRadio) {
return this.subjectRadioDao.queryAllByLimit(subjectRadio);
}
}

View File

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

View File

@@ -0,0 +1,151 @@
<?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.SubjectBriefDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectBrief" id="SubjectBriefMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectId" column="subject_id" jdbcType="INTEGER"/>
<result property="subjectAnswer" column="subject_answer" jdbcType="VARCHAR"/>
<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="SubjectBriefMap">
select id,subject_id,subject_answer,created_by,created_time,update_by,update_time,is_deleted
from subject_brief
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectBriefMap">
select
id,subject_id,subject_answer,created_by,created_time,update_by,update_time,is_deleted
from subject_brief
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="subjectAnswer != null and subjectAnswer != ''">
and subject_answer = #{subjectAnswer}
</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="count" resultType="java.lang.Long">
select count(1)
from subject_brief
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="subjectAnswer != null and subjectAnswer != ''">
and subject_answer = #{subjectAnswer}
</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_brief(subject_id,subject_answer,created_by,created_time,update_by,update_time,is_deleted)
values (#{subjectId},#{subjectAnswer},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_brief(subject_id,subject_answer,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.subjectAnswer},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_brief(subject_id,subject_answer,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.subjectAnswer},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_id = values(subject_id)subject_answer = values(subject_answer)created_by =
values(created_by)created_time = values(created_time)update_by = values(update_by)update_time =
values(update_time)is_deleted = values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update subject_brief
<set>
<if test="subjectId != null">
subject_id = #{subjectId},
</if>
<if test="subjectAnswer != null and subjectAnswer != ''">
subject_answer = #{subjectAnswer},
</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_brief
where id = #{id}
</delete>
</mapper>

View File

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

View File

@@ -0,0 +1,255 @@
<?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.SubjectInfoDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectInfo" id="SubjectInfoMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectName" column="subject_name" jdbcType="VARCHAR"/>
<result property="subjectDifficult" column="subject_difficult" jdbcType="INTEGER"/>
<result property="settleName" column="settle_name" jdbcType="VARCHAR"/>
<result property="subjectType" column="subject_type" jdbcType="INTEGER"/>
<result property="subjectScore" column="subject_score" jdbcType="INTEGER"/>
<result property="subjectParse" column="subject_parse" jdbcType="VARCHAR"/>
<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="SubjectInfoMap">
select id,
subject_name,
subject_difficult,
settle_name,
subject_type,
subject_score,
subject_parse,
created_by,
created_time,
update_by,
update_time,
is_deleted
from subject_info
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectInfoMap">
select
id,subject_name,subject_difficult,settle_name,subject_type,subject_score,subject_parse,created_by,created_time,update_by,update_time,is_deleted
from subject_info
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectName != null and subjectName != ''">
and subject_name = #{subjectName}
</if>
<if test="subjectDifficult != null">
and subject_difficult = #{subjectDifficult}
</if>
<if test="settleName != null and settleName != ''">
and settle_name = #{settleName}
</if>
<if test="subjectType != null">
and subject_type = #{subjectType}
</if>
<if test="subjectScore != null">
and subject_score = #{subjectScore}
</if>
<if test="subjectParse != null and subjectParse != ''">
and subject_parse = #{subjectParse}
</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>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from subject_info
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectName != null and subjectName != ''">
and subject_name = #{subjectName}
</if>
<if test="subjectDifficult != null">
and subject_difficult = #{subjectDifficult}
</if>
<if test="settleName != null and settleName != ''">
and settle_name = #{settleName}
</if>
<if test="subjectType != null">
and subject_type = #{subjectType}
</if>
<if test="subjectScore != null">
and subject_score = #{subjectScore}
</if>
<if test="subjectParse != null and subjectParse != ''">
and subject_parse = #{subjectParse}
</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="countByCondition" resultType="java.lang.Integer">
select count(1)
from subject_info a,
subject_mapping b
where a.id = b.subject_id
and b.label_id = #{labelId}
and b.category_id = #{categoryId}
and a.is_deleted = 0
and b.is_deleted = 0
<if test="subjectInfo.subjectDifficult != null">
and a.subject_difficult = #{subjectInfo.subjectDifficult}
</if>
<if test="subjectInfo.subjectType != null">
and a.subject_type = #{subjectInfo.subjectType}
</if>
</select>
<select id="queryPage" resultMap="SubjectInfoMap">
select a.id,
a.subject_name,
a.subject_difficult,
a.settle_name,
a.subject_type,
a.subject_score,
a.subject_parse,
a.created_by,
a.created_time,
a. update_by,
a.update_time,
a.is_deleted
from subject_info a,
subject_mapping b
where a.id = b.subject_id
and b.label_id = #{labelId}
and b.category_id = #{categoryId}
and a.is_deleted = 0
and b.is_deleted = 0
<if test="subjectInfo.subjectDifficult != null">
and a.subject_difficult = #{subjectInfo.subjectDifficult}
</if>
<if test="subjectInfo.subjectType != null">
and a.subject_type = #{subjectInfo.subjectType}
</if>
limit #{start},#{pageSize}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
<selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
SELECT LAST_INSERT_ID()
</selectKey>
insert into
subject_info(subject_name,subject_difficult,settle_name,subject_type,subject_score,subject_parse,created_by,created_time,update_by,update_time,is_deleted)
values
(#{subjectName},#{subjectDifficult},#{settleName},#{subjectType},#{subjectScore},#{subjectParse},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_info(subject_name,subject_difficult,settle_name,subject_type,subject_score,subject_parse,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectName},#{entity.subjectDifficult},#{entity.settleName},#{entity.subjectType},#{entity.subjectScore},#{entity.subjectParse},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_info(subject_name,subject_difficult,settle_name,subject_type,subject_score,subject_parse,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectName},#{entity.subjectDifficult},#{entity.settleName},#{entity.subjectType},#{entity.subjectScore},#{entity.subjectParse},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_name = values(subject_name)subject_difficult = values(subject_difficult)settle_name =
values(settle_name)subject_type = values(subject_type)subject_score = values(subject_score)subject_parse =
values(subject_parse)created_by = values(created_by)created_time = values(created_time)update_by =
values(update_by)update_time = values(update_time)is_deleted = values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update subject_info
<set>
<if test="subjectName != null and subjectName != ''">
subject_name = #{subjectName},
</if>
<if test="subjectDifficult != null">
subject_difficult = #{subjectDifficult},
</if>
<if test="settleName != null and settleName != ''">
settle_name = #{settleName},
</if>
<if test="subjectType != null">
subject_type = #{subjectType},
</if>
<if test="subjectScore != null">
subject_score = #{subjectScore},
</if>
<if test="subjectParse != null and subjectParse != ''">
subject_parse = #{subjectParse},
</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_info
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,151 @@
<?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.SubjectJudgeDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectJudge" id="SubjectJudgeMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectId" column="subject_id" jdbcType="INTEGER"/>
<result property="isCorrect" column="is_correct" 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="SubjectJudgeMap">
select id,subject_id,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_judge
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectJudgeMap">
select
id,subject_id,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_judge
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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="count" resultType="java.lang.Long">
select count(1)
from subject_judge
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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_judge(subject_id,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values (#{subjectId},#{isCorrect},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_judge(subject_id,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_judge(subject_id,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_id = values(subject_id)is_correct = values(is_correct)created_by = values(created_by)created_time =
values(created_time)update_by = values(update_by)update_time = values(update_time)is_deleted =
values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update subject_judge
<set>
<if test="subjectId != null">
subject_id = #{subjectId},
</if>
<if test="isCorrect != null">
is_correct = #{isCorrect},
</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_judge
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,170 @@
<?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.SubjectLabelDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectLabel" id="SubjectLabelMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="labelName" column="label_name" jdbcType="VARCHAR"/>
<result property="sortNum" column="sort_num" jdbcType="INTEGER"/>
<result property="categoryId" column="category_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="SubjectLabelMap">
select id,label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted
from subject_label
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryByCondition" resultMap="SubjectLabelMap">
select
id,label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted
from subject_label
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="labelName != null and labelName != ''">
and label_name = #{labelName}
</if>
<if test="sortNum != null">
and sort_num = #{sortNum}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</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="count" resultType="java.lang.Long">
select count(1)
from subject_label
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="labelName != null and labelName != ''">
and label_name = #{labelName}
</if>
<if test="sortNum != null">
and sort_num = #{sortNum}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</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="batchQueryById" resultMap="SubjectLabelMap">
select
id,label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted
from subject_label
where id in
<foreach open="(" close=")" collection="list" item="id" separator=",">
#{id}
</foreach>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into subject_label(label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted)
values (#{labelName},#{sortNum},#{categoryId},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_label(label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.labelName},#{entity.sortNum},#{entity.categoryId},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_label(label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.labelName},#{entity.sortNum},#{entity.categoryId},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
label_name = values(label_name)sort_num = values(sort_num)category_id = values(category_id)created_by =
values(created_by)created_time = values(created_time)update_by = values(update_by)update_time =
values(update_time)is_deleted = values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update subject_label
<set>
<if test="labelName != null and labelName != ''">
label_name = #{labelName},
</if>
<if test="sortNum != null">
sort_num = #{sortNum},
</if>
<if test="categoryId != null">
category_id = #{categoryId},
</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_label
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,196 @@
<?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.SubjectMappingDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectMapping" id="SubjectMappingMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectId" column="subject_id" jdbcType="INTEGER"/>
<result property="categoryId" column="category_id" jdbcType="INTEGER"/>
<result property="labelId" column="label_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="SubjectMappingMap">
select id,subject_id,category_id,label_id,created_by,created_time,update_by,update_time,is_deleted
from subject_mapping
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectMappingMap">
select
id,subject_id,category_id,label_id,created_by,created_time,update_by,update_time,is_deleted
from subject_mapping
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
<if test="labelId != null">
and label_id = #{labelId}
</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>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from subject_mapping
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
<if test="labelId != null">
and label_id = #{labelId}
</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="queryDistinctLabelId" resultMap="SubjectMappingMap">
select
distinct label_id
from subject_mapping
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
<if test="labelId != null">
and label_id = #{labelId}
</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_mapping(subject_id,category_id,label_id,created_by,created_time,update_by,update_time,is_deleted)
values (#{subjectId},#{categoryId},#{labelId},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_mapping(subject_id,category_id,label_id,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.categoryId},#{entity.labelId},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_mapping(subject_id,category_id,label_id,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.categoryId},#{entity.labelId},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_id = values(subject_id)category_id = values(category_id)label_id = values(label_id)created_by =
values(created_by)created_time = values(created_time)update_by = values(update_by)update_time =
values(update_time)is_deleted = values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update subject_mapping
<set>
<if test="subjectId != null">
subject_id = #{subjectId},
</if>
<if test="categoryId != null">
category_id = #{categoryId},
</if>
<if test="labelId != null">
label_id = #{labelId},
</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_mapping
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,174 @@
<?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.SubjectMultipleDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectMultiple" id="SubjectMultipleMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectId" column="subject_id" jdbcType="INTEGER"/>
<result property="optionType" column="option_type" jdbcType="INTEGER"/>
<result property="optionContent" column="option_content" jdbcType="VARCHAR"/>
<result property="isCorrect" column="is_correct" 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="SubjectMultipleMap">
select id,subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_multiple
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectMultipleMap">
select
id,subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_multiple
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="optionType != null">
and option_type = #{optionType}
</if>
<if test="optionContent != null and optionContent != ''">
and option_content = #{optionContent}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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="count" resultType="java.lang.Long">
select count(1)
from subject_multiple
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="optionType != null">
and option_type = #{optionType}
</if>
<if test="optionContent != null and optionContent != ''">
and option_content = #{optionContent}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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_multiple(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values (#{subjectId},#{optionType},#{optionContent},#{isCorrect},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_multiple(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.optionType},#{entity.optionContent},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_multiple(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.optionType},#{entity.optionContent},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_id = values(subject_id)option_type = values(option_type)option_content =
values(option_content)is_correct = values(is_correct)created_by = values(created_by)created_time =
values(created_time)update_by = values(update_by)update_time = values(update_time)is_deleted =
values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update subject_multiple
<set>
<if test="subjectId != null">
subject_id = #{subjectId},
</if>
<if test="optionType != null">
option_type = #{optionType},
</if>
<if test="optionContent != null and optionContent != ''">
option_content = #{optionContent},
</if>
<if test="isCorrect != null">
is_correct = #{isCorrect},
</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_multiple
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,174 @@
<?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.SubjectRadioDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectRadio" id="SubjectRadioMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectId" column="subject_id" jdbcType="INTEGER"/>
<result property="optionType" column="option_type" jdbcType="INTEGER"/>
<result property="optionContent" column="option_content" jdbcType="VARCHAR"/>
<result property="isCorrect" column="is_correct" 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="SubjectRadioMap">
select id,subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_radio
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectRadioMap">
select
id,subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_radio
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="optionType != null">
and option_type = #{optionType}
</if>
<if test="optionContent != null and optionContent != ''">
and option_content = #{optionContent}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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="count" resultType="java.lang.Long">
select count(1)
from subject_radio
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="optionType != null">
and option_type = #{optionType}
</if>
<if test="optionContent != null and optionContent != ''">
and option_content = #{optionContent}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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_radio(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values (#{subjectId},#{optionType},#{optionContent},#{isCorrect},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_radio(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.optionType},#{entity.optionContent},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_radio(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.optionType},#{entity.optionContent},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_id = values(subject_id)option_type = values(option_type)option_content =
values(option_content)is_correct = values(is_correct)created_by = values(created_by)created_time =
values(created_time)update_by = values(update_by)update_time = values(update_time)is_deleted =
values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update subject_radio
<set>
<if test="subjectId != null">
subject_id = #{subjectId},
</if>
<if test="optionType != null">
option_type = #{optionType},
</if>
<if test="optionContent != null and optionContent != ''">
option_content = #{optionContent},
</if>
<if test="isCorrect != null">
is_correct = #{isCorrect},
</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_radio
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,106 @@
<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>qing-yu-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>qing-yu-club-starter</artifactId>
<packaging>jar</packaging>
<name>qing-yu-club-starter</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.4.2</spring-boot.version>
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
<spring-cloud.version>2020.0.6</spring-cloud.version>
</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>qing-yu-club-application-controller</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.landaiqing</groupId>
<artifactId>qing-yu-club-infra</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>${project.artifactId}</finalName>
<!--打包成jar包时的名字-->
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.0.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

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

View File

@@ -0,0 +1,35 @@
server:
port: 3000
spring:
datasource:
username: landaiqing
password: iPHzskWvLGI2TrPw2AV7pu4C8O4bfxSSeQrkIqq0ZwM5tpBmx4aI6xN/8xjYgSmIir5v2Cv35Fn2732AypFKww==
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://116.196.80.239:3306/qing-yu-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: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKsYR+P7j9DehNkZaLxNeeoqU6ThCw3SNYCoPt1S7yeP1gEzpdS1cCQcz7/7OLQI/iFFjIJgXQDM2CA85yIomTMCAwEAAQ==
logging:
config: classpath:log4j2-spring.xml

View File

@@ -0,0 +1,17 @@
spring:
application:
name: qing-yu-club-subject
profiles:
active: dev
cloud:
nacos:
config:
server-addr: 116.196.80.239:8848
prefix: ${spring.application.name}
group: DEFAULT_GROUP
namespace:
file-extension: yaml
discovery:
enabled: true
server-addr: 116.196.80.239:8848

Some files were not shown because too many files have changed in this diff Show More