Commit b97a428d authored by 廖旭伟's avatar 廖旭伟

list接口增加时间倒序;新增客户,手机号码唯一

parent 068a983a
...@@ -35,7 +35,8 @@ import java.util.List; ...@@ -35,7 +35,8 @@ import java.util.List;
public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, CustomerEntity, Long> implements CustomerService { public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, CustomerEntity, Long> implements CustomerService {
@Override @Override
protected void validData(CustomerEntity entity, Context context) throws AppException { protected void saveBefore(CustomerEntity entity, Context context) throws AppException {
this.validData(entity, context);
if(StringUtils.isEmpty(entity.getContactTelphone())){ if(StringUtils.isEmpty(entity.getContactTelphone())){
throw new AppException("手机号不能为空"); throw new AppException("手机号不能为空");
} }
...@@ -45,11 +46,6 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu ...@@ -45,11 +46,6 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu
if(!PhoneUtil.isPhone(entity.getContactTelphone())){ if(!PhoneUtil.isPhone(entity.getContactTelphone())){
throw new AppException("手机号码格式不正确"); throw new AppException("手机号码格式不正确");
} }
}
@Override
protected void saveBefore(CustomerEntity entity, Context context) throws AppException {
this.validData(entity, context);
CustomerEntity query = new CustomerEntity(); CustomerEntity query = new CustomerEntity();
query.setContactTelphone(entity.getContactTelphone()); query.setContactTelphone(entity.getContactTelphone());
List<CustomerEntity> list = dao.getList(query); List<CustomerEntity> list = dao.getList(query);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment