Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#929 Display creator of search condition #935

Merged
merged 1 commit into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.support.project.knowledge.dao.CommentsDao;
import org.support.project.knowledge.dao.DraftItemValuesDao;
import org.support.project.knowledge.dao.ExGroupsDao;
import org.support.project.knowledge.dao.ExUsersDao;
import org.support.project.knowledge.dao.KnowledgeHistoriesDao;
import org.support.project.knowledge.dao.KnowledgeItemValuesDao;
import org.support.project.knowledge.dao.KnowledgesDao;
Expand Down Expand Up @@ -528,10 +529,12 @@ public Boundary list() throws Exception {
if (StringUtils.isNotEmpty(creators)) {
String[] creatorsArray = creators.split(",");
for (String userName : creatorsArray) {
List<UsersEntity> users = UserLogic.get().getUser(userName.trim(), offset, 20);
List<UsersEntity> users = ExUsersDao.get().selectByUserName(userName);
creatorUserEntities.addAll(users);
}
}
setAttribute("creators", creatorUserEntities);

knowledges.addAll(knowledgeLogic.searchKnowledge(keyword, tags, groups, creatorUserEntities, templates, loginedUser, offset * PAGE_LIMIT, PAGE_LIMIT));
}

Expand Down
15 changes: 15 additions & 0 deletions src/main/java/org/support/project/knowledge/dao/ExUsersDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,20 @@ public AccountInfo selectAccountInfoOnKey(Integer userId) {

return info;
}

/**
* ユーザ名でユーザの情報を取得
* 同姓同名も存在しうるため、リストで返す
* @param userName
* @return
*/
public List<UsersEntity> selectByUserName(String userName) {
String sql = "SELECT * FROM USERS WHERE USER_NAME = ?";
List<UsersEntity> users = executeQueryList(sql, UsersEntity.class, userName);
for (UsersEntity usersEntity : users) {
usersEntity.setPassword(""); // パスワードはクリア
}
return users;
}

}
16 changes: 13 additions & 3 deletions src/main/webapp/WEB-INF/views/open/knowledge/list.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

<!-- Filter -->
<c:if
test="${!empty selectedTag || !empty selectedGroup || !empty selectedUser || !empty selectedTags || !empty selectedGroups || !empty keyword || !empty types}">
test="${!empty selectedTag || !empty selectedGroup || !empty selectedUser || !empty selectedTags || !empty selectedGroups || !empty keyword || !empty types || !empty creators }">
<div class="row">
<div class="col-sm-12 selected_tag">

Expand Down Expand Up @@ -103,6 +103,15 @@
</a>
</c:forEach>
</c:if>

<c:if test="${!empty creators}">
<c:forEach var="creator" items="${creators}" varStatus="status">
<a class="text-link" href="<%=request.getContextPath()%>/open.knowledge/list?creators=<%=jspUtil.out("creator.userName")%>">
<i class="fa fa-pencil"></i>&nbsp;<%=jspUtil.out("creator.userName")%>
</a>
</c:forEach>
</c:if>


<c:if test="${!empty selectedGroups}">
<c:forEach var="group" items="${selectedGroups}" varStatus="status">
Expand Down Expand Up @@ -164,7 +173,7 @@
</div>
</c:if>


<c:if test="${empty types}">
<div class="row">
<div class="col-sm-12">
<form role="form" action="<%=request.getContextPath()%>/open.knowledge/list">
Expand Down Expand Up @@ -199,10 +208,11 @@
<button class="btn btn-primary btn-xs" type="submit">
<i class="fa fa-search"></i>&nbsp;<%= jspUtil.label("label.apply") %>
</button>
</form>
</div>
</form>
</div>
</div>
</c:if>

<!-- リスト -->
<div class="row" id="knowledgeList">
Expand Down