diff --git a/bower.json b/bower.json index 36146c357..efca93ba3 100644 --- a/bower.json +++ b/bower.json @@ -10,7 +10,8 @@ "bootbox": "4.3.0", "bootstrap-tagsinput": "0.4.2", "jquery-file-upload": "9.8.1", - "teambox.free-file-icons": "teambox/Free-file-icons" + "teambox.free-file-icons": "teambox/Free-file-icons", + "echojs": "1.6.0" }, "devDependencies": {} } diff --git a/document/database/knowledge.a5er b/document/database/knowledge.a5er index 90f3679f6..39013df4d 100755 --- a/document/database/knowledge.a5er +++ b/document/database/knowledge.a5er @@ -47,6 +47,48 @@ SqlSeparator=0 ShowTag=1 ShowCommonAttributes=0 +[Relation] +Entity1=USERS +Entity2=ACCOUNT_IMAGES +RelationType1=1 +RelationType2=3 +Fields1=USER_ID +Fields2=USER_ID +Cardinarity1= +Cardinarity2= +Position="MAIN",0,4985,4791,7220,R,R +Dependence=0 +Caption= +PName= +LineMode=0 +Bar1=498 +Bar2=479 +Bar3=722 +TermPos1=R +TermPos2=R + +[Entity] +PName=ACCOUNT_IMAGES +LName=アカウントの画像 +Comment= +TableOption= +Page=Main +Left=550 +Top=850 +Field="IMAGE_ID","IMAGE_ID","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" +Field="ユーザID","USER_ID","@INT",,,"","",$FFFFFFFF,"" +Field="ファイル名","FILE_NAME","@VARCHAR(256)",,,"","",$FFFFFFFF,"" +Field="ファイルサイズ","FILE_SIZE","@DOUBLE",,,"","",$FFFFFFFF,"" +Field="バイナリ","FILE_BINARY","blob",,,"","",$FFFFFFFF,"" +Field="拡張子","EXTENSION","@VARCHAR(256)",,,"","",$FFFFFFFF,"" +Field="CONTENT_TYPE","CONTENT_TYPE","@VARCHAR(256)",,,"","",$FFFFFFFF,"" +Index=IDX_ACCOUNT_IMAGES_USER_ID=1,USER_ID +EffectMode=None +Color=$000000 +BkColor=$FFFFFF +ModifiedDateTime=20150102014151 +Position="Main",550,850 + [Relation] Entity1=KNOWLEDGES Entity2=LIKES @@ -74,14 +116,15 @@ Comment= TableOption= Page=MAIN Left=100 -Top=900 +Top=1300 Field="NO","NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" Field="ナレッジID","KNOWLEDGE_ID","bigint","NOT NULL",,"","",$FFFFFFFF,"" +Index=IDX_LIKES_KNOWLEDGE_ID=0,KNOWLEDGE_ID EffectMode=None Color=$000000 BkColor=$FFFFFF -ModifiedDateTime=20141228073716 -Position="MAIN",100,900 +ModifiedDateTime=20150102013522 +Position="MAIN",100,1300 [Relation] Entity1=KNOWLEDGES @@ -115,10 +158,11 @@ Top=1550 Field="コメント番号","COMMENT_NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" Field="ナレッジID","KNOWLEDGE_ID","bigint","NOT NULL",,"","",$FFFFFFFF,"" Field="コメント","COMMENT","text",,,"","",$FFFFFFFF,"" +Index=IDX_COMMENTS_KNOWLEDGE_ID=0,KNOWLEDGE_ID EffectMode=None Color=$000000 BkColor=$FFFFFF -ModifiedDateTime=20141222160017 +ModifiedDateTime=20150102013923 Position="MAIN",1300,1550 [Relation] @@ -152,10 +196,11 @@ Top=1400 Field="VOTE_NO","VOTE_NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" Field="ナレッジID","KNOWLEDGE_ID","bigint","NOT NULL",,"","",$FFFFFFFF,"" Field="投票区分","VOTE_KIND","@INT","NOT NULL",,"","",$FFFFFFFF,"" +Index=IDX_VOTES_KNOWLEDGE_ID=0,KNOWLEDGE_ID EffectMode=None Color=$000000 BkColor=$FFFFFF -ModifiedDateTime=20141222155133 +ModifiedDateTime=20150102013835 Position="MAIN",1250,1400,435,89 [Relation] @@ -190,10 +235,11 @@ Top=850 Field="HISTORY_NO","HISTORY_NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" Field="ナレッジID","KNOWLEDGE_ID","bigint","NOT NULL",,"","",$FFFFFFFF,"" Field="日時","VIEW_DATE_TIME","@DATETIME","NOT NULL",,"","",$FFFFFFFF,"" +Index=IDX_VIEW_HISTORIES_KNOWLEDGE_ID=0,KNOWLEDGE_ID EffectMode=None Color=$000000 BkColor=$FFFFFF -ModifiedDateTime=20141222154942 +ModifiedDateTime=20150102013703 Position="MAIN",1150,850 [Relation] @@ -315,14 +361,14 @@ Fields1=TAG_ID Fields2=TAG_ID Cardinarity1= Cardinarity2= -Position="MAIN",0,4552,5672,4658,R,R +Position="MAIN",0,4552,5672,5143,R,R Dependence=1 Caption= PName= LineMode=0 Bar1=455 Bar2=567 -Bar3=466 +Bar3=514 TermPos1=R TermPos2=R @@ -368,15 +414,15 @@ LName=タグ Comment= TableOption= Page=MAIN -Left=600 -Top=850 +Left=100 +Top=1100 Field="タグ_ID","TAG_ID","@INT","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" Field="タグ名称","TAG_NAME","@VARCHAR(128)","NOT NULL",,"","",$FFFFFFFF,"" EffectMode=None Color=$000000 BkColor=$FFFFFF ModifiedDateTime=20141120205901 -Position="MAIN",600,850 +Position="MAIN",100,1100 [Relation] Entity1=KNOWLEDGES @@ -413,10 +459,11 @@ Field="ファイル名","FILE_NAME","@VARCHAR(256)",,,"","",$FFFFFFFF,"" Field="ファイルサイズ","FILE_SIZE","@DOUBLE",,,"","",$FFFFFFFF,"" Field="バイナリ","FILE_BINARY","blob",,,"","",$FFFFFFFF,"" Field="パース結果","PARSE_STATUS","@INT","NOT NULL",,"","",$FFFFFFFF,"" +Index=IDX_KNOWLEDGE_FILES_KNOWLEDGE_ID=0,KNOWLEDGE_ID EffectMode=None Color=$000000 BkColor=$FFFFFF -ModifiedDateTime=20141226051251 +ModifiedDateTime=20150102013438 Position="MAIN",600,1600 [Entity] @@ -434,7 +481,7 @@ Field="公開区分","PUBLIC_FLAG","@INT",,,"","",$FFFFFFFF,"" EffectMode=None Color=$000000 BkColor=$FFFFFF -ModifiedDateTime=20141222155113 +ModifiedDateTime=20150102012615 Position="MAIN",600,1300 [Comment] diff --git a/pom.xml b/pom.xml index e37bf0c7c..d831b1016 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ redcomet knowledge war - 0.2.4 + 0.3.0 webapp for knowledge https://support-project.org/ @@ -17,7 +17,7 @@ redcomet web - 0.2.2 + 0.3.0 @@ -64,13 +64,17 @@ 4.10.2 - org.apache.tika tika-parsers 1.6 + + javax.mail + mail + 1.4.7 + diff --git a/src/main/java/redcomet/knowledge/config/IndexType.java b/src/main/java/redcomet/knowledge/config/IndexType.java index ae91345fe..e84eac5c6 100644 --- a/src/main/java/redcomet/knowledge/config/IndexType.java +++ b/src/main/java/redcomet/knowledge/config/IndexType.java @@ -1,7 +1,7 @@ package redcomet.knowledge.config; public enum IndexType { - Knoeledge, + knowledge, KnowledgeFile; diff --git a/src/main/java/redcomet/knowledge/control/Control.java b/src/main/java/redcomet/knowledge/control/Control.java index 73aea1483..17271ae49 100644 --- a/src/main/java/redcomet/knowledge/control/Control.java +++ b/src/main/java/redcomet/knowledge/control/Control.java @@ -16,8 +16,11 @@ import redcomet.common.log.LogFactory; import redcomet.common.log.LogLevel; import redcomet.common.util.HtmlUtils; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.web.util.JspUtil; +@DI(instance=Instance.Prototype) public abstract class Control extends redcomet.web.control.Control { /** ログ */ private static Log LOG = LogFactory.getLog(Control.class); diff --git a/src/main/java/redcomet/knowledge/control/IndexControl.java b/src/main/java/redcomet/knowledge/control/IndexControl.java index 86bf08892..dcba8f025 100644 --- a/src/main/java/redcomet/knowledge/control/IndexControl.java +++ b/src/main/java/redcomet/knowledge/control/IndexControl.java @@ -2,10 +2,13 @@ import redcomet.common.log.Log; import redcomet.common.log.LogFactory; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.web.bean.MessageResult; import redcomet.web.boundary.Boundary; import redcomet.web.config.MessageStatus; +@DI(instance=Instance.Prototype) public class IndexControl extends Control { /** ログ */ private static Log log = LogFactory.getLog(IndexControl.class); diff --git a/src/main/java/redcomet/knowledge/control/admin/UsersControl.java b/src/main/java/redcomet/knowledge/control/admin/UsersControl.java index 419276891..62f9af1e2 100644 --- a/src/main/java/redcomet/knowledge/control/admin/UsersControl.java +++ b/src/main/java/redcomet/knowledge/control/admin/UsersControl.java @@ -8,6 +8,8 @@ import redcomet.common.bean.ValidateError; import redcomet.common.util.PropertyUtil; import redcomet.common.util.StringUtils; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; import redcomet.knowledge.logic.UserLogic; import redcomet.knowledge.vo.Roles; @@ -20,6 +22,7 @@ import redcomet.web.entity.UsersEntity; import redcomet.web.exception.InvalidParamException; +@DI(instance=Instance.Prototype) public class UsersControl extends Control { public static final int PAGE_LIMIT = 100; diff --git a/src/main/java/redcomet/knowledge/control/open/AccountControl.java b/src/main/java/redcomet/knowledge/control/open/AccountControl.java new file mode 100644 index 000000000..f78474a4a --- /dev/null +++ b/src/main/java/redcomet/knowledge/control/open/AccountControl.java @@ -0,0 +1,42 @@ +package redcomet.knowledge.control.open; + +import java.io.InputStream; + +import redcomet.di.DI; +import redcomet.di.Instance; +import redcomet.knowledge.control.Control; +import redcomet.knowledge.dao.AccountImagesDao; +import redcomet.knowledge.entity.AccountImagesEntity; +import redcomet.web.boundary.Boundary; +import redcomet.web.exception.InvalidParamException; + +@DI(instance=Instance.Prototype) +public class AccountControl extends Control { + /** + * ユーザのアイコン画像を取得 + * @return + * @throws InvalidParamException + */ + public Boundary icon() throws InvalidParamException { + Integer userId = getPathInteger(-1); + + AccountImagesDao dao = AccountImagesDao.get(); + AccountImagesEntity entity = dao.selectOnUserId(userId); + + String fileName = "icon.png"; + String contentType = "image/png"; + InputStream inputStream = null; + long size = 12140; + if (entity != null) { + fileName = entity.getFileName(); + contentType = entity.getContentType(); + size = entity.getFileSize().longValue(); + inputStream = entity.getFileBinary(); + } else { + inputStream = getClass().getResourceAsStream("/icon/icon.png"); + } + return download(fileName, inputStream, size, contentType); + + } + +} diff --git a/src/main/java/redcomet/knowledge/control/open/FileControl.java b/src/main/java/redcomet/knowledge/control/open/FileControl.java index c61a8d056..0250222ac 100644 --- a/src/main/java/redcomet/knowledge/control/open/FileControl.java +++ b/src/main/java/redcomet/knowledge/control/open/FileControl.java @@ -2,12 +2,15 @@ import redcomet.common.log.Log; import redcomet.common.log.LogFactory; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; import redcomet.knowledge.entity.KnowledgeFilesEntity; import redcomet.knowledge.logic.UploadedFileLogic; import redcomet.web.boundary.Boundary; import redcomet.web.common.HttpStatus; +@DI(instance=Instance.Prototype) public class FileControl extends Control { /** ログ */ private static Log LOG = LogFactory.getLog(FileControl.class); diff --git a/src/main/java/redcomet/knowledge/control/open/KnowledgeControl.java b/src/main/java/redcomet/knowledge/control/open/KnowledgeControl.java index 54887573e..1d09e8362 100644 --- a/src/main/java/redcomet/knowledge/control/open/KnowledgeControl.java +++ b/src/main/java/redcomet/knowledge/control/open/KnowledgeControl.java @@ -8,6 +8,8 @@ import redcomet.common.log.Log; import redcomet.common.log.LogFactory; import redcomet.common.util.StringUtils; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; import redcomet.knowledge.dao.CommentsDao; import redcomet.knowledge.dao.LikesDao; @@ -25,6 +27,7 @@ import redcomet.web.common.HttpStatus; import redcomet.web.exception.InvalidParamException; +@DI(instance=Instance.Prototype) public class KnowledgeControl extends Control { /** ログ */ private static Log LOG = LogFactory.getLog(KnowledgeControl.class); diff --git a/src/main/java/redcomet/knowledge/control/open/LicenseControl.java b/src/main/java/redcomet/knowledge/control/open/LicenseControl.java index 79ac4749e..5ee77e7aa 100644 --- a/src/main/java/redcomet/knowledge/control/open/LicenseControl.java +++ b/src/main/java/redcomet/knowledge/control/open/LicenseControl.java @@ -1,7 +1,10 @@ package redcomet.knowledge.control.open; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; +@DI(instance=Instance.Prototype) public class LicenseControl extends Control { } diff --git a/src/main/java/redcomet/knowledge/control/protect/AccountControl.java b/src/main/java/redcomet/knowledge/control/protect/AccountControl.java index 56cb9a2ef..e8ad78b6d 100644 --- a/src/main/java/redcomet/knowledge/control/protect/AccountControl.java +++ b/src/main/java/redcomet/knowledge/control/protect/AccountControl.java @@ -1,13 +1,24 @@ package redcomet.knowledge.control.protect; +import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import org.apache.commons.fileupload.FileItem; + import redcomet.common.bean.ValidateError; import redcomet.common.util.StringUtils; +import redcomet.common.validate.Validator; +import redcomet.common.validate.ValidatorFactory; import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; +import redcomet.knowledge.logic.AccountLogic; import redcomet.knowledge.logic.UserLogic; +import redcomet.knowledge.vo.UploadFile; +import redcomet.knowledge.vo.UploadResults; import redcomet.web.bean.LoginedUser; import redcomet.web.boundary.Boundary; import redcomet.web.common.HttpStatus; @@ -16,6 +27,7 @@ import redcomet.web.logic.AuthenticationLogic; import redcomet.web.logic.impl.DefaultAuthenticationLogicImpl; +@DI(instance=Instance.Prototype) public class AccountControl extends Control { @Override @@ -108,5 +120,45 @@ public Boundary delete() throws Exception { //return redirect(getRequest().getContextPath()); } - + /** + * アイコン画像をアップロード + * @return + * @throws IOException + */ + public Boundary iconupload() throws IOException { + AccountLogic logic = AccountLogic.get(); + UploadResults results = new UploadResults(); + List files = new ArrayList(); + Object obj = getParam("files[]", Object.class); + if (obj instanceof FileItem) { + FileItem fileItem = (FileItem) obj; + ValidateError error = checkExtension(fileItem.getName()); + if (error != null) { + return send(HttpStatus.SC_400_BAD_REQUEST, error); + } + UploadFile file = logic.saveIconImage(fileItem, getLoginedUser(), getRequest().getContextPath()); + files.add(file); + } else if (obj instanceof List) { + List fileItems = (List) obj; + for (FileItem fileItem : fileItems) { + ValidateError error = checkExtension(fileItem.getName()); + if (error != null) { + return send(HttpStatus.SC_400_BAD_REQUEST, error); + } + UploadFile file = logic.saveIconImage(fileItem, getLoginedUser(), getRequest().getContextPath()); + files.add(file); + } + } + results.setFiles(files); + return send(HttpStatus.SC_200_OK, results); + } + /** + * アイコン画像の拡張子チェック + * @param name + * @return + */ + private ValidateError checkExtension(String name) { + Validator validator = ValidatorFactory.getInstance(Validator.EXTENSION); + return validator.validate(name, "icon", "png", "jpg", "jpeg", "gif"); + } } diff --git a/src/main/java/redcomet/knowledge/control/protect/FileControl.java b/src/main/java/redcomet/knowledge/control/protect/FileControl.java index 4fa87a980..b5a81b285 100644 --- a/src/main/java/redcomet/knowledge/control/protect/FileControl.java +++ b/src/main/java/redcomet/knowledge/control/protect/FileControl.java @@ -7,6 +7,8 @@ import redcomet.common.log.Log; import redcomet.common.log.LogFactory; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; import redcomet.knowledge.dao.KnowledgeFilesDao; import redcomet.knowledge.entity.KnowledgeFilesEntity; @@ -17,6 +19,7 @@ import redcomet.web.boundary.JsonBoundary; import redcomet.web.common.HttpStatus; +@DI(instance=Instance.Prototype) public class FileControl extends Control { /** ログ */ private static Log LOG = LogFactory.getLog(FileControl.class); diff --git a/src/main/java/redcomet/knowledge/control/protect/KnowledgeControl.java b/src/main/java/redcomet/knowledge/control/protect/KnowledgeControl.java index 512926b4a..9a53844df 100644 --- a/src/main/java/redcomet/knowledge/control/protect/KnowledgeControl.java +++ b/src/main/java/redcomet/knowledge/control/protect/KnowledgeControl.java @@ -9,6 +9,8 @@ import redcomet.common.log.LogFactory; import redcomet.common.util.StringUtils; import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; import redcomet.knowledge.dao.CommentsDao; import redcomet.knowledge.dao.KnowledgesDao; @@ -22,6 +24,7 @@ import redcomet.web.common.HttpStatus; import redcomet.web.exception.InvalidParamException; +@DI(instance=Instance.Prototype) public class KnowledgeControl extends Control { /** ログ */ private static Log LOG = LogFactory.getLog(KnowledgeControl.class); diff --git a/src/main/java/redcomet/knowledge/dao/AccountImagesDao.java b/src/main/java/redcomet/knowledge/dao/AccountImagesDao.java new file mode 100644 index 000000000..b5958eca6 --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/AccountImagesDao.java @@ -0,0 +1,32 @@ +package redcomet.knowledge.dao; + +import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; +import redcomet.knowledge.dao.gen.GenAccountImagesDao; +import redcomet.knowledge.entity.AccountImagesEntity; + +/** + * アカウントの画像 + */ +@DI(instance=Instance.Singleton) +public class AccountImagesDao extends GenAccountImagesDao { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static AccountImagesDao get() { + return Container.getComp(AccountImagesDao.class); + } + public AccountImagesEntity selectOnUserId(Integer userId) { + String sql = "SELECT * FROM ACCOUNT_IMAGES WHERE USER_ID = ?"; + return executeQuerySingle(sql, AccountImagesEntity.class, userId); + } + + + +} diff --git a/src/main/java/redcomet/knowledge/dao/gen/GenAccountImagesDao.java b/src/main/java/redcomet/knowledge/dao/gen/GenAccountImagesDao.java new file mode 100644 index 000000000..33692c55c --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/gen/GenAccountImagesDao.java @@ -0,0 +1,270 @@ +package redcomet.knowledge.dao.gen; + +import java.util.List; + +import java.io.InputStream; +import java.sql.Timestamp; + + +import redcomet.knowledge.entity.AccountImagesEntity; +import redcomet.ormapping.dao.AbstractDao; +import redcomet.ormapping.exception.ORMappingException; +import redcomet.ormapping.common.SQLManager; +import redcomet.ormapping.common.DBUserPool; +import redcomet.ormapping.common.IDGen; +import redcomet.common.util.PropertyUtil; + +import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; +import redcomet.aop.Aspect; + +/** + * アカウントの画像 + */ +@DI(instance=Instance.Singleton) +public class GenAccountImagesDao extends AbstractDao { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static GenAccountImagesDao get() { + return Container.getComp(GenAccountImagesDao.class); + } + + /** + * 全て取得(削除フラグを無視して取得) + */ + public List physicalSelectAll() { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_all.sql"); + return executeQuery(sql, AccountImagesEntity.class); + } + /** + * キーで1件取得(削除フラグを無視して取得) + */ + public AccountImagesEntity physicalSelectOnKey(Long imageId) { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_on_key.sql"); + return executeQueryOnKey(sql, AccountImagesEntity.class, imageId); + } + /** + * 全て取得 + */ + public List selectAll() { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_all.sql"); + return executeQuery(sql, AccountImagesEntity.class); + } + /** + * キーで1件取得 + */ + public AccountImagesEntity selectOnKey(Long imageId) { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_on_key.sql"); + return executeQueryOnKey(sql, AccountImagesEntity.class, imageId); + } + /** + * 登録(データを生で操作) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity physicalInsert(AccountImagesEntity entity) { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_insert.sql"); + Class type = PropertyUtil.getPropertyType(entity, "imageId"); + Object key = executeInsert(sql, type, + entity.getImageId() + , entity.getUserId() + , entity.getFileName() + , entity.getFileSize() + , entity.getFileBinary() + , entity.getExtension() + , entity.getContentType() + , entity.getInsertUser() + , entity.getInsertDatetime() + , entity.getUpdateUser() + , entity.getUpdateDatetime() + , entity.getDeleteFlag() + ); + PropertyUtil.setPropertyValue(entity, "imageId", key); + return entity; + } + /** + * 登録(登録ユーザを指定) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity insert(Integer user, AccountImagesEntity entity) { + entity.setInsertUser(user); + entity.setInsertDatetime(new Timestamp(new java.util.Date().getTime())); + entity.setUpdateUser(user); + entity.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + entity.setDeleteFlag(0); + return physicalInsert(entity); + } + /** + * 登録 + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity insert(AccountImagesEntity entity) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer userId = (Integer) pool.getUser(); + return insert(userId, entity); + } + /** + * 更新(データを生で操作) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity physicalUpdate(AccountImagesEntity entity) { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_update.sql"); + executeUpdate(sql, + entity.getUserId() + , entity.getFileName() + , entity.getFileSize() + , entity.getFileBinary() + , entity.getExtension() + , entity.getContentType() + , entity.getInsertUser() + , entity.getInsertDatetime() + , entity.getUpdateUser() + , entity.getUpdateDatetime() + , entity.getDeleteFlag() + , entity.getImageId() + ); + return entity; + } + /** + * 更新(更新ユーザを指定) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity update(Integer user, AccountImagesEntity entity) { + AccountImagesEntity db = selectOnKey(entity.getImageId()); + entity.setInsertUser(db.getInsertUser()); + entity.setInsertDatetime(db.getInsertDatetime()); + entity.setDeleteFlag(db.getDeleteFlag()); + entity.setUpdateUser(user); + entity.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + return physicalUpdate(entity); + } + /** + * 更新 + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity update(AccountImagesEntity entity) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer userId = (Integer) pool.getUser(); + return update(userId, entity); + } + /** + * 保存(ユーザを指定) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity save(Integer user, AccountImagesEntity entity) { + AccountImagesEntity db = selectOnKey(entity.getImageId()); + if (db == null) { + return insert(user, entity); + } else { + return update(user, entity); + } + } + /** + * 保存(存在しなければ登録、存在すれば更新) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity save(AccountImagesEntity entity) { + AccountImagesEntity db = selectOnKey(entity.getImageId()); + if (db == null) { + return insert(entity); + } else { + return update(entity); + } + } + /** + * 削除(データを生で操作/物理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void physicalDelete(Long imageId) { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_delete.sql"); + executeUpdate(sql, imageId); + } + /** + * 削除(データを生で操作/物理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void physicalDelete(AccountImagesEntity entity) { + physicalDelete(entity.getImageId()); + + } + /** + * 削除(削除ユーザを指定/論理削除があれば論理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void delete(Integer user, Long imageId) { + AccountImagesEntity db = selectOnKey(imageId); + db.setDeleteFlag(1); + db.setUpdateUser(user); + db.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + physicalUpdate(db); + } + /** + * 削除(論理削除があれば論理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void delete(Long imageId) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer user = (Integer) pool.getUser(); + delete(user, imageId); + } + /** + * 削除(削除ユーザを指定/論理削除があれば論理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void delete(Integer user, AccountImagesEntity entity) { + delete(user, entity.getImageId()); + + } + /** + * 削除(論理削除があれば論理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void delete(AccountImagesEntity entity) { + delete(entity.getImageId()); + + } + /** + 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void activation(Integer user, Long imageId) { + AccountImagesEntity db = physicalSelectOnKey(imageId); + db.setDeleteFlag(0); + db.setUpdateUser(user); + db.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + physicalUpdate(db); + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void activation(Long imageId) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer user = (Integer) pool.getUser(); + activation(user, imageId); + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void activation(Integer user, AccountImagesEntity entity) { + activation(user, entity.getImageId()); + + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void activation(AccountImagesEntity entity) { + activation(entity.getImageId()); + + } + +} diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_delete.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_delete.sql new file mode 100644 index 000000000..04ad7c0b1 --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_delete.sql @@ -0,0 +1,4 @@ +DELETE FROM ACCOUNT_IMAGES +WHERE +IMAGE_ID = ? +; diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_insert.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_insert.sql new file mode 100644 index 000000000..fa582a620 --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_insert.sql @@ -0,0 +1,28 @@ +INSERT INTO ACCOUNT_IMAGES +( +IMAGE_ID + , USER_ID + , FILE_NAME + , FILE_SIZE + , FILE_BINARY + , EXTENSION + , CONTENT_TYPE + , INSERT_USER + , INSERT_DATETIME + , UPDATE_USER + , UPDATE_DATETIME + , DELETE_FLAG +) VALUES ( +? + , ? + , ? + , ? + , ? + , ? + , ? + , ? + , ? + , ? + , ? + , ? +); diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_all.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_all.sql new file mode 100644 index 000000000..264387c8e --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_all.sql @@ -0,0 +1 @@ +SELECT * FROM ACCOUNT_IMAGES; diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_on_key.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_on_key.sql new file mode 100644 index 000000000..00a6b510a --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_on_key.sql @@ -0,0 +1,4 @@ +SELECT * FROM ACCOUNT_IMAGES + WHERE +IMAGE_ID = ? +; diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_all.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_all.sql new file mode 100644 index 000000000..431b8be9d --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_all.sql @@ -0,0 +1,2 @@ +SELECT * FROM ACCOUNT_IMAGES + WHERE DELETE_FLAG = 0; diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_on_key.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_on_key.sql new file mode 100644 index 000000000..3622e625c --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_on_key.sql @@ -0,0 +1,5 @@ +SELECT * FROM ACCOUNT_IMAGES + WHERE +IMAGE_ID = ? + AND DELETE_FLAG = 0; +; diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_update.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_update.sql new file mode 100644 index 000000000..6e55a6163 --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_update.sql @@ -0,0 +1,16 @@ +UPDATE ACCOUNT_IMAGES +SET + USER_ID = ? + , FILE_NAME = ? + , FILE_SIZE = ? + , FILE_BINARY = ? + , EXTENSION = ? + , CONTENT_TYPE = ? + , INSERT_USER = ? + , INSERT_DATETIME = ? + , UPDATE_USER = ? + , UPDATE_DATETIME = ? + , DELETE_FLAG = ? +WHERE +IMAGE_ID = ? +; diff --git a/src/main/java/redcomet/knowledge/deploy/InitDB.java b/src/main/java/redcomet/knowledge/deploy/InitDB.java index 3ffe7a536..8e30525ae 100644 --- a/src/main/java/redcomet/knowledge/deploy/InitDB.java +++ b/src/main/java/redcomet/knowledge/deploy/InitDB.java @@ -7,6 +7,7 @@ import redcomet.common.log.Log; import redcomet.common.log.LogFactory; import redcomet.knowledge.deploy.v0_0_1.InitializeSystem; +import redcomet.knowledge.deploy.v0_3_0.Migrate_0_3_0; import redcomet.web.dao.SystemsDao; import redcomet.web.entity.SystemsEntity; @@ -18,11 +19,15 @@ public class InitDB { private static final String SYSTEM_NAME = "knowledge"; private static final Map MAP = new LinkedHashMap<>(); + private static final Migrate INIT = InitializeSystem.get(); + private static final String CURRENT = "0.3.0"; + public InitDB() { super(); // MAP.put("0.0.1", InitializeSystem.get()); // MAP.put("0.1.0", Migrate_0_1_0.get()); - MAP.put("0.2.0", InitializeSystem.get()); //既存データは全てクリア + MAP.put("0.2.0", INIT); // 初期公開バージョン + MAP.put(CURRENT, Migrate_0_3_0.get()); } public static void main(String[] args) throws Exception { @@ -51,14 +56,18 @@ public void start() throws Exception { finded = true; } + if (finded) { + // テーブルが存在しない(初めての起動) + version = CURRENT; + migrate = INIT; + doMigrate(migrate, version); + return; + } + + // バージョンアップ Iterator versions = MAP.keySet().iterator(); while (versions.hasNext()) { String v = (String) versions.next(); - if (finded) { - version = v; - migrate = MAP.get(v); - break; - } if (version.equals(v)) { finded = true; } @@ -69,18 +78,19 @@ public void start() throws Exception { } // Migrate 実行 - boolean result = migrate.doMigrate(); - if (result) { - if (entity == null) { - entity = new SystemsEntity(SYSTEM_NAME); - } - entity.setVersion(version); - LOG.info("Migrate to " + version); - dao.save(entity); - } + doMigrate(migrate, version); } while (migrate != null); } - + private void doMigrate(Migrate migrate, String version) throws Exception { + SystemsDao dao = SystemsDao.get(); + boolean result = migrate.doMigrate(); + if (result) { + SystemsEntity entity = new SystemsEntity(SYSTEM_NAME); + entity.setVersion(version); + LOG.info("Migrate to " + version); + dao.save(entity); + } + } } diff --git a/src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java b/src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java new file mode 100644 index 000000000..0875c3f71 --- /dev/null +++ b/src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java @@ -0,0 +1,22 @@ +package redcomet.knowledge.deploy.v0_3_0; + +import redcomet.knowledge.deploy.Migrate; +import redcomet.ormapping.tool.dao.InitializeDao; + +public class Migrate_0_3_0 implements Migrate { + + public static Migrate_0_3_0 get() { + return redcomet.di.Container.getComp(Migrate_0_3_0.class); + } + + @Override + public boolean doMigrate() throws Exception { + InitializeDao initializeDao = InitializeDao.get(); + String[] sqlpaths = { + "/redcomet/knowledge/deploy/v0_3_0/migrate.sql" + }; + initializeDao.initializeDatabase(sqlpaths); + return true; + } + +} diff --git a/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate.sql b/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate.sql new file mode 100644 index 000000000..112f5dea9 --- /dev/null +++ b/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate.sql @@ -0,0 +1,56 @@ +-- アカウントの画像 +drop table if exists ACCOUNT_IMAGES cascade; + +create table ACCOUNT_IMAGES ( + IMAGE_ID bigint not null AUTO_INCREMENT + , USER_ID integer + , FILE_NAME character varying(256) + , FILE_SIZE double precision + , FILE_BINARY blob + , EXTENSION character varying(256) + , CONTENT_TYPE character varying(256) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint ACCOUNT_IMAGES_PKC primary key (IMAGE_ID) +) ; + +create unique index IDX_ACCOUNT_IMAGES_USER_ID + on ACCOUNT_IMAGES(USER_ID); + +create index IDX_LIKES_KNOWLEDGE_ID + on LIKES(KNOWLEDGE_ID); + +create index IDX_COMMENTS_KNOWLEDGE_ID + on COMMENTS(KNOWLEDGE_ID); + +create index IDX_VOTES_KNOWLEDGE_ID + on VOTES(KNOWLEDGE_ID); + +create index IDX_VIEW_HISTORIES_KNOWLEDGE_ID + on VIEW_HISTORIES(KNOWLEDGE_ID); + +create index IDX_KNOWLEDGE_FILES_KNOWLEDGE_ID + on KNOWLEDGE_FILES(KNOWLEDGE_ID); + +ALTER TABLE GROUPS ADD GROUP_CLASS integer; + +comment on table ACCOUNT_IMAGES is 'アカウントの画像'; +comment on column ACCOUNT_IMAGES.IMAGE_ID is 'IMAGE_ID'; +comment on column ACCOUNT_IMAGES.USER_ID is 'ユーザID'; +comment on column ACCOUNT_IMAGES.FILE_NAME is 'ファイル名'; +comment on column ACCOUNT_IMAGES.FILE_SIZE is 'ファイルサイズ'; +comment on column ACCOUNT_IMAGES.FILE_BINARY is 'バイナリ'; +comment on column ACCOUNT_IMAGES.EXTENSION is '拡張子'; +comment on column ACCOUNT_IMAGES.CONTENT_TYPE is 'CONTENT_TYPE'; +comment on column ACCOUNT_IMAGES.INSERT_USER is '登録ユーザ'; +comment on column ACCOUNT_IMAGES.INSERT_DATETIME is '登録日時'; +comment on column ACCOUNT_IMAGES.UPDATE_USER is '更新ユーザ'; +comment on column ACCOUNT_IMAGES.UPDATE_DATETIME is '更新日時'; +comment on column ACCOUNT_IMAGES.DELETE_FLAG is '削除フラグ'; + +comment on column GROUPS.GROUP_CLASS is 'グループの区分'; + + diff --git a/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate2.sql b/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate2.sql new file mode 100644 index 000000000..6b140d08d --- /dev/null +++ b/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate2.sql @@ -0,0 +1,211 @@ +-- パスワードリセット +drop table if exists PASSWORD_RESETS cascade; + +create table PASSWORD_RESETS ( + ID character varying(256) not null + , USER_KEY character varying(256) + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint PASSWORD_RESETS_PKC primary key (ID) +) ; + +-- 仮登録ユーザ +drop table if exists PROVISIONAL_REGISTRATIONS cascade; + +create table PROVISIONAL_REGISTRATIONS ( + ID character varying(256) not null + , USER_KEY character varying(256) not null + , USER_NAME character varying(256) not null + , PASSWORD character varying(1024) not null + , SALT character varying(1024) not null + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint PROVISIONAL_REGISTRATIONS_PKC primary key (ID) +) ; + +-- ハッシュ生成の設定 +drop table if exists HASH_CONFIGS cascade; + +create table HASH_CONFIGS ( + SYSTEM_NAME character varying(64) not null + , HASH_ITERATIONS integer not null + , HASH_SIZE_BITS integer not null + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint HASH_CONFIGS_PKC primary key (SYSTEM_NAME) +) ; + +-- メール設定 +drop table if exists MAIL_CONFIGS cascade; + +create table MAIL_CONFIGS ( + SYSTEM_NAME character varying(64) not null + , HOST character varying(256) not null + , PORT integer not null + , AUTH_TYPE integer not null + , SMTP_ID character varying(256) + , SMTP_PASSWORD character varying(1048) + , SALT character varying(1048) + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint MAIL_CONFIGS_PKC primary key (SYSTEM_NAME) +) ; + +-- コンフィグ +drop table if exists SYSTEM_CONFIGS cascade; + +create table SYSTEM_CONFIGS ( + SYSTEM_NAME character varying(64) not null + , CONFIG_NAME character varying(256) not null + , CONFIG_VALUE character varying(1024) + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint SYSTEM_CONFIGS_PKC primary key (SYSTEM_NAME,CONFIG_NAME) +) ; + +-- メール +drop table if exists MAILS cascade; + +create table MAILS ( + MAIL_ID character varying(64) not null + , STATUS integer not null + , TO_ADDRESS character varying(256) not null + , TO_NAME character varying(256) + , FROM_ADDRESS character varying(256) + , FROM_NAME character varying(256) + , TITLE character varying(256) not null + , CONTENT text + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint MAILS_PKC primary key (MAIL_ID) +) ; + +create index IDX_MAILS_STATUS + on MAILS(STATUS); + + + +alter table HASH_CONFIGS + add constraint HASH_CONFIGS_FK1 foreign key (SYSTEM_NAME) references SYSTEMS(SYSTEM_NAME) + on delete cascade + on update cascade; + +alter table MAIL_CONFIGS + add constraint MAIL_CONFIGS_FK1 foreign key (SYSTEM_NAME) references SYSTEMS(SYSTEM_NAME) + on delete cascade + on update cascade; + +alter table SYSTEM_CONFIGS + add constraint SYSTEM_CONFIGS_FK1 foreign key (SYSTEM_NAME) references SYSTEMS(SYSTEM_NAME) + on delete cascade + on update cascade; + + +comment on table PASSWORD_RESETS is 'パスワードリセット'; +comment on column PASSWORD_RESETS.ID is 'パスワードリセットID'; +comment on column PASSWORD_RESETS.USER_KEY is 'ユーザKEY'; +comment on column PASSWORD_RESETS.ROW_ID is '行ID'; +comment on column PASSWORD_RESETS.INSERT_USER is '登録ユーザ'; +comment on column PASSWORD_RESETS.INSERT_DATETIME is '登録日時'; +comment on column PASSWORD_RESETS.UPDATE_USER is '更新ユーザ'; +comment on column PASSWORD_RESETS.UPDATE_DATETIME is '更新日時'; +comment on column PASSWORD_RESETS.DELETE_FLAG is '削除フラグ'; + +comment on table PROVISIONAL_REGISTRATIONS is '仮登録ユーザ'; +comment on column PROVISIONAL_REGISTRATIONS.ID is '仮発行ID'; +comment on column PROVISIONAL_REGISTRATIONS.USER_KEY is 'ユーザKEY'; +comment on column PROVISIONAL_REGISTRATIONS.USER_NAME is 'ユーザ名'; +comment on column PROVISIONAL_REGISTRATIONS.PASSWORD is 'パスワード'; +comment on column PROVISIONAL_REGISTRATIONS.SALT is 'SALT'; +comment on column PROVISIONAL_REGISTRATIONS.ROW_ID is '行ID'; +comment on column PROVISIONAL_REGISTRATIONS.INSERT_USER is '登録ユーザ'; +comment on column PROVISIONAL_REGISTRATIONS.INSERT_DATETIME is '登録日時'; +comment on column PROVISIONAL_REGISTRATIONS.UPDATE_USER is '更新ユーザ'; +comment on column PROVISIONAL_REGISTRATIONS.UPDATE_DATETIME is '更新日時'; +comment on column PROVISIONAL_REGISTRATIONS.DELETE_FLAG is '削除フラグ'; + +comment on table HASH_CONFIGS is 'ハッシュ生成の設定'; +comment on column HASH_CONFIGS.SYSTEM_NAME is 'システム名'; +comment on column HASH_CONFIGS.HASH_ITERATIONS is 'HASH_ITERATIONS'; +comment on column HASH_CONFIGS.HASH_SIZE_BITS is 'HASH_SIZE_BITS'; +comment on column HASH_CONFIGS.ROW_ID is '行ID'; +comment on column HASH_CONFIGS.INSERT_USER is '登録ユーザ'; +comment on column HASH_CONFIGS.INSERT_DATETIME is '登録日時'; +comment on column HASH_CONFIGS.UPDATE_USER is '更新ユーザ'; +comment on column HASH_CONFIGS.UPDATE_DATETIME is '更新日時'; +comment on column HASH_CONFIGS.DELETE_FLAG is '削除フラグ'; + +comment on table MAIL_CONFIGS is 'メール設定'; +comment on column MAIL_CONFIGS.SYSTEM_NAME is 'システム名'; +comment on column MAIL_CONFIGS.HOST is 'SMTP_HOST'; +comment on column MAIL_CONFIGS.PORT is 'SMTP_PORT'; +comment on column MAIL_CONFIGS.AUTH_TYPE is 'AUTH_TYPE'; +comment on column MAIL_CONFIGS.SMTP_ID is 'SMTP_ID'; +comment on column MAIL_CONFIGS.SMTP_PASSWORD is 'SMTP_PASSWORD 暗号化(可逆)'; +comment on column MAIL_CONFIGS.SALT is 'SALT'; +comment on column MAIL_CONFIGS.ROW_ID is '行ID'; +comment on column MAIL_CONFIGS.INSERT_USER is '登録ユーザ'; +comment on column MAIL_CONFIGS.INSERT_DATETIME is '登録日時'; +comment on column MAIL_CONFIGS.UPDATE_USER is '更新ユーザ'; +comment on column MAIL_CONFIGS.UPDATE_DATETIME is '更新日時'; +comment on column MAIL_CONFIGS.DELETE_FLAG is '削除フラグ'; + +comment on table SYSTEM_CONFIGS is 'コンフィグ'; +comment on column SYSTEM_CONFIGS.SYSTEM_NAME is 'システム名'; +comment on column SYSTEM_CONFIGS.CONFIG_NAME is 'コンフィグ名'; +comment on column SYSTEM_CONFIGS.CONFIG_VALUE is 'コンフィグ値'; +comment on column SYSTEM_CONFIGS.ROW_ID is '行ID'; +comment on column SYSTEM_CONFIGS.INSERT_USER is '登録ユーザ'; +comment on column SYSTEM_CONFIGS.INSERT_DATETIME is '登録日時'; +comment on column SYSTEM_CONFIGS.UPDATE_USER is '更新ユーザ'; +comment on column SYSTEM_CONFIGS.UPDATE_DATETIME is '更新日時'; +comment on column SYSTEM_CONFIGS.DELETE_FLAG is '削除フラグ'; + +comment on table MAILS is 'メール'; +comment on column MAILS.MAIL_ID is 'MAIL_ID'; +comment on column MAILS.STATUS is 'ステータス'; +comment on column MAILS.TO_ADDRESS is '送信先'; +comment on column MAILS.TO_NAME is '送信先名'; +comment on column MAILS.FROM_ADDRESS is '送信元'; +comment on column MAILS.FROM_NAME is '送信元名'; +comment on column MAILS.TITLE is 'タイトル'; +comment on column MAILS.CONTENT is 'メッセージ'; +comment on column MAILS.ROW_ID is '行ID'; +comment on column MAILS.INSERT_USER is '登録ユーザ'; +comment on column MAILS.INSERT_DATETIME is '登録日時'; +comment on column MAILS.UPDATE_USER is '更新ユーザ'; +comment on column MAILS.UPDATE_DATETIME is '更新日時'; +comment on column MAILS.DELETE_FLAG is '削除フラグ'; + + +-- 既存のテーブルへの変更 +ALTER TABLE USERS CHANGE COLUMN PASSWORD PASSWORD character varying(1024) not null; +ALTER TABLE USERS ADD COLUMN SALT character varying(1024); + +comment on column USERS.PASSWORD is 'パスワード ハッシュ(不可逆)'; +comment on column USERS.SALT is 'SALT'; + diff --git a/src/main/java/redcomet/knowledge/entity/AccountImagesEntity.java b/src/main/java/redcomet/knowledge/entity/AccountImagesEntity.java new file mode 100644 index 000000000..32d192965 --- /dev/null +++ b/src/main/java/redcomet/knowledge/entity/AccountImagesEntity.java @@ -0,0 +1,51 @@ +package redcomet.knowledge.entity; + +import redcomet.knowledge.entity.gen.GenAccountImagesEntity; + +import java.util.List; +import java.util.Map; + +import redcomet.common.bean.ValidateError; +import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; + +import java.io.InputStream; +import java.sql.Timestamp; + + +/** + * アカウントの画像 + */ +@DI(instance=Instance.Prototype) +public class AccountImagesEntity extends GenAccountImagesEntity { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static AccountImagesEntity get() { + return Container.getComp(AccountImagesEntity.class); + } + + /** + * コンストラクタ + */ + public AccountImagesEntity() { + super(); + } + + /** + * コンストラクタ + * @param imageId IMAGE_ID + */ + + public AccountImagesEntity(Long imageId) { + super( imageId); + } + +} diff --git a/src/main/java/redcomet/knowledge/entity/gen/GenAccountImagesEntity.java b/src/main/java/redcomet/knowledge/entity/gen/GenAccountImagesEntity.java new file mode 100644 index 000000000..ee9df5316 --- /dev/null +++ b/src/main/java/redcomet/knowledge/entity/gen/GenAccountImagesEntity.java @@ -0,0 +1,412 @@ +package redcomet.knowledge.entity.gen; + +import java.io.Serializable; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; + +import java.io.InputStream; +import java.sql.Timestamp; + + + +import redcomet.common.bean.ValidateError; +import redcomet.common.validate.Validator; +import redcomet.common.validate.ValidatorFactory; +import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; + +/** + * アカウントの画像 + */ +@DI(instance=Instance.Prototype) +public class GenAccountImagesEntity implements Serializable { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static GenAccountImagesEntity get() { + return Container.getComp(GenAccountImagesEntity.class); + } + + /** + * コンストラクタ + */ + public GenAccountImagesEntity() { + super(); + } + + /** + * コンストラクタ + * @param imageId IMAGE_ID + */ + + public GenAccountImagesEntity(Long imageId) { + super(); + this.imageId = imageId; + } + /** IMAGE_ID */ + private Long imageId; + /** ユーザID */ + private Integer userId; + /** ファイル名 */ + private String fileName; + /** ファイルサイズ */ + private Double fileSize; + /** バイナリ */ + private InputStream fileBinary; + /** 拡張子 */ + private String extension; + /** CONTENT_TYPE */ + private String contentType; + /** 登録ユーザ */ + private Integer insertUser; + /** 登録日時 */ + private Timestamp insertDatetime; + /** 更新ユーザ */ + private Integer updateUser; + /** 更新日時 */ + private Timestamp updateDatetime; + /** 削除フラグ */ + private Integer deleteFlag; + + /** + * IMAGE_ID を取得する + */ + public Long getImageId() { + return this.imageId; + } + /** + * IMAGE_ID を設定する + * @param imageId IMAGE_ID + */ + public GenAccountImagesEntity setImageId(Long imageId) { + this.imageId = imageId; + return this; + } + + /** + * ユーザID を取得する + */ + public Integer getUserId() { + return this.userId; + } + /** + * ユーザID を設定する + * @param userId ユーザID + */ + public GenAccountImagesEntity setUserId(Integer userId) { + this.userId = userId; + return this; + } + + /** + * ファイル名 を取得する + */ + public String getFileName() { + return this.fileName; + } + /** + * ファイル名 を設定する + * @param fileName ファイル名 + */ + public GenAccountImagesEntity setFileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * ファイルサイズ を取得する + */ + public Double getFileSize() { + return this.fileSize; + } + /** + * ファイルサイズ を設定する + * @param fileSize ファイルサイズ + */ + public GenAccountImagesEntity setFileSize(Double fileSize) { + this.fileSize = fileSize; + return this; + } + + /** + * バイナリ を取得する + */ + public InputStream getFileBinary() { + return this.fileBinary; + } + /** + * バイナリ を設定する + * @param fileBinary バイナリ + */ + public GenAccountImagesEntity setFileBinary(InputStream fileBinary) { + this.fileBinary = fileBinary; + return this; + } + + /** + * 拡張子 を取得する + */ + public String getExtension() { + return this.extension; + } + /** + * 拡張子 を設定する + * @param extension 拡張子 + */ + public GenAccountImagesEntity setExtension(String extension) { + this.extension = extension; + return this; + } + + /** + * CONTENT_TYPE を取得する + */ + public String getContentType() { + return this.contentType; + } + /** + * CONTENT_TYPE を設定する + * @param contentType CONTENT_TYPE + */ + public GenAccountImagesEntity setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * 登録ユーザ を取得する + */ + public Integer getInsertUser() { + return this.insertUser; + } + /** + * 登録ユーザ を設定する + * @param insertUser 登録ユーザ + */ + public GenAccountImagesEntity setInsertUser(Integer insertUser) { + this.insertUser = insertUser; + return this; + } + + /** + * 登録日時 を取得する + */ + public Timestamp getInsertDatetime() { + return this.insertDatetime; + } + /** + * 登録日時 を設定する + * @param insertDatetime 登録日時 + */ + public GenAccountImagesEntity setInsertDatetime(Timestamp insertDatetime) { + this.insertDatetime = insertDatetime; + return this; + } + + /** + * 更新ユーザ を取得する + */ + public Integer getUpdateUser() { + return this.updateUser; + } + /** + * 更新ユーザ を設定する + * @param updateUser 更新ユーザ + */ + public GenAccountImagesEntity setUpdateUser(Integer updateUser) { + this.updateUser = updateUser; + return this; + } + + /** + * 更新日時 を取得する + */ + public Timestamp getUpdateDatetime() { + return this.updateDatetime; + } + /** + * 更新日時 を設定する + * @param updateDatetime 更新日時 + */ + public GenAccountImagesEntity setUpdateDatetime(Timestamp updateDatetime) { + this.updateDatetime = updateDatetime; + return this; + } + + /** + * 削除フラグ を取得する + */ + public Integer getDeleteFlag() { + return this.deleteFlag; + } + /** + * 削除フラグ を設定する + * @param deleteFlag 削除フラグ + */ + public GenAccountImagesEntity setDeleteFlag(Integer deleteFlag) { + this.deleteFlag = deleteFlag; + return this; + } + + /** + * キーの値を取得 + */ + public Object[] getKeyValues() { + Object[] keyValues = new Object[1]; + keyValues[0] = this.imageId; + return keyValues; + } + /** + * キーの値を設定 + * @param imageId IMAGE_ID + */ + public void setKeyValues(Long imageId) { + this.imageId = imageId; + } + /** + * キーで比較 + */ + public boolean equalsOnKey(GenAccountImagesEntity entity) { + Object[] keyValues1 = getKeyValues(); + Object[] keyValues2 = entity.getKeyValues(); + for (int i = 0; i < keyValues1.length; i++) { + Object val1 = keyValues1[i]; + Object val2 = keyValues2[i]; + if (val1 == null && val2 != null) { + return false; + } + if (val1 != null && val2 == null) { + return false; + } + if (val1 != null && val2 != null) { + if (!val1.equals(val2)) { + return false; + } + } + + } + return true; + } + /** + * ToString + */ + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("imageId = ").append(imageId).append("\n"); + builder.append("userId = ").append(userId).append("\n"); + builder.append("fileName = ").append(fileName).append("\n"); + builder.append("fileSize = ").append(fileSize).append("\n"); + builder.append("fileBinary = ").append(fileBinary).append("\n"); + builder.append("extension = ").append(extension).append("\n"); + builder.append("contentType = ").append(contentType).append("\n"); + builder.append("insertUser = ").append(insertUser).append("\n"); + builder.append("insertDatetime = ").append(insertDatetime).append("\n"); + builder.append("updateUser = ").append(updateUser).append("\n"); + builder.append("updateDatetime = ").append(updateDatetime).append("\n"); + builder.append("deleteFlag = ").append(deleteFlag).append("\n"); + return builder.toString(); + } + /** + * 表示用の名称を変換 + */ + protected String convLabelName(String label) { + return label; + } + /** + * validate + */ + public List validate() { + List errors = new ArrayList<>(); + Validator validator; + ValidateError error; + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(this.userId, convLabelName("User Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(this.fileName, convLabelName("File Name"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(this.extension, convLabelName("Extension"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(this.contentType, convLabelName("Content Type"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(this.insertUser, convLabelName("Insert User")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(this.updateUser, convLabelName("Update User")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(this.deleteFlag, convLabelName("Delete Flag")); + if (error != null) { + errors.add(error); + } + return errors; + } + /** + * validate + */ + public List validate(Map values) { + List errors = new ArrayList<>(); + Validator validator; + ValidateError error; + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(values.get("userId"), convLabelName("User Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(values.get("fileName"), convLabelName("File Name"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(values.get("extension"), convLabelName("Extension"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(values.get("contentType"), convLabelName("Content Type"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(values.get("insertUser"), convLabelName("Insert User")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(values.get("updateUser"), convLabelName("Update User")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(values.get("deleteFlag"), convLabelName("Delete Flag")); + if (error != null) { + errors.add(error); + } + return errors; + } + +} diff --git a/src/main/java/redcomet/knowledge/logic/AccountLogic.java b/src/main/java/redcomet/knowledge/logic/AccountLogic.java new file mode 100644 index 000000000..d9cfb3bd5 --- /dev/null +++ b/src/main/java/redcomet/knowledge/logic/AccountLogic.java @@ -0,0 +1,82 @@ +package redcomet.knowledge.logic; + +import java.io.IOException; +import java.util.Date; + +import org.apache.commons.fileupload.FileItem; + +import redcomet.common.log.Log; +import redcomet.common.log.LogFactory; +import redcomet.common.util.StringUtils; +import redcomet.di.Container; +import redcomet.knowledge.dao.AccountImagesDao; +import redcomet.knowledge.entity.AccountImagesEntity; +import redcomet.knowledge.vo.UploadFile; +import redcomet.web.bean.LoginedUser; + +public class AccountLogic { + /** ログ */ + private static Log LOG = LogFactory.getLog(AccountLogic.class); + + public static AccountLogic get() { + return Container.getComp(AccountLogic.class); + } + + public UploadFile saveIconImage(FileItem fileItem, LoginedUser loginedUser, String context) throws IOException { + LOG.trace("saveFile()"); + AccountImagesDao dao = AccountImagesDao.get(); + AccountImagesEntity entity =dao.selectOnUserId(loginedUser.getUserId()); + if (entity == null) { + entity = new AccountImagesEntity(); + } + + entity.setFileName(fileItem.getName()); + entity.setFileSize(new Double(fileItem.getSize())); + entity.setFileBinary(fileItem.getInputStream()); + entity.setUserId(loginedUser.getUserId()); + + String extension = StringUtils.getExtension(entity.getFileName()); + entity.setExtension(extension); + + String contentType = "application/octet-stream"; + if (StringUtils.isNotEmpty(extension)) { + if (extension.toLowerCase().indexOf("png") != -1) { + contentType = "image/png"; + } else if (extension.toLowerCase().indexOf("jpg") != -1) { + contentType = "image/jpeg"; + } else if (extension.toLowerCase().indexOf("jpeg") != -1) { + contentType = "image/jpeg"; + } else if (extension.toLowerCase().indexOf("gif") != -1) { + contentType = "image/gif"; + } + } + entity.setContentType(contentType); + entity = dao.save(entity); + UploadFile file = convUploadFile(context, entity); + //処理が完了したら、テンポラリのファイルを削除 + fileItem.delete(); + return file; + } + + + /** + * KnowledgeFilesEntity の情報から、画面に戻す UploadFile の情報を生成する + * @param context + * @param entity + * @return + */ + private UploadFile convUploadFile(String context, AccountImagesEntity entity) { + UploadFile file = new UploadFile(); + file.setFileNo(new Long(entity.getUserId())); + file.setUrl(context + "/open.account/icon/" + entity.getUserId()); + file.setThumbnailUrl(context + "/open.account/icon/" + entity.getUserId() + "?t=" + new Date().getTime()); + file.setName(entity.getFileName()); + file.setType("-"); + file.setSize(entity.getFileSize()); + file.setDeleteUrl(context + "/protect.account/delete"); + file.setDeleteType("DELETE"); + return file; + } + + +} diff --git a/src/main/java/redcomet/knowledge/logic/KnowledgeLogic.java b/src/main/java/redcomet/knowledge/logic/KnowledgeLogic.java index c36b94f61..80a48effc 100644 --- a/src/main/java/redcomet/knowledge/logic/KnowledgeLogic.java +++ b/src/main/java/redcomet/knowledge/logic/KnowledgeLogic.java @@ -45,7 +45,7 @@ public class KnowledgeLogic { public static final int PUBLIC_FLAG_PRIVATE = 1; public static final int PUBLIC_FLAG_SELECT_USERS = 2; - public static final int TYPE_KNOWLEDGE = IndexType.Knoeledge.getValue(); + public static final int TYPE_KNOWLEDGE = IndexType.knowledge.getValue(); public static final int TYPE_FILE = IndexType.KnowledgeFile.getValue(); public static KnowledgeLogic get() { diff --git a/src/main/java/redcomet/knowledge/searcher/impl/LuceneSearcher.java b/src/main/java/redcomet/knowledge/searcher/impl/LuceneSearcher.java index db56e0a0b..ac6313614 100644 --- a/src/main/java/redcomet/knowledge/searcher/impl/LuceneSearcher.java +++ b/src/main/java/redcomet/knowledge/searcher/impl/LuceneSearcher.java @@ -167,7 +167,7 @@ private Query structQuery(final SearchingValue value) throws ParseException { container.add(miniContainer, BooleanClause.Occur.MUST); } else { - Query query = NumericRangeQuery.newIntRange(FIELD_LABEL_TYPE, 1, IndexType.Knoeledge.getValue(), IndexType.Knoeledge.getValue(), true, true); + Query query = NumericRangeQuery.newIntRange(FIELD_LABEL_TYPE, 1, IndexType.knowledge.getValue(), IndexType.knowledge.getValue(), true, true); container.add(query, BooleanClause.Occur.MUST); } diff --git a/src/main/resources/appconfig.xml b/src/main/resources/appconfig.xml index e23c1e5a4..f3eda881b 100644 --- a/src/main/resources/appconfig.xml +++ b/src/main/resources/appconfig.xml @@ -5,6 +5,7 @@ {user.home}/.knowledge/tmp/ {user.home}/.knowledge/db/ 5 + 100 diff --git a/src/main/resources/appresource.properties b/src/main/resources/appresource.properties index 66b7549dd..049b97216 100644 --- a/src/main/resources/appresource.properties +++ b/src/main/resources/appresource.properties @@ -23,6 +23,7 @@ errors.url={1} is an invalid url (web address). errors.exist={1} is already registered. errors.noexist={1} is not exist. errors.noauthority=No authority. +errors.extension={0}\u306e\u62e1\u5f35\u5b50\u304c\u4e0d\u6b63\u3067\u3059\u3002{1}\u306e\u307f\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3059\u3002 label.login=Login message.login.error=ID/Password invalid diff --git a/src/main/resources/appresource_ja_JP.properties b/src/main/resources/appresource_ja_JP.properties index 2cc8cb5d6..2771139cd 100644 --- a/src/main/resources/appresource_ja_JP.properties +++ b/src/main/resources/appresource_ja_JP.properties @@ -23,6 +23,7 @@ errors.url={1}\u306fURL\u3068\u3057\u3066\u4e0d\u6b63\u3067\u3059\u3002 errors.exist=\u5165\u529b\u3055\u308c\u305f{1}\u306f\u65e2\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u3059\u3002 errors.noexist=\u5165\u529b\u3055\u308c\u305f{1}\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 errors.noauthority=\u6a29\u9650\u304c\u3042\u308a\u307e\u305b\u3093\u3002 +errors.extension={0}\u306e\u62e1\u5f35\u5b50\u304c\u4e0d\u6b63\u3067\u3059\u3002{1}\u306e\u307f\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3059\u3002 label.login=Login message.login.error=ID/Password\u304c\u9593\u9055\u3063\u3066\u3044\u307e\u3059\u3002 diff --git a/src/main/resources/icon/icon.png b/src/main/resources/icon/icon.png new file mode 100644 index 000000000..b0caee2ca Binary files /dev/null and b/src/main/resources/icon/icon.png differ diff --git a/src/main/resources/redcomet/knowledge/database/ddl.sql b/src/main/resources/redcomet/knowledge/database/ddl.sql index d43126eb8..f5274e77f 100644 --- a/src/main/resources/redcomet/knowledge/database/ddl.sql +++ b/src/main/resources/redcomet/knowledge/database/ddl.sql @@ -1,3 +1,25 @@ +-- アカウントの画像 +drop table if exists ACCOUNT_IMAGES cascade; + +create table ACCOUNT_IMAGES ( + IMAGE_ID bigint not null AUTO_INCREMENT + , USER_ID integer + , FILE_NAME character varying(256) + , FILE_SIZE double precision + , FILE_BINARY blob + , EXTENSION character varying(256) + , CONTENT_TYPE character varying(256) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint ACCOUNT_IMAGES_PKC primary key (IMAGE_ID) +) ; + +create unique index IDX_ACCOUNT_IMAGES_USER_ID + on ACCOUNT_IMAGES(USER_ID); + -- いいね drop table if exists LIKES cascade; @@ -12,6 +34,9 @@ create table LIKES ( , constraint LIKES_PKC primary key (NO) ) ; +create index IDX_LIKES_KNOWLEDGE_ID + on LIKES(KNOWLEDGE_ID); + -- コメント drop table if exists COMMENTS cascade; @@ -27,6 +52,9 @@ create table COMMENTS ( , constraint COMMENTS_PKC primary key (COMMENT_NO) ) ; +create index IDX_COMMENTS_KNOWLEDGE_ID + on COMMENTS(KNOWLEDGE_ID); + -- 投票 drop table if exists VOTES cascade; @@ -42,6 +70,9 @@ create table VOTES ( , constraint VOTES_PKC primary key (VOTE_NO) ) ; +create index IDX_VOTES_KNOWLEDGE_ID + on VOTES(KNOWLEDGE_ID); + -- ナレッジの参照履歴 drop table if exists VIEW_HISTORIES cascade; @@ -57,6 +88,9 @@ create table VIEW_HISTORIES ( , constraint VIEW_HISTORIES_PKC primary key (HISTORY_NO) ) ; +create index IDX_VIEW_HISTORIES_KNOWLEDGE_ID + on VIEW_HISTORIES(KNOWLEDGE_ID); + -- ストックしたナレッジ drop table if exists STOCKS cascade; @@ -146,6 +180,9 @@ create table KNOWLEDGE_FILES ( , constraint KNOWLEDGE_FILES_PKC primary key (FILE_NO) ) ; +create index IDX_KNOWLEDGE_FILES_KNOWLEDGE_ID + on KNOWLEDGE_FILES(KNOWLEDGE_ID); + -- ナレッジ drop table if exists KNOWLEDGES cascade; @@ -212,6 +249,20 @@ alter table KNOWLEDGE_FILES on delete cascade on update cascade; +comment on table ACCOUNT_IMAGES is 'アカウントの画像'; +comment on column ACCOUNT_IMAGES.IMAGE_ID is 'IMAGE_ID'; +comment on column ACCOUNT_IMAGES.USER_ID is 'ユーザID'; +comment on column ACCOUNT_IMAGES.FILE_NAME is 'ファイル名'; +comment on column ACCOUNT_IMAGES.FILE_SIZE is 'ファイルサイズ'; +comment on column ACCOUNT_IMAGES.FILE_BINARY is 'バイナリ'; +comment on column ACCOUNT_IMAGES.EXTENSION is '拡張子'; +comment on column ACCOUNT_IMAGES.CONTENT_TYPE is 'CONTENT_TYPE'; +comment on column ACCOUNT_IMAGES.INSERT_USER is '登録ユーザ'; +comment on column ACCOUNT_IMAGES.INSERT_DATETIME is '登録日時'; +comment on column ACCOUNT_IMAGES.UPDATE_USER is '更新ユーザ'; +comment on column ACCOUNT_IMAGES.UPDATE_DATETIME is '更新日時'; +comment on column ACCOUNT_IMAGES.DELETE_FLAG is '削除フラグ'; + comment on table LIKES is 'いいね'; comment on column LIKES.NO is 'NO'; comment on column LIKES.KNOWLEDGE_ID is 'ナレッジID'; diff --git a/src/main/webapp/WEB-INF/views/commons/layout/commonHeader.jsp b/src/main/webapp/WEB-INF/views/commons/layout/commonHeader.jsp index 53a6476e9..461d2ed71 100644 --- a/src/main/webapp/WEB-INF/views/commons/layout/commonHeader.jsp +++ b/src/main/webapp/WEB-INF/views/commons/layout/commonHeader.jsp @@ -10,14 +10,14 @@ - - - - - + + + + + diff --git a/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp b/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp index fcbe42b59..b23ce5b90 100644 --- a/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp +++ b/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp @@ -57,7 +57,7 @@ <% if (request.getRemoteUser() != null) { %>