zheng-cms前台删除后台代码
This commit is contained in:
parent
e779caa7e1
commit
bdd46f53ee
|
@ -1,35 +0,0 @@
|
|||
package com.zheng.cms.web.Interceptor;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 后台过滤器
|
||||
* Created by ZhangShuzheng on 2016/10/17.
|
||||
*/
|
||||
public class ManageInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
private static Logger _log = LoggerFactory.getLogger(ManageInterceptor.class);
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
_log.info("ManageInterceptor==>preHandle");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
package com.zheng.cms.web.controller.manage;
|
||||
|
||||
import com.zheng.cms.web.controller.BaseController;
|
||||
import com.zheng.cms.dao.model.CmsArticle;
|
||||
import com.zheng.cms.dao.model.CmsArticleExample;
|
||||
import com.zheng.cms.rpc.api.CmsArticleService;
|
||||
import com.zheng.common.util.Paginator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文章控制器
|
||||
* Created by shuzheng on 2016/11/14.
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/manage/article")
|
||||
public class CmsArticleController extends BaseController {
|
||||
|
||||
private final static Logger _log = LoggerFactory.getLogger(CmsArticleController.class);
|
||||
|
||||
@Autowired
|
||||
private CmsArticleService cmsArticleService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param page 当前页码
|
||||
* @param rows 每页条数
|
||||
* @param desc 降序排序
|
||||
* @param request
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(
|
||||
@RequestParam(required = false, defaultValue = "1", value = "page") int page,
|
||||
@RequestParam(required = false, defaultValue = "20", value = "rows") int rows,
|
||||
@RequestParam(required = false, defaultValue = "true", value = "desc") boolean desc,
|
||||
HttpServletRequest request, ModelMap modelMap) {
|
||||
|
||||
// 数据列表
|
||||
CmsArticleExample cmsArticleExample = new CmsArticleExample();
|
||||
cmsArticleExample.setOffset((page - 1) * rows);
|
||||
cmsArticleExample.setLimit(rows);
|
||||
cmsArticleExample.setOrderByClause(desc ? "orders desc" : "orders asc");
|
||||
List<CmsArticle> articles = cmsArticleService.selectByExample(cmsArticleExample);
|
||||
|
||||
// 分页对象
|
||||
long total = cmsArticleService.countByExample(cmsArticleExample);
|
||||
Paginator paginator = new Paginator(total, page, rows, request);
|
||||
|
||||
modelMap.put("articles", articles);
|
||||
modelMap.put("paginator", paginator);
|
||||
return "/manage/article/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增get
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.GET)
|
||||
public String add() {
|
||||
return "/manage/article/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增post
|
||||
* @param cmsArticle
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public String add(CmsArticle cmsArticle, ModelMap modelMap) {
|
||||
long time = System.currentTimeMillis();
|
||||
cmsArticle.setCtime(time);
|
||||
cmsArticle.setOrders(time);
|
||||
int count = cmsArticleService.insertSelective(cmsArticle);
|
||||
modelMap.put("count", count);
|
||||
_log.info("新增记录id为:{}", cmsArticle.getArticleId());
|
||||
return "redirect:/manage/article/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete/{ids}",method = RequestMethod.GET)
|
||||
public String delete(@PathVariable("ids") String ids, ModelMap modelMap) {
|
||||
int count = cmsArticleService.deleteByPrimaryKeys(ids);
|
||||
modelMap.put("count", count);
|
||||
return "redirect:/manage/article/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改get
|
||||
* @param id
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
|
||||
public String update(@PathVariable("id") int id, ModelMap modelMap) {
|
||||
CmsArticle article = cmsArticleService.selectByPrimaryKey(id);
|
||||
modelMap.put("article", article);
|
||||
return "/manage/article/update";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改post
|
||||
* @param id
|
||||
* @param cmsArticle
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
public String update(@PathVariable("id") int id, CmsArticle cmsArticle, ModelMap modelMap) {
|
||||
int count = cmsArticleService.updateByPrimaryKeySelective(cmsArticle);
|
||||
modelMap.put("count", count);
|
||||
modelMap.put("id", id);
|
||||
return "redirect:/manage/article/list";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
package com.zheng.cms.web.controller.manage;
|
||||
|
||||
import com.zheng.cms.web.controller.BaseController;
|
||||
import com.zheng.cms.dao.model.CmsCategory;
|
||||
import com.zheng.cms.dao.model.CmsCategoryExample;
|
||||
import com.zheng.cms.rpc.api.CmsCategoryService;
|
||||
import com.zheng.common.util.Paginator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类目控制器
|
||||
* Created by shuzheng on 2016/11/14.
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/manage/category")
|
||||
public class CmsCategoryController extends BaseController {
|
||||
|
||||
private final static Logger _log = LoggerFactory.getLogger(CmsCategoryController.class);
|
||||
|
||||
@Autowired
|
||||
private CmsCategoryService cmsCategoryService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param page 当前页码
|
||||
* @param rows 每页条数
|
||||
* @param desc 降序排序
|
||||
* @param request
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(
|
||||
@RequestParam(required = false, defaultValue = "1", value = "page") int page,
|
||||
@RequestParam(required = false, defaultValue = "20", value = "rows") int rows,
|
||||
@RequestParam(required = false, defaultValue = "false", value = "desc") boolean desc,
|
||||
HttpServletRequest request, ModelMap modelMap) {
|
||||
|
||||
// 数据列表
|
||||
CmsCategoryExample cmsCategoryExample = new CmsCategoryExample();
|
||||
cmsCategoryExample.setOffset((page - 1) * rows);
|
||||
cmsCategoryExample.setLimit(rows);
|
||||
cmsCategoryExample.setOrderByClause(desc ? "orders desc" : "orders asc");
|
||||
List<CmsCategory> categorys = cmsCategoryService.selectByExample(cmsCategoryExample);
|
||||
|
||||
// 分页对象
|
||||
long total = cmsCategoryService.countByExample(cmsCategoryExample);
|
||||
Paginator paginator = new Paginator(total, page, rows, request);
|
||||
|
||||
modelMap.put("categorys", categorys);
|
||||
modelMap.put("paginator", paginator);
|
||||
return "/manage/category/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增get
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.GET)
|
||||
public String add() {
|
||||
return "/manage/category/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增post
|
||||
* @param cmsCategory
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public String add(CmsCategory cmsCategory, ModelMap modelMap) {
|
||||
long time = System.currentTimeMillis();
|
||||
cmsCategory.setCtime(time);
|
||||
cmsCategory.setOrders(time);
|
||||
int count = cmsCategoryService.insertSelective(cmsCategory);
|
||||
modelMap.put("count", count);
|
||||
_log.info("新增记录id为:{}", cmsCategory.getCategoryId());
|
||||
return "redirect:/manage/category/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete/{ids}",method = RequestMethod.GET)
|
||||
public String delete(@PathVariable("ids") String ids, ModelMap modelMap) {
|
||||
int count = cmsCategoryService.deleteByPrimaryKeys(ids);
|
||||
modelMap.put("count", count);
|
||||
return "redirect:/manage/category/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改get
|
||||
* @param id
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
|
||||
public String update(@PathVariable("id") int id, ModelMap modelMap) {
|
||||
CmsCategory category = cmsCategoryService.selectByPrimaryKey(id);
|
||||
modelMap.put("category", category);
|
||||
return "/manage/category/update";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改post
|
||||
* @param id
|
||||
* @param cmsCategory
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
public String update(@PathVariable("id") int id, CmsCategory cmsCategory, ModelMap modelMap) {
|
||||
int count = cmsCategoryService.updateByPrimaryKeySelective(cmsCategory);
|
||||
modelMap.put("count", count);
|
||||
modelMap.put("id", id);
|
||||
return "redirect:/manage/category/list";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
package com.zheng.cms.web.controller.manage;
|
||||
|
||||
import com.zheng.cms.web.controller.BaseController;
|
||||
import com.zheng.cms.dao.model.CmsComment;
|
||||
import com.zheng.cms.dao.model.CmsCommentExample;
|
||||
import com.zheng.cms.rpc.api.CmsCommentService;
|
||||
import com.zheng.common.util.Paginator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 评论控制器
|
||||
* Created by shuzheng on 2016/11/14.
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/manage/comment")
|
||||
public class CmsCommentController extends BaseController {
|
||||
|
||||
private final static Logger _log = LoggerFactory.getLogger(CmsCommentController.class);
|
||||
|
||||
@Autowired
|
||||
private CmsCommentService cmsCommentService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param page 当前页码
|
||||
* @param rows 每页条数
|
||||
* @param desc 降序排序
|
||||
* @param request
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(
|
||||
@RequestParam(required = false, defaultValue = "1", value = "page") int page,
|
||||
@RequestParam(required = false, defaultValue = "20", value = "rows") int rows,
|
||||
@RequestParam(required = false, defaultValue = "true", value = "desc") boolean desc,
|
||||
HttpServletRequest request, ModelMap modelMap) {
|
||||
|
||||
// 数据列表
|
||||
CmsCommentExample cmsCommentExample = new CmsCommentExample();
|
||||
cmsCommentExample.setOffset((page - 1) * rows);
|
||||
cmsCommentExample.setLimit(rows);
|
||||
cmsCommentExample.setOrderByClause(desc ? "comment_id desc" : "comment_id asc");
|
||||
List<CmsComment> comments = cmsCommentService.selectByExample(cmsCommentExample);
|
||||
|
||||
// 分页对象
|
||||
long total = cmsCommentService.countByExample(cmsCommentExample);
|
||||
Paginator paginator = new Paginator(total, page, rows, request);
|
||||
|
||||
modelMap.put("comments", comments);
|
||||
modelMap.put("paginator", paginator);
|
||||
return "/manage/comment/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增get
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.GET)
|
||||
public String add() {
|
||||
return "/manage/comment/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增post
|
||||
* @param cmsComment
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public String add(CmsComment cmsComment, ModelMap modelMap) {
|
||||
cmsComment.setCtime(System.currentTimeMillis());
|
||||
int count = cmsCommentService.insertSelective(cmsComment);
|
||||
modelMap.put("count", count);
|
||||
_log.info("新增记录id为:{}", cmsComment.getArticleId());
|
||||
return "redirect:/manage/comment/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete/{ids}",method = RequestMethod.GET)
|
||||
public String delete(@PathVariable("ids") String ids, ModelMap modelMap) {
|
||||
int count = cmsCommentService.deleteByPrimaryKeys(ids);
|
||||
modelMap.put("count", count);
|
||||
return "redirect:/manage/comment/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改get
|
||||
* @param id
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
|
||||
public String update(@PathVariable("id") int id, ModelMap modelMap) {
|
||||
CmsComment comment = cmsCommentService.selectByPrimaryKey(id);
|
||||
modelMap.put("comment", comment);
|
||||
return "/manage/comment/update";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改post
|
||||
* @param id
|
||||
* @param cmsComment
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
public String update(@PathVariable("id") int id, CmsComment cmsComment, ModelMap modelMap) {
|
||||
int count = cmsCommentService.updateByPrimaryKeySelective(cmsComment);
|
||||
modelMap.put("count", count);
|
||||
modelMap.put("id", id);
|
||||
return "redirect:/manage/comment/list";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
package com.zheng.cms.web.controller.manage;
|
||||
|
||||
import com.zheng.cms.web.controller.BaseController;
|
||||
import com.zheng.cms.dao.model.CmsTag;
|
||||
import com.zheng.cms.dao.model.CmsTagExample;
|
||||
import com.zheng.cms.rpc.api.CmsTagService;
|
||||
import com.zheng.common.util.Paginator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 标签控制器
|
||||
* Created by shuzheng on 2016/11/14.
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/manage/tag")
|
||||
public class CmsTagController extends BaseController {
|
||||
|
||||
private final static Logger _log = LoggerFactory.getLogger(CmsTagController.class);
|
||||
|
||||
@Autowired
|
||||
private CmsTagService cmsTagService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param page 当前页码
|
||||
* @param rows 每页条数
|
||||
* @param desc 降序排序
|
||||
* @param request
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(
|
||||
@RequestParam(required = false, defaultValue = "1", value = "page") int page,
|
||||
@RequestParam(required = false, defaultValue = "20", value = "rows") int rows,
|
||||
@RequestParam(required = false, defaultValue = "false", value = "desc") boolean desc,
|
||||
HttpServletRequest request, ModelMap modelMap) {
|
||||
|
||||
// 数据列表
|
||||
CmsTagExample cmsTagExample = new CmsTagExample();
|
||||
cmsTagExample.setOffset((page - 1) * rows);
|
||||
cmsTagExample.setLimit(rows);
|
||||
cmsTagExample.setOrderByClause(desc ? "orders desc" : "orders asc");
|
||||
List<CmsTag> tags = cmsTagService.selectByExample(cmsTagExample);
|
||||
|
||||
// 分页对象
|
||||
long total = cmsTagService.countByExample(cmsTagExample);
|
||||
Paginator paginator = new Paginator(total, page, rows, request);
|
||||
|
||||
modelMap.put("tags", tags);
|
||||
modelMap.put("paginator", paginator);
|
||||
return "/manage/tag/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增get
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.GET)
|
||||
public String add() {
|
||||
return "/manage/tag/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增post
|
||||
* @param cmsTag
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public String add(CmsTag cmsTag, ModelMap modelMap) {
|
||||
long time = System.currentTimeMillis();
|
||||
cmsTag.setCtime(time);
|
||||
cmsTag.setOrders(time);
|
||||
int count = cmsTagService.insertSelective(cmsTag);
|
||||
modelMap.put("count", count);
|
||||
_log.info("新增记录id为:{}", cmsTag.getTagId());
|
||||
return "redirect:/manage/tag/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete/{ids}",method = RequestMethod.GET)
|
||||
public String delete(@PathVariable("ids") String ids, ModelMap modelMap) {
|
||||
int count = cmsTagService.deleteByPrimaryKeys(ids);
|
||||
modelMap.put("count", count);
|
||||
return "redirect:/manage/tag/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改get
|
||||
* @param id
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
|
||||
public String update(@PathVariable("id") int id, ModelMap modelMap) {
|
||||
CmsTag tag = cmsTagService.selectByPrimaryKey(id);
|
||||
modelMap.put("tag", tag);
|
||||
return "/manage/tag/update";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改post
|
||||
* @param id
|
||||
* @param cmsTag
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
public String update(@PathVariable("id") int id, CmsTag cmsTag, ModelMap modelMap) {
|
||||
int count = cmsTagService.updateByPrimaryKeySelective(cmsTag);
|
||||
modelMap.put("count", count);
|
||||
modelMap.put("id", id);
|
||||
return "redirect:/manage/tag/list";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue