|
|
@ -1,6 +1,7 @@ |
|
|
package cc.hiver.mall.controller; |
|
|
package cc.hiver.mall.controller; |
|
|
|
|
|
|
|
|
import cc.hiver.core.common.utils.ResultUtil; |
|
|
import cc.hiver.core.common.utils.ResultUtil; |
|
|
|
|
|
import cc.hiver.core.common.utils.StringUtils; |
|
|
import cc.hiver.core.common.vo.Result; |
|
|
import cc.hiver.core.common.vo.Result; |
|
|
import cc.hiver.core.entity.User; |
|
|
import cc.hiver.core.entity.User; |
|
|
import cc.hiver.core.service.UserService; |
|
|
import cc.hiver.core.service.UserService; |
|
|
@ -58,7 +59,9 @@ public class CustomerController { |
|
|
@RequestMapping(value = "/edit", method = RequestMethod.POST) |
|
|
@RequestMapping(value = "/edit", method = RequestMethod.POST) |
|
|
@ApiOperation(value = "根据客户id修改客户") |
|
|
@ApiOperation(value = "根据客户id修改客户") |
|
|
public Result edit(Customer customer) { |
|
|
public Result edit(Customer customer) { |
|
|
|
|
|
if(StringUtils.isEmpty(customer.getId())){ |
|
|
|
|
|
return ResultUtil.error("客户id不能为空"); |
|
|
|
|
|
} |
|
|
Customer originCustomer = customerService.getById(customer.getId()); |
|
|
Customer originCustomer = customerService.getById(customer.getId()); |
|
|
User user = userService.get(originCustomer.getUserId()); |
|
|
User user = userService.get(originCustomer.getUserId()); |
|
|
user.setNickname(customer.getName()); |
|
|
user.setNickname(customer.getName()); |
|
|
@ -78,6 +81,9 @@ public class CustomerController { |
|
|
@RequestMapping(value = "/delById", method = RequestMethod.POST) |
|
|
@RequestMapping(value = "/delById", method = RequestMethod.POST) |
|
|
@ApiOperation(value = "根据id删除客户") |
|
|
@ApiOperation(value = "根据id删除客户") |
|
|
public Result delete(Customer customer) { |
|
|
public Result delete(Customer customer) { |
|
|
|
|
|
if(StringUtils.isEmpty(customer.getId())){ |
|
|
|
|
|
return ResultUtil.error("客户id不能为空"); |
|
|
|
|
|
} |
|
|
boolean result = customerService.removeById(customer); |
|
|
boolean result = customerService.removeById(customer); |
|
|
if(result) { |
|
|
if(result) { |
|
|
return ResultUtil.success("删除成功"); |
|
|
return ResultUtil.success("删除成功"); |
|
|
|