|
|
|
@@ -0,0 +1,122 @@ |
|
|
|
package com.iformall.controller; |
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.UserBasicInfoAddress; |
|
|
|
import com.iformall.domain.po.WxCUserBasicChild; |
|
|
|
import com.iformall.service.UserBasicInfoAddressService; |
|
|
|
import com.iformall.service.WxCUserBasicChildService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping("api/userBasicInfoAddress") |
|
|
|
@Api(description = "会员子女相关接口") |
|
|
|
public class UserBasicInfoChildController extends BaseController { |
|
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCUserBasicChildService wxCUserBasicChildService; |
|
|
|
|
|
|
|
@ApiOperation("分页列表接口") |
|
|
|
@GetMapping("list") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) |
|
|
|
public ResultData list(@ModelAttribute WxCUserBasicChild userBasicChild, Integer pageNum, Integer pageSize) { |
|
|
|
logger.debug("[" + getIpAddr() + "] UserBasicInfoChildController::list"); |
|
|
|
if (null == userBasicChild) { |
|
|
|
userBasicChild = new WxCUserBasicChild(); |
|
|
|
} |
|
|
|
Long memberId; |
|
|
|
try { |
|
|
|
memberId = getMemberId(); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
userBasicChild.setCUserId(memberId); |
|
|
|
userBasicChild.setTenantId(getTenantInfo().getFinalTenantId()); |
|
|
|
PageInfo<WxCUserBasicChild> page = wxCUserBasicChildService.listAsPage(userBasicChild, pageNum, pageSize); |
|
|
|
return new ResultData(page); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("saveOrUpdate") |
|
|
|
public ResultData saveOrUpdate(@RequestBody WxCUserBasicChild userBasicChild) { |
|
|
|
logger.debug("[" + getIpAddr() + "] UserBasicInfoChildController::saveOrUpdate"); |
|
|
|
if(userBasicChild == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
Long memberId; |
|
|
|
try { |
|
|
|
memberId = getMemberId(); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
userBasicChild.setCUserId(memberId); |
|
|
|
userBasicChild.setTenantId(getTenantInfo().getFinalTenantId()); |
|
|
|
wxCUserBasicChildService.saveOrUpdate(userBasicChild); |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("saveList") |
|
|
|
public ResultData saveOrUpdate(@RequestBody List<WxCUserBasicChild> userBasicChilds) { |
|
|
|
logger.debug("[" + getIpAddr() + "] UserBasicInfoChildController::saveOrUpdate"); |
|
|
|
if(userBasicChilds == null || userBasicChilds.isEmpty()){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
Long memberId; |
|
|
|
try { |
|
|
|
memberId = getMemberId(); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
for (WxCUserBasicChild userBasicChild:userBasicChilds) { |
|
|
|
userBasicChild.setCUserId(memberId); |
|
|
|
userBasicChild.setTenantId(getTenantInfo().getFinalTenantId()); |
|
|
|
wxCUserBasicChildService.saveOrUpdate(userBasicChild); |
|
|
|
} |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("删除") |
|
|
|
@GetMapping("/del") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) |
|
|
|
public ResultData delete(Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] UserBasicInfoChildController::delete"); |
|
|
|
if(id == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "Id为空"); |
|
|
|
} |
|
|
|
WxCUserBasicChild userBasicChild = new WxCUserBasicChild(); |
|
|
|
userBasicChild.setId(id); |
|
|
|
userBasicChild.setTenantId(getTenantInfo().getFinalTenantId()); |
|
|
|
wxCUserBasicChildService.updDelById(userBasicChild); |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("查询") |
|
|
|
@GetMapping("/findById") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) |
|
|
|
public ResultData findById(Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] UserBasicInfoChildController::findById"); |
|
|
|
if(id == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "Id为空"); |
|
|
|
} |
|
|
|
WxCUserBasicChild userBasicChild = new WxCUserBasicChild(); |
|
|
|
userBasicChild.setId(id); |
|
|
|
userBasicChild.setTenantId(getTenantInfo().getFinalTenantId()); |
|
|
|
userBasicChild = wxCUserBasicChildService.findById(userBasicChild); |
|
|
|
return new ResultData(userBasicChild); |
|
|
|
} |
|
|
|
|
|
|
|
} |