This is a personal blog application with a front-end and a back-end built in Spring Boot, mybatis and semantic-ui. It has basic functionality like view the blog, query the blog by its tag/type, and it has a admin module where the admin user can log-in and edit the blogs. You should analyse the repo closely to understand the whole application and the requirement is to add a new backend functionality that the user can view the blog by its "category". Make necessary code changes and front-end implenementation and testing are not required.
[!TIP]
I can email you next time I complete a pull request if you set up your email here!
Actions (click)
[ ] ↻ Restart Sweep
Step 1: 🔎 Searching
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description.
https://github.com/helado12/blog/blob/504980349c052ccf98c9f489dd366759813627b4/src/main/resources/mapper/BlogDao.xml#L1-L169
Create src/main/resources/mapper/CategoryDao.xml with contents: • Create a new MyBatis mapper XML file named `CategoryDao.xml` in the `src/main/resources/mapper` directory. • Define a namespace for the mapper, e.g., `namespace="com.htr.dao.CategoryDao"`. • Add a `` to map the category entity fields to the database columns. • Include `
[X] Running GitHub Actions for src/main/resources/mapper/CategoryDao.xml ✓ Edit
Check src/main/resources/mapper/CategoryDao.xml with contents:
Create src/main/java/com/htr/dao/CategoryDao.java with contents: • Create a new interface `CategoryDao` in the `com.htr.dao` package. • Define methods that correspond to the `
[X] Running GitHub Actions for src/main/java/com/htr/dao/CategoryDao.java ✓ Edit
Check src/main/java/com/htr/dao/CategoryDao.java with contents:
Modify src/main/resources/mapper/BlogDao.xml with contents: • Add a new `
---
+++
@@ -154,6 +154,14 @@
where (blogtag.tag_id= tag.id and blogtag.blog_id = b.id and tag.id = #{id} ) order by b.update_time desc
+
+ select b.*
+ from t_blog b
+ join t_category c on b.category_id = c.id
+ where c.id = #{id}
+ order by b.update_time desc
+
+
update t_blog set views = views + 1 where id = #{id}
[X] Running GitHub Actions for src/main/resources/mapper/BlogDao.xml ✓ Edit
Check src/main/resources/mapper/BlogDao.xml with contents:
Modify src/main/java/com/htr/dao/BlogDao.java with contents: • Add a new method signature in the `BlogDao` interface to support fetching blogs by category ID, e.g., `List getBlogsByCategoryId(Long categoryId);`.
---
+++
@@ -43,6 +43,8 @@
List getByTagId(Long id);
+ List getBlogsByCategoryId(Long categoryId);
+
List queryBlogYear();
List findByYear(String year);
[X] Running GitHub Actions for src/main/java/com/htr/dao/BlogDao.java ✓ Edit
Check src/main/java/com/htr/dao/BlogDao.java with contents:
Modify src/main/java/com/htr/service/BlogService.java with contents: • Add a new method in the `BlogService` class to fetch blogs by category ID. This method will call the newly added method in the `BlogDao` interface. • The method could be named `getBlogsByCategory(Long categoryId)` and should return a list of `Blog` entities.
---
+++
@@ -37,6 +37,8 @@
List getByTagId(Long id);
+ List getBlogsByCategory(Long categoryId);
+
Map> archiveBlog();
}
[X] Running GitHub Actions for src/main/java/com/htr/service/BlogService.java ✓ Edit
Check src/main/java/com/htr/service/BlogService.java with contents:
Create src/main/java/com/htr/entity/Category.java with contents: • Create a new `Category` entity class in the `com.htr.entity` package. • Define fields for the category entity, such as `id`, `name`, and any other relevant fields. • Annotate the class with JPA annotations if necessary, depending on whether JPA is used alongside MyBatis in this project.
[X] Running GitHub Actions for src/main/java/com/htr/entity/Category.java ✓ Edit
Check src/main/java/com/htr/entity/Category.java with contents:
Create src/main/java/com/htr/entity/Blog.java with contents: • Add a new field to the `Blog` entity to reference the `Category` entity. This could be a `Category` type field with appropriate JPA/MyBatis annotations to establish the relationship.
[X] Running GitHub Actions for src/main/java/com/htr/entity/Blog.java ✓ Edit
Check src/main/java/com/htr/entity/Blog.java with contents:
This is a personal blog application with a front-end and a back-end built in Spring Boot, mybatis and semantic-ui. It has basic functionality like view the blog, query the blog by its tag/type, and it has a admin module where the admin user can log-in and edit the blogs. You should analyse the repo closely to understand the whole application and the requirement is to add a new backend functionality that the user can view the blog by its "category". Make necessary code changes and front-end implenementation and testing are not required.
Checklist
- [X] Create `src/main/resources/mapper/CategoryDao.xml` ✓ https://github.com/helado12/blog/commit/096aa6d1a329e98b5330a997cca6a4f9c759e4fb [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/resources/mapper/CategoryDao.xml) - [X] Running GitHub Actions for `src/main/resources/mapper/CategoryDao.xml` ✓ [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/resources/mapper/CategoryDao.xml) - [X] Create `src/main/java/com/htr/dao/CategoryDao.java` ✓ https://github.com/helado12/blog/commit/c79c156c5c91502688c039f8e64626999cb2ffcc [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/java/com/htr/dao/CategoryDao.java) - [X] Running GitHub Actions for `src/main/java/com/htr/dao/CategoryDao.java` ✓ [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/java/com/htr/dao/CategoryDao.java) - [X] Modify `src/main/resources/mapper/BlogDao.xml` ✓ https://github.com/helado12/blog/commit/912ba18f479db8be25562dedb4ed7552a55a76b7 [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/resources/mapper/BlogDao.xml) - [X] Running GitHub Actions for `src/main/resources/mapper/BlogDao.xml` ✓ [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/resources/mapper/BlogDao.xml) - [X] Modify `src/main/java/com/htr/dao/BlogDao.java` ✓ https://github.com/helado12/blog/commit/42abac3fdb63047182afca008e480bd18158bb99 [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/java/com/htr/dao/BlogDao.java) - [X] Running GitHub Actions for `src/main/java/com/htr/dao/BlogDao.java` ✓ [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/java/com/htr/dao/BlogDao.java) - [X] Modify `src/main/java/com/htr/service/BlogService.java` ✓ https://github.com/helado12/blog/commit/49cb17696819817ba8e48f8c9fa10ff807e5b80d [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/java/com/htr/service/BlogService.java) - [X] Running GitHub Actions for `src/main/java/com/htr/service/BlogService.java` ✓ [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/java/com/htr/service/BlogService.java) - [X] Create `src/main/java/com/htr/entity/Category.java` ✓ https://github.com/helado12/blog/commit/fb81fc4d3bc1c3fcb9ecde0e256c1e9486ad6e96 [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/java/com/htr/entity/Category.java) - [X] Running GitHub Actions for `src/main/java/com/htr/entity/Category.java` ✓ [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/java/com/htr/entity/Category.java) - [X] Create `src/main/java/com/htr/entity/Blog.java` ✓ https://github.com/helado12/blog/commit/d253217f6cfb3c82b145b3688c130852afc23019 [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/java/com/htr/entity/Blog.java) - [X] Running GitHub Actions for `src/main/java/com/htr/entity/Blog.java` ✓ [Edit](https://github.com/helado12/blog/edit/sweep/add_a_new_backend_service_to_this_blog_a/src/main/java/com/htr/entity/Blog.java)