下边是我实现图片功能的代码:现在我需要添加一个用户名称(登录人)查询,但是我这个表里存的是user表里的id,而不是名称,所以我想知道怎么实现按名称查询,求大神能够在代码上修改,大家可以先看看我的代码,或者详细告知下,本人新手,跪求指导
public String getList() throws Exception
{
chengJiJiLuList = dao.getList(TrainingOrCompetitionID,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,String startTime,String endTime)
{
String where = " ";
where = where + " and " + TypeChange.DateBetweenSql("a.shiJian", startTime, endTime)+ " and " +"TrainingOrCompetitionID="+trainingOrCompetitionID;
return this.findAll(where);
}
<div class="buttonDiv">
查询日期: <input type="text" name="startTime" size="10" value="<s:property value="startTime"/>" readonly="true" onclick="setday(this)">
至 <input type="text" name="endTime" size="10" value="<s:property value="endTime"/>" readonly="true" onclick="setday(this)">
用户名称:<s:textfield name="keRenMingCheng" size="8" value="%{keRenMingCheng}"/>
<s:submit theme="simple" name="List" action="List" value="查询" cssClass="button_style" method="getList"/>
<input type="button" class="button_style_add" onclick="return doAction('add')"/>
<input type="button" class="button_style_edit" onclick="return doAction('update')"/>
<input type="button" class="button_style_del" onclick="return doAction('del')"/>
</div>
<div class="validatemsg">
<s:actionerror/>
<s:fielderror/>
<s:actionmessage/>
</div>
<table width="100%" class="listext" id="table1">
<tr>
<TH colspan="7" style="background: #EBEBEB;height: 35px"> 成绩记录</TH>
</tr>
<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>
</s:iterator>
</TABLE>