Skip to content

Commit

Permalink
update fix
Browse files Browse the repository at this point in the history
  • Loading branch information
think-gem committed Aug 30, 2013
1 parent c7f3784 commit 67f61bf
Show file tree
Hide file tree
Showing 20 changed files with 145 additions and 75 deletions.
14 changes: 7 additions & 7 deletions bin/refresh-db/cms/jeesite_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CREATE TABLE cms_article
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '文章表';
) ENGINE=InnoDB COMMENT = '文章表';


CREATE TABLE cms_article_data
Expand All @@ -46,7 +46,7 @@ CREATE TABLE cms_article_data
relation varchar(255) COMMENT '相关文章',
allow_comment char(1) COMMENT '是否允许评论',
PRIMARY KEY (id)
) COMMENT = '文章详表';
) ENGINE=InnoDB COMMENT = '文章详表';


CREATE TABLE cms_category
Expand Down Expand Up @@ -78,7 +78,7 @@ CREATE TABLE cms_category
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '栏目表';
) ENGINE=InnoDB COMMENT = '栏目表';


CREATE TABLE cms_comment
Expand All @@ -95,7 +95,7 @@ CREATE TABLE cms_comment
audit_date datetime COMMENT '审核时间',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '评论表';
) ENGINE=InnoDB COMMENT = '评论表';


CREATE TABLE cms_guestbook
Expand All @@ -114,7 +114,7 @@ CREATE TABLE cms_guestbook
re_content varchar(100) COMMENT '回复内容',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '留言板';
) ENGINE=InnoDB COMMENT = '留言板';


CREATE TABLE cms_link
Expand All @@ -134,7 +134,7 @@ CREATE TABLE cms_link
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '友情链接';
) ENGINE=InnoDB COMMENT = '友情链接';


CREATE TABLE cms_site
Expand All @@ -156,7 +156,7 @@ CREATE TABLE cms_site
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '站点表';
) ENGINE=InnoDB COMMENT = '站点表';



Expand Down
14 changes: 7 additions & 7 deletions bin/refresh-db/cms/jeesite_oracle.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ DROP SEQUENCE seq_cms_site;

/* Create Sequences */

CREATE SEQUENCE seq_cms_article INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_cms_article_data INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_cms_category INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_cms_comment INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_cms_guestbook INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_cms_link INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_cms_site INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_cms_article INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_cms_article_data INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_cms_category INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_cms_comment INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_cms_guestbook INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_cms_link INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_cms_site INCREMENT BY 1 START WITH 100;



Expand Down
2 changes: 1 addition & 1 deletion bin/refresh-db/oa/jeesite_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CREATE TABLE oa_leave
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
);
) ENGINE=InnoDB ;



Expand Down
4 changes: 2 additions & 2 deletions bin/refresh-db/oa/jeesite_oracle.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ DROP SEQUENCE SEQ_oa_leave_id;

/* Create Sequences */

CREATE SEQUENCE seq_oa_leave INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE SEQ_oa_leave_id INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_oa_leave INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE SEQ_oa_leave_id INCREMENT BY 1 START WITH 100;



Expand Down
20 changes: 10 additions & 10 deletions bin/refresh-db/sys/jeesite_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CREATE TABLE sys_area
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '区域表';
) ENGINE=InnoDB COMMENT = '区域表';


CREATE TABLE sys_dict
Expand All @@ -52,7 +52,7 @@ CREATE TABLE sys_dict
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '字典表';
) ENGINE=InnoDB COMMENT = '字典表';


CREATE TABLE sys_log
Expand Down Expand Up @@ -86,7 +86,7 @@ CREATE TABLE sys_mdict
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '区域表';
) ENGINE=InnoDB COMMENT = '区域表';


CREATE TABLE sys_menu
Expand All @@ -108,7 +108,7 @@ CREATE TABLE sys_menu
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '菜单表';
) ENGINE=InnoDB COMMENT = '菜单表';


CREATE TABLE sys_office
Expand All @@ -134,7 +134,7 @@ CREATE TABLE sys_office
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '部门表';
) ENGINE=InnoDB COMMENT = '部门表';


CREATE TABLE sys_role
Expand All @@ -152,23 +152,23 @@ CREATE TABLE sys_role
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '角色表';
) ENGINE=InnoDB COMMENT = '角色表';


CREATE TABLE sys_role_menu
(
role_id bigint NOT NULL COMMENT '角色编号',
menu_id bigint NOT NULL COMMENT '菜单编号',
PRIMARY KEY (role_id, menu_id)
) COMMENT = '角色-菜单';
) ENGINE=InnoDB COMMENT = '角色-菜单';


CREATE TABLE sys_role_office
(
role_id bigint NOT NULL COMMENT '角色编号',
office_id bigint NOT NULL COMMENT '机构编号',
PRIMARY KEY (role_id, office_id)
) COMMENT = '角色-机构';
) ENGINE=InnoDB COMMENT = '角色-机构';


CREATE TABLE sys_user
Expand All @@ -193,15 +193,15 @@ CREATE TABLE sys_user
remarks varchar(255) COMMENT '备注信息',
del_flag char(1) DEFAULT '0' NOT NULL COMMENT '删除标记(0:正常;1:删除)',
PRIMARY KEY (id)
) COMMENT = '用户表';
) ENGINE=InnoDB COMMENT = '用户表';


CREATE TABLE sys_user_role
(
user_id bigint NOT NULL COMMENT '用户编号',
role_id bigint NOT NULL COMMENT '角色编号',
PRIMARY KEY (user_id, role_id)
) COMMENT = '用户-角色';
) ENGINE=InnoDB COMMENT = '用户-角色';



