|
|
@ -105,17 +105,18 @@ public class RestrictedBrandService extends MybatisBaseService<RestrictedBrandMa |
|
|
|
BeanUtil.copyProperties(dto, restrictedBrand, "sid"); |
|
|
|
baseMapper.insert(restrictedBrand); |
|
|
|
} else { |
|
|
|
RestrictedBrand restrictedBrand = fetchByCode(code); |
|
|
|
if (restrictedBrand == null) { |
|
|
|
return rb.setMsg("该品牌不存在"); |
|
|
|
} |
|
|
|
RestrictedBrand restrictedBrand = fetchBySid(sid); |
|
|
|
// if (restrictedBrand == null) {
|
|
|
|
// return rb.setMsg("该品牌不存在");
|
|
|
|
// }
|
|
|
|
//查询是否存在code值相同的
|
|
|
|
RestrictedBrand restrictedBrands = baseMapper.selectByCodeAndSid(code, sid); |
|
|
|
if (restrictedBrands != null) { |
|
|
|
return rb.setMsg("该品牌编码已存在"); |
|
|
|
} |
|
|
|
BeanUtil.copyProperties(dto, restrictedBrand, "sid"); |
|
|
|
baseMapper.updateById(restrictedBrand); |
|
|
|
// baseMapper.updateById(restrictedBrand);
|
|
|
|
baseMapper.update(restrictedBrand,new QueryWrapper<RestrictedBrand>().eq("sid",sid)); |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
|
|
|
@ -199,9 +200,9 @@ public class RestrictedBrandService extends MybatisBaseService<RestrictedBrandMa |
|
|
|
return baseMapper.selectByBrands(brandCode); |
|
|
|
} |
|
|
|
|
|
|
|
public RestrictedBrand fetchByCode(String code) { |
|
|
|
public RestrictedBrand fetchBySid(String sid) { |
|
|
|
QueryWrapper<RestrictedBrand> qw = new QueryWrapper<>(); |
|
|
|
qw.eq("code", code); |
|
|
|
qw.eq("sid", sid); |
|
|
|
List<RestrictedBrand> list = baseMapper.selectList(qw); |
|
|
|
if (list == null || list.isEmpty()) |
|
|
|
return null; |
|
|
|