国家区域
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BaseAreaEntity;
|
||||
import com.peanut.modules.book.service.BaseAreaService;
|
||||
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.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/book/baseArea")
|
||||
public class BaseAreaController {
|
||||
@Autowired
|
||||
private BaseAreaService baseAreaService;
|
||||
|
||||
|
||||
/**
|
||||
* 添加区域
|
||||
* @param baseArea
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/addBaseArea")
|
||||
public R addBaseArea(@RequestBody BaseAreaEntity baseArea){
|
||||
baseAreaService.save(baseArea);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除区域
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/delBaseArea")
|
||||
public R delBaseArea(@RequestBody Map<String,Object> map){
|
||||
Integer areaId = Integer.valueOf(map.get("areaId").toString());
|
||||
baseAreaService.removeById(areaId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑区域信息
|
||||
* @param baseArea
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/editBaseArea")
|
||||
public R editBaseArea(@RequestBody BaseAreaEntity baseArea){
|
||||
baseAreaService.updateById(baseArea);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区域列表
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getBaseAreas")
|
||||
public R getBaseAreas(@RequestBody Map<String,Object> map){
|
||||
Integer limit = Integer.valueOf(map.get("limit").toString());
|
||||
Integer page = Integer.valueOf(map.get("page").toString());
|
||||
|
||||
Page baseAreas = baseAreaService.getBaseAreas(limit, page);
|
||||
return R.ok().put("page",baseAreas);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user