@Override public boolean saveZ_User_Power_User( String account_source, String account_source_type, String account_target, String account_target_type) { try { if (StringUtil.isNotEmpty(account_source) && StringUtil.isNotEmpty(account_source_type) && StringUtil.isNotEmpty(account_target) && StringUtil.isNotEmpty(account_target_type)) { Connection conn = DBUtils.createConn(); String sql = "insert into Z_USER_POWER_USER (account_source, account_source_type, account_target,account_target_type)" + " values('" + account_source + "','" + account_source_type + "','" + account_target + "','" + account_target_type + "')"; Statement st = conn.createStatement(); int ds = st.executeUpdate(sql); DBUtils.close(conn); if (st != null) { st.close(); } if (ds > 0) { return true; } else { return false; } } else { return false; } } catch (Exception e) { e.printStackTrace(); return false; } }
@Override public boolean deleteZ_User_Power_User( String account_source, String account_source_type, String account_target, String account_target_type) { try { Connection conn = DBUtils.createConn(); String sql = " delete from Z_USER_POWER_USER where 1=1"; if (StringUtil.isNotEmpty(account_target)) { sql += " and account_target ='" + account_target + "' "; } if (StringUtil.isNotEmpty(account_source_type)) { sql += " and account_source_type ='" + account_source_type + "' "; } if (StringUtil.isNotEmpty(account_target_type)) { sql += " and account_target_type ='" + account_target_type + "' "; } if (StringUtil.isNotEmpty(account_source)) { sql += " and account_source ='" + account_source + "' "; PreparedStatement ps = DBUtils.getPs(conn, sql); int isok = ps.executeUpdate(sql); DBUtils.close(ps); DBUtils.close(conn); if (isok > 0) { return true; } else { return false; } } else { return false; } } catch (Exception e) { e.printStackTrace(); return false; } }