更新方法名。
parent
a0b16afde2
commit
5c3b31bb18
|
@ -68,13 +68,13 @@ public abstract class PlusoneJdbcDaoSupport {
|
||||||
return queryForStream(sql, new MapSqlParameterSource(paramName, value), elementType);
|
return queryForStream(sql, new MapSqlParameterSource(paramName, value), elementType);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean queryExists(String sql, SqlParameterSource parameterSource) {
|
protected final boolean queryForBool(String sql, SqlParameterSource parameterSource) {
|
||||||
Boolean isExists = this.jdbc.queryForObject(sql, parameterSource, Boolean.TYPE);
|
Boolean result = this.jdbc.queryForObject(sql, parameterSource, Boolean.TYPE);
|
||||||
return Boolean.TRUE.equals(isExists);
|
return Boolean.TRUE.equals(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean queryExists(String sql, String paramName, Object value) {
|
protected final boolean queryForBool(String sql, String paramName, Object value) {
|
||||||
return queryExists(sql, new MapSqlParameterSource(paramName, value));
|
return queryForBool(sql, new MapSqlParameterSource(paramName, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final int update(String sql, SqlParameterSource parameterSource) {
|
protected final int update(String sql, SqlParameterSource parameterSource) {
|
||||||
|
|
|
@ -94,26 +94,26 @@ public class AccountRepositoryImpl extends JdbcRepositorySupport<Account, Long>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exists(Long id) {
|
public boolean exists(Long id) {
|
||||||
return queryExists("SELECT EXISTS (SELECT 1 FROM sys_account WHERE id = :id AND deleted = 0 LIMIT 1)",
|
return queryForBool("SELECT EXISTS (SELECT 1 FROM sys_account WHERE id = :id AND deleted = 0 LIMIT 1)",
|
||||||
"id", id);
|
"id", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean existsUsername(Username username) {
|
public boolean existsUsername(Username username) {
|
||||||
return queryExists(
|
return queryForBool(
|
||||||
"SELECT EXISTS (SELECT 1 FROM sys_account WHERE username = :username AND deleted = 0 LIMIT 1)",
|
"SELECT EXISTS (SELECT 1 FROM sys_account WHERE username = :username AND deleted = 0 LIMIT 1)",
|
||||||
"username", username.value());
|
"username", username.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean existsEmail(Email email) {
|
public boolean existsEmail(Email email) {
|
||||||
return queryExists("SELECT EXISTS (SELECT 1 FROM sys_account WHERE email = :email AND deleted = 0 LIMIT 1)",
|
return queryForBool("SELECT EXISTS (SELECT 1 FROM sys_account WHERE email = :email AND deleted = 0 LIMIT 1)",
|
||||||
"email", email.value());
|
"email", email.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean existsMobilePhone(MobilePhone mobilePhone) {
|
public boolean existsMobilePhone(MobilePhone mobilePhone) {
|
||||||
return queryExists(
|
return queryForBool(
|
||||||
"SELECT EXISTS (SELECT 1 FROM sys_account WHERE mobile_phone = :mobile_phone AND deleted = 0 LIMIT 1)",
|
"SELECT EXISTS (SELECT 1 FROM sys_account WHERE mobile_phone = :mobile_phone AND deleted = 0 LIMIT 1)",
|
||||||
"mobile_phone", mobilePhone.value());
|
"mobile_phone", mobilePhone.value());
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class DictRepositoryImpl extends JdbcRepositorySupport<Dict, Long> implem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exists(Long id) {
|
public boolean exists(Long id) {
|
||||||
return queryExists("SELECT EXISTS (SELECT 1 FROM sys_dict_type WHERE id = :id AND deleted = 0 LIMIT 1)",
|
return queryForBool("SELECT EXISTS (SELECT 1 FROM sys_dict_type WHERE id = :id AND deleted = 0 LIMIT 1)",
|
||||||
new MapSqlParameterSource("id", id));
|
new MapSqlParameterSource("id", id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class MenuRepositoryImpl extends JdbcRepositorySupport<Menu, Long> implem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exists(Long id) {
|
public boolean exists(Long id) {
|
||||||
return queryExists("SELECT EXISTS (SELECT 1 FROM sys_menu WHERE id = :id AND deleted = 0 LIMIT 1)",
|
return queryForBool("SELECT EXISTS (SELECT 1 FROM sys_menu WHERE id = :id AND deleted = 0 LIMIT 1)",
|
||||||
"id", id);
|
"id", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class RoleRepositoryImpl extends JdbcRepositorySupport<Role, Long> implem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exists(Long id) {
|
public boolean exists(Long id) {
|
||||||
return queryExists("SELECT EXISTS (SELECT 1 FROM sys_role WHERE id = :id AND deleted = 0 LIMIT 1)",
|
return queryForBool("SELECT EXISTS (SELECT 1 FROM sys_role WHERE id = :id AND deleted = 0 LIMIT 1)",
|
||||||
"id", id);
|
"id", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue