dao层修改 单元测试

This commit is contained in:
禾几海
2020-05-24 22:54:51 +08:00
parent 0136435a41
commit 4f63f7b3d5
9 changed files with 262 additions and 44 deletions

View File

@@ -1,20 +1,14 @@
package cn.celess.blog.entity;
import lombok.Data;
/**
* @author : xiaohai
* @date : 2019/03/28 22:18
*/
@Data
public class Category {
private Long id;
private String name;
private String articles;
}
package cn.celess.blog.entity;
import lombok.NoArgsConstructor;
/**
* @author : xiaohai
* @date : 2019/03/28 22:18
*/
@NoArgsConstructor
public class Category extends TagCategory {
public Category(String name) {
super.setName(name);
}
}

View File

@@ -1,16 +1,15 @@
package cn.celess.blog.entity;
import lombok.Data;
/**
* @author : xiaohai
* @date : 2019/03/28 22:19
*/
@Data
public class Tag {
private Long id;
private String name;
private String articles;
}
package cn.celess.blog.entity;
import lombok.NoArgsConstructor;
/**
* @author : xiaohai
* @date : 2019/03/28 22:19
*/
@NoArgsConstructor
public class Tag extends TagCategory {
public Tag(String name) {
super.setName(name);
}
}

View File

@@ -0,0 +1,19 @@
package cn.celess.blog.entity;
import lombok.Data;
/**
* @Author: 小海
* @Date: 2020-05-24 14:03
* @Desc:
*/
@Data
public class TagCategory {
private Long id;
private String name;
private boolean category = true;
private boolean deleted = false;
}

View File

@@ -34,7 +34,7 @@ public interface CategoryMapper {
String getNameById(long id);
Long getIDByName(String name);
Long getIdByName(String name);
Category getLastestCategory();

View File

@@ -26,10 +26,6 @@ public interface TagMapper {
Boolean existsByName(String name);
Long getIDByName(String name);
String getNameById(long id);
Tag getLastestTag();
List<Tag> findAll();

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.celess.blog.mapper.CategoryMapper">
<resultMap id="categoryResultMap" type="cn.celess.blog.entity.TagCategory">
<resultMap id="categoryResultMap" type="cn.celess.blog.entity.Category">
<id column="t_id" property="id"/>
<result column="t_name" property="name"/>
<result column="is_category" property="category"/>
@@ -56,7 +56,8 @@
<select id="getNameById" resultType="java.lang.String">
select t_name
from tag_category
where is_category = true;
where is_category = true
and t_id = #{id};
</select>
<select id="getIdByName" resultType="java.lang.Long">

View File

@@ -4,7 +4,6 @@
<resultMap id="tagResultMap" type="cn.celess.blog.entity.Tag"
extends="cn.celess.blog.mapper.CategoryMapper.categoryResultMap">
</resultMap>
<insert id="insert" useGeneratedKeys="true" keyProperty="id">