日期:2014-05-20 浏览次数:21000 次
Connection conn = MySqlTool.getMySqlConnection();
PreparedStatement ps = null;
String sql = "";
try {
if(groupObj.getGroupAddress()!=null || groupObj.getGroupAddress().trim().length()!=0){
sql = "update t_group set groupAddress = ? where groupKey = ?";
ps = conn.prepareStatement(sql);
ps.setString(1, groupObj.getGroupAddress());
ps.setString(2, groupObj.getGroupKey());
ps.executeUpdate();
}
if(groupObj.getGroupDescription()!= null || groupObj.getGroupDescription().length() != 0){
sql = "update t_group set groupDescption = ? where groupKey = ?";
ps = conn.prepareStatement(sql);
ps.setString(1, groupObj.getGroupDescription());
ps.setString(2, groupObj.getGroupKey());
ps.executeUpdate();
}
if(groupObj.getGroupName() != null || groupObj.getGroupName().length() != 0){
sql = "update t_group set groupName = ? where groupKey = ?";
ps = conn.prepareStatement(sql);
ps.setString(1, groupObj.getGroupName());
ps.setString(2, groupObj.getGroupKey());
ps.executeUpdate();
}
ps.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
MySqlTool.closeMySqlConnection(conn);
}