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 java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 题目标签DTO
|
||||
@@ -12,7 +11,7 @@ import java.util.Date;
|
||||
* @since 2024-02-14 17:08:06
|
||||
*/
|
||||
@Data
|
||||
public class SubjectLabelDTO implements Serializable {
|
||||
public class SubjectLabelDTO implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
|
@@ -1,12 +1,15 @@
|
||||
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;
|
||||
@@ -27,6 +30,9 @@ public class SubjectLabelDomainServiceImpl implements SubjectLabelDomainService
|
||||
@Resource
|
||||
private SubjectMappingService subjectMappingService;
|
||||
|
||||
@Resource
|
||||
private SubjectCategoryService subjectCategoryService;
|
||||
|
||||
/**
|
||||
* @description: 新增标签
|
||||
* @param: [subjectLabelBO]
|
||||
@@ -63,13 +69,14 @@ public class SubjectLabelDomainServiceImpl implements SubjectLabelDomainService
|
||||
int count = subjectLabelService.update(subjectLabel);
|
||||
return count > 0;
|
||||
}
|
||||
/**
|
||||
* @description: 删除标签
|
||||
* @param: [subjectLabelBO]
|
||||
* @return: java.lang.Boolean
|
||||
|
||||
/**
|
||||
* @description: 删除标签
|
||||
* @param: [subjectLabelBO]
|
||||
* @return: java.lang.Boolean
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 18:58
|
||||
*/
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(SubjectLabelBO subjectLabelBO) {
|
||||
if (log.isInfoEnabled()) {
|
||||
@@ -81,28 +88,38 @@ public class SubjectLabelDomainServiceImpl implements SubjectLabelDomainService
|
||||
int count = subjectLabelService.update(subjectLabel);
|
||||
return count > 0;
|
||||
}
|
||||
/**
|
||||
* @description: 查询分类下的标签
|
||||
* @param: [subjectLabelBO]
|
||||
* @return: java.util.List<com.landaiqing.subject.domain.entity.SubjectLabelBO>
|
||||
|
||||
/**
|
||||
* @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 subjectMapping = new SubjectMapping();
|
||||
subjectMapping.setCategoryId(categoryId);
|
||||
subjectMapping.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
||||
List<SubjectMapping> mappingList= subjectMappingService.queryLabelId(subjectMapping);
|
||||
if(CollectionUtils.isEmpty(mappingList)){
|
||||
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();
|
||||
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);
|
||||
|
@@ -28,7 +28,7 @@ public interface SubjectLabelDao {
|
||||
* @param subjectLabel 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<SubjectLabel> queryAllByLimit(SubjectLabel subjectLabel);
|
||||
List<SubjectLabel> queryByCondition(SubjectLabel subjectLabel);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
|
@@ -49,4 +49,6 @@ public interface SubjectLabelService {
|
||||
boolean deleteById(Long id);
|
||||
|
||||
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) {
|
||||
return this.subjectLabelDao.batchQueryById(labelIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SubjectLabel> queryByCondition(SubjectLabel subjectLabel) {
|
||||
return this.subjectLabelDao.queryByCondition(subjectLabel);
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="SubjectLabelMap">
|
||||
<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
|
||||
@@ -55,7 +55,6 @@
|
||||
and is_deleted = #{isDeleted}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
|
Reference in New Issue
Block a user