package com.peanut.modules.book.controller; import com.peanut.common.utils.R; import com.peanut.modules.book.entity.PointCategoryEntity; import com.peanut.modules.book.service.PointCategoryService; import com.peanut.modules.book.service.PointService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; @RestController @RequestMapping("book/point") public class PointController { @Autowired private PointService pointService; @Autowired private PointCategoryService pointCategoryService; /** * 获取脉穴分类列表-树形结构 * @return */ @RequestMapping("/getPointCategoryList") public R getPointCategoryList(){ List categoryList = pointCategoryService.getCategoryList(); return R.ok().put("categorys",categoryList); } /** * 添加脉穴分类 * @return */ @RequestMapping("/addPointCategory") public R addPointCategory(@RequestBody PointCategoryEntity p){ pointCategoryService.save(p); return R.ok(); } /** * 删除脉穴分类 * @return */ @RequestMapping("/delPointCategory") public R delPointCategory(@RequestBody Map map){ Integer id = Integer.valueOf(map.get("pointCategoryId").toString()); pointCategoryService.removeById(id); return R.ok(); } /** * 修改脉穴分类 * @param p * @return */ @RequestMapping("/editPointCategory") public R editPointCategory(@RequestBody PointCategoryEntity p){ pointCategoryService.updateById(p); return R.ok(); } }