wang-hao-jie
2022-03-17 6dfd2599d2e52507e018fd4c6b35d38873e48cfb
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerReceiveController.java
@@ -49,9 +49,11 @@
    @RequestMapping(value = "/getByPage", method = RequestMethod.GET)
    @ApiOperation(value = "分页获取")
    public Result<IPage<CustomerReceive>> getByPage(PageVo page) {
        IPage<CustomerReceive> data = iCustomerReceiveService.page(PageUtil.initMpPage(page));
    public Result<IPage<CustomerReceive>> getByPage(String name,PageVo page) {
        QueryWrapper<CustomerReceive> wrapper = new QueryWrapper<>();
        if (!StrUtil.isEmpty(name))
            wrapper.like("b.name","%"+name+"%");
        IPage<CustomerReceive> data = iCustomerReceiveService.page2(PageUtil.initMpPage(page),wrapper);
        return new ResultUtil<IPage<CustomerReceive>>().setData(data);
    }
@@ -59,6 +61,20 @@
    @ApiOperation(value = "编辑或更新数据")
    public Result<CustomerReceive> saveOrUpdate(CustomerReceive customerReceive) {
        if(StrUtil.isEmpty(customerReceive.getCustomerId())){
            return ResultUtil.error("商户id为空,请重新登陆或联系管理员");
        }
        if (iCustomerReceiveService.saveOrUpdate(customerReceive)) {
            return new ResultUtil<CustomerReceive>().setData(customerReceive);
        }
        return new ResultUtil<CustomerReceive>().setErrorMsg("操作失败");
    }
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @ApiOperation(value = "修改头像")
    public Result<CustomerReceive> update(String id,String imgUrl) {
        CustomerReceive customerReceive = iCustomerReceiveService.getById(id);
        customerReceive.setImg(imgUrl);
        if (iCustomerReceiveService.saveOrUpdate(customerReceive)) {
            return new ResultUtil<CustomerReceive>().setData(customerReceive);
        }