本文整理汇总了Java中com.zheng.cms.dao.model.CmsTopic类的典型用法代码示例。如果您正苦于以下问题:Java CmsTopic类的具体用法?Java CmsTopic怎么用?Java CmsTopic使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CmsTopic类属于com.zheng.cms.dao.model包,在下文中一共展示了CmsTopic类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: list
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list(
@RequestParam(required = false, defaultValue = "1", value = "page") int page,
HttpServletRequest request,
Model model) {
// 专题列表
int rows = 10;
CmsTopicExample cmsTopicExample = new CmsTopicExample();
List<CmsTopic> topics = cmsTopicService.selectByExampleForOffsetPage(cmsTopicExample, (page - 1) * rows, rows);
model.addAttribute("topics", topics);
// 文章总数
long total = cmsTopicService.countByExample(cmsTopicExample);
// 分页
Paginator paginator = new Paginator(total, page, rows, request);
model.addAttribute("paginator", paginator);
return thymeleaf("/topic/list");
}
示例2: list
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
@ApiOperation(value = "评论列表")
@RequiresPermissions("cms:topic:read")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, value = "sort") String sort,
@RequestParam(required = false, value = "order") String order) {
CmsTopicExample cmsTopicExample = new CmsTopicExample();
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
cmsTopicExample.setOrderByClause(sort + " " + order);
}
List<CmsTopic> rows = cmsTopicService.selectByExampleForOffsetPage(cmsTopicExample, offset, limit);
long total = cmsTopicService.countByExample(cmsTopicExample);
Map<String, Object> result = new HashMap<>();
result.put("rows", rows);
result.put("total", total);
return result;
}
示例3: create
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
@ApiOperation(value = "新增专题")
@RequiresPermissions("cms:topic:create")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public Object create(CmsTopic cmsTopic) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsTopic.getTitle(), new LengthValidator(1, 100, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
cmsTopic.setCtime(time);
int count = cmsTopicService.insertSelective(cmsTopic);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例4: update
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
@ApiOperation(value = "修改专题")
@RequiresPermissions("cms:topic:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, CmsTopic cmsTopic) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsTopic.getTitle(), new LengthValidator(1, 100, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
cmsTopic.setTopicId(id);
int count = cmsTopicService.updateByPrimaryKeySelective(cmsTopic);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例5: list
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
@ApiOperation(value = "评论列表")
@RequiresPermissions("cms:topic:read")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, value = "sort") String sort,
@RequestParam(required = false, value = "order") String order) {
CmsTopicExample cmsTopicExample = new CmsTopicExample();
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
cmsTopicExample.setOrderByClause(sort + " " + order);
}
List<CmsTopic> rows = cmsTopicService.selectByExampleForOffsetPage(cmsTopicExample, offset, limit);
long total = cmsTopicService.countByExample(cmsTopicExample);
Map<String, Object> result = new HashMap<>(2);
result.put("rows", rows);
result.put("total", total);
return result;
}
示例6: create
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
@ApiOperation(value = "新增文章")
@RequiresPermissions("cms:article:create")
@RequestMapping(value = "/create", method = RequestMethod.GET)
public String create(ModelMap modelMap) {
CmsTopicExample cmsTopicExample = new CmsTopicExample();
cmsTopicExample.setOrderByClause("ctime desc");
List<CmsTopic> cmsTopics = cmsTopicService.selectByExample(cmsTopicExample);
modelMap.put("cmsTopics", cmsTopics);
return "/manage/article/create.jsp";
}
示例7: update
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
@ApiOperation(value = "修改文章")
@RequiresPermissions("cms:article:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
public String update(@PathVariable("id") int id, ModelMap modelMap) {
CmsTopicExample cmsTopicExample = new CmsTopicExample();
cmsTopicExample.setOrderByClause("ctime desc");
List<CmsTopic> cmsTopics = cmsTopicService.selectByExample(cmsTopicExample);
CmsArticle article = cmsArticleService.selectByPrimaryKey(id);
modelMap.put("cmsTopics", cmsTopics);
modelMap.put("article", article);
return "/manage/article/update.jsp";
}
示例8: index
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
@RequestMapping(value = "{topicId}", method = RequestMethod.GET)
public String index(@PathVariable("topicId") int topicId, Model model) {
CmsTopic topic = cmsTopicService.selectByPrimaryKey(topicId);
model.addAttribute("topic", topic);
return thymeleaf("/topic/index");
}
示例9: insert
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
int insert(CmsTopic record);
示例10: insertSelective
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
int insertSelective(CmsTopic record);
示例11: selectByExample
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
List<CmsTopic> selectByExample(CmsTopicExample example);
示例12: selectByPrimaryKey
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
CmsTopic selectByPrimaryKey(Integer topicId);
示例13: updateByExampleSelective
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
int updateByExampleSelective(@Param("record") CmsTopic record, @Param("example") CmsTopicExample example);
示例14: updateByExample
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
int updateByExample(@Param("record") CmsTopic record, @Param("example") CmsTopicExample example);
示例15: updateByPrimaryKeySelective
import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
int updateByPrimaryKeySelective(CmsTopic record);