Search in sources :

Example 6 with FreeUpdateSqlBuilder

use of com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder in project dal by ctripcorp.

the class DaoOfDatabaseSet method deleteDatabaseSetEntryByDbsetId.

/**
 * 依据外键databaseSet_Id删除entry
 *
 * @param dbsetId
 * @return
 */
public int deleteDatabaseSetEntryByDbsetId(Integer dbsetId) throws SQLException {
    FreeUpdateSqlBuilder builder = new FreeUpdateSqlBuilder(dbCategory);
    builder.setTemplate("DELETE FROM databasesetentry WHERE databaseSet_Id = ?");
    StatementParameters parameters = new StatementParameters();
    int i = 1;
    parameters.setSensitive(i++, "databaseSet_Id", Types.INTEGER, dbsetId);
    DalHints hints = DalHints.createIfAbsent(null);
    return queryDao.update(builder, parameters, hints);
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) FreeUpdateSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters)

Example 7 with FreeUpdateSqlBuilder

use of com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder 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);
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) FreeUpdateSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters)

Example 8 with FreeUpdateSqlBuilder

use of com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder in project dal by ctripcorp.

the class GroupRelationDao method updateGroupRelation.

public int updateGroupRelation(Integer currentGroupId, Integer childGroupId, Integer childGroupRole, Integer adduser, String updateUserNo, Timestamp updateTime) throws SQLException {
    FreeUpdateSqlBuilder builder = new FreeUpdateSqlBuilder(dbCategory);
    builder.setTemplate("UPDATE group_relation SET child_group_role=?, adduser=?, update_user_no=?,update_time=? WHERE current_group_id = ? AND child_group_id = ?");
    StatementParameters parameters = new StatementParameters();
    int i = 1;
    parameters.set(i++, "child_group_role", Types.INTEGER, childGroupRole);
    parameters.set(i++, "adduser", Types.INTEGER, adduser);
    parameters.set(i++, "update_user_no", Types.VARCHAR, updateUserNo);
    parameters.set(i++, "update_time", Types.TIMESTAMP, updateTime);
    parameters.set(i++, "current_group_id", Types.INTEGER, currentGroupId);
    parameters.set(i++, "child_group_id", Types.INTEGER, childGroupId);
    DalHints hints = DalHints.createIfAbsent(null);
    return queryDao.update(builder, parameters, hints);
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) FreeUpdateSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters)

Example 9 with FreeUpdateSqlBuilder

use of com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder in project dal by ctripcorp.

the class GroupRelationDao method deleteChildGroupByCurrentGroupIdAndChildGroupId.

public int deleteChildGroupByCurrentGroupIdAndChildGroupId(Integer currentGroupId, Integer childGroupId) throws SQLException {
    FreeUpdateSqlBuilder builder = new FreeUpdateSqlBuilder(dbCategory);
    builder.setTemplate("DELETE FROM group_relation WHERE current_group_id = ? AND child_group_id = ?");
    StatementParameters parameters = new StatementParameters();
    int i = 1;
    parameters.set(i++, "current_group_id", Types.INTEGER, currentGroupId);
    parameters.set(i++, "child_group_id", Types.INTEGER, childGroupId);
    DalHints hints = DalHints.createIfAbsent(null);
    return queryDao.update(builder, parameters, hints);
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) FreeUpdateSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters)

Example 10 with FreeUpdateSqlBuilder

use of com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder in project dal by ctripcorp.

the class UserGroupDao method updateUserPersimion.

public int updateUserPersimion(Integer userId, Integer groupId, Integer role, Integer adduser) throws SQLException {
    FreeUpdateSqlBuilder builder = new FreeUpdateSqlBuilder(dbCategory);
    builder.setTemplate("UPDATE user_group SET role=?, adduser=?  WHERE user_id=? AND group_id=?");
    StatementParameters parameters = new StatementParameters();
    int i = 1;
    parameters.set(i++, "role", Types.INTEGER, role);
    parameters.set(i++, "adduser", Types.INTEGER, adduser);
    parameters.set(i++, "user_id", Types.INTEGER, userId);
    parameters.set(i++, "group_id", Types.INTEGER, groupId);
    DalHints hints = DalHints.createIfAbsent(null);
    return queryDao.update(builder, parameters, hints);
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) FreeUpdateSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters)

Aggregations

FreeUpdateSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder)27 DalHints (com.ctrip.platform.dal.dao.DalHints)20 StatementParameters (com.ctrip.platform.dal.dao.StatementParameters)20 Test (org.junit.Test)7 FreeSelectSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder)2 GenTaskByFreeSql (com.ctrip.platform.dal.daogen.entity.GenTaskByFreeSql)1 GenTaskBySqlBuilder (com.ctrip.platform.dal.daogen.entity.GenTaskBySqlBuilder)1