@Override
@Transactional(rollbackFor = Exception.class)
public Long customerPropertyUpdate(Long tenantId, MtCustomerVO vo, String fullUpdate) {
if (vo == null) {
return null;
}
if (MtIdHelper.isIdNull(vo.getCustomerId())) {
// 校验必输参数
checkParamsInput(tenantId, vo);
// 新增数据
MtCustomer mtCustomer = new MtCustomer();
mtCustomer.setTenantId(tenantId);
BeanUtils.copyProperties(vo, mtCustomer);
self().insertSelective(mtCustomer);
return mtCustomer.getCustomerId();
}
// 校验参数有效性 id 是否存在
MtCustomer mtCustomer = mtCustomerMapper.selectByPrimaryKey(vo.getCustomerId());
if (mtCustomer == null) {
throw new MtException("MT_MODELING_0003", mtCommonRpcClient.getErrorMessage(tenantId, "MT_MODELING_0003",
"customerId", "【API:customerPropertyUpdate】"));
}
// 更新检查参数输入
checkUpdateParamsInput(tenantId, vo, fullUpdate);
MtCustomer updateCustomer = new MtCustomer();
updateCustomer.setTenantId(tenantId);
BeanUtils.copyProperties(vo, updateCustomer);
if (MtBaseConstants.YES.equals(fullUpdate)) {
if (StringUtils.isEmpty(vo.getCustomerNameAlt())) {
updateCustomer.setCustomerNameAlt("");
}
if (StringUtils.isEmpty(vo.getCustomerType())) {
updateCustomer.setCustomerType("");
}
if (StringUtils.isEmpty(vo.getSourceIdentificationId())) {
updateCustomer.setSourceIdentificationId("");
}
if (vo.getDateTo() == null) {
updateCustomer.setDateTo(null);
}
this.updateByPrimaryKey(updateCustomer);
} else {
this.updateByPrimaryKeySelective(updateCustomer);
}
return updateCustomer.getCustomerId();
}
10-31
1316
10-16
2016
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交