فهرست منبع

更新排序字段

shuzheng 9 سال پیش
والد
کامیت
f3b70ff34e

+ 4 - 2
cms/cms-web/src/main/java/com/zheng/cms/controller/CmsArticleController.java

@@ -50,7 +50,7 @@ public class CmsArticleController extends BaseController {
 		CmsArticleExample cmsArticleExample = new CmsArticleExample();
 		CmsArticleExample cmsArticleExample = new CmsArticleExample();
 		cmsArticleExample.setOffset((page - 1) * rows);
 		cmsArticleExample.setOffset((page - 1) * rows);
 		cmsArticleExample.setLimit(rows);
 		cmsArticleExample.setLimit(rows);
-		cmsArticleExample.setOrderByClause("article_id desc");
+		cmsArticleExample.setOrderByClause("orders desc");
 		List<CmsArticle> articles = cmsArticleService.getMapper().selectByExample(cmsArticleExample);
 		List<CmsArticle> articles = cmsArticleService.getMapper().selectByExample(cmsArticleExample);
 
 
 		// 分页对象
 		// 分页对象
@@ -85,7 +85,9 @@ public class CmsArticleController extends BaseController {
 			}
 			}
 			return "/article/add";
 			return "/article/add";
 		}
 		}
-		cmsArticle.setCtime(System.currentTimeMillis());
+		long time = System.currentTimeMillis();
+		cmsArticle.setCtime(time);
+		cmsArticle.setOrders(time);
 		cmsArticleService.getMapper().insertSelective(cmsArticle);
 		cmsArticleService.getMapper().insertSelective(cmsArticle);
 		_log.info("新增记录id为:{}", cmsArticle.getArticleId());
 		_log.info("新增记录id为:{}", cmsArticle.getArticleId());
 		return "redirect:/article/list";
 		return "redirect:/article/list";

+ 4 - 2
cms/cms-web/src/main/java/com/zheng/cms/controller/CmsCategoryController.java

@@ -50,7 +50,7 @@ public class CmsCategoryController extends BaseController {
 		CmsCategoryExample cmsCategoryExample = new CmsCategoryExample();
 		CmsCategoryExample cmsCategoryExample = new CmsCategoryExample();
 		cmsCategoryExample.setOffset((page - 1) * rows);
 		cmsCategoryExample.setOffset((page - 1) * rows);
 		cmsCategoryExample.setLimit(rows);
 		cmsCategoryExample.setLimit(rows);
-		cmsCategoryExample.setOrderByClause("category_id desc");
+		cmsCategoryExample.setOrderByClause("orders desc");
 		List<CmsCategory> categorys = cmsCategoryService.getMapper().selectByExample(cmsCategoryExample);
 		List<CmsCategory> categorys = cmsCategoryService.getMapper().selectByExample(cmsCategoryExample);
 
 
 		// 分页对象
 		// 分页对象
@@ -85,7 +85,9 @@ public class CmsCategoryController extends BaseController {
 			}
 			}
 			return "/category/add";
 			return "/category/add";
 		}
 		}
-		cmsCategory.setCtime(System.currentTimeMillis());
+		long time = System.currentTimeMillis();
+		cmsCategory.setCtime(time);
+		cmsCategory.setOrders(time);
 		cmsCategoryService.getMapper().insertSelective(cmsCategory);
 		cmsCategoryService.getMapper().insertSelective(cmsCategory);
 		_log.info("新增记录id为:{}", cmsCategory.getCategoryId());
 		_log.info("新增记录id为:{}", cmsCategory.getCategoryId());
 		return "redirect:/category/list";
 		return "redirect:/category/list";

+ 3 - 3
cms/cms-web/src/main/java/com/zheng/cms/controller/CmsCommentController.java

@@ -52,14 +52,14 @@ public class CmsCommentController extends BaseController {
 		CmsCommentExample cmsCommentExample = new CmsCommentExample();
 		CmsCommentExample cmsCommentExample = new CmsCommentExample();
 		cmsCommentExample.setOffset((page - 1) * rows);
 		cmsCommentExample.setOffset((page - 1) * rows);
 		cmsCommentExample.setLimit(rows);
 		cmsCommentExample.setLimit(rows);
-		cmsCommentExample.setOrderByClause("comment_id desc");
-		List<CmsComment> tags = cmsCommentService.getMapper().selectByExample(cmsCommentExample);
+		cmsCommentExample.setOrderByClause("orders desc");
+		List<CmsComment> comments = cmsCommentService.getMapper().selectByExample(cmsCommentExample);
 
 
 		// 分页对象
 		// 分页对象
 		long total = cmsCommentService.getMapper().countByExample(cmsCommentExample);
 		long total = cmsCommentService.getMapper().countByExample(cmsCommentExample);
 		Paginator paginator = new Paginator(total, page, rows, request);
 		Paginator paginator = new Paginator(total, page, rows, request);
 
 
-		model.addAttribute("tags", tags);
+		model.addAttribute("comments", comments);
 		model.addAttribute("paginator", paginator);
 		model.addAttribute("paginator", paginator);
 		return "/comment/list";
 		return "/comment/list";
 	}
 	}