dao层修改 单元测试
This commit is contained in:
@@ -42,21 +42,6 @@ public class Article {
|
||||
|
||||
private Date updateDate = null;
|
||||
|
||||
@Deprecated
|
||||
private Long categoryId;
|
||||
|
||||
@Deprecated
|
||||
private String tagsId;
|
||||
|
||||
@Deprecated
|
||||
private Long authorId;
|
||||
|
||||
@Deprecated
|
||||
private Long preArticleId;
|
||||
|
||||
@Deprecated
|
||||
private Long nextArticleId;
|
||||
|
||||
private Long readingNumber;
|
||||
|
||||
/**
|
||||
@@ -73,4 +58,6 @@ public class Article {
|
||||
private Integer dislikeCount;
|
||||
|
||||
private User user;
|
||||
|
||||
private boolean deleted = false;
|
||||
}
|
||||
|
||||
27
src/main/java/cn/celess/blog/entity/ArticleTag.java
Normal file
27
src/main/java/cn/celess/blog/entity/ArticleTag.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package cn.celess.blog.entity;
|
||||
|
||||
import com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author: 小海
|
||||
* @Date: 2020-05-24 14:52
|
||||
* @Desc:
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ArticleTag {
|
||||
private Long id;
|
||||
|
||||
private Article article;
|
||||
|
||||
private TagCategory tag;
|
||||
|
||||
public ArticleTag(Article article, TagCategory tag) {
|
||||
this.article = article;
|
||||
this.tag = tag;
|
||||
}
|
||||
}
|
||||
@@ -21,15 +21,6 @@ public interface ArticleMapper {
|
||||
|
||||
int update(Article a);
|
||||
|
||||
@Deprecated
|
||||
int updateNextArticleId(long targetArticleID, long nextArticleID);
|
||||
|
||||
@Deprecated
|
||||
int updatePreArticleId(long targetArticleID, long preArticleID);
|
||||
|
||||
@Deprecated
|
||||
long getLastestArticleId();
|
||||
|
||||
Article getLastestArticle();
|
||||
|
||||
Article findArticleById(long id);
|
||||
@@ -38,7 +29,7 @@ public interface ArticleMapper {
|
||||
|
||||
boolean isDeletedById(long id);
|
||||
|
||||
List<Article> findAllByAuthorId(long authorID);
|
||||
List<Article> findAllByAuthorId(long authorId);
|
||||
|
||||
List<Article> findAllByOpen(boolean isOpen);
|
||||
|
||||
@@ -48,15 +39,6 @@ public interface ArticleMapper {
|
||||
|
||||
List<Article> findAll();
|
||||
|
||||
Article getSimpleInfo(long id);
|
||||
|
||||
List<Article> getSimpleInfoByCategory(long categoryId);
|
||||
|
||||
List<Article> getSimpleInfoByTag(List<String> idList);
|
||||
|
||||
@Deprecated
|
||||
int setReadingNumber(long number, long id);
|
||||
|
||||
int updateReadingNumber(long id);
|
||||
|
||||
long count();
|
||||
|
||||
31
src/main/java/cn/celess/blog/mapper/ArticleTagMapper.java
Normal file
31
src/main/java/cn/celess/blog/mapper/ArticleTagMapper.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package cn.celess.blog.mapper;
|
||||
|
||||
import cn.celess.blog.entity.ArticleTag;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: 小海
|
||||
* @Date: 2020-05-24 14:21
|
||||
* @Desc:
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface ArticleTagMapper {
|
||||
|
||||
int insert(ArticleTag articleTag);
|
||||
|
||||
int update(ArticleTag articleTag);
|
||||
|
||||
ArticleTag findOneById(Long id);
|
||||
|
||||
int deleteById(Long id);
|
||||
|
||||
int deleteByArticleId(Long articleId);
|
||||
|
||||
List<ArticleTag> findAllByArticleId(Long articleId);
|
||||
|
||||
int deleteMultiById(List<ArticleTag> articleTags);
|
||||
}
|
||||
@@ -113,7 +113,7 @@
|
||||
<select id="findAllByAuthorId" resultMap="articleViewResultMap">
|
||||
select *
|
||||
from articleView
|
||||
where authorId = #{authorID}
|
||||
where authorId = #{authorId}
|
||||
and isDelete = false
|
||||
order by articleId desc
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user