Expand Down
18 changes: 9 additions & 9 deletions bin/refresh-db/sys/jeesite_oracle.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ DROP SEQUENCE seq_sys_user;

/* Create Sequences */

CREATE SEQUENCE hibernate_sequence INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_sys_area INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_sys_dict INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_sys_log INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_sys_mdict INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_sys_menu INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_sys_office INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_sys_role INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE seq_sys_user INCREMENT BY 1 START WITH 1;
CREATE SEQUENCE hibernate_sequence INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_sys_area INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_sys_dict INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_sys_log INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_sys_mdict INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_sys_menu INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_sys_office INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_sys_role INCREMENT BY 1 START WITH 100;
CREATE SEQUENCE seq_sys_user INCREMENT BY 1 START WITH 100;



Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
</dependency><!-- jpa
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
</dependency> -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public static String formatDate(Date date, Object... pattern) {
}
return formatDate;
}

/**
* 得到日期时间字符串,转换格式(yyyy-MM-dd HH:mm:ss)
*/
public static String formatDateTime(Date date) {
return formatDate(date, "yyyy-MM-dd HH:mm:ss");
}

/**
* 得到当前时间字符串 格式(HH:mm:ss)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.Valid;
Expand Down Expand Up @@ -50,7 +51,7 @@
@Table(name = "cms_article")
@DynamicInsert @DynamicUpdate
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Indexed @Analyzer(impl = IKAnalyzer.class)
//@Indexed @Analyzer(impl = IKAnalyzer.class)
public class Article extends DataEntity {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -192,7 +193,9 @@ public void setPosid(String posid) {
this.posid = posid;
}

@OneToOne(mappedBy="article",cascade=CascadeType.ALL,optional=false)
// @OneToOne(mappedBy="article",cascade=CascadeType.ALL,optional=false)
@OneToOne(cascade=CascadeType.ALL)
@PrimaryKeyJoinColumn
@Valid
@IndexedEmbedded
public ArticleData getArticleData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ public void setAllowComment(String allowComment) {
this.allowComment = allowComment;
}

@OneToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE},optional=false)
@PrimaryKeyJoinColumn
// @OneToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE},optional=false)
// @PrimaryKeyJoinColumn
@OneToOne(mappedBy="articleData",cascade=CascadeType.ALL)
@PrimaryKeyJoinColumn
public Article getArticle() {
return article;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.cms.entity.Article;
import com.thinkgem.jeesite.modules.cms.entity.ArticleData;
import com.thinkgem.jeesite.modules.cms.entity.Category;
import com.thinkgem.jeesite.modules.cms.entity.Site;
import com.thinkgem.jeesite.modules.cms.service.ArticleService;
Expand Down Expand Up @@ -58,6 +59,14 @@ public Article get(@RequestParam(required=false) Long id) {
@RequiresPermissions("cms:article:view")
@RequestMapping(value = {"list", ""})
public String list(Article article, HttpServletRequest request, HttpServletResponse response, Model model) {
// for (int i=0; i<10000000; i++){
// Article a = new Article();
// a.setCategory(new Category(article.getCategory().getId()));
// a.setTitle("测试测试测试测试测试测试测试测试"+a.getCategory().getId());
// a.setArticleData(new ArticleData());
// a.getArticleData().setContent(a.getTitle());
// articleService.save(a);
// }
Page<Article> page = articleService.find(new Page<Article>(request, response), article, true);
model.addAttribute("page", page);
return "modules/cms/articleList";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public List<Area> findAllList(){
}

public List<Area> findAllChild(Long parentId, String likeParentIds){
return find("from Area where delFlag=:p1 and (id=p2 or parent.id=:p2 or parentIds like :p3) order by code",
return find("from Area where delFlag=:p1 and (id=:p2 or parent.id=:p2 or parentIds like :p3) order by code",
new Parameter(Area.DEL_FLAG_NORMAL, parentId, likeParentIds));
}
}
13 changes: 9 additions & 4 deletions src/main/java/com/thinkgem/jeesite/modules/sys/entity/Area.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
Expand All @@ -25,6 +26,8 @@
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;
Expand Down Expand Up @@ -124,9 +127,10 @@ public void setCode(String code) {
this.code = code;
}

@OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="area")
// @OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="area")
@OneToMany(mappedBy = "area", fetch=FetchType.LAZY)
@Where(clause="del_flag='"+DEL_FLAG_NORMAL+"'")
@OrderBy(value="code")
@OrderBy(value="code") @Fetch(FetchMode.SUBSELECT)
@NotFound(action = NotFoundAction.IGNORE)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public List<Office> getOfficeList() {
Expand All @@ -137,9 +141,10 @@ public void setOfficeList(List<Office> officeList) {
this.officeList = officeList;
}

@OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="parent")
// @OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="parent")
@OneToMany(mappedBy = "parent", fetch=FetchType.LAZY)
@Where(clause="del_flag='"+DEL_FLAG_NORMAL+"'")
@OrderBy(value="code")
@OrderBy(value="code") @Fetch(FetchMode.SUBSELECT)
@NotFound(action = NotFoundAction.IGNORE)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public List<Area> getChildList() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ public void setPermission(String permission) {
this.permission = permission;
}

@OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="parent")
// @OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="parent")
@OneToMany(mappedBy = "parent", fetch=FetchType.LAZY)
@Where(clause="del_flag='"+DEL_FLAG_NORMAL+"'")
@OrderBy(value="sort")
@OrderBy(value="sort") @Fetch(FetchMode.SUBSELECT)
@NotFound(action = NotFoundAction.IGNORE)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public List<Menu> getChildList() {
Expand Down
Loading

0 comments on commit 67f61bf

Please sign in to comment.