在这里插入代码片
```package com.pyg.manager.controller;
import com.alibaba.dubbo.config.annotation.Reference;
import com.pyg.common.PageResult;
import com.pyg.pojo.ContentCategory;
import com.pyg.service.ContentCategoryService;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Description: 内容分类控制器<br/>
* @author: yky <br/>
* @date: 2019年08月25日 14:58 <br/>
* @param: <br/>
* @return:
*/
@RestController
@RequestMapping("/contentCategory")
public class ContentCategoryController {
@Reference
private ContentCategoryService contentCategoryService;
/** 查询全部方法 */
@GetMapping("/findAll")
public List<ContentCategory> findAll() {
return contentCategoryService.findAll();
}
/** 多条件分页查询方法 */
@GetMapping("/findByPage")
public PageResult<ContentCategory> findByPage(ContentCategory contentCategory,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10")Integer rows) {
try {
return contentCategoryService.findByPage(contentCategory, page, rows);
}catch (Exception ex){
ex.printStackTrace();
}
return null;
}
/** 根据主键id查询方法 */
@GetMapping("/findOne")
public ContentCategory findOne(Long id) {
try {
return contentCategoryService.findOne(id);
}catch (Exception ex){
ex.printStackTrace();
}
return null;
}
/** 添加方法 */
@PostMapping("/save")
public boolean save(@RequestBody ContentCategory contentCategory) {
try {
contentCategoryService.save(contentCategory);
return true;
}catch (Exception ex){
ex.printStackTrace();
}
return false;
}
/** 修改方法 */
@PostMapping("/update")
public boolean update(@RequestBody ContentCategory contentCategory) {
try {
contentCategoryService.update(contentCategory);
return true;
}catch (Exception ex){
ex.printStackTrace();
}
return false;
}
/** 删除方法 */
@GetMapping("/delete")
public boolean delete(Long[] ids) {
try {
contentCategoryService.deleteAll(ids);
return true;
}catch (Exception ex){
ex.printStackTrace();
}
return false;
}
}
返回json
猜你喜欢
转载自blog.csdn.net/weixin_44805962/article/details/104764871
今日推荐
周排行