fix: SubjectLabel
This commit is contained in:
25
jc-club-auth/pom.xml
Normal file
25
jc-club-auth/pom.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<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>
|
||||||
|
|
||||||
|
<groupId>com.landaiqing</groupId>
|
||||||
|
<artifactId>jc-club-auth</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>jc-club-auth</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>
|
13
jc-club-auth/src/main/java/com/landaiqing/App.java
Normal file
13
jc-club-auth/src/main/java/com/landaiqing/App.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.landaiqing;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hello world!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
System.out.println( "Hello World!" );
|
||||||
|
}
|
||||||
|
}
|
38
jc-club-auth/src/test/java/com/landaiqing/AppTest.java
Normal file
38
jc-club-auth/src/test/java/com/landaiqing/AppTest.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package com.landaiqing;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for simple App.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the test case
|
||||||
|
*
|
||||||
|
* @param testName name of the test case
|
||||||
|
*/
|
||||||
|
public AppTest( String testName )
|
||||||
|
{
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the suite of tests being tested
|
||||||
|
*/
|
||||||
|
public static Test suite()
|
||||||
|
{
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rigourous Test :-)
|
||||||
|
*/
|
||||||
|
public void testApp()
|
||||||
|
{
|
||||||
|
assertTrue( true );
|
||||||
|
}
|
||||||
|
}
|
25
jc-club-gateway/pom.xml
Normal file
25
jc-club-gateway/pom.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<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>
|
||||||
|
|
||||||
|
<groupId>com.landaiqing</groupId>
|
||||||
|
<artifactId>jc-club-gateway</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>jc-club-gateway</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>
|
13
jc-club-gateway/src/main/java/com/landaiqing/App.java
Normal file
13
jc-club-gateway/src/main/java/com/landaiqing/App.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.landaiqing;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hello world!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
System.out.println( "Hello World!" );
|
||||||
|
}
|
||||||
|
}
|
38
jc-club-gateway/src/test/java/com/landaiqing/AppTest.java
Normal file
38
jc-club-gateway/src/test/java/com/landaiqing/AppTest.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package com.landaiqing;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for simple App.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the test case
|
||||||
|
*
|
||||||
|
* @param testName name of the test case
|
||||||
|
*/
|
||||||
|
public AppTest( String testName )
|
||||||
|
{
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the suite of tests being tested
|
||||||
|
*/
|
||||||
|
public static Test suite()
|
||||||
|
{
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rigourous Test :-)
|
||||||
|
*/
|
||||||
|
public void testApp()
|
||||||
|
{
|
||||||
|
assertTrue( true );
|
||||||
|
}
|
||||||
|
}
|
@@ -3,7 +3,6 @@ package com.landaiqing.subject.application.dto;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 题目标签DTO
|
* 题目标签DTO
|
||||||
@@ -12,7 +11,7 @@ import java.util.Date;
|
|||||||
* @since 2024-02-14 17:08:06
|
* @since 2024-02-14 17:08:06
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class SubjectLabelDTO implements Serializable {
|
public class SubjectLabelDTO implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
|
@@ -1,12 +1,15 @@
|
|||||||
package com.landaiqing.subject.domain.service.impl;
|
package com.landaiqing.subject.domain.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.landaiqing.subject.common.enums.CategoryTypeEnum;
|
||||||
import com.landaiqing.subject.common.enums.IsDeletedFlagEnum;
|
import com.landaiqing.subject.common.enums.IsDeletedFlagEnum;
|
||||||
import com.landaiqing.subject.domain.convert.SubjectLabelConverter;
|
import com.landaiqing.subject.domain.convert.SubjectLabelConverter;
|
||||||
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
|
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
|
||||||
import com.landaiqing.subject.domain.service.SubjectLabelDomainService;
|
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.SubjectLabel;
|
||||||
import com.landaiqing.subject.infra.basic.entity.SubjectMapping;
|
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.SubjectLabelService;
|
||||||
import com.landaiqing.subject.infra.basic.service.SubjectMappingService;
|
import com.landaiqing.subject.infra.basic.service.SubjectMappingService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -27,6 +30,9 @@ public class SubjectLabelDomainServiceImpl implements SubjectLabelDomainService
|
|||||||
@Resource
|
@Resource
|
||||||
private SubjectMappingService subjectMappingService;
|
private SubjectMappingService subjectMappingService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SubjectCategoryService subjectCategoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 新增标签
|
* @description: 新增标签
|
||||||
* @param: [subjectLabelBO]
|
* @param: [subjectLabelBO]
|
||||||
@@ -63,13 +69,14 @@ public class SubjectLabelDomainServiceImpl implements SubjectLabelDomainService
|
|||||||
int count = subjectLabelService.update(subjectLabel);
|
int count = subjectLabelService.update(subjectLabel);
|
||||||
return count > 0;
|
return count > 0;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @description: 删除标签
|
/**
|
||||||
* @param: [subjectLabelBO]
|
* @description: 删除标签
|
||||||
* @return: java.lang.Boolean
|
* @param: [subjectLabelBO]
|
||||||
|
* @return: java.lang.Boolean
|
||||||
* @author landaiqing
|
* @author landaiqing
|
||||||
* @date: 2024/2/14 18:58
|
* @date: 2024/2/14 18:58
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean delete(SubjectLabelBO subjectLabelBO) {
|
public Boolean delete(SubjectLabelBO subjectLabelBO) {
|
||||||
if (log.isInfoEnabled()) {
|
if (log.isInfoEnabled()) {
|
||||||
@@ -81,28 +88,38 @@ public class SubjectLabelDomainServiceImpl implements SubjectLabelDomainService
|
|||||||
int count = subjectLabelService.update(subjectLabel);
|
int count = subjectLabelService.update(subjectLabel);
|
||||||
return count > 0;
|
return count > 0;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @description: 查询分类下的标签
|
/**
|
||||||
* @param: [subjectLabelBO]
|
* @description: 查询分类下的标签
|
||||||
* @return: java.util.List<com.landaiqing.subject.domain.entity.SubjectLabelBO>
|
* @param: [subjectLabelBO]
|
||||||
|
* @return: java.util.List<com.landaiqing.subject.domain.entity.SubjectLabelBO>
|
||||||
* @author landaiqing
|
* @author landaiqing
|
||||||
* @date: 2024/2/14 19:08
|
* @date: 2024/2/14 19:08
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SubjectLabelBO> queryLabelByCategoryId(SubjectLabelBO subjectLabelBO) {
|
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();
|
Long categoryId = subjectLabelBO.getCategoryId();
|
||||||
SubjectMapping subjectMapping=new SubjectMapping();
|
SubjectMapping subjectMapping = new SubjectMapping();
|
||||||
subjectMapping.setCategoryId(categoryId);
|
subjectMapping.setCategoryId(categoryId);
|
||||||
subjectMapping.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
subjectMapping.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
||||||
List<SubjectMapping> mappingList= subjectMappingService.queryLabelId(subjectMapping);
|
List<SubjectMapping> mappingList = subjectMappingService.queryLabelId(subjectMapping);
|
||||||
if(CollectionUtils.isEmpty(mappingList)){
|
if (CollectionUtils.isEmpty(mappingList)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<Long> labelIdList = mappingList.stream().map(SubjectMapping::getLabelId).collect(Collectors.toList());
|
List<Long> labelIdList = mappingList.stream().map(SubjectMapping::getLabelId).collect(Collectors.toList());
|
||||||
List<SubjectLabel> labelList= subjectLabelService.batchQueryById(labelIdList);
|
List<SubjectLabel> labelList = subjectLabelService.batchQueryById(labelIdList);
|
||||||
List<SubjectLabelBO> boList=new LinkedList<>();
|
List<SubjectLabelBO> boList = new LinkedList<>();
|
||||||
labelList.forEach(label->{
|
labelList.forEach(label -> {
|
||||||
SubjectLabelBO bo=new SubjectLabelBO();
|
SubjectLabelBO bo = new SubjectLabelBO();
|
||||||
bo.setId(label.getId());
|
bo.setId(label.getId());
|
||||||
bo.setLabelName(label.getLabelName());
|
bo.setLabelName(label.getLabelName());
|
||||||
bo.setCategoryId(categoryId);
|
bo.setCategoryId(categoryId);
|
||||||
|
@@ -28,7 +28,7 @@ public interface SubjectLabelDao {
|
|||||||
* @param subjectLabel 分页对象
|
* @param subjectLabel 分页对象
|
||||||
* @return 对象列表
|
* @return 对象列表
|
||||||
*/
|
*/
|
||||||
List<SubjectLabel> queryAllByLimit(SubjectLabel subjectLabel);
|
List<SubjectLabel> queryByCondition(SubjectLabel subjectLabel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计总行数
|
* 统计总行数
|
||||||
|
@@ -49,4 +49,6 @@ public interface SubjectLabelService {
|
|||||||
boolean deleteById(Long id);
|
boolean deleteById(Long id);
|
||||||
|
|
||||||
List<SubjectLabel> batchQueryById(@Param("list") List<Long> labelIdList);
|
List<SubjectLabel> batchQueryById(@Param("list") List<Long> labelIdList);
|
||||||
|
|
||||||
|
List<SubjectLabel> queryByCondition(SubjectLabel subjectLabel);
|
||||||
}
|
}
|
||||||
|
@@ -71,4 +71,9 @@ public class SubjectLabelServiceImpl implements SubjectLabelService {
|
|||||||
public List<SubjectLabel> batchQueryById(List<Long> labelIdList) {
|
public List<SubjectLabel> batchQueryById(List<Long> labelIdList) {
|
||||||
return this.subjectLabelDao.batchQueryById(labelIdList);
|
return this.subjectLabelDao.batchQueryById(labelIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SubjectLabel> queryByCondition(SubjectLabel subjectLabel) {
|
||||||
|
return this.subjectLabelDao.queryByCondition(subjectLabel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--查询指定行数据-->
|
<!--查询指定行数据-->
|
||||||
<select id="queryAllByLimit" resultMap="SubjectLabelMap">
|
<select id="queryByCondition" resultMap="SubjectLabelMap">
|
||||||
select
|
select
|
||||||
id,label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted
|
id,label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted
|
||||||
from subject_label
|
from subject_label
|
||||||
@@ -55,7 +55,6 @@
|
|||||||
and is_deleted = #{isDeleted}
|
and is_deleted = #{isDeleted}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
limit #{pageable.offset}, #{pageable.pageSize}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--统计总行数-->
|
<!--统计总行数-->
|
||||||
|
Reference in New Issue
Block a user