2021年12月13日14:05:28
parent
9fc1132bbe
commit
156dd5b8b4
|
|
@ -0,0 +1,55 @@
|
|||
package com.zhangmeng.admin.manager.controller;
|
||||
|
||||
import com.zhangmeng.admin.manager.feign.ArticleFeign;
|
||||
import com.zhangmeng.admin.manager.feign.CategoryFeign;
|
||||
import com.zhangmeng.model.base.baseController.BaseController;
|
||||
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
||||
import com.zhangmeng.model.entity.Article;
|
||||
import com.zhangmeng.model.entity.Category;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/article")
|
||||
public class ArticleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CategoryFeign categoryFeign;
|
||||
|
||||
@Autowired
|
||||
private ArticleFeign articleFeign;
|
||||
|
||||
@GetMapping("/index")
|
||||
public ModelAndView article_index(Model model, Long categoryId) {
|
||||
List<Category> categoryList = this.categoryFeign.findAll();
|
||||
model.addAttribute("categoryList", categoryList);
|
||||
model.addAttribute("categoryId", categoryId == null ? 0L : categoryId);
|
||||
return this.jumpPage("admin/article/list");
|
||||
}
|
||||
|
||||
@GetMapping("/add")
|
||||
public ModelAndView article_add(Model model) {
|
||||
//查询分类
|
||||
List<Category> categoryList = this.categoryFeign.findAll();
|
||||
model.addAttribute("categoryList", categoryList);
|
||||
return this.jumpPage("admin/article/add");
|
||||
}
|
||||
|
||||
@GetMapping("/edit")
|
||||
public ModelAndView article_edit(Model model, String articleId) {
|
||||
if (CommonUtil.isNotNull(articleId)) {
|
||||
Article article = this.articleFeign.findById(Long.parseLong(articleId));
|
||||
model.addAttribute("article", article);
|
||||
//查询分类
|
||||
List<Category> categoryList = this.categoryFeign.findAll();
|
||||
model.addAttribute("categoryList", categoryList);
|
||||
}
|
||||
return this.jumpPage("admin/article/edit");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.zhangmeng.admin.manager.controller;
|
||||
|
||||
import com.zhangmeng.admin.manager.feign.ArticleFeign;
|
||||
import com.zhangmeng.model.base.baseController.BaseController;
|
||||
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
||||
import com.zhangmeng.model.entity.Article;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/blog")
|
||||
public class BlogController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ArticleFeign articleFeign;
|
||||
|
||||
@GetMapping("/index")
|
||||
public ModelAndView index(Model model, Integer pageNum, Integer pageSize) {
|
||||
if (pageNum == null) {
|
||||
pageNum = CommonUtil.pageNum;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = CommonUtil.pageSize;
|
||||
}
|
||||
Map<String, Object> map = this.articleFeign.getListByPage(pageNum, pageSize);
|
||||
model.addAllAttributes(map);
|
||||
return this.jumpPage("blog/v1/index");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/details/{id}")
|
||||
public ModelAndView blog_details(Model model,@PathVariable("id") Long id) {
|
||||
model.addAllAttributes(this.articleFeign.blog_common_page());//页面公共部分
|
||||
model.addAllAttributes(this.articleFeign.comment_list(id));//详情获取评论
|
||||
Article article = this.articleFeign.findById(id);
|
||||
model.addAttribute("article",article);
|
||||
return this.jumpPage("blog/v1/details");
|
||||
}
|
||||
|
||||
@GetMapping("/category")
|
||||
public ModelAndView blog_category(Model model){
|
||||
Map<String,Object> map = this.articleFeign.blog_common_page();
|
||||
model.addAllAttributes(map);
|
||||
return this.jumpPage("blog/v1/category");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.zhangmeng.admin.manager.controller;
|
||||
|
||||
import com.zhangmeng.admin.manager.feign.CategoryFeign;
|
||||
import com.zhangmeng.model.base.baseController.BaseController;
|
||||
import com.zhangmeng.model.entity.Category;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/category")
|
||||
public class CategoryController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CategoryFeign categoryFeign;
|
||||
|
||||
@GetMapping("/index")
|
||||
public ModelAndView category_index() {
|
||||
return this.jumpPage("admin/category/list");
|
||||
}
|
||||
|
||||
@GetMapping("/add")
|
||||
public ModelAndView category_add(Model model) {
|
||||
Category.Type[] values = Category.Type.values();
|
||||
model.addAttribute("categoryTypeList", values);
|
||||
return this.jumpPage("admin/category/add");
|
||||
}
|
||||
|
||||
@GetMapping("/edit")
|
||||
public ModelAndView category_edit(Model model, String categoryId) {
|
||||
Category.Type[] values = Category.Type.values();
|
||||
model.addAttribute("categoryTypeList", values);
|
||||
Category category = null;
|
||||
if (categoryId != null && !categoryId.equals("")) {
|
||||
category = this.categoryFeign.findById(Long.parseLong(categoryId));
|
||||
}
|
||||
model.addAttribute("category", category);
|
||||
return this.jumpPage("admin/category/edit");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.zhangmeng.admin.manager.controller;
|
||||
|
||||
import com.zhangmeng.model.base.baseController.BaseController;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/file")
|
||||
public class FileController extends BaseController {
|
||||
|
||||
@GetMapping("/index")
|
||||
public ModelAndView file_index() {
|
||||
return this.jumpPage("admin/file/list");
|
||||
}
|
||||
|
||||
@GetMapping("/add")
|
||||
public ModelAndView file_add() {
|
||||
return this.jumpPage("admin/file/add");
|
||||
}
|
||||
|
||||
@GetMapping("/upload")
|
||||
public ModelAndView file_upload() {
|
||||
return this.jumpPage("admin/file/upload");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.zhangmeng.admin.manager.controller;
|
||||
|
||||
import com.zhangmeng.admin.manager.feign.MailFeign;
|
||||
import com.zhangmeng.model.base.baseController.BaseController;
|
||||
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
||||
import com.zhangmeng.model.dto.system.SysConstant;
|
||||
import com.zhangmeng.model.entity.Mail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(SysConstant.mail_prefix)
|
||||
public class MailController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private MailFeign mailFeign;
|
||||
|
||||
@GetMapping( "/index")
|
||||
public ModelAndView mail_index() {
|
||||
return this.jumpPage("admin/mail/list");
|
||||
}
|
||||
|
||||
@GetMapping( "/add")
|
||||
public ModelAndView mail_add() {
|
||||
return this.jumpPage("admin/mail/add");
|
||||
}
|
||||
|
||||
@GetMapping("/edit")
|
||||
public ModelAndView mail_edit(String mail_id, Model model) {
|
||||
if (mail_id != null) {
|
||||
Mail mail = this.mailFeign.findById(Long.parseLong(mail_id));
|
||||
if (CommonUtil.isNotNull(mail)) {
|
||||
model.addAttribute("mail", mail);
|
||||
}
|
||||
}
|
||||
return this.jumpPage("admin/mail/edit");
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,9 @@ import com.zhangmeng.model.vo.Result;
|
|||
import com.zhangmeng.model.vo.ResultTree;
|
||||
import com.zhangmeng.model.vo.StatusCode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import tk.mybatis.mapper.entity.Condition;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
|
|
@ -28,6 +30,29 @@ public class PermissionController extends BaseController implements PermissionCo
|
|||
@Autowired
|
||||
private UserUtil userUtil;
|
||||
|
||||
|
||||
@GetMapping("/index")
|
||||
public ModelAndView permission_index() {
|
||||
return this.jumpPage("admin/permission/list");
|
||||
}
|
||||
|
||||
@GetMapping("/add")
|
||||
public ModelAndView permission_add(Model model) {
|
||||
model.addAttribute("permissionTypeList", Permission.Type.valueListMap());
|
||||
return this.jumpPage("admin/permission/add");
|
||||
}
|
||||
|
||||
@GetMapping("/edit")
|
||||
public ModelAndView permission_edit(Model model, String permissionId) {
|
||||
if (CommonUtil.isNotNull(permissionId)) {
|
||||
Permission permission = this.permissionService.findById(Long.parseLong(permissionId));
|
||||
model.addAttribute("permission", permission);
|
||||
model.addAttribute("permissionTypeList", Permission.Type.valueListMap());
|
||||
}
|
||||
return this.jumpPage("admin/permission/edit");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@GetMapping("/list")
|
||||
public Result list(Integer pageNum, Integer pageSize, String title) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package com.zhangmeng.admin.manager.controller;
|
||||
|
||||
import com.zhangmeng.admin.manager.feign.QuartzFeign;
|
||||
import com.zhangmeng.model.base.baseController.BaseController;
|
||||
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
||||
import com.zhangmeng.model.entity.QuartzJob;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/quartz")
|
||||
public class QuartzController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private QuartzFeign quartzFeign;
|
||||
|
||||
@GetMapping("/index")
|
||||
public ModelAndView quartz_index() {
|
||||
return this.jumpPage("admin/job/job-list");
|
||||
}
|
||||
|
||||
@GetMapping("/add")
|
||||
public ModelAndView quartz_add(Model model) {
|
||||
Set<String> names = this.quartzFeign.spring_bean_list();
|
||||
model.addAttribute("spring_bean_list", names);
|
||||
return this.jumpPage("admin/job/job-add");
|
||||
}
|
||||
|
||||
@GetMapping("/edit")
|
||||
public ModelAndView quartz_edit(Model model, String jobId) {
|
||||
Set<String> names = this.quartzFeign.spring_bean_list();
|
||||
model.addAttribute("spring_bean_list", names);
|
||||
if (CommonUtil.isNotNull(jobId)) {
|
||||
QuartzJob job = this.quartzFeign.findById(Long.parseLong(jobId));
|
||||
model.addAttribute("job", job);
|
||||
}
|
||||
return this.jumpPage("admin/job/job-edit");
|
||||
}
|
||||
}
|
||||
|
|
@ -30,6 +30,49 @@ public class RoleController extends BaseController implements RoleControllerApi
|
|||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
public ModelAndView index() {
|
||||
return this.jumpPage("admin/role/list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色添加
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public ModelAndView add(Model model) {
|
||||
model.addAttribute("roleStatusList", Role.Status.enumListMap());
|
||||
return this.jumpPage("admin/role/add");
|
||||
}
|
||||
|
||||
@GetMapping("/edit")
|
||||
public ModelAndView edit(Model model, String roleId) {
|
||||
if (roleId != null && !roleId.equals("")) {
|
||||
Role role = this.roleService.findById(Long.parseLong(roleId));
|
||||
model.addAttribute("roleTypeList", Role.Type.enumListMap());
|
||||
model.addAttribute("role", role);
|
||||
}
|
||||
return this.jumpPage("admin/role/edit");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/authorize")
|
||||
public ModelAndView authorize(Model model, String roleId) {
|
||||
if (roleId != null && !roleId.equals("")) {
|
||||
Role role = this.roleService.findById(Long.parseLong(roleId));
|
||||
model.addAttribute("roleTypeList", Role.Type.enumListMap());
|
||||
model.addAttribute("role", role);
|
||||
}
|
||||
return this.jumpPage("admin/role/authorize");
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping("/save")
|
||||
public Result save(@RequestParam @RequestBody Map<String, Object> map) {
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@ public class SysConfigController extends BaseController {
|
|||
|
||||
@GetMapping("/getSysConfig")
|
||||
public SysConfig getSysConfig(){
|
||||
SysConfig sysConfig = this.sysConfigService.getSysConfig();
|
||||
System.out.println(sysConfig);
|
||||
return sysConfig;
|
||||
|
||||
return this.sysConfigService.getSysConfig();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,203 +153,8 @@ public class UrlRequestController extends BaseController {
|
|||
return jumpPage("admin/home/home");
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/user/index")
|
||||
public ModelAndView user_index(Model model) {
|
||||
return this.jumpPage("admin/user/list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户添加
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/user/add")
|
||||
public ModelAndView user_add(Model model) {
|
||||
return this.jumpPage("admin/user/add");
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/user/edit")
|
||||
public ModelAndView user_edit(Model model, String userId) {
|
||||
if (userId != null && !userId.equals("")) {
|
||||
User user = this.userService.findById(Long.parseLong(userId));
|
||||
model.addAttribute("user", user);
|
||||
}
|
||||
return this.jumpPage("admin/user/edit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/role/index")
|
||||
public ModelAndView index() {
|
||||
return this.jumpPage("admin/role/list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色添加
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/role/add")
|
||||
public ModelAndView add(Model model) {
|
||||
model.addAttribute("roleStatusList", Role.Status.enumListMap());
|
||||
return this.jumpPage("admin/role/add");
|
||||
}
|
||||
|
||||
@GetMapping("/role/edit")
|
||||
public ModelAndView edit(Model model, String roleId) {
|
||||
if (roleId != null && !roleId.equals("")) {
|
||||
Role role = this.roleService.findById(Long.parseLong(roleId));
|
||||
model.addAttribute("roleTypeList", Role.Type.enumListMap());
|
||||
model.addAttribute("role", role);
|
||||
}
|
||||
return this.jumpPage("admin/role/edit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权
|
||||
*
|
||||
* @param model
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/role/authorize")
|
||||
public ModelAndView authorize(Model model, String roleId) {
|
||||
if (roleId != null && !roleId.equals("")) {
|
||||
Role role = this.roleService.findById(Long.parseLong(roleId));
|
||||
model.addAttribute("roleTypeList", Role.Type.enumListMap());
|
||||
model.addAttribute("role", role);
|
||||
}
|
||||
return this.jumpPage("admin/role/authorize");
|
||||
}
|
||||
|
||||
@GetMapping("/permission/index")
|
||||
public ModelAndView permission_index() {
|
||||
return this.jumpPage("admin/permission/list");
|
||||
}
|
||||
|
||||
@GetMapping("/permission/add")
|
||||
public ModelAndView permission_add(Model model) {
|
||||
model.addAttribute("permissionTypeList", Permission.Type.valueListMap());
|
||||
return this.jumpPage("admin/permission/add");
|
||||
}
|
||||
|
||||
@GetMapping("/permission/edit")
|
||||
public ModelAndView permission_edit(Model model, String permissionId) {
|
||||
if (CommonUtil.isNotNull(permissionId)) {
|
||||
Permission permission = this.permissionService.findById(Long.parseLong(permissionId));
|
||||
model.addAttribute("permission", permission);
|
||||
model.addAttribute("permissionTypeList", Permission.Type.valueListMap());
|
||||
}
|
||||
return this.jumpPage("admin/permission/edit");
|
||||
}
|
||||
|
||||
@GetMapping("/article/index")
|
||||
public ModelAndView article_index(Model model, Long categoryId) {
|
||||
List<Category> categoryList = this.categoryFeign.findAll();
|
||||
model.addAttribute("categoryList", categoryList);
|
||||
model.addAttribute("categoryId", categoryId == null ? 0L : categoryId);
|
||||
return this.jumpPage("admin/article/list");
|
||||
}
|
||||
|
||||
@GetMapping("/article/add")
|
||||
public ModelAndView article_add(Model model) {
|
||||
//查询分类
|
||||
List<Category> categoryList = this.categoryFeign.findAll();
|
||||
model.addAttribute("categoryList", categoryList);
|
||||
return this.jumpPage("admin/article/add");
|
||||
}
|
||||
|
||||
@GetMapping("/article/edit")
|
||||
public ModelAndView article_edit(Model model, String articleId) {
|
||||
if (CommonUtil.isNotNull(articleId)) {
|
||||
Article article = this.articleFeign.findById(Long.parseLong(articleId));
|
||||
model.addAttribute("article", article);
|
||||
//查询分类
|
||||
List<Category> categoryList = this.categoryFeign.findAll();
|
||||
model.addAttribute("categoryList", categoryList);
|
||||
}
|
||||
return this.jumpPage("admin/article/edit");
|
||||
}
|
||||
|
||||
@GetMapping("/category/index")
|
||||
public ModelAndView category_index() {
|
||||
return this.jumpPage("admin/category/list");
|
||||
}
|
||||
|
||||
@GetMapping("/category/add")
|
||||
public ModelAndView category_add(Model model) {
|
||||
Category.Type[] values = Category.Type.values();
|
||||
model.addAttribute("categoryTypeList", values);
|
||||
return this.jumpPage("admin/category/add");
|
||||
}
|
||||
|
||||
@GetMapping("/category/edit")
|
||||
public ModelAndView category_edit(Model model, String categoryId) {
|
||||
Category.Type[] values = Category.Type.values();
|
||||
model.addAttribute("categoryTypeList", values);
|
||||
Category category = null;
|
||||
if (categoryId != null && !categoryId.equals("")) {
|
||||
category = this.categoryFeign.findById(Long.parseLong(categoryId));
|
||||
}
|
||||
model.addAttribute("category", category);
|
||||
return this.jumpPage("admin/category/edit");
|
||||
}
|
||||
|
||||
@GetMapping("/file/index")
|
||||
public ModelAndView file_index() {
|
||||
return this.jumpPage("admin/file/list");
|
||||
}
|
||||
|
||||
@GetMapping("/file/add")
|
||||
public ModelAndView file_add() {
|
||||
return this.jumpPage("admin/file/add");
|
||||
}
|
||||
|
||||
@GetMapping("/file/upload")
|
||||
public ModelAndView file_upload() {
|
||||
return this.jumpPage("admin/file/upload");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/quartz/index")
|
||||
public ModelAndView quartz_index() {
|
||||
return this.jumpPage("admin/job/job-list");
|
||||
}
|
||||
|
||||
@GetMapping("/quartz/add")
|
||||
public ModelAndView quartz_add(Model model) {
|
||||
Set<String> names = this.quartzFeign.spring_bean_list();
|
||||
model.addAttribute("spring_bean_list", names);
|
||||
return this.jumpPage("admin/job/job-add");
|
||||
}
|
||||
|
||||
@GetMapping("/quartz/edit")
|
||||
public ModelAndView quartz_edit(Model model, String jobId) {
|
||||
Set<String> names = this.quartzFeign.spring_bean_list();
|
||||
model.addAttribute("spring_bean_list", names);
|
||||
if (CommonUtil.isNotNull(jobId)) {
|
||||
QuartzJob job = this.quartzFeign.findById(Long.parseLong(jobId));
|
||||
model.addAttribute("job", job);
|
||||
}
|
||||
return this.jumpPage("admin/job/job-edit");
|
||||
}
|
||||
|
||||
@GetMapping("/crypt/encrypt")
|
||||
public ModelAndView index(Model model) {
|
||||
|
|
@ -363,26 +168,7 @@ public class UrlRequestController extends BaseController {
|
|||
return this.jumpPage("admin/code/form");
|
||||
}
|
||||
|
||||
@GetMapping(SysConstant.mail_prefix + "/index")
|
||||
public ModelAndView mail_index() {
|
||||
return this.jumpPage("admin/mail/list");
|
||||
}
|
||||
|
||||
@GetMapping(SysConstant.mail_prefix + "/add")
|
||||
public ModelAndView mail_add() {
|
||||
return this.jumpPage("admin/mail/add");
|
||||
}
|
||||
|
||||
@GetMapping(SysConstant.mail_prefix + "/edit")
|
||||
public ModelAndView mail_edit(String mail_id, Model model) {
|
||||
if (mail_id != null) {
|
||||
Mail mail = this.mailFeign.findById(Long.parseLong(mail_id));
|
||||
if (CommonUtil.isNotNull(mail)) {
|
||||
model.addAttribute("mail", mail);
|
||||
}
|
||||
}
|
||||
return this.jumpPage("admin/mail/edit");
|
||||
}
|
||||
|
||||
@GetMapping(SysConstant.fiction_prefix + "/add")
|
||||
public ModelAndView add() {
|
||||
|
|
@ -497,35 +283,4 @@ public class UrlRequestController extends BaseController {
|
|||
String path = serviceInstance.getUri().toString();
|
||||
return new RedirectView(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 博客首页
|
||||
*
|
||||
* @param model
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/blog/index")
|
||||
public ModelAndView index(Model model, Integer pageNum, Integer pageSize) {
|
||||
if (pageNum == null) {
|
||||
pageNum = CommonUtil.pageNum;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = CommonUtil.pageSize;
|
||||
}
|
||||
Map<String, Object> map = this.articleFeign.getListByPage(pageNum, pageSize);
|
||||
model.addAllAttributes(map);
|
||||
return this.jumpPage("blog/v1/index");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/blog/details/{id}")
|
||||
public ModelAndView blog_details(Model model,@PathVariable("id") Long id) {
|
||||
Map<String,Object> map = this.articleFeign.blog_common_page(id);
|
||||
model.addAllAttributes(map);
|
||||
Article article = this.articleFeign.findById(id);
|
||||
model.addAttribute("article",article);
|
||||
return this.jumpPage("blog/v1/details");
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,9 @@ import com.zhangmeng.model.entity.User;
|
|||
import com.zhangmeng.model.vo.Result;
|
||||
import com.zhangmeng.model.vo.StatusCode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import tk.mybatis.mapper.entity.Condition;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
import com.zhangmeng.admin.manager.service.UserService;
|
||||
|
|
@ -37,6 +39,43 @@ public class UserController extends BaseController implements UserControllerApi
|
|||
@Autowired
|
||||
private UserUtil userUtil;
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
public ModelAndView user_index(Model model) {
|
||||
return this.jumpPage("admin/user/list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户添加
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public ModelAndView user_add(Model model) {
|
||||
return this.jumpPage("admin/user/add");
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/edit")
|
||||
public ModelAndView user_edit(Model model, String userId) {
|
||||
if (userId != null && !userId.equals("")) {
|
||||
User user = this.userService.findById(Long.parseLong(userId));
|
||||
model.addAttribute("user", user);
|
||||
}
|
||||
return this.jumpPage("admin/user/edit");
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping("/save")
|
||||
public Result save(@RequestParam @RequestBody Map<String, Object> parms) {
|
||||
|
|
@ -161,7 +200,7 @@ public class UserController extends BaseController implements UserControllerApi
|
|||
}
|
||||
|
||||
@Override
|
||||
@GetMapping("findByUserId")
|
||||
@GetMapping("/findByUserId")
|
||||
public User findByUserId(@RequestParam("userId") Long userId){
|
||||
return this.userService.findById(userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,5 +31,8 @@ public interface ArticleFeign {
|
|||
Map<String,Object> getListByPage(@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize);
|
||||
|
||||
@GetMapping("/article/blog_common_page")
|
||||
Map<String,Object> blog_common_page(@RequestParam("article_id") Long article_id);
|
||||
Map<String,Object> blog_common_page();
|
||||
|
||||
@GetMapping("/article/comment_list")
|
||||
public Map<String,Object> comment_list(@RequestParam("article_id") Long article_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,5 +42,8 @@ public interface ArticleControllerApi {
|
|||
Map<String,Object> getListByPage(@RequestParam Integer pageNum,@RequestParam Integer pageSize);
|
||||
|
||||
@ApiOperation("获取博客公共部分信息")
|
||||
public Map<String,Object> blog_common_page(@RequestParam("article_id") Long article_id);
|
||||
public Map<String,Object> blog_common_page();
|
||||
|
||||
@ApiOperation("根据文章获取评论")
|
||||
public Map<String,Object> comment_list(@RequestParam("article_id") Long article_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ public class ArticleController extends BaseController implements ArticleControll
|
|||
|
||||
@Override
|
||||
@GetMapping("/blog_common_page")
|
||||
public Map<String,Object> blog_common_page(@RequestParam("article_id") Long article_id){
|
||||
public Map<String,Object> blog_common_page(){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("title",this.blogTools.title());
|
||||
map.put("blog_count",blogTools.blog_count());
|
||||
|
|
@ -256,6 +256,13 @@ public class ArticleController extends BaseController implements ArticleControll
|
|||
map.put("latest_blog",blogTools.latest_blog());
|
||||
map.put("user",blogTools.userInfo());
|
||||
map.put("message",blogTools.message());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping("/comment_list")
|
||||
public Map<String,Object> comment_list(@RequestParam("article_id") Long article_id){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("commentModelList",blogTools.commentModelList(article_id));
|
||||
return map;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class BlogTools {
|
|||
Condition article_condition = new Condition(Article.class);
|
||||
Example.Criteria article_criteria = article_condition.createCriteria();
|
||||
article_criteria.andEqualTo("deleteStatus", false);
|
||||
PageInfo<Article> pageInfo = this.articleService.findByCondition(new QueryParams(1, 10, article_condition, "addTime desc"), true);
|
||||
PageInfo<Article> pageInfo = this.articleService.findByCondition(new QueryParams(1, 3, article_condition, "addTime desc"), true);
|
||||
return pageInfo.getList();
|
||||
}
|
||||
|
||||
|
|
@ -174,21 +174,6 @@ public class BlogTools {
|
|||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 博客标题
|
||||
*/
|
||||
public void title(ArticleModel articleModel) {
|
||||
SysConfig sysConfig = this.sysConfigFeign.getSysConfig();
|
||||
if (sysConfig != null) {
|
||||
String blogTitle = sysConfig.getBlogTitle();
|
||||
if (blogTitle != null && !blogTitle.equals("")) {
|
||||
title = blogTitle;
|
||||
}
|
||||
}
|
||||
articleModel.setBlog_title(title);
|
||||
articleModel.setMessage(message);
|
||||
}
|
||||
|
||||
public <T> QueryResult<T> queryResult(PageInfo pageInfo, List<T> list){
|
||||
if (pageInfo.getPrePage() == 0 ){
|
||||
pageInfo.setPrePage(1);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ mystyle:
|
|||
- /article/getListByPage
|
||||
- /article/findById
|
||||
- /article/blog_common_page
|
||||
- /article/comment_list
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
|
|
|
|||
|
|
@ -9,14 +9,8 @@ import java.util.List;
|
|||
@Data
|
||||
public class ArticleModel implements Serializable {
|
||||
|
||||
private Integer count;
|
||||
|
||||
private List<ArticleDto> articleDto_list;
|
||||
|
||||
private List<ArticleDto> latest_article_list;//最新推荐
|
||||
|
||||
private String blog_title;
|
||||
|
||||
//当前页
|
||||
private int pageNum;
|
||||
|
||||
|
|
@ -28,14 +22,4 @@ public class ArticleModel implements Serializable {
|
|||
|
||||
//下一页
|
||||
private int nextPage;
|
||||
|
||||
private String message;
|
||||
|
||||
private String QQ;
|
||||
|
||||
private String email;
|
||||
|
||||
private ArticleDto details;
|
||||
|
||||
List<CommentModel> commentModelList;//评论
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue