Showing
16 changed files
with
401 additions
and
0 deletions
dal/src/main/java/com/yoho/datasync/fullsync/dal/repository/yhcms/ITblAttentionUserRepository.java
0 → 100644
1 | +package com.yoho.datasync.fullsync.dal.repository.yhcms; | ||
2 | + | ||
3 | +import com.yoho.datasync.fullsync.dal.repository.yhcms.model.TblAttentionUser; | ||
4 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | + | ||
6 | +/** | ||
7 | + * Created by shengguo.cai on 2019/3/19. | ||
8 | + */ | ||
9 | +public interface ITblAttentionUserRepository extends JpaRepository<TblAttentionUser, Integer> { | ||
10 | +} |
dal/src/main/java/com/yoho/datasync/fullsync/dal/repository/yhcms/ITblCommentInfoRepository.java
0 → 100644
1 | +package com.yoho.datasync.fullsync.dal.repository.yhcms; | ||
2 | + | ||
3 | +import com.yoho.datasync.fullsync.dal.repository.yhcms.model.TblCommentInfo; | ||
4 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | + | ||
6 | +/** | ||
7 | + * Created by shengguo.cai on 2019/3/19. | ||
8 | + */ | ||
9 | +public interface ITblCommentInfoRepository extends JpaRepository<TblCommentInfo, Integer> { | ||
10 | +} |
dal/src/main/java/com/yoho/datasync/fullsync/dal/repository/yhcms/model/TblAttentionUser.java
0 → 100644
1 | +package com.yoho.datasync.fullsync.dal.repository.yhcms.model; | ||
2 | + | ||
3 | +import com.yoho.datasync.fullsync.dal.repository.BaseEntity; | ||
4 | +import lombok.Data; | ||
5 | + | ||
6 | +import javax.persistence.Column; | ||
7 | +import javax.persistence.Entity; | ||
8 | +import javax.persistence.Table; | ||
9 | +import java.io.Serializable; | ||
10 | + | ||
11 | +/** | ||
12 | + * Created by shengguo.cai on 2019/3/19. | ||
13 | + */ | ||
14 | +@Data | ||
15 | +@Entity | ||
16 | +@Table(name = "tbl_attention_user") | ||
17 | +public class TblAttentionUser extends BaseEntity implements Serializable { | ||
18 | + private Integer uid; | ||
19 | + @Column(name = "uid_attention") | ||
20 | + private Integer uidAttention; | ||
21 | + @Column(name = "create_time") | ||
22 | + private Integer createTime; | ||
23 | +} |
dal/src/main/java/com/yoho/datasync/fullsync/dal/repository/yhcms/model/TblCommentInfo.java
0 → 100644
1 | +package com.yoho.datasync.fullsync.dal.repository.yhcms.model; | ||
2 | + | ||
3 | +import com.yoho.datasync.fullsync.dal.repository.BaseEntity; | ||
4 | +import lombok.Data; | ||
5 | + | ||
6 | +import javax.persistence.Column; | ||
7 | +import javax.persistence.Entity; | ||
8 | +import javax.persistence.Table; | ||
9 | +import java.io.Serializable; | ||
10 | + | ||
11 | +/** | ||
12 | + * Created by shengguo.cai on 2019/3/19. | ||
13 | + */ | ||
14 | +@Data | ||
15 | +@Entity | ||
16 | +@Table(name = "tbl_comment_info") | ||
17 | +public class TblCommentInfo extends BaseEntity implements Serializable { | ||
18 | + private Integer id; | ||
19 | + @Column(name = "forum_code") | ||
20 | + private Integer forumCode; | ||
21 | + @Column(name = "content_id") | ||
22 | + private Integer contentId; | ||
23 | + @Column(name = "to_comment_id") | ||
24 | + private Integer toCommentId; | ||
25 | + @Column(name = "parent_comment_id") | ||
26 | + private Integer parentCommentId; | ||
27 | + @Column(name = "floor_num") | ||
28 | + private Integer floorNum; | ||
29 | + private Integer uid; | ||
30 | + @Column(name = "comment_text") | ||
31 | + private String commentText; | ||
32 | + @Column(name = "comment_image") | ||
33 | + private String commentImage; | ||
34 | + @Column(name = "check_status") | ||
35 | + private Integer checkStatus; | ||
36 | + @Column(name = "to_uid") | ||
37 | + private Integer toUid; | ||
38 | + private Integer status; | ||
39 | + @Column(name = "create_time") | ||
40 | + private Integer createTime; | ||
41 | + @Column(name = "real_praise_num") | ||
42 | + private Integer realPraiseNum; | ||
43 | + @Column(name = "fake_praise_num") | ||
44 | + private Integer fakePraiseNum; | ||
45 | + @Column(name = "notice_uids") | ||
46 | + private String noticeUids; | ||
47 | + @Column(name = "author_uid") | ||
48 | + private Integer authorUid; | ||
49 | + @Column(name = "identify_info") | ||
50 | + private String identifyInfo; | ||
51 | +} |
dal/src/main/java/com/yoho/datasync/fullsync/dal/repository/yhsocial/IPostsPraiseRepository.java
0 → 100644
1 | +package com.yoho.datasync.fullsync.dal.repository.yhsocial; | ||
2 | + | ||
3 | +import com.yoho.datasync.fullsync.dal.repository.yhsocial.model.PostsPraise; | ||
4 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | + | ||
6 | +/** | ||
7 | + * Created by shengguo.cai on 2019/3/19. | ||
8 | + */ | ||
9 | +public interface IPostsPraiseRepository extends JpaRepository<PostsPraise, Integer> { | ||
10 | +} |
dal/src/main/java/com/yoho/datasync/fullsync/dal/repository/yhsocial/model/CommunityUser.java
0 → 100644
1 | +package com.yoho.datasync.fullsync.dal.repository.yhsocial.model; | ||
2 | + | ||
3 | +import com.yoho.datasync.fullsync.dal.repository.BaseEntity; | ||
4 | +import lombok.Data; | ||
5 | + | ||
6 | +import javax.persistence.Entity; | ||
7 | +import javax.persistence.Table; | ||
8 | +import java.io.Serializable; | ||
9 | + | ||
10 | +/** | ||
11 | + * Created by shengguo.cai on 2019/3/19. | ||
12 | + */ | ||
13 | +@Data | ||
14 | +@Entity | ||
15 | +@Table(name = "community_user") | ||
16 | +public class CommunityUser extends BaseEntity implements Serializable { | ||
17 | + private Integer uid; | ||
18 | +} |
1 | +package com.yoho.datasync.fullsync.dal.repository.yhsocial.model; | ||
2 | + | ||
3 | +import com.yoho.datasync.fullsync.dal.repository.BaseEntity; | ||
4 | +import lombok.Data; | ||
5 | + | ||
6 | +import javax.persistence.Entity; | ||
7 | +import javax.persistence.Table; | ||
8 | +import java.io.Serializable; | ||
9 | + | ||
10 | +/** | ||
11 | + * Created by shengguo.cai on 2019/3/20. | ||
12 | + */ | ||
13 | +@Data | ||
14 | +@Entity | ||
15 | +@Table(name = "posts") | ||
16 | +public class Posts extends BaseEntity implements Serializable { | ||
17 | + private Integer id; | ||
18 | + private Integer authorId; | ||
19 | + | ||
20 | + private Integer isOnlyImage; | ||
21 | + | ||
22 | + private Integer status; | ||
23 | + | ||
24 | + private Integer isHot; | ||
25 | + | ||
26 | + private Integer isIndexTop; | ||
27 | + | ||
28 | + private Integer isForumTop; | ||
29 | + | ||
30 | + private Long createTime; | ||
31 | + | ||
32 | + private Long revieweTime; | ||
33 | + | ||
34 | + private Integer revieweState; | ||
35 | + | ||
36 | + private String revieweUserName; | ||
37 | + | ||
38 | + private Long updateTime; | ||
39 | + | ||
40 | + private Long indexTopTime; | ||
41 | + | ||
42 | + private Integer shareCommentId; | ||
43 | + | ||
44 | + private Integer shareProductId; | ||
45 | + | ||
46 | + private Integer appType; | ||
47 | + | ||
48 | + private Integer postType; | ||
49 | + | ||
50 | + private Integer voteType; | ||
51 | + | ||
52 | + private Long voteDeadline; | ||
53 | + | ||
54 | + private Integer userPraiseNum; | ||
55 | + private Integer virtualPraiseNum; | ||
56 | + private Integer commentsNum;//废弃 | ||
57 | + private Integer commentNum; | ||
58 | + | ||
59 | + private Integer sendTime; | ||
60 | + | ||
61 | + private String activityType;//活动帖类型,如果不是活动帖,则为null | ||
62 | + | ||
63 | + private String topic;//活动贴的话题 | ||
64 | + | ||
65 | + private String defaultReply;//活动帖的官方默认回复 | ||
66 | + | ||
67 | + private Integer needCoins;//活动帖的参加活动需要消耗的有货币 | ||
68 | + | ||
69 | + private Integer joinNumLimit;//活动帖的最大参加次数,如果没有限制,则为null | ||
70 | + | ||
71 | + private String activityBanner;//活动banner | ||
72 | + | ||
73 | + private Long activityStartTime;//活动开始时间 | ||
74 | + | ||
75 | + private Long activityEndTime;//活动结束时间 | ||
76 | + | ||
77 | + private String noticeUids; | ||
78 | + private String yohoProductSkns; | ||
79 | +} |
dal/src/main/java/com/yoho/datasync/fullsync/dal/repository/yhsocial/model/PostsPraise.java
0 → 100644
1 | +package com.yoho.datasync.fullsync.dal.repository.yhsocial.model; | ||
2 | + | ||
3 | +import com.yoho.datasync.fullsync.dal.repository.BaseEntity; | ||
4 | +import lombok.Data; | ||
5 | + | ||
6 | +import javax.persistence.Column; | ||
7 | +import javax.persistence.Entity; | ||
8 | +import javax.persistence.Table; | ||
9 | +import java.io.Serializable; | ||
10 | + | ||
11 | +/** | ||
12 | + * Created by shengguo.cai on 2019/3/19. | ||
13 | + */ | ||
14 | +@Data | ||
15 | +@Entity | ||
16 | +@Table(name = "posts_praise") | ||
17 | +public class PostsPraise extends BaseEntity implements Serializable { | ||
18 | + @Column(name = "posts_id") | ||
19 | + private Integer postsId; | ||
20 | + private Integer uid; | ||
21 | + @Column(name = "create_time") | ||
22 | + private Long createTime; | ||
23 | + @Column(name = "author_id") | ||
24 | + private Integer authorId; | ||
25 | + @Column(name = "forum_code") | ||
26 | + private Integer forumCode; | ||
27 | + @Column(name = "is_virtual") | ||
28 | + private Integer isVirtual = 0; | ||
29 | +} |
service/src/main/java/com/yoho/datasync/fullsync/controller/YohoNowDataSynController.java
0 → 100644
1 | +package com.yoho.datasync.fullsync.controller; | ||
2 | + | ||
3 | +import com.yoho.datasync.fullsync.dal.repository.yhcms.ITblAttentionUserRepository; | ||
4 | +import com.yoho.datasync.fullsync.dal.repository.yhcms.model.TblAttentionUser; | ||
5 | +import org.springframework.beans.BeanUtils; | ||
6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
7 | +import org.springframework.web.bind.annotation.RestController; | ||
8 | + | ||
9 | +import javax.annotation.Resource; | ||
10 | + | ||
11 | +/** | ||
12 | + * Created by shengguo.cai on 2019/3/19. | ||
13 | + */ | ||
14 | +@RestController | ||
15 | +public class YohoNowDataSynController { | ||
16 | + @Resource | ||
17 | + private ITblAttentionUserRepository tblAttentionUserRepository; | ||
18 | + @RequestMapping("/test") | ||
19 | + public TblAttentionUser test(){ | ||
20 | + TblAttentionUser user = tblAttentionUserRepository.getOne(99); | ||
21 | + TblAttentionUser t = new TblAttentionUser(); | ||
22 | + BeanUtils.copyProperties(user,t); | ||
23 | + return t; | ||
24 | + } | ||
25 | +} |
@@ -33,6 +33,24 @@ public class DataSourceConfig { | @@ -33,6 +33,24 @@ public class DataSourceConfig { | ||
33 | @Value("${spring.datasource.secondary.password}") | 33 | @Value("${spring.datasource.secondary.password}") |
34 | private String password2; | 34 | private String password2; |
35 | 35 | ||
36 | + @Value("${spring.datasource.yhCms.url}") | ||
37 | + private String yhCmsUrl; | ||
38 | + | ||
39 | + @Value("${spring.datasource.yhCms.username}") | ||
40 | + private String yhCmsUsername; | ||
41 | + | ||
42 | + @Value("${spring.datasource.yhCms.password}") | ||
43 | + private String yhCmsPassword; | ||
44 | + | ||
45 | + @Value("${spring.datasource.yhSocial.url}") | ||
46 | + private String yhSocialUrl; | ||
47 | + | ||
48 | + @Value("${spring.datasource.yhSocial.username}") | ||
49 | + private String yhSocialUsername; | ||
50 | + | ||
51 | + @Value("${spring.datasource.yhSocial.password}") | ||
52 | + private String yhSocialPassword; | ||
53 | + | ||
36 | public static final String text = "1qaz2wsx3edc4rfv"; | 54 | public static final String text = "1qaz2wsx3edc4rfv"; |
37 | 55 | ||
38 | @Bean(name = "primaryDataSource") | 56 | @Bean(name = "primaryDataSource") |
@@ -48,6 +66,16 @@ public class DataSourceConfig { | @@ -48,6 +66,16 @@ public class DataSourceConfig { | ||
48 | return getDataSource(url2, username2, password2); | 66 | return getDataSource(url2, username2, password2); |
49 | } | 67 | } |
50 | 68 | ||
69 | + @Bean(name = "yhCmsDataSource") | ||
70 | + public DataSource yhCmsDataSource() throws Exception { | ||
71 | + return getDataSource(yhCmsUrl, yhCmsUsername, yhCmsPassword); | ||
72 | + } | ||
73 | + | ||
74 | + @Bean(name = "yhSocialDataSource") | ||
75 | + public DataSource yhSocialDataSource() throws Exception { | ||
76 | + return getDataSource(yhSocialUrl, yhSocialUsername, yhSocialPassword); | ||
77 | + } | ||
78 | + | ||
51 | private DataSource getDataSource(String url, String userName, String passWord) throws Exception { | 79 | private DataSource getDataSource(String url, String userName, String passWord) throws Exception { |
52 | /* | 80 | /* |
53 | // * 连接池配置 | 81 | // * 连接池配置 |
starter/src/main/java/com/yoho/datasync/fullsync/starter/config/YhCmsDataSourceConfig.java
0 → 100644
1 | +package com.yoho.datasync.fullsync.starter.config; | ||
2 | + | ||
3 | +import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; | ||
4 | +import org.springframework.context.annotation.Bean; | ||
5 | +import org.springframework.context.annotation.Configuration; | ||
6 | +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
7 | +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; | ||
8 | + | ||
9 | +import javax.annotation.Resource; | ||
10 | +import javax.persistence.EntityManager; | ||
11 | +import javax.sql.DataSource; | ||
12 | +import java.util.Properties; | ||
13 | + | ||
14 | +/** | ||
15 | + * Created by shengguo.cai on 2019/3/19. | ||
16 | + */ | ||
17 | +@Configuration | ||
18 | +@EnableJpaRepositories( | ||
19 | + entityManagerFactoryRef = "entityManagerFactoryYhCms", | ||
20 | + basePackages = "com.yoho.datasync.fullsync.dal.repository.yhcms") | ||
21 | +public class YhCmsDataSourceConfig { | ||
22 | + @Resource(name="yhCmsDataSource") | ||
23 | + private DataSource dataSource; | ||
24 | + | ||
25 | + @Resource | ||
26 | + private Properties jpaProperties; | ||
27 | + | ||
28 | + @Bean(name = "entityManagerYhCms") | ||
29 | + public EntityManager entityManager(EntityManagerFactoryBuilder builder) throws Exception { | ||
30 | + return entityManagerFactorySecondary(builder).getObject().createEntityManager(); | ||
31 | + } | ||
32 | + @Bean(name = "entityManagerFactoryYhCms") | ||
33 | + public LocalContainerEntityManagerFactoryBean entityManagerFactorySecondary (EntityManagerFactoryBuilder builder) throws Exception { | ||
34 | + LocalContainerEntityManagerFactoryBean entityManagerFactory | ||
35 | + = builder | ||
36 | + .dataSource(dataSource) | ||
37 | + .packages("com.yoho.datasync.fullsync.dal.repository.yhcms.model")//设置实体类所在位置 | ||
38 | + .persistenceUnit("primaryPersistenceUnit")//持久化单元创建一个默认即可,多个便要分别命名 | ||
39 | + .build(); | ||
40 | + entityManagerFactory.setJpaProperties(jpaProperties); | ||
41 | + return entityManagerFactory; | ||
42 | + } | ||
43 | +} |
starter/src/main/java/com/yoho/datasync/fullsync/starter/config/YhSocialDataSourceConfig.java
0 → 100644
1 | +package com.yoho.datasync.fullsync.starter.config; | ||
2 | + | ||
3 | +import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; | ||
4 | +import org.springframework.context.annotation.Bean; | ||
5 | +import org.springframework.context.annotation.Configuration; | ||
6 | +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
7 | +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; | ||
8 | + | ||
9 | +import javax.annotation.Resource; | ||
10 | +import javax.persistence.EntityManager; | ||
11 | +import javax.sql.DataSource; | ||
12 | +import java.util.Properties; | ||
13 | + | ||
14 | +/** | ||
15 | + * Created by shengguo.cai on 2019/3/19. | ||
16 | + */ | ||
17 | +@Configuration | ||
18 | +@EnableJpaRepositories( | ||
19 | + entityManagerFactoryRef = "entityManagerFactoryYhSocial", | ||
20 | + basePackages = "com.yoho.datasync.fullsync.dal.repository.yhsocial") | ||
21 | +public class YhSocialDataSourceConfig { | ||
22 | + @Resource(name="yhSocialDataSource") | ||
23 | + private DataSource dataSource; | ||
24 | + | ||
25 | + @Resource | ||
26 | + private Properties jpaProperties; | ||
27 | + | ||
28 | + @Bean(name = "entityManagerYhSocial") | ||
29 | + public EntityManager entityManager(EntityManagerFactoryBuilder builder) throws Exception { | ||
30 | + return entityManagerFactorySecondary(builder).getObject().createEntityManager(); | ||
31 | + } | ||
32 | + @Bean(name = "entityManagerFactoryYhSocial") | ||
33 | + public LocalContainerEntityManagerFactoryBean entityManagerFactorySecondary (EntityManagerFactoryBuilder builder) throws Exception { | ||
34 | + LocalContainerEntityManagerFactoryBean entityManagerFactory | ||
35 | + = builder | ||
36 | + .dataSource(dataSource) | ||
37 | + .packages("com.yoho.datasync.fullsync.dal.repository.yhsocial.model")//设置实体类所在位置 | ||
38 | + .persistenceUnit("primaryPersistenceUnit")//持久化单元创建一个默认即可,多个便要分别命名 | ||
39 | + .build(); | ||
40 | + entityManagerFactory.setJpaProperties(jpaProperties); | ||
41 | + return entityManagerFactory; | ||
42 | + } | ||
43 | +} |
@@ -19,3 +19,15 @@ spring: | @@ -19,3 +19,15 @@ spring: | ||
19 | username: yh_test | 19 | username: yh_test |
20 | password: 9nm0icOwt6bMHjMusIfMLw== | 20 | password: 9nm0icOwt6bMHjMusIfMLw== |
21 | driver-class-name: com.mysql.jdbc.Driver | 21 | driver-class-name: com.mysql.jdbc.Driver |
22 | + | ||
23 | + yhSocial: | ||
24 | + url: jdbc:mysql://192.168.102.219:3306/yh_social?useUnicode=true&characterEncoding=UTF-8 | ||
25 | + username: yh_test | ||
26 | + password: 9nm0icOwt6bMHjMusIfMLw== | ||
27 | + driver-class-name: com.mysql.jdbc.Driver | ||
28 | + | ||
29 | + yhCms: | ||
30 | + url: jdbc:mysql://192.168.102.17:3306/yh_cms?useUnicode=true&characterEncoding=UTF-8 | ||
31 | + username: root | ||
32 | + password: Z5BMngayHLUxyWLSv6+koA== | ||
33 | + driver-class-name: com.mysql.jdbc.Driver |
1 | +spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true |
@@ -19,3 +19,15 @@ spring: | @@ -19,3 +19,15 @@ spring: | ||
19 | username: yh_test | 19 | username: yh_test |
20 | password: 9nm0icOwt6bMHjMusIfMLw== | 20 | password: 9nm0icOwt6bMHjMusIfMLw== |
21 | driver-class-name: com.mysql.jdbc.Driver | 21 | driver-class-name: com.mysql.jdbc.Driver |
22 | + | ||
23 | + yhSocial: | ||
24 | + url: jdbc:mysql://192.168.102.219:3306/yh_social?useUnicode=true&characterEncoding=UTF-8 | ||
25 | + username: yh_test | ||
26 | + password: 9nm0icOwt6bMHjMusIfMLw== | ||
27 | + driver-class-name: com.mysql.jdbc.Driver | ||
28 | + | ||
29 | + yhCms: | ||
30 | + url: jdbc:mysql://192.168.102.17:3306/yh_cms?useUnicode=true&characterEncoding=UTF-8 | ||
31 | + username: root | ||
32 | + password: Z5BMngayHLUxyWLSv6+koA== | ||
33 | + driver-class-name: com.mysql.jdbc.Driver |
-
Please register or login to post a comment