下面代码实现了,显示用户名称,但是保存到数据库里的是userID,但是现在想要实现,按用户名称查询,请问各位大神,action,dao,jsp里,下边的代码应该怎么写?跪求
public String getList() throws Exception
{
chengJiJiLuList = dao.getList(TrainingOrCompetitionID,userID,startTime,endTime);
userList = this.getUserLisAll();
return SUCCESS;
}
public ArrayList getUserLisAll() throws Exception {
Users user = new Users();
ArrayList userList = new ArrayList<Users>();
service.getObjList(userList, user, " oid in (select id from organization)", " id");
return userList;
}
public List<ChengJiJiLu> getList(int trainingOrCompetitionID,int userid,String startTime,String endTime)
{
String where = " ";
where = where + " and " + TypeChange.DateBetweenSql("a.shiJian", startTime, endTime)+ " and " +"TrainingOrCompetitionID="+trainingOrCompetitionID;
return this.findAll(where);
}
用户名称:<s:textfield name="keRenMingCheng" size="8" value="%{keRenMingCheng}"/>
<TR>
<TH width="10"><s:checkbox id="doAllSele" value="" onclick="selectAll()" name="doAllSele"></s:checkbox></TH>
<TH width="30"> 序号</TH>
<TH>用户名称</TH>
<%--<TH>TrainingOrCompetitionID</TH>--%>
<TH>时间</TH>
<TH>项目</TH>
<TH>状态</TH>
<TH>备注</TH>
</TR>
<s:iterator value="chengJiJiLuList" status="st" var="cil">
<TR>
<TD><input type="checkbox" name="selId" id="selId" value="<s:property value="id"/>"/></TD>
<TD align="center"><s:property value='#st.index+1'/></TD>
<TD ><s:iterator value="userList" var="ulist">
<s:if test="#ulist.id==#cil.userID"><s:property value="#ulist.name"/></s:if>
</s:iterator></TD>
<%--<TD ><s:property value="trainingOrCompetitionID"/></TD>--%>
<TD align="center"><s:date name="shiJian" format="yyyy-MM-dd" /></TD>
<TD ><s:property value="xiangMu"/></TD>
<TD ><s:property value="zhuangTai"/></TD>
<TD ><s:property value="beiZhu"/></TD>
</TR>