Skip to content

Commit

Permalink
Merge pull request #319 from support-project/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
koda-masaru committed Mar 8, 2016
2 parents 668ffa2 + 8344598 commit 0a8bf34
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 56 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.support-project</groupId>
<artifactId>knowledge</artifactId>
<packaging>war</packaging>
<version>1.2.0</version>
<version>1.2.1</version>
<name>webapp for knowledge</name>
<url>https://support-project.org/</url>

Expand Down
107 changes: 61 additions & 46 deletions src/main/java/org/support/project/knowledge/dao/ExUsersDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,67 @@
import org.support.project.web.dao.UsersDao;
import org.support.project.web.entity.UsersEntity;

/**
* ユーザ情報を取得するDaoのKnowledgeでの拡張
* @author Koda
*/
public class ExUsersDao extends UsersDao {
/**
* インスタンス取得
* AOPに対応
* @return インスタンス
*/
public static ExUsersDao get() {
return Container.getComp(ExUsersDao.class);
}

/**
* グループに所属しているユーザを取得
* @param groupId
* @param offset
* @param limit
* @return
*/
public List<GroupUser> selectGroupUser(Integer groupId, int offset, int limit) {
String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/ExUsersDao/selectGroupUser.sql");
return executeQueryList(sql, GroupUser.class, groupId, limit, offset);
}


/**
* 公開区分が「公開」のナレッジが登録された場合に、通知を希望しているユーザの一覧を取得
* @return
*/
public List<UsersEntity> selectNotifyPublicUsers() {
String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/ExUsersDao/selectNotifyPublicUsers.sql");
return executeQueryList(sql, UsersEntity.class);
}

/**
* アカウント情報ページに表示するデータを取得
*
* アカウント名
* ナレッジ登録件数
* イイネをおされた件数
* ストックされた件数
*
* @param userId
* @return
*/
public AccountInfo selectAccountInfoOnKey(Integer userId) {
String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/ExUsersDao/selectAccountInfoOnKey.sql");
return executeQuerySingle(sql, AccountInfo.class, userId);
}
/** シリアルバージョン */
private static final long serialVersionUID = 1L;

/**
* インスタンス取得 AOPに対応
*
* @return インスタンス
*/
public static ExUsersDao get() {
return Container.getComp(ExUsersDao.class);
}

/**
* グループに所属しているユーザを取得
*
* @param groupId
* @param offset
* @param limit
* @return
*/
public List<GroupUser> selectGroupUser(Integer groupId, int offset, int limit) {
String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/ExUsersDao/selectGroupUser.sql");
return executeQueryList(sql, GroupUser.class, groupId, limit, offset);
}

/**
* 公開区分が「公開」のナレッジが登録された場合に、通知を希望しているユーザの一覧を取得
*
* @return
*/
public List<UsersEntity> selectNotifyPublicUsers() {
String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/ExUsersDao/selectNotifyPublicUsers.sql");
return executeQueryList(sql, UsersEntity.class);
}

/**
* アカウント情報ページに表示するデータを取得
*
* アカウント名 ナレッジ登録件数 イイネをおされた件数 ストックされた件数
*
* @param userId
* @return
*/
public AccountInfo selectAccountInfoOnKey(Integer userId) {
String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/ExUsersDao/selectAccountInfoOnKey.sql");
AccountInfo info = executeQuerySingle(sql, AccountInfo.class, userId);

sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/ExUsersDao/selectLikeCountOnAccount.sql");
Integer likeCount = executeQuerySingle(sql, Integer.class, userId);
info.setLikeCount(likeCount);

sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/ExUsersDao/selectStockCountOnAccount.sql");
Integer stockCount = executeQuerySingle(sql, Integer.class, userId);
info.setStockCount(stockCount);

return info;
}

}
2 changes: 1 addition & 1 deletion src/main/resources/appresource.properties
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ message.allready.started=Allready started.
message.confirm.delete=Are you sure you want to delete?

# Common Label
label.version=v1.2.0
label.version=v1.2.1
label.login=Sign in
label.previous = Previous
label.next=Next
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/appresource_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ message.allready.started=すでに開始済です
message.confirm.delete=本当に削除しますか?

# Common Label
label.version=v1.2.0
label.version=v1.2.1
label.login=サインイン
label.previous = 前へ
label.next = 次へ
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
SELECT
USERS.USER_ID, USERS.USER_KEY, USERS.USER_NAME,
COUNT(KNOWLEDGES.KNOWLEDGE_ID) AS KNOWLEDGE_COUNT,
COUNT(LIKES.NO) AS LIKE_COUNT,
COUNT(STOCK_KNOWLEDGES.STOCK_ID) AS STOCK_COUNT
COUNT(KNOWLEDGES.KNOWLEDGE_ID) AS KNOWLEDGE_COUNT
FROM
USERS
LEFT OUTER JOIN KNOWLEDGES ON KNOWLEDGES.INSERT_USER = USERS.USER_ID
LEFT OUTER JOIN LIKES ON LIKES.KNOWLEDGE_ID = KNOWLEDGES.KNOWLEDGE_ID
LEFT OUTER JOIN STOCK_KNOWLEDGES ON STOCK_KNOWLEDGES.KNOWLEDGE_ID = KNOWLEDGES.KNOWLEDGE_ID
LEFT OUTER JOIN KNOWLEDGES ON (KNOWLEDGES.INSERT_USER = USERS.USER_ID AND KNOWLEDGES.DELETE_FLAG = 0)
WHERE
USERS.USER_ID = ?
AND USERS.DELETE_FLAG = 0
GROUP BY USERS.USER_ID
GROUP BY USERS.USER_ID, USERS.USER_KEY, USERS.USER_NAME
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SELECT
COUNT(LIKES.NO) AS LIKE_COUNT
FROM
USERS
INNER JOIN KNOWLEDGES ON (KNOWLEDGES.INSERT_USER = USERS.USER_ID AND KNOWLEDGES.DELETE_FLAG = 0)
INNER JOIN LIKES ON (LIKES.KNOWLEDGE_ID = KNOWLEDGES.KNOWLEDGE_ID AND LIKES.DELETE_FLAG = 0)
WHERE
USERS.USER_ID = ?
AND USERS.DELETE_FLAG = 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SELECT
COUNT(STOCK_KNOWLEDGES.STOCK_ID) AS STOCK_COUNT
FROM
USERS
INNER JOIN KNOWLEDGES ON (KNOWLEDGES.INSERT_USER = USERS.USER_ID AND KNOWLEDGES.DELETE_FLAG = 0)
INNER JOIN STOCK_KNOWLEDGES ON (STOCK_KNOWLEDGES.KNOWLEDGE_ID = KNOWLEDGES.KNOWLEDGE_ID AND STOCK_KNOWLEDGES.DELETE_FLAG = 0)
WHERE
USERS.USER_ID = ?
AND USERS.DELETE_FLAG = 0

0 comments on commit 0a8bf34

Please sign in to comment.