|
@@ -5,7 +5,9 @@ import com.caimei.service.user.PersonalService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -40,9 +42,13 @@ public class PersonalController {
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@RequestMapping("/touchBalance")
|
|
|
- public List<CmUserBalanceRecord> touchBalance(int year, int month, CmUserBalanceRecord balanceRecord) {
|
|
|
+ public Page<CmUserBalanceRecord> touchBalance(int year, int month, Integer index, Integer pageSize, CmUserBalanceRecord balanceRecord) {
|
|
|
+ if (index == null) index = 1;
|
|
|
+ if (pageSize == null) pageSize = 10;
|
|
|
+ PageHelper.startPage(index, pageSize);
|
|
|
List<CmUserBalanceRecord> list = personalService.touchBalance(year, month, balanceRecord);
|
|
|
- return list;
|
|
|
+ Page<CmUserBalanceRecord> page = new Page<>(list);
|
|
|
+ return page;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -108,9 +114,10 @@ public class PersonalController {
|
|
|
* @return
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
- @RequestMapping("/save")
|
|
|
- public WxJsonModel saveAddress(Address address) {
|
|
|
+ @RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
+ public WxJsonModel saveAddress(@RequestBody Address address) {
|
|
|
WxJsonModel res = WxJsonModel.newInstance();
|
|
|
+ if (address == null) return res.error("参数异常");
|
|
|
try {
|
|
|
personalService.saveAddress(address);
|
|
|
} catch (Exception e) {
|
|
@@ -119,4 +126,19 @@ public class PersonalController {
|
|
|
return res.success("保存成功", "");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除地址
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping("/delete")
|
|
|
+ public WxJsonModel deleteAddress(Integer addressID) {
|
|
|
+ WxJsonModel res = WxJsonModel.newInstance();
|
|
|
+ try {
|
|
|
+ personalService.deleteAddress(addressID);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return res.error("删除失败");
|
|
|
+ }
|
|
|
+ return res.success("删除成功", "");
|
|
|
+ }
|
|
|
+
|
|
|
}
|