首页>代码>spring boot+mybatis+thymeleaf+apache shiro开发面向学习型的后台管理系统BootDo>/bootdo/src/main/java/com/bootdo/blog/controller/BCommentsController.java
package com.bootdo.blog.controller;

import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bootdo.blog.domain.BCommentsDO;
import com.bootdo.blog.domain.BContentDO;
import com.bootdo.blog.service.BCommentsService;
import com.bootdo.common.utils.PageUtils;
import com.bootdo.common.utils.Query;
import com.bootdo.common.utils.R;

/**
 * 
 * 
 * @author chglee
 * @email 1992lcg@163.com
 * @date 2017-09-08 13:56:45
 */
@Controller
@RequestMapping("/blog/bComments")
public class BCommentsController {
	@Autowired
	private BCommentsService bCommentsService;
	
	@GetMapping()
	//@RequiresPermissions("blog:bComments")
	String bComments(){
	    return "blog/bComments/bComments";
	}
	
	@GetMapping("/list")
	@ResponseBody
	//@RequiresPermissions("blog:list")
	public PageUtils list(@RequestParam Map<String, Object> params){
		//查询列表数据
        Query query = new Query(params);

		List<BCommentsDO> bCommentsList = bCommentsService.list(query);
		int total = bCommentsService.count(query);
		
		PageUtils pageUtils = new PageUtils(bCommentsList, total);
		
		return pageUtils;
	}
	
	@GetMapping("/add")
	//@RequiresPermissions("blog:bComments")
	String add(){
	    return "blog/bComments/add";
	}
	@GetMapping("/edit")
	//@RequiresPermissions("blog:bComments")
	String edit(Long id,Model model){
		BCommentsDO bContentDO = bCommentsService.get(id);
		model.addAttribute("bContentDO", bContentDO);
	    return "blog/bComments/edit";
	}
	
	/**
	 * 保存
	 */
	@PostMapping("/save")
	@ResponseBody
	//@RequiresPermissions("blog:save")
	public R save(BCommentsDO bComments){
		bCommentsService.save(bComments);
		
		return R.ok();
	}
	
	/**
	 * 修改
	 */
	@RequestMapping("/update")
	@RequiresPermissions("blog:update")
	public R update( BCommentsDO bComments){
		bCommentsService.update(bComments);
		return R.ok();
	}
	
	@PostMapping( "/remove")
	@ResponseBody
	@RequiresPermissions("blog:remove")
	public R remove( Integer id){
		if(bCommentsService.remove(id)>0){
		return R.ok();
		}
		return R.error();
	}
	
	/**
	 * 删除
	 */
	@PostMapping( "/batchRemove")
	@ResponseBody
	@RequiresPermissions("blog:delete")
	public R delete(@RequestParam("ids[]") Integer[] ids){
		bCommentsService.batchRemove(ids);
		return R.ok();
	}
	
}
最近下载更多
shuangfu  LV25 2024年5月7日
大白兔奶糖  LV2 2023年7月11日
森sdfgf  LV8 2023年6月14日
啥也不会ddd  LV1 2023年5月25日
an1127  LV3 2023年4月4日
lyws1986  LV17 2023年3月28日
liaozhenlei  LV8 2022年9月3日
刘亦菲9527  LV15 2022年7月21日
LLLLLL_77  LV2 2022年6月16日
1529860026  LV24 2022年6月1日
最近浏览更多
bluerstar  LV1 2024年10月23日
颜菜菜  LV2 2024年6月19日
计科一班  LV7 2024年6月19日
f22m1a2b2  LV17 2024年5月31日
shuangfu  LV25 2024年5月7日
wushui  LV1 2024年3月9日
zcwmmd  LV20 2024年1月4日
WBelong  LV8 2023年12月27日
fff2003  LV9 2023年12月21日
3334004690  LV10 2023年11月1日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友