|
@@ -1,4 +1,4 @@
|
|
|
- package com.huimv.management.controller;
|
|
|
+package com.huimv.management.controller;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
@@ -18,7 +18,6 @@ import com.huimv.common.utils.PageUtils;
|
|
|
import com.huimv.common.utils.R;
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 牧场表
|
|
|
*
|
|
@@ -37,7 +36,7 @@ public class PastureController {
|
|
|
* 列表
|
|
|
*/
|
|
|
@RequestMapping("/list")
|
|
|
- public R list(@RequestParam Map<String, Object> params){
|
|
|
+ public R list(@RequestParam Map<String, Object> params) {
|
|
|
PageUtils page = pastureService.queryPage(params);
|
|
|
|
|
|
return R.ok().put("page", page);
|
|
@@ -48,8 +47,8 @@ public class PastureController {
|
|
|
* 信息
|
|
|
*/
|
|
|
@RequestMapping("/info/{id}")
|
|
|
- public R info(@PathVariable("id") Integer id){
|
|
|
- PastureEntity pasture = pastureService.getById(id);
|
|
|
+ public R info(@PathVariable("id") Integer id) {
|
|
|
+ PastureEntity pasture = pastureService.getById(id);
|
|
|
|
|
|
return R.ok().put("pasture", pasture);
|
|
|
}
|
|
@@ -58,21 +57,20 @@ public class PastureController {
|
|
|
* 保存
|
|
|
*/
|
|
|
@RequestMapping("/save")
|
|
|
- public R save(@RequestBody PastureEntity pasture){
|
|
|
- Boolean isExist = pastureService.findByName(pasture);
|
|
|
- if (isExist){
|
|
|
- pastureService.save(pasture);
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
- return R.error().put("msg","牧场名称名称重复");
|
|
|
+ public R save(@RequestBody PastureEntity pasture) {
|
|
|
+// Boolean isExist = pastureService.findByName(pasture);
|
|
|
+// if (isExist){
|
|
|
+ pastureService.save(pasture);
|
|
|
+ return R.ok();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改
|
|
|
*/
|
|
|
@RequestMapping("/update")
|
|
|
- public R update(@RequestBody PastureEntity pasture){
|
|
|
- pastureService.updateById(pasture);
|
|
|
+ public R update(@RequestBody PastureEntity pasture) {
|
|
|
+ pastureService.updateById(pasture);
|
|
|
|
|
|
return R.ok();
|
|
|
}
|
|
@@ -81,14 +79,14 @@ public class PastureController {
|
|
|
* 删除
|
|
|
*/
|
|
|
@RequestMapping("/delete")
|
|
|
- public R delete(@RequestBody Integer[] ids){
|
|
|
+ public R delete(@RequestBody Integer[] ids) {
|
|
|
// pigstyService.removeByIds(Arrays.asList(ids));
|
|
|
Integer delete = pastureService.delete(ids);
|
|
|
- if (delete == 1){
|
|
|
+ if (delete == 1) {
|
|
|
pastureService.removeByIds(Arrays.asList(ids));
|
|
|
return R.ok();
|
|
|
- }else {
|
|
|
- return R.error().put("msg","牧场中有未清空猪舍");
|
|
|
+ } else {
|
|
|
+ return R.error().put("msg", "牧场中有未清空猪舍");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -98,10 +96,10 @@ public class PastureController {
|
|
|
* 查询全部
|
|
|
*/
|
|
|
@RequestMapping("/findAll")
|
|
|
- public R findAll(){
|
|
|
+ public R findAll() {
|
|
|
List list = pastureService.findAll();
|
|
|
|
|
|
- return R.ok().put("all",list);
|
|
|
+ return R.ok().put("all", list);
|
|
|
}
|
|
|
|
|
|
}
|