mirror of https://github.com/halo-dev/halo
create controllers
parent
6e20fd2cf2
commit
c3e223713d
|
@ -3,8 +3,6 @@ package cc.ryanc.halo.service;
|
||||||
import cc.ryanc.halo.model.entity.Tag;
|
import cc.ryanc.halo.model.entity.Tag;
|
||||||
import cc.ryanc.halo.service.base.CrudService;
|
import cc.ryanc.halo.service.base.CrudService;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tag service.
|
* Tag service.
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cc.ryanc.halo.service.impl;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.entity.Attachment;
|
||||||
|
import cc.ryanc.halo.repository.AttachmentRepository;
|
||||||
|
import cc.ryanc.halo.service.AttachmentService;
|
||||||
|
import cc.ryanc.halo.service.base.AbstractCrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AttachmentService implementation class
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AttachmentServiceImpl extends AbstractCrudService<Attachment, Integer> implements AttachmentService {
|
||||||
|
|
||||||
|
private AttachmentRepository attachmentRepository;
|
||||||
|
|
||||||
|
public AttachmentServiceImpl(AttachmentRepository attachmentRepository) {
|
||||||
|
super(attachmentRepository);
|
||||||
|
this.attachmentRepository = attachmentRepository;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cc.ryanc.halo.service.impl;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.entity.Category;
|
||||||
|
import cc.ryanc.halo.repository.CategoryRepository;
|
||||||
|
import cc.ryanc.halo.service.CategoryService;
|
||||||
|
import cc.ryanc.halo.service.base.AbstractCrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CategoryService implementation class
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CategoryServiceImpl extends AbstractCrudService<Category, Integer> implements CategoryService {
|
||||||
|
|
||||||
|
private CategoryRepository categoryRepository;
|
||||||
|
|
||||||
|
public CategoryServiceImpl(CategoryRepository categoryRepository) {
|
||||||
|
super(categoryRepository);
|
||||||
|
this.categoryRepository = categoryRepository;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cc.ryanc.halo.service.impl;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.entity.Comment;
|
||||||
|
import cc.ryanc.halo.repository.CommentRepository;
|
||||||
|
import cc.ryanc.halo.service.CommentService;
|
||||||
|
import cc.ryanc.halo.service.base.AbstractCrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CommentService implementation class
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CommentServiceImpl extends AbstractCrudService<Comment, Long> implements CommentService {
|
||||||
|
|
||||||
|
private final CommentRepository commentRepository;
|
||||||
|
|
||||||
|
public CommentServiceImpl(CommentRepository commentRepository) {
|
||||||
|
super(commentRepository);
|
||||||
|
this.commentRepository = commentRepository;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cc.ryanc.halo.service.impl;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.entity.Gallery;
|
||||||
|
import cc.ryanc.halo.repository.GalleryRepository;
|
||||||
|
import cc.ryanc.halo.service.GalleryService;
|
||||||
|
import cc.ryanc.halo.service.base.AbstractCrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GalleryService implementation class
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class GalleryServiceImpl extends AbstractCrudService<Gallery, Integer> implements GalleryService {
|
||||||
|
|
||||||
|
private GalleryRepository galleryRepository;
|
||||||
|
|
||||||
|
public GalleryServiceImpl(GalleryRepository galleryRepository) {
|
||||||
|
super(galleryRepository);
|
||||||
|
this.galleryRepository = galleryRepository;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cc.ryanc.halo.service.impl;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.entity.Link;
|
||||||
|
import cc.ryanc.halo.repository.LinkRepository;
|
||||||
|
import cc.ryanc.halo.service.LinkService;
|
||||||
|
import cc.ryanc.halo.service.base.AbstractCrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LinkService implementation class
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LinkServiceImpl extends AbstractCrudService<Link, Integer> implements LinkService {
|
||||||
|
|
||||||
|
private LinkRepository linkRepository;
|
||||||
|
|
||||||
|
public LinkServiceImpl(LinkRepository linkRepository) {
|
||||||
|
super(linkRepository);
|
||||||
|
this.linkRepository = linkRepository;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cc.ryanc.halo.service.impl;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.entity.Log;
|
||||||
|
import cc.ryanc.halo.repository.LogRepository;
|
||||||
|
import cc.ryanc.halo.service.LogService;
|
||||||
|
import cc.ryanc.halo.service.base.AbstractCrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LogService implementation class
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LogServiceImpl extends AbstractCrudService<Log, Long> implements LogService {
|
||||||
|
|
||||||
|
private LogRepository logRepository;
|
||||||
|
|
||||||
|
public LogServiceImpl(LogRepository logRepository) {
|
||||||
|
super(logRepository);
|
||||||
|
this.logRepository = logRepository;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cc.ryanc.halo.service.impl;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.entity.Menu;
|
||||||
|
import cc.ryanc.halo.repository.MenuRepository;
|
||||||
|
import cc.ryanc.halo.service.MenuService;
|
||||||
|
import cc.ryanc.halo.service.base.AbstractCrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MenuService implementation class
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MenuServiceImpl extends AbstractCrudService<Menu, Integer> implements MenuService {
|
||||||
|
|
||||||
|
private MenuRepository menuRepository;
|
||||||
|
|
||||||
|
public MenuServiceImpl(MenuRepository menuRepository) {
|
||||||
|
super(menuRepository);
|
||||||
|
this.menuRepository = menuRepository;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cc.ryanc.halo.service.impl;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.entity.Option;
|
||||||
|
import cc.ryanc.halo.repository.OptionRepository;
|
||||||
|
import cc.ryanc.halo.service.OptionService;
|
||||||
|
import cc.ryanc.halo.service.base.AbstractCrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OptionService implementation class
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OptionServiceImpl extends AbstractCrudService<Option, Integer> implements OptionService {
|
||||||
|
|
||||||
|
private OptionRepository optionRepository;
|
||||||
|
|
||||||
|
public OptionServiceImpl(OptionRepository optionRepository) {
|
||||||
|
super(optionRepository);
|
||||||
|
this.optionRepository = optionRepository;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cc.ryanc.halo.service.impl;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.entity.Tag;
|
||||||
|
import cc.ryanc.halo.repository.TagRepository;
|
||||||
|
import cc.ryanc.halo.service.TagService;
|
||||||
|
import cc.ryanc.halo.service.base.AbstractCrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TagService implementation class
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TagServiceImpl extends AbstractCrudService<Tag, Integer> implements TagService {
|
||||||
|
|
||||||
|
private TagRepository tagRepository;
|
||||||
|
|
||||||
|
public TagServiceImpl(TagRepository tagRepository) {
|
||||||
|
super(tagRepository);
|
||||||
|
this.tagRepository = tagRepository;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cc.ryanc.halo.service.impl;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.entity.User;
|
||||||
|
import cc.ryanc.halo.repository.UserRepository;
|
||||||
|
import cc.ryanc.halo.service.UserService;
|
||||||
|
import cc.ryanc.halo.service.base.AbstractCrudService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UserService implementation class
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserServiceImpl extends AbstractCrudService<User, Integer> implements UserService {
|
||||||
|
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
|
public UserServiceImpl(UserRepository userRepository) {
|
||||||
|
super(userRepository);
|
||||||
|
this.userRepository = userRepository;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.service.AttachmentService;
|
||||||
|
import cc.ryanc.halo.service.CommentService;
|
||||||
|
import cc.ryanc.halo.service.PostService;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Admin controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin")
|
||||||
|
public class AdminController {
|
||||||
|
|
||||||
|
private final PostService postService;
|
||||||
|
|
||||||
|
private final CommentService commentService;
|
||||||
|
|
||||||
|
private final AttachmentService attachmentService;
|
||||||
|
|
||||||
|
public AdminController(PostService postService,
|
||||||
|
CommentService commentService,
|
||||||
|
AttachmentService attachmentService) {
|
||||||
|
this.postService = postService;
|
||||||
|
this.commentService = commentService;
|
||||||
|
this.attachmentService = attachmentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* admin dashboard
|
||||||
|
*
|
||||||
|
* @param model model
|
||||||
|
* @return template path: admin/admin_index.ftl
|
||||||
|
*/
|
||||||
|
@GetMapping(value = {"", "/index"})
|
||||||
|
public String admin(Model model) {
|
||||||
|
final Long postsCount = postService.count();
|
||||||
|
final Long commentsCount = commentService.count();
|
||||||
|
final Long attachmentsCount = attachmentService.count();
|
||||||
|
|
||||||
|
model.addAttribute("postsCount", postsCount);
|
||||||
|
model.addAttribute("commentsCount", commentsCount);
|
||||||
|
model.addAttribute("attachmentsCount", attachmentsCount);
|
||||||
|
return "admin/admin_index";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.service.AttachmentService;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attachments controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/attachments")
|
||||||
|
public class AttachmentController {
|
||||||
|
|
||||||
|
private AttachmentService attachmentService;
|
||||||
|
|
||||||
|
public AttachmentController(AttachmentService attachmentService) {
|
||||||
|
this.attachmentService = attachmentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* attachments list
|
||||||
|
*
|
||||||
|
* @return template path: admin/admin_attachment
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public String attachments() {
|
||||||
|
return "admin/admin_attachment";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backup controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/backup")
|
||||||
|
public class BackupController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* backup manage
|
||||||
|
*
|
||||||
|
* @return template path: admin/admin_backup.ftl
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public String backup() {
|
||||||
|
return "admin/admin_backup";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.service.CategoryService;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Categories controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/categories")
|
||||||
|
public class CategoryController {
|
||||||
|
|
||||||
|
private final CategoryService categoryService;
|
||||||
|
|
||||||
|
public CategoryController(CategoryService categoryService) {
|
||||||
|
this.categoryService = categoryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* categories manage
|
||||||
|
*
|
||||||
|
* @return template path: admin/admin_category.ftl
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public String categories() {
|
||||||
|
return "admin/admin_category";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comments controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/comments")
|
||||||
|
public class CommentController {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Menus controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/menus")
|
||||||
|
public class MenuController {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/options")
|
||||||
|
public class OptionController {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pages controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/pages")
|
||||||
|
public class PageController {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Posts controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/posts")
|
||||||
|
public class PostController {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tags controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/tags")
|
||||||
|
public class TagController {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Themes controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/themes")
|
||||||
|
public class ThemeController {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User controller
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019-03-14
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/admin/user")
|
||||||
|
public class UserController {
|
||||||
|
}
|
Loading…
Reference in New Issue