当前位置: 首页>>代码示例>>Java>>正文


Java CmsTopic类代码示例

本文整理汇总了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");
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:18,代码来源:TopicController.java

示例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;
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:21,代码来源:CmsTopicController.java

示例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);
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:18,代码来源:CmsTopicController.java

示例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);
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:17,代码来源:CmsTopicController.java

示例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;
}
 
开发者ID:ChangyiHuang,项目名称:shuzheng,代码行数:21,代码来源:CmsTopicController.java

示例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";
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:11,代码来源:CmsArticleController.java

示例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";
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:13,代码来源:CmsArticleController.java

示例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");
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:7,代码来源:TopicController.java

示例9: insert

import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
int insert(CmsTopic record); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:CmsTopicMapper.java

示例10: insertSelective

import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
int insertSelective(CmsTopic record); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:CmsTopicMapper.java

示例11: selectByExample

import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
List<CmsTopic> selectByExample(CmsTopicExample example); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:CmsTopicMapper.java

示例12: selectByPrimaryKey

import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
CmsTopic selectByPrimaryKey(Integer topicId); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:CmsTopicMapper.java

示例13: updateByExampleSelective

import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
int updateByExampleSelective(@Param("record") CmsTopic record, @Param("example") CmsTopicExample example); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:CmsTopicMapper.java

示例14: updateByExample

import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
int updateByExample(@Param("record") CmsTopic record, @Param("example") CmsTopicExample example); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:CmsTopicMapper.java

示例15: updateByPrimaryKeySelective

import com.zheng.cms.dao.model.CmsTopic; //导入依赖的package包/类
int updateByPrimaryKeySelective(CmsTopic record); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:CmsTopicMapper.java


注:本文中的com.zheng.cms.dao.model.CmsTopic类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。