v1.0.3
This commit is contained in:
@@ -18,6 +18,9 @@ public interface GaoCustomerMapper extends BaseMapper<GaoCustomer, String> {
|
||||
@Select("SELECT * FROM `gao_customer` WHERE `code` = #{code} AND `deleted_at` IS NULL LIMIT 1")
|
||||
GaoCustomer selectByCode(@Param("code") String code);
|
||||
|
||||
@Select("SELECT * FROM `gao_customer` WHERE `name` = #{name} AND `deleted_at` IS NULL LIMIT 1")
|
||||
GaoCustomer selectByName(@Param("name") String name);
|
||||
|
||||
List<GaoCustomer> search(@Param("keyword") String keyword, @Param("introducerCustomerId") String introducerCustomerId);
|
||||
|
||||
Long countSearch(@Param("keyword") String keyword, @Param("introducerCustomerId") String introducerCustomerId);
|
||||
|
||||
+8
-2
@@ -258,10 +258,16 @@ public class GaoCustomerServiceImplement extends AbstractEntityService<GaoCustom
|
||||
TimiException.required(entity.getId(), "not found customer.id");
|
||||
}
|
||||
TimiException.required(entity.getName(), "not found customer.name");
|
||||
entity.setName(entity.getName().trim());
|
||||
TimiException.requiredTrue(!entity.getName().isEmpty(), "not found customer.name");
|
||||
GaoCustomer dbCustomer = mapper.selectByName(entity.getName());
|
||||
if (dbCustomer != null && !dbCustomer.getId().equals(entity.getId())) {
|
||||
throw new TimiException(TimiCode.ARG_BAD, "客户姓名已存在");
|
||||
}
|
||||
if (TimiJava.isNotEmpty(entity.getCode())) {
|
||||
GaoCustomer dbCustomer = mapper.selectByCode(entity.getCode());
|
||||
dbCustomer = mapper.selectByCode(entity.getCode());
|
||||
if (dbCustomer != null && !dbCustomer.getId().equals(entity.getId())) {
|
||||
throw new TimiException(TimiCode.ARG_BAD).msgKey("客户编码已存在");
|
||||
throw new TimiException(TimiCode.ARG_BAD, "客户编码已存在");
|
||||
}
|
||||
}
|
||||
if (TimiJava.isNotEmpty(entity.getIntroducerCustomerId())) {
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ public class GaoUserServiceImplement extends AbstractEntityService<GaoUser, Stri
|
||||
TimiException.required(userMapper.select(entity.getUserId()), "not found user");
|
||||
GaoUser dbGaoUser = mapper.selectByUserId(entity.getUserId());
|
||||
if (dbGaoUser != null && !dbGaoUser.getId().equals(entity.getId())) {
|
||||
throw new TimiException(TimiCode.ARG_BAD).msgKey("GAO 用户已存在");
|
||||
throw new TimiException(TimiCode.ARG_BAD, "GAO 用户已存在");
|
||||
}
|
||||
if (entity.getEnabled() == null) {
|
||||
entity.setEnabled(true);
|
||||
|
||||
Reference in New Issue
Block a user