fix
Helius
2022-07-11 cf566cbe51e917833f3e4e9820b8656b9c7c6a7c
fix
1 files modified
1 files added
34 ■■■■■ changed files
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java 2 ●●● patch | view | raw | blame | history
src/test/java/com/xcong/farmer/cms/ArticleTest.java 32 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
@@ -182,7 +182,7 @@
            return Result.fail("请选择文章栏目");
        }
        if (!articleEntity.getColumnId().equals(columnId) && articleEntity.getBeforeColumnId() != null) {
        if (!articleEntity.getColumnId().equals(columnId) && articleEntity.getBeforeColumnId() == null) {
            articleEntity.setBeforeColumnId(articleEntity.getColumnId());
        }
        articleEntity.setColumnId(columnId);
src/test/java/com/xcong/farmer/cms/ArticleTest.java
New file
@@ -0,0 +1,32 @@
package com.xcong.farmer.cms;
import com.xcong.farmer.cms.modules.system.entity.ArticleEntity;
import com.xcong.farmer.cms.modules.system.mapper.ArticleMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
/**
 * @author wzy
 * @date 2022-07-11
 **/
@SpringBootTest
public class ArticleTest {
    @Autowired
    private ArticleMapper articleMapper;
    @Test
    public void articleColumnIdUpdateTest() {
        Long columnId = 83L;
        ArticleEntity article = articleMapper.selectById(88L);
        System.out.println(!article.getColumnId().equals(columnId));
        if (!article.getColumnId().equals(columnId) && article.getBeforeColumnId() == null) {
            article.setBeforeColumnId(article.getColumnId());
        }
        System.out.println(1);
    }
}