店铺修改 参数问题

This commit is contained in:
wangw 2024-09-12 10:26:28 +08:00
parent 7e29627bf6
commit 0a3b50ef6f
2 changed files with 3 additions and 4 deletions

View File

@ -57,8 +57,7 @@ public class TbShopInfo implements Serializable {
@ApiModelProperty(value = "商户Id") @ApiModelProperty(value = "商户Id")
private String merchantId; private String merchantId;
@Column(name = "`shop_name`",nullable = false) @Column(name = "`shop_name`")
@NotBlank
@ApiModelProperty(value = "店铺名称") @ApiModelProperty(value = "店铺名称")
private String shopName; private String shopName;
@ -282,6 +281,6 @@ public class TbShopInfo implements Serializable {
private String paymentQrcode; private String paymentQrcode;
public void copy(TbShopInfo source){ public void copy(TbShopInfo source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(false)); BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
} }
} }

View File

@ -239,7 +239,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(TbShopInfo resources) { public void update(TbShopInfo resources) {
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(resources.getId()).orElseGet(TbShopInfo::new); TbShopInfo tbShopInfo = tbShopInfoRepository.findById(resources.getId()).orElseGet(TbShopInfo::new);
if (!resources.getShopName().equals(tbShopInfo.getShopName())) { if (StringUtils.isNotBlank(resources.getShopName()) && !resources.getShopName().equals(tbShopInfo.getShopName())) {
shopStaffRepository.updateNameById(resources.getShopName(),resources.getId().toString()); shopStaffRepository.updateNameById(resources.getShopName(),resources.getId().toString());
userRepository.updateNickName(resources.getAccount(),resources.getShopName()); userRepository.updateNickName(resources.getAccount(),resources.getShopName());
} }