feat: 修改模块名称
This commit is contained in:
28
qing-yu-club-subject/qing-yu-club-application/pom.xml
Normal file
28
qing-yu-club-subject/qing-yu-club-application/pom.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.landaiqing</groupId>
|
||||
<artifactId>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>
|
@@ -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>
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,155 @@
|
||||
package com.landaiqing.subject.application.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.landaiqing.subject.application.convert.SubjectCategoryDTOConverter;
|
||||
import com.landaiqing.subject.application.dto.SubjectCategoryDTO;
|
||||
import com.landaiqing.subject.common.entity.Result;
|
||||
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
|
||||
import com.landaiqing.subject.domain.service.SubjectCategoryDomainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 刷题分类controller
|
||||
*
|
||||
* @author landaiqing
|
||||
* @date 2024/2/7
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/subject/category")
|
||||
@Slf4j
|
||||
public class SubjectCategoryController {
|
||||
@Resource
|
||||
private SubjectCategoryDomainService subjectCategoryDomainService;
|
||||
|
||||
/**
|
||||
* @description: 新增分类
|
||||
* @param: [subjectCategoryDTO]
|
||||
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/13 20:19
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result<Boolean> add(@RequestBody SubjectCategoryDTO subjectCategoryDTO) {
|
||||
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectCategoryController.add.dto:{}", JSON.toJSONString(subjectCategoryDTO));
|
||||
}
|
||||
|
||||
Preconditions.checkNotNull(subjectCategoryDTO.getCategoryType(), "分类类型不能为空!");
|
||||
Preconditions.checkArgument(!StringUtils.isBlank(subjectCategoryDTO.getCategoryName()), "分类的名称不能为空!");
|
||||
Preconditions.checkNotNull(subjectCategoryDTO.getParentId(), "分类父级不能为空!");
|
||||
|
||||
|
||||
SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE.convertDtoToCategoryBO(subjectCategoryDTO);
|
||||
subjectCategoryDomainService.add(subjectCategoryBO);
|
||||
return Result.ok(true);
|
||||
} catch (Exception e) {
|
||||
log.error("SubjectCategoryController.add.error:{}", e.getMessage(), e);
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询岗位大类
|
||||
* @param: [subjectCategoryDTO]
|
||||
* @return: com.landaiqing.subject.common.entity.Result<java.util.List < com.landaiqing.subject.application.dto.SubjectCategoryDTO>>
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/13 20:19
|
||||
*/
|
||||
@PostMapping("/queryPrimaryCategory")
|
||||
public Result<List<SubjectCategoryDTO>> queryPrimaryCategory(@RequestBody SubjectCategoryDTO subjectCategoryDTO) {
|
||||
try {
|
||||
SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE.
|
||||
convertDtoToCategoryBO(subjectCategoryDTO);
|
||||
List<SubjectCategoryBO> subjectCategoryBOList = subjectCategoryDomainService.queryCategory(subjectCategoryBO);
|
||||
List<SubjectCategoryDTO> subjectCategoryDTOList = SubjectCategoryDTOConverter.INSTANCE.
|
||||
convertBoToCategoryDTOList(subjectCategoryBOList);
|
||||
return Result.ok(subjectCategoryDTOList);
|
||||
} catch (Exception e) {
|
||||
log.error("SubjectCategoryController.queryPrimaryCategory.error:{}", e.getMessage(), e);
|
||||
return Result.fail("查询失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 根据分类id查二级分类
|
||||
* @param: [subjectCategoryDTO]
|
||||
* @return: com.landaiqing.subject.common.entity.Result<java.util.List < com.landaiqing.subject.application.dto.SubjectCategoryDTO>>
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/13 20:19
|
||||
*/
|
||||
@PostMapping("/queryCategoryByPrimary")
|
||||
public Result<List<SubjectCategoryDTO>> queryCategoryByPrimary(@RequestBody SubjectCategoryDTO subjectCategoryDTO) {
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectCategoryController.queryCategoryByPrimary.dto:{}"
|
||||
, JSON.toJSONString(subjectCategoryDTO));
|
||||
}
|
||||
Preconditions.checkNotNull(subjectCategoryDTO.getParentId(), "分类id不能为空");
|
||||
SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE.
|
||||
convertDtoToCategoryBO(subjectCategoryDTO);
|
||||
List<SubjectCategoryBO> subjectCategoryBOList = subjectCategoryDomainService.queryCategory(subjectCategoryBO);
|
||||
List<SubjectCategoryDTO> subjectCategoryDTOList = SubjectCategoryDTOConverter.INSTANCE.
|
||||
convertBoToCategoryDTOList(subjectCategoryBOList);
|
||||
return Result.ok(subjectCategoryDTOList);
|
||||
} catch (Exception e) {
|
||||
log.error("SubjectCategoryController.queryPrimaryCategory.error:{}", e.getMessage(), e);
|
||||
return Result.fail("查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 更新分类
|
||||
* @param: [subjectCategoryDTO]
|
||||
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 14:42
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public Result<Boolean> update(@RequestBody SubjectCategoryDTO subjectCategoryDTO) {
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectCategoryController.update.dto:{}"
|
||||
, JSON.toJSONString(subjectCategoryDTO));
|
||||
}
|
||||
SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE.convertDtoToCategoryBO(subjectCategoryDTO);
|
||||
Boolean result = subjectCategoryDomainService.update(subjectCategoryBO);
|
||||
return Result.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("SubjectCategoryController.update.error:{}", e.getMessage(), e);
|
||||
return Result.fail("更新分类失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除分类
|
||||
* @param: [subjectCategoryDTO]
|
||||
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 15:05
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public Result<Boolean> delete(@RequestBody SubjectCategoryDTO subjectCategoryDTO) {
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectCategoryController.delete.dto:{}"
|
||||
, JSON.toJSONString(subjectCategoryDTO));
|
||||
}
|
||||
SubjectCategoryBO subjectCategoryBO = SubjectCategoryDTOConverter.INSTANCE.convertDtoToCategoryBO(subjectCategoryDTO);
|
||||
Boolean result = subjectCategoryDomainService.delete(subjectCategoryBO);
|
||||
return Result.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("SubjectCategoryController.delete.error:{}", e.getMessage(), e);
|
||||
return Result.fail("删除分类失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,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("查询题目详情失败!");
|
||||
}
|
||||
}
|
||||
}
|
@@ -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("查询标签失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -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);
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.landaiqing.subject.application.convert;
|
||||
|
||||
import com.landaiqing.subject.application.dto.SubjectCategoryDTO;
|
||||
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题目分类dto转换器
|
||||
*
|
||||
* @author: landaiqing
|
||||
* @date: 2024/2/13
|
||||
*/
|
||||
@Mapper
|
||||
public interface SubjectCategoryDTOConverter {
|
||||
SubjectCategoryDTOConverter INSTANCE = Mappers.getMapper(SubjectCategoryDTOConverter.class);
|
||||
|
||||
SubjectCategoryBO convertDtoToCategoryBO(SubjectCategoryDTO subjectCategoryDTO);
|
||||
|
||||
SubjectCategoryDTO convertBoToCategoryDTO(SubjectCategoryBO subjectCategoryBO);
|
||||
List<SubjectCategoryDTO> convertBoToCategoryDTOList(List<SubjectCategoryBO> subjectCategoryDTO);
|
||||
|
||||
}
|
@@ -0,0 +1,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);
|
||||
|
||||
|
||||
}
|
@@ -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);
|
||||
|
||||
|
||||
|
||||
}
|
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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>
|
@@ -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>
|
Reference in New Issue
Block a user