use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DaoOfLoginUser method updateUserPassword.
public int updateUserPassword(LoginUser user) throws SQLException {
if (user == null)
return 0;
FreeUpdateSqlBuilder builder = new FreeUpdateSqlBuilder(dbCategory);
builder.setTemplate("UPDATE login_users SET password = ? WHERE id = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "password", Types.VARCHAR, user.getPassword());
parameters.set(i++, "id", Types.INTEGER, user.getId());
DalHints hints = DalHints.createIfAbsent(null);
return queryDao.update(builder, parameters, hints);
}
use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DaoOfLoginUser method getUserByGroupId.
public List<LoginUser> getUserByGroupId(int groupId) throws SQLException {
FreeSelectSqlBuilder<List<LoginUser>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT tb2.id, tb2.user_no, tb2.user_name, tb2.user_email, tb2.password, tb1.role, tb1.adduser FROM user_group tb1 LEFT JOIN login_users tb2 ON tb1.user_id = tb2.id WHERE tb1.group_id = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.setSensitive(i++, "group_id", Types.INTEGER, groupId);
builder.mapWith(loginUserRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
return queryDao.query(builder, parameters, hints);
}
use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DaoOfLoginUser method getUserByNo.
public LoginUser getUserByNo(String userNo) throws SQLException {
FreeSelectSqlBuilder<LoginUser> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, user_no, user_name, user_email, password FROM login_users WHERE user_no = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.setSensitive(i++, "user_no", Types.VARCHAR, userNo);
builder.mapWith(loginUserRowMapper).requireFirst().nullable();
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
return queryDao.query(builder, parameters, hints);
}
use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DaoOfProject method getProjectByGroupId.
public List<Project> getProjectByGroupId(int groupId) throws SQLException {
FreeSelectSqlBuilder<List<Project>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, name, namespace,dal_group_id,dal_config_name,update_user_no,update_time FROM project WHERE dal_group_id = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "dal_group_id", Types.INTEGER, groupId);
builder.mapWith(projectRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
List<Project> list = queryDao.query(builder, parameters, hints);
processList(list);
return list;
}
use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DaoOfProject method getProjectByConfigname.
public List<Project> getProjectByConfigname(String dal_config_name) throws SQLException {
FreeSelectSqlBuilder<List<Project>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, name, namespace,dal_group_id,dal_config_name,update_user_no,update_time FROM project WHERE dal_config_name = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "dal_config_name", Types.VARCHAR, dal_config_name);
builder.mapWith(projectRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
List<Project> list = queryDao.query(builder, parameters, hints);
processList(list);
return list;
}
Aggregations