먼저 두 개의 문자열 (등록 ID 및 사용자 이름)이 있습니다. 이 두 문자열은 연결됩니다. 내가 CONCATENATE 문자열 getStudentUser 얻을두 문자열 사이의 특정 문자열을 식별하는 방법
public ArrayList getStudentUser(int check,int userid,int mgmtid)
{
ArrayList companyList = new ArrayList();
Session session = null;
PreparedStatement pst = null;
ResultSet rst = null;
try {
session = HibernateUtil.getSession();
if(check==1){
String query = "select a.firstname,a.lastName,b.RegistarionId from t_vs_users a inner join t_vs_userdetails b on b.UserId=a.User_ID where a. RoleId=5 and SourceId=? and a.User_ID not in (?)";
pst = session.connection().prepareStatement(query);
pst.setInt(1, mgmtid);
pst.setInt(2, userid);
rst = pst.executeQuery();
while(rst.next()) {
companyList.add(rst.getString("firstname")+""+(rst.getString("lastName"))+","+rst.getString("RegistarionId"));
}
} else {
String query = "select a.firstname,a.lastName,b.RegistarionId from t_vs_users a inner join t_vs_userdetails b on b.UserId=a.User_ID where a. RoleId=5 and SourceId=? and a.User_ID not in (?)";
pst = session.connection().prepareStatement(query);
pst.setInt(1, mgmtid);
pst.setInt(2, userid);
rst = pst.executeQuery();
while(rst.next()) {
companyList.add(rst.getString("RegistarionId")+","+(rst.getString("firstname"))+""+rst.getString("lastName"));
}
}
}catch(Exception e)
{
e.printStackTrace();
}
return companyList;
}
public boolean checkIfNumber(String in) {
try {
Integer.parseInt(in);
} catch (NumberFormatException ex) {
return false;
}
return true;
}
하지만 난 단지 등록 ID 방법을 원하는 : 시간의 사용자 이름이 동일하지만 그렇게
이 코드를 등록 ID가 다르기 때문에
이유는 두 문자열을 연결 분할 할
예상 결과와 예제를 추가해주세요. –