|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
|
import com.baomidou.mybatisplus.service.IService;
|
|
import com.baomidou.mybatisplus.service.IService;
|
|
|
|
|
+import com.mokamrp.privates.constant.Constants;
|
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
|
import com.mokamrp.privates.entity.AddHandle;
|
|
import com.mokamrp.privates.entity.AddHandle;
|
|
|
import com.mokamrp.privates.entity.DelHandle;
|
|
import com.mokamrp.privates.entity.DelHandle;
|
|
@@ -18,10 +19,7 @@ import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.Iterator;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 一个粗糙的鸡肋
|
|
* 一个粗糙的鸡肋
|
|
@@ -44,7 +42,7 @@ public class BaseController<T> {
|
|
|
if (!res) {
|
|
if (!res) {
|
|
|
return AjaxResult.error("删除失败");
|
|
return AjaxResult.error("删除失败");
|
|
|
}
|
|
}
|
|
|
- return AjaxResult.success("success", res);
|
|
|
|
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
@@ -55,7 +53,7 @@ public class BaseController<T> {
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
|
Boolean res = service.insert(addHandle.getRaw());
|
|
Boolean res = service.insert(addHandle.getRaw());
|
|
|
if (res) {
|
|
if (res) {
|
|
|
- return AjaxResult.success("success", res);
|
|
|
|
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
} else {
|
|
} else {
|
|
|
return AjaxResult.error("新增失败", res);
|
|
return AjaxResult.error("新增失败", res);
|
|
|
}
|
|
}
|
|
@@ -67,7 +65,16 @@ public class BaseController<T> {
|
|
|
return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
}
|
|
}
|
|
|
service.update(editHandle.getRaw(), new EntityWrapper<T>().in("id", editHandle.getIds()));
|
|
service.update(editHandle.getRaw(), new EntityWrapper<T>().in("id", editHandle.getIds()));
|
|
|
- return AjaxResult.success("success", true);
|
|
|
|
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/edit")
|
|
|
|
|
+ public Object info(@RequestParam(name = "ids") String ids) {
|
|
|
|
|
+ if (ids == null || ids.isEmpty()){
|
|
|
|
|
+ return AjaxResult.error("ids null");
|
|
|
|
|
+ }
|
|
|
|
|
+ T res = service.selectOne(new EntityWrapper<T>().eq("id",ids));
|
|
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/index")
|
|
@PostMapping("/index")
|