├── .gitignore
├── README.md
├── deploy.sh
├── pom-service-hbase.xml
├── pom-service-search.xml
├── pom.xml
├── release-note.txt
├── rz-common
├── .gitignore
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── rick
│ │ └── scaffold
│ │ └── common
│ │ ├── config
│ │ └── Global.java
│ │ ├── http
│ │ ├── HttpService.java
│ │ └── HttpServiceImpl.java
│ │ ├── jsontool
│ │ └── JsonMapper.java
│ │ └── utils
│ │ ├── FileUtils.java
│ │ └── SpringContextHolder.java
│ └── resources
│ └── config
│ └── props
│ ├── cluster.properties
│ ├── db.properties
│ ├── domain.properties
│ └── scaffold.properties
├── rz-core
├── .gitignore
├── db
│ ├── v1.2
│ │ ├── 41.sql
│ │ ├── 42.sql
│ │ ├── 45.sql
│ │ ├── goods.sql
│ │ └── init_shop.sql
│ └── v1
│ │ ├── init.sql
│ │ └── product.sql
├── mycat
│ ├── rule.xml
│ ├── schema.xml
│ ├── server.xml
│ └── wrapper.conf
├── pom-gen.xml
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── rick
│ │ │ └── scaffold
│ │ │ ├── common
│ │ │ ├── Constants.java
│ │ │ ├── persistence
│ │ │ │ ├── annotation
│ │ │ │ │ └── MyBatisDao.java
│ │ │ │ └── tool
│ │ │ │ │ └── IncrSequenceTimeHandler.java
│ │ │ ├── security
│ │ │ │ └── SecurityComponent.java
│ │ │ └── utils
│ │ │ │ ├── CacheUtils.java
│ │ │ │ ├── ExceptionUtils.java
│ │ │ │ └── JedisUtils.java
│ │ │ └── core
│ │ │ ├── dao
│ │ │ ├── address
│ │ │ │ ├── AddressDao.java
│ │ │ │ └── RegionDao.java
│ │ │ ├── admin
│ │ │ │ └── AdminDao.java
│ │ │ ├── cart
│ │ │ │ ├── CartDao.java
│ │ │ │ └── CartItemDao.java
│ │ │ ├── generic
│ │ │ │ ├── BaseDao.java
│ │ │ │ └── CrudDao.java
│ │ │ ├── goods
│ │ │ │ ├── CategoryDao.java
│ │ │ │ ├── GoodsDao.java
│ │ │ │ └── GoodsGalleryDao.java
│ │ │ ├── order
│ │ │ │ ├── OrderDao.java
│ │ │ │ └── OrderItemDao.java
│ │ │ ├── product
│ │ │ │ └── ProductDao.java
│ │ │ ├── shop
│ │ │ │ └── ShopDao.java
│ │ │ └── user
│ │ │ │ ├── CompanyDao.java
│ │ │ │ ├── PhotoDao.java
│ │ │ │ ├── UserDao.java
│ │ │ │ └── UsersDao.java
│ │ │ ├── entity
│ │ │ ├── address
│ │ │ │ ├── Address.java
│ │ │ │ └── Region.java
│ │ │ ├── admin
│ │ │ │ └── Admin.java
│ │ │ ├── cart
│ │ │ │ ├── Cart.java
│ │ │ │ └── CartItem.java
│ │ │ ├── generic
│ │ │ │ ├── BaseEntity.java
│ │ │ │ └── DataEntity.java
│ │ │ ├── goods
│ │ │ │ ├── Category.java
│ │ │ │ ├── Goods.java
│ │ │ │ └── GoodsGallery.java
│ │ │ ├── order
│ │ │ │ ├── Order.java
│ │ │ │ └── OrderItem.java
│ │ │ ├── product
│ │ │ │ └── Product.java
│ │ │ ├── shop
│ │ │ │ └── Shop.java
│ │ │ └── user
│ │ │ │ ├── Company.java
│ │ │ │ ├── FullUser.java
│ │ │ │ ├── Photo.java
│ │ │ │ ├── User.java
│ │ │ │ └── Users.java
│ │ │ ├── service
│ │ │ ├── address
│ │ │ │ ├── AddressService.java
│ │ │ │ └── RegionService.java
│ │ │ ├── admin
│ │ │ │ └── AdminService.java
│ │ │ ├── cart
│ │ │ │ ├── CartItemService.java
│ │ │ │ └── CartService.java
│ │ │ ├── generic
│ │ │ │ ├── BaseService.java
│ │ │ │ └── CrudService.java
│ │ │ ├── goods
│ │ │ │ ├── CategoryService.java
│ │ │ │ ├── GoodsGalleryService.java
│ │ │ │ └── GoodsService.java
│ │ │ ├── order
│ │ │ │ ├── OrderItemService.java
│ │ │ │ └── OrderService.java
│ │ │ ├── product
│ │ │ │ └── ProductService.java
│ │ │ ├── shop
│ │ │ │ └── ShopService.java
│ │ │ └── user
│ │ │ │ ├── CompanyService.java
│ │ │ │ ├── PhotoService.java
│ │ │ │ ├── UserService.java
│ │ │ │ └── UsersService.java
│ │ │ └── vo
│ │ │ └── Paginator.java
│ └── resources
│ │ ├── config
│ │ ├── cache
│ │ │ └── ehcache-local.xml
│ │ ├── mybatis
│ │ │ └── mybatis-config.xml
│ │ └── spring
│ │ │ ├── spring-core.xml
│ │ │ ├── spring-ehcache.xml
│ │ │ ├── spring-jdbc.xml
│ │ │ └── spring-jedis.xml
│ │ ├── mappings
│ │ ├── address
│ │ │ ├── AddressMapper.xml
│ │ │ └── RegionMapper.xml
│ │ ├── admin
│ │ │ └── AdminMapper.xml
│ │ ├── cart
│ │ │ ├── CartItemMapper.xml
│ │ │ └── CartMapper.xml
│ │ ├── goods
│ │ │ ├── CategoryMapper.xml
│ │ │ ├── GoodsGalleryMapper.xml
│ │ │ └── GoodsMapper.xml
│ │ ├── order
│ │ │ ├── OrderItemMapper.xml
│ │ │ └── OrderMapper.xml
│ │ ├── product
│ │ │ └── ProductMapper.xml
│ │ ├── shop
│ │ │ └── ShopMapper.xml
│ │ └── user
│ │ │ ├── CompanyMapper.xml
│ │ │ ├── PhotoMapper.xml
│ │ │ ├── UserMapper.xml
│ │ │ └── UsersMapper.xml
│ │ └── mybatis-generator
│ │ ├── generatorConfig.xml
│ │ └── mybatis-generator.properties
│ └── test
│ ├── java
│ └── com
│ │ └── rick
│ │ └── scaffold
│ │ ├── base
│ │ └── BaseTest.java
│ │ └── service
│ │ ├── address
│ │ └── TestRegion.java
│ │ └── user
│ │ └── TestObjectId.java
│ └── resources
│ └── test-applicationContext-core.xml
├── rz-hbase
├── .gitignore
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── rick
│ │ │ └── scaffold
│ │ │ ├── hbase
│ │ │ ├── HbaseConstants.java
│ │ │ ├── delegate
│ │ │ │ ├── HbaseService.java
│ │ │ │ └── HbaseServiceImpl.java
│ │ │ ├── module
│ │ │ │ └── goods
│ │ │ │ │ └── GoodsHbaseImpl.java
│ │ │ └── utils
│ │ │ │ └── HbaseClient.java
│ │ │ └── soa
│ │ │ └── hbase
│ │ │ ├── HbaseResult.java
│ │ │ └── service
│ │ │ └── GoodsHbase.java
│ └── resources
│ │ ├── config
│ │ └── spring
│ │ │ ├── spring-hbase-soa.xml
│ │ │ └── spring-hbase.xml
│ │ └── log4j.xml
│ └── test
│ ├── java
│ └── com
│ │ └── rick
│ │ └── scaffold
│ │ ├── base
│ │ └── BaseTest.java
│ │ └── hbase
│ │ └── TestHbase.java
│ └── resources
│ └── test-spring-hbase.xml
├── rz-search
├── .gitignore
├── maven-eclipse.xml
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── rick
│ │ │ └── scaffold
│ │ │ ├── search
│ │ │ ├── SearchConstants.java
│ │ │ ├── module
│ │ │ │ └── goods
│ │ │ │ │ └── GoodsSearchImpl.java
│ │ │ ├── services
│ │ │ │ ├── RZEntry.java
│ │ │ │ ├── RZFacet.java
│ │ │ │ ├── RZGetResponse.java
│ │ │ │ ├── RZIndexKeywordRequest.java
│ │ │ │ ├── RZSearchField.java
│ │ │ │ ├── RZSearchHit.java
│ │ │ │ ├── RZSearchRequest.java
│ │ │ │ ├── RZSearchResponse.java
│ │ │ │ ├── RZSearchService.java
│ │ │ │ ├── delegate
│ │ │ │ │ ├── SearchDelegate.java
│ │ │ │ │ └── SearchDelegateImpl.java
│ │ │ │ ├── field
│ │ │ │ │ ├── RZBooleanField.java
│ │ │ │ │ ├── RZDateField.java
│ │ │ │ │ ├── RZDoubleField.java
│ │ │ │ │ ├── RZField.java
│ │ │ │ │ ├── RZIntegerField.java
│ │ │ │ │ ├── RZListField.java
│ │ │ │ │ ├── RZLongField.java
│ │ │ │ │ └── RZStringField.java
│ │ │ │ ├── worker
│ │ │ │ │ ├── DeleteKeywordsImpl.java
│ │ │ │ │ ├── DeleteObjectImpl.java
│ │ │ │ │ ├── DeleteObjectWorker.java
│ │ │ │ │ ├── IndexWorker.java
│ │ │ │ │ ├── KeywordIndexerImpl.java
│ │ │ │ │ ├── KeywordSearchWorker.java
│ │ │ │ │ ├── KeywordSearchWorkerImpl.java
│ │ │ │ │ ├── ObjectIndexerImpl.java
│ │ │ │ │ ├── SearchWorker.java
│ │ │ │ │ └── SearchWorkerImpl.java
│ │ │ │ └── workflow
│ │ │ │ │ ├── DeleteObjectWorkflow.java
│ │ │ │ │ ├── GetWorkflow.java
│ │ │ │ │ ├── ImportWorkflow.java
│ │ │ │ │ ├── IndexWorkflow.java
│ │ │ │ │ ├── SearchWorkflow.java
│ │ │ │ │ └── Workflow.java
│ │ │ └── utils
│ │ │ │ ├── CustomIndexConfiguration.java
│ │ │ │ ├── CustomIndexFieldConfiguration.java
│ │ │ │ ├── IndexConfiguration.java
│ │ │ │ ├── SearchClient.java
│ │ │ │ └── ServerConfiguration.java
│ │ │ └── soa
│ │ │ └── search
│ │ │ ├── IndexObject.java
│ │ │ ├── SearchEntry.java
│ │ │ ├── SearchFacet.java
│ │ │ ├── SearchKeywords.java
│ │ │ ├── SearchResult.java
│ │ │ ├── model
│ │ │ └── IndexGoods.java
│ │ │ └── service
│ │ │ └── GoodsSearch.java
│ └── resources
│ │ ├── config
│ │ ├── search
│ │ │ ├── indice_mappings_goods.json
│ │ │ └── indice_settings_cn.json
│ │ └── spring
│ │ │ ├── spring-search-soa.xml
│ │ │ └── spring-search.xml
│ │ └── log4j.xml
│ └── test
│ ├── java
│ └── com
│ │ └── rick
│ │ └── scaffold
│ │ ├── base
│ │ └── BaseTest.java
│ │ └── goods
│ │ └── TestGoods.java
│ └── resources
│ ├── complex_search.json
│ └── test-spring-search.xml
└── rz-web
├── .gitignore
├── pom.xml
├── src
├── main
│ ├── java
│ │ └── com
│ │ │ └── rick
│ │ │ └── scaffold
│ │ │ ├── common
│ │ │ ├── listener
│ │ │ │ ├── CorsFilter.java
│ │ │ │ └── WebContextListener.java
│ │ │ └── security
│ │ │ │ ├── AuthenticationFilter.java
│ │ │ │ ├── AuthenticationInterceptor.java
│ │ │ │ └── AuthenticationRealm.java
│ │ │ ├── exception
│ │ │ ├── APIException.java
│ │ │ └── CommonException.java
│ │ │ ├── soa
│ │ │ ├── hbase
│ │ │ │ ├── HbaseResult.java
│ │ │ │ └── service
│ │ │ │ │ └── GoodsHbase.java
│ │ │ └── search
│ │ │ │ ├── IndexObject.java
│ │ │ │ ├── SearchEntry.java
│ │ │ │ ├── SearchFacet.java
│ │ │ │ ├── SearchKeywords.java
│ │ │ │ ├── SearchResult.java
│ │ │ │ ├── model
│ │ │ │ └── IndexGoods.java
│ │ │ │ └── service
│ │ │ │ └── GoodsSearch.java
│ │ │ └── web
│ │ │ ├── api
│ │ │ ├── generic
│ │ │ │ └── BaseAPI.java
│ │ │ ├── product
│ │ │ │ └── ProductAPI.java
│ │ │ └── user
│ │ │ │ └── UserAPI.java
│ │ │ ├── bean
│ │ │ └── generic
│ │ │ │ ├── FailBean.java
│ │ │ │ └── SuccessBean.java
│ │ │ └── controller
│ │ │ ├── AdminController.java
│ │ │ └── LoginController.java
│ ├── resources
│ │ └── config
│ │ │ ├── logger
│ │ │ └── log4j.xml
│ │ │ └── spring
│ │ │ ├── dispatcher-servlet.xml
│ │ │ ├── spring-shiro.xml
│ │ │ ├── spring-soa.xml
│ │ │ └── spring-web.xml
│ └── webapp
│ │ ├── META-INF
│ │ └── MANIFEST.MF
│ │ ├── WEB-INF
│ │ ├── .gitignore
│ │ ├── views
│ │ │ ├── adminIndex.jsp
│ │ │ ├── error
│ │ │ │ ├── 404.jsp
│ │ │ │ └── 500.jsp
│ │ │ └── login.jsp
│ │ └── web.xml
│ │ └── static
│ │ ├── css
│ │ ├── bootstrap.min.css
│ │ └── jquery.validate.min.css
│ │ └── js
│ │ ├── angular.js
│ │ ├── bootstrap.min.js
│ │ ├── jquery.min.js
│ │ ├── jquery.validate.min.js
│ │ ├── ui-bootstrap-tpls.js
│ │ └── ui-bootstrap.js
└── test
│ ├── java
│ └── com
│ │ └── rick
│ │ └── scaffold
│ │ ├── api
│ │ └── user
│ │ │ └── TestUser.java
│ │ ├── base
│ │ ├── BaseApiTest.java
│ │ └── BaseTest.java
│ │ └── service
│ │ ├── goods
│ │ ├── TestGoods.java
│ │ └── TestHbase.java
│ │ └── user
│ │ ├── TestCompany.java
│ │ ├── TestES.java
│ │ ├── TestPhoto.java
│ │ ├── TestRedis.java
│ │ ├── TestUser.java
│ │ └── TestUsers.java
│ └── resources
│ ├── complex_search.json
│ ├── test-applicationContext-all.xml
│ └── test-spring-soa.xml
└── tomcat
├── conf
└── context.xml
└── lib
├── commons-pool2-2.3.jar
├── jedis-2.7.2.jar
└── redis-tomcat-0.0.1-SNAPSHOT.jar
/.gitignore:
--------------------------------------------------------------------------------
1 | .mymetadata
2 | .checkstyle
3 | .classpath
4 | .project
5 | *.class
6 | .war
7 | .zip
8 | .rar
9 | .idea
10 | *.iml
11 | .ext*
12 | */.settings/*
13 | .settings
14 | /indexes/*
15 | /target/*
16 | /src/main/webapp/WEB-INF/classes/*
17 | /src/main/webapp/userfiles/*
18 | /target/
19 | /data/
20 | /bin/
21 | */logs
22 | deploy.sh
23 | *~
24 | zookeeper.out
25 | dump.rdb
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # scaffold
2 | J2EE scaffold
3 |
4 | A skeleton of J2EE project
5 |
--------------------------------------------------------------------------------
/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | shutdown.sh
3 | mvn package
4 | rm -rf /Users/user/dev/tomcat7/webapps/scaffold*
5 | \cp -r /Users/user/Desktop/lib/scaffold/rz-web/target/scaffold.war /Users/user/dev/tomcat7/webapps
6 | startup.sh
7 |
--------------------------------------------------------------------------------
/pom-service-hbase.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.rick
7 | scaffold
8 | 1.1.0
9 | pom
10 |
11 | scaffold
12 | http://www.rick.com
13 | 2015-2020
14 |
15 |
16 | 4.1.7.RELEASE
17 | 2.4.0
18 |
19 | 1.7
20 | UTF-8
21 |
22 |
23 |
24 |
25 | rz-common
26 | rz-hbase
27 |
28 |
29 |
30 |
31 |
32 |
33 | com.yzlpie
34 | Rick
35 | rickatyzlpie.com
36 |
37 | Code Farmer
38 |
39 | +8
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/pom-service-search.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.rick
7 | scaffold
8 | 1.1.0
9 | pom
10 |
11 | scaffold
12 | http://www.rick.com
13 | 2015-2020
14 |
15 |
16 | 4.1.7.RELEASE
17 | 2.4.0
18 |
19 | 1.7
20 | UTF-8
21 |
22 |
23 |
24 |
25 | rz-common
26 | rz-search
27 |
28 |
29 |
30 |
31 |
32 |
33 | com.yzlpie
34 | Rick
35 | rickatyzlpie.com
36 |
37 | Code Farmer
38 |
39 | +8
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.rick
7 | scaffold
8 | 1.1.0
9 | pom
10 |
11 | scaffold
12 | http://www.rick.com
13 | 2015-2020
14 |
15 |
16 |
17 | 4.1.7.RELEASE
18 | 4.2.17.Final
19 | 3.2.8
20 | 1.2.2
21 | 4.2.17.Final
22 | 1.2.3
23 |
24 |
25 | 1.2
26 | 2.4.0
27 |
28 |
29 | 5.1.31
30 |
31 |
32 | 1.7
33 | 2.2
34 | 7.6.14.v20131031
35 | 80
36 | UTF-8
37 |
38 |
39 |
40 |
41 | rz-common
42 | rz-core
43 | rz-web
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | com.yzlpie
54 | Rick
55 | rickatyzlpie.com
56 |
57 | Code Farmer
58 |
59 | +8
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/release-note.txt:
--------------------------------------------------------------------------------
1 | v1.2.0
2 | modify rz-search as service, import dubbo
--------------------------------------------------------------------------------
/rz-common/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 |
--------------------------------------------------------------------------------
/rz-common/src/main/java/com/rick/scaffold/common/config/Global.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.common.config;
2 |
3 | import java.util.Map;
4 | import java.util.Properties;
5 |
6 | import org.apache.commons.lang3.StringUtils;
7 |
8 | import com.google.common.base.Optional;
9 | import com.google.common.collect.Maps;
10 | import com.rick.scaffold.common.utils.FileUtils;
11 |
12 | /**
13 | * 全局配置类
14 | * @author Rick
15 | * @version 2015-08-25
16 | */
17 | public class Global {
18 |
19 | /**
20 | * 当前对象实例
21 | */
22 | private static Global global = new Global();
23 |
24 | /**
25 | * 保存全局属性值
26 | */
27 | private static Map map = Maps.newHashMap();
28 |
29 | /**
30 | * 属性文件加载对象
31 | */
32 | private static Properties loader = FileUtils.loadProps("config/props/scaffold.properties");
33 |
34 | /**
35 | * 获取当前对象实例
36 | */
37 | public static Global getInstance() {
38 | return global;
39 | }
40 |
41 | /**
42 | * 获取配置
43 | */
44 | public static String getConfig(String key) {
45 | String value = map.get(key);
46 | if (value == null){
47 | value = loader.getProperty(key);
48 | map.put(key, Optional.fromNullable(value).or(StringUtils.EMPTY));
49 | }
50 | return value;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/rz-common/src/main/java/com/rick/scaffold/common/http/HttpService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.common.http;
2 |
3 | public interface HttpService {
4 |
5 | String put(String url, String params);
6 | }
7 |
--------------------------------------------------------------------------------
/rz-common/src/main/java/com/rick/scaffold/common/http/HttpServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.common.http;
2 |
3 | import java.io.IOException;
4 |
5 | import org.apache.http.client.config.RequestConfig;
6 | import org.apache.http.client.methods.CloseableHttpResponse;
7 | import org.apache.http.client.methods.HttpPut;
8 | import org.apache.http.entity.StringEntity;
9 | import org.apache.http.impl.client.CloseableHttpClient;
10 | import org.apache.http.impl.client.HttpClients;
11 | import org.apache.http.util.EntityUtils;
12 | import org.springframework.stereotype.Component;
13 |
14 | @Component
15 | public class HttpServiceImpl implements HttpService {
16 |
17 |
18 |
19 | @Override
20 | public String put(String url, String params) {
21 | CloseableHttpClient httpclient = HttpClients.createDefault();
22 | HttpPut httpput = new HttpPut(url);
23 | //timeout
24 | RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(5000).setConnectTimeout(2000).build();
25 | httpput.setConfig(requestConfig);
26 |
27 | httpput.setHeader("Content-type", "application/json");
28 | StringEntity requestParam = new StringEntity(params,"utf-8");
29 | httpput.setEntity(requestParam);
30 | CloseableHttpResponse response = null;
31 | String result = null;
32 | try {
33 | response = httpclient.execute(httpput);
34 | result = EntityUtils.toString(response.getEntity());
35 | System.out.println(result);
36 | } catch (Exception e) {
37 | e.printStackTrace();
38 | } finally {
39 | try {
40 | if(response != null) {
41 | response.close();
42 | }
43 | } catch (IOException e) {
44 | e.printStackTrace();
45 | }
46 | }
47 | return result;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/rz-common/src/main/java/com/rick/scaffold/common/utils/FileUtils.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.common.utils;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 | import java.util.Properties;
7 |
8 | import org.apache.log4j.Logger;
9 |
10 | import com.google.common.base.Charsets;
11 | import com.google.common.io.Files;
12 |
13 | public class FileUtils {
14 |
15 | private static Logger log = Logger.getLogger(FileUtils.class);
16 |
17 | public static String readFileAsString(String fileName) {
18 | String path = FileUtils.class.getClassLoader().getResource(fileName).getPath();
19 | File file = new File(path);
20 | try {
21 | String fileReaded = Files.asCharSource(file, Charsets.UTF_8).read();
22 | return fileReaded;
23 | } catch (IOException e) {
24 | log.warn("read file "+ fileName + "error.");
25 | return null;
26 | }
27 | }
28 |
29 | public static Properties loadProps(String propsFile){
30 | Properties props = new Properties();
31 | InputStream inp = Thread.currentThread().getContextClassLoader().getResourceAsStream(propsFile);
32 |
33 | if (inp == null) {
34 | throw new java.lang.RuntimeException("time sequnce properties not found " + propsFile);
35 | }
36 | try {
37 | props.load(inp);
38 | } catch (IOException e) {
39 | throw new java.lang.RuntimeException(e);
40 | }
41 | return props;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/rz-common/src/main/java/com/rick/scaffold/common/utils/SpringContextHolder.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.common.utils;
2 |
3 | import org.apache.commons.lang3.Validate;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 | import org.springframework.beans.factory.DisposableBean;
7 | import org.springframework.context.ApplicationContext;
8 | import org.springframework.context.ApplicationContextAware;
9 | import org.springframework.context.annotation.Lazy;
10 | import org.springframework.stereotype.Service;
11 |
12 | /**
13 | * 以静态变量保存Spring ApplicationContext, 可在任何代码任何地方任何时候取出ApplicaitonContext.
14 | *
15 | * @author Zaric
16 | * @date 2013-5-29 下午1:25:40
17 | */
18 | @Service
19 | @Lazy(false)
20 | public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
21 |
22 | private static ApplicationContext applicationContext = null;
23 |
24 | private static Logger logger = LoggerFactory.getLogger(SpringContextHolder.class);
25 |
26 | /**
27 | * 取得存储在静态变量中的ApplicationContext.
28 | */
29 | public static ApplicationContext getApplicationContext() {
30 | assertContextInjected();
31 | return applicationContext;
32 | }
33 |
34 | /**
35 | * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
36 | */
37 | @SuppressWarnings("unchecked")
38 | public static T getBean(String name) {
39 | assertContextInjected();
40 | return (T) applicationContext.getBean(name);
41 | }
42 |
43 | /**
44 | * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
45 | */
46 | public static T getBean(Class requiredType) {
47 | assertContextInjected();
48 | return applicationContext.getBean(requiredType);
49 | }
50 |
51 | /**
52 | * 清除SpringContextHolder中的ApplicationContext为Null.
53 | */
54 | public static void clearHolder() {
55 | if (logger.isDebugEnabled()){
56 | logger.debug("清除SpringContextHolder中的ApplicationContext:" + applicationContext);
57 | }
58 | applicationContext = null;
59 | }
60 |
61 | /**
62 | * 实现ApplicationContextAware接口, 注入Context到静态变量中.
63 | */
64 | @Override
65 | public void setApplicationContext(ApplicationContext applicationContext) {
66 | SpringContextHolder.applicationContext = applicationContext;
67 | }
68 |
69 | /**
70 | * 实现DisposableBean接口, 在Context关闭时清理静态变量.
71 | */
72 | @Override
73 | public void destroy() throws Exception {
74 | SpringContextHolder.clearHolder();
75 | }
76 |
77 | /**
78 | * 检查ApplicationContext不为空.
79 | */
80 | private static void assertContextInjected() {
81 | Validate.validState(applicationContext != null, "applicaitonContext属性未注入, 请在applicationContext.xml中定义SpringContextHolder.");
82 | }
83 | }
--------------------------------------------------------------------------------
/rz-common/src/main/resources/config/props/cluster.properties:
--------------------------------------------------------------------------------
1 | SEQ.DATAACENTERID=1
2 | SEQ.WORKID=1
--------------------------------------------------------------------------------
/rz-common/src/main/resources/config/props/db.properties:
--------------------------------------------------------------------------------
1 | db.driver=com.mysql.jdbc.Driver
2 | db.url=jdbc:mysql://192.168.6.49:8066/scaffold?useUnicode=true&characterEncoding=UTF-8
3 | db.user=root
4 | db.password=eros
5 |
6 | connection_pools.initial_pool_size=5
7 | connection_pools.min_pool_size=5
8 | connection_pools.max_pool_size=100
9 | connection_pools.max_idle_time=600
10 | connection_pools.acquire_increment=5
11 | connection_pools.checkout_timeout=60000
12 |
13 | #ubuntu path
14 | #mybatis.driver.path=/home/eros/.m2/repository/mysql/mysql-connector-java/5.1.31/mysql-connector-java-5.1.31.jar
15 | #mac path
16 | mybatis.driver.path=/Users/user/.m2/repository/mysql/mysql-connector-java/5.1.31/mysql-connector-java-5.1.31.jar
17 | #windows office
18 | #mybatis.driver.path=C:/Users/user/.m2/repository/mysql/mysql-connector-java/5.1.31/mysql-connector-java-5.1.31.jar
19 |
20 | mybatis.model.package=com.rick.scaffold.core.entity
21 | mybatis.mapper.package=mappings
22 | mybatis.dao.package=com.rick.scaffold.core.dao
--------------------------------------------------------------------------------
/rz-common/src/main/resources/config/props/domain.properties:
--------------------------------------------------------------------------------
1 | domain.name=http://localhost
--------------------------------------------------------------------------------
/rz-common/src/main/resources/config/props/scaffold.properties:
--------------------------------------------------------------------------------
1 | #global
2 | global.productName=scaffold
3 | global.version=1.0
4 | global.staticDomain=http://localhost:8080/scaffold/static
5 |
6 | #redis settings
7 | redis.keyPrefix=scaffold
8 | redis.host=192.168.6.41
9 | redis.port=6379
10 |
11 | #elasticsearch settings
12 | es.clusterName=elasticsearch
13 | es.host1=192.168.6.41
14 | es.port1=9300
15 |
16 | #zookeeper settings
17 | zoo.address=192.168.6.45:2181,192.168.6.42:2181,192.168.6.43:2181
18 | zoo.master.host=192.168.6.45
19 | zoo.master.port=2181
20 |
21 | #jsp file directory
22 | web.view.prefix=/WEB-INF/views/
23 | web.view.suffix=.jsp
--------------------------------------------------------------------------------
/rz-core/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 |
--------------------------------------------------------------------------------
/rz-core/db/v1/init.sql:
--------------------------------------------------------------------------------
1 | SET SESSION FOREIGN_KEY_CHECKS=0;
2 |
3 | /* Drop Tables */
4 |
5 | DROP TABLE IF EXISTS sys_user;
6 |
7 |
8 | /* Create Tables */
9 |
10 | CREATE TABLE sys_user
11 | (
12 | id bigint(20) unique,
13 | login_name varchar(100) NOT NULL unique,
14 | password varchar(100) NOT NULL,
15 | name varchar(100) NOT NULL,
16 | email varchar(200),
17 | phone varchar(200),
18 | user_tag bigint(20),
19 | avatar varchar(255),
20 | login_ip varchar(100),
21 | login_date datetime,
22 | create_date datetime NOT NULL,
23 | update_date datetime NOT NULL,
24 | del_flag tinyint(1) DEFAULT 0 NOT NULL,
25 | company_id varchar(24) not null,
26 | PRIMARY KEY (id)
27 | );
28 |
29 | CREATE INDEX idx_sys_user_update_date ON sys_user (update_date ASC);
30 | CREATE INDEX idx_sys_user_del_flag ON sys_user (del_flag ASC);
31 |
32 | drop table if exists sys_company;
33 | create table sys_company
34 | (
35 | id bigint(20) unique,
36 | name varchar(100) NOT NULL,
37 | phone varchar(100) NOT NULL,
38 | primary key (id)
39 | );
40 |
41 | drop table if exists sys_photo;
42 | create table sys_photo
43 | (
44 | id bigint(20) unique,
45 | url varchar(100) NOT NULL,
46 | size int(11) NOT NULL,
47 | user_id bigint(20),
48 | primary key (id),
49 | FOREIGN KEY (user_id) REFERENCES sys_user(id)
50 | );
51 |
--------------------------------------------------------------------------------
/rz-core/db/v1/product.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.6.19, for debian-linux-gnu (x86_64)
2 | --
3 | -- Host: localhost Database: zjsy
4 | -- ------------------------------------------------------
5 | -- Server version 5.6.19-0ubuntu0.14.04.1
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `yzl_product`
20 | --
21 |
22 | DROP TABLE IF EXISTS `sys_product`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `sys_product` (
26 | `id` bigint(20) unique,
27 | `create_date` datetime NOT NULL,
28 | `modify_date` datetime NOT NULL,
29 | `image` varchar(255),
30 | `remark` varchar(255),
31 | `name` varchar(255) NOT NULL,
32 | `price` decimal(21,2) NOT NULL,
33 | `sn` varchar(100) NOT NULL,
34 | `unit` varchar(255) NOT NULL,
35 | `amount` float NOT NULL DEFAULT 0,
36 | `delFlag` tinyint(1) NOT NULL DEFAULT 0,
37 | PRIMARY KEY (`id`)
38 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/rz-core/mycat/schema.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
16 |
17 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
31 | select user()
32 |
33 |
34 |
36 | select user()
37 |
38 |
39 |
41 | select user()
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/rz-core/mycat/server.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 | druidparser
14 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
33 |
34 |
38 |
40 |
42 |
43 | eros
44 | scaffold
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/rz-core/pom-gen.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 |
7 | com.rick
8 | scaffold
9 | 1.1.0
10 |
11 |
12 | rz-core
13 | jar
14 |
15 | rz-core
16 | http://www.rick.com
17 | 2015-2020
18 |
19 |
20 |
21 |
22 |
23 |
24 | org.mybatis.generator
25 | mybatis-generator-maven-plugin
26 | 1.3.2
27 |
28 | src/main/resources/mybatis-generator/generatorConfig.xml
29 | true
30 | true
31 |
32 |
33 |
34 | Generate MyBatis Artifacts
35 |
36 | generate
37 |
38 |
39 |
40 |
41 |
42 | org.mybatis.generator
43 | mybatis-generator-core
44 | 1.3.2
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/common/Constants.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.common;
2 |
3 |
4 | public interface Constants {
5 |
6 | String HTTP_STATUS_OK = "OK";
7 | String HTTP_STATUS_ERROR = "Error";
8 |
9 | String STRING_SEPERATOR = "!@#";
10 | String SEARCH_INDICE = "scaffold";
11 | }
12 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/common/persistence/annotation/MyBatisDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.common.persistence.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | import org.springframework.stereotype.Component;
10 |
11 | /**
12 | * 标识MyBatis的DAO,方便{@link org.mybatis.spring.mapper.MapperScannerConfigurer}的扫描。
13 | */
14 | @Retention(RetentionPolicy.RUNTIME)
15 | @Target(ElementType.TYPE)
16 | @Documented
17 | @Component
18 | public @interface MyBatisDao {
19 |
20 | /**
21 | * The value may indicate a suggestion for a logical component name,
22 | * to be turned into a Spring bean in case of an autodetected component.
23 | * @return the suggested component name, if any
24 | */
25 | String value() default "";
26 |
27 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/common/utils/CacheUtils.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.common.utils;
2 |
3 | import net.sf.ehcache.Cache;
4 | import net.sf.ehcache.CacheManager;
5 | import net.sf.ehcache.Element;
6 |
7 | /**
8 | * Cache工具类
9 | *
10 | */
11 | public class CacheUtils {
12 |
13 | private static CacheManager cacheManager = ((CacheManager)SpringContextHolder.getBean("cacheManager"));
14 |
15 | private static final String SYS_CACHE = "sysCache";
16 |
17 | /**
18 | * 获取SYS_CACHE缓存
19 | * @param key
20 | * @return
21 | */
22 | public static Object get(String key) {
23 | return get(SYS_CACHE, key);
24 | }
25 |
26 | /**
27 | * 写入SYS_CACHE缓存
28 | * @param key
29 | * @return
30 | */
31 | public static void put(String key, Object value) {
32 | put(SYS_CACHE, key, value);
33 | }
34 |
35 | /**
36 | * 从SYS_CACHE缓存中移除
37 | * @param key
38 | * @return
39 | */
40 | public static void remove(String key) {
41 | remove(SYS_CACHE, key);
42 | }
43 |
44 | /**
45 | * 获取缓存
46 | * @param cacheName
47 | * @param key
48 | * @return
49 | */
50 | public static Object get(String cacheName, String key) {
51 | Element element = getCache(cacheName).get(key);
52 | return element==null?null:element.getObjectValue();
53 | }
54 |
55 | /**
56 | * 写入缓存
57 | * @param cacheName
58 | * @param key
59 | * @param value
60 | */
61 | public static void put(String cacheName, String key, Object value) {
62 | Element element = new Element(key, value);
63 | getCache(cacheName).put(element);
64 | }
65 |
66 | /**
67 | * 从缓存中移除
68 | * @param cacheName
69 | * @param key
70 | */
71 | public static void remove(String cacheName, String key) {
72 | getCache(cacheName).remove(key);
73 | }
74 |
75 | /**
76 | * 获得一个Cache,没有则创建一个。
77 | * @param cacheName
78 | * @return
79 | */
80 | private static Cache getCache(String cacheName){
81 | Cache cache = cacheManager.getCache(cacheName);
82 | if (cache == null){
83 | cacheManager.addCache(cacheName);
84 | cache = cacheManager.getCache(cacheName);
85 | cache.getCacheConfiguration().setEternal(true);
86 | }
87 | return cache;
88 | }
89 |
90 | public static CacheManager getCacheManager() {
91 | return cacheManager;
92 | }
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/common/utils/ExceptionUtils.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.common.utils;
2 |
3 | import java.util.UUID;
4 |
5 | public class ExceptionUtils {
6 |
7 | public static String getTrackID() {
8 | return UUID.randomUUID().toString();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/address/AddressDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.address;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.CrudDao;
5 | import com.rick.scaffold.core.entity.address.Address;
6 |
7 | @MyBatisDao
8 | public interface AddressDao extends CrudDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/address/RegionDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.address;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.BaseDao;
5 | import com.rick.scaffold.core.entity.address.Region;
6 |
7 | @MyBatisDao
8 | public interface RegionDao extends BaseDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/admin/AdminDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.admin;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.CrudDao;
5 | import com.rick.scaffold.core.entity.admin.Admin;
6 |
7 | @MyBatisDao
8 | public interface AdminDao extends CrudDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/cart/CartDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.cart;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.CrudDao;
5 | import com.rick.scaffold.core.entity.cart.Cart;
6 |
7 | @MyBatisDao
8 | public interface CartDao extends CrudDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/cart/CartItemDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.cart;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.BaseDao;
5 | import com.rick.scaffold.core.entity.cart.CartItem;
6 |
7 | @MyBatisDao
8 | public interface CartItemDao extends BaseDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/generic/BaseDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.generic;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * DAO支持类实现
7 | */
8 | public interface BaseDao {
9 |
10 | /**
11 | * 获取单条数据
12 | * @param id
13 | * @return
14 | */
15 | public T findOne(Long id);
16 |
17 | /**
18 | * @param entity
19 | * @return
20 | */
21 | public List findAll();
22 |
23 | /**
24 | * 插入数据
25 | * @param entity
26 | * @return
27 | */
28 | public int insert(T entity);
29 |
30 | /**
31 | * 更新数据
32 | * @param entity
33 | * @return
34 | */
35 | public int update(T entity);
36 |
37 | /**
38 | * 删除数据(一般为逻辑删除,更新del_flag字段为1)
39 | * @param id
40 | * @see public int delete(T entity)
41 | * @return
42 | */
43 | public int delete(Long id);
44 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/generic/CrudDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.generic;
2 |
3 |
4 | /**
5 | * DAO支持类实现
6 | * @param
7 | */
8 | public interface CrudDao extends BaseDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/goods/CategoryDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.goods;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.CrudDao;
5 | import com.rick.scaffold.core.entity.goods.Category;
6 |
7 | @MyBatisDao
8 | public interface CategoryDao extends CrudDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/goods/GoodsDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.goods;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.CrudDao;
5 | import com.rick.scaffold.core.entity.goods.Goods;
6 |
7 | @MyBatisDao
8 | public interface GoodsDao extends CrudDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/goods/GoodsGalleryDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.goods;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.BaseDao;
5 | import com.rick.scaffold.core.entity.goods.GoodsGallery;
6 |
7 | @MyBatisDao
8 | public interface GoodsGalleryDao extends BaseDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/order/OrderDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.order;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.CrudDao;
5 | import com.rick.scaffold.core.entity.order.Order;
6 |
7 | @MyBatisDao
8 | public interface OrderDao extends CrudDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/order/OrderItemDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.order;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.BaseDao;
5 | import com.rick.scaffold.core.entity.order.OrderItem;
6 |
7 | @MyBatisDao
8 | public interface OrderItemDao extends BaseDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/product/ProductDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.product;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.CrudDao;
5 | import com.rick.scaffold.core.entity.product.Product;
6 |
7 | @MyBatisDao
8 | public interface ProductDao extends CrudDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/shop/ShopDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.shop;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.CrudDao;
5 | import com.rick.scaffold.core.entity.shop.Shop;
6 |
7 | @MyBatisDao
8 | public interface ShopDao extends CrudDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/user/CompanyDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.user;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.BaseDao;
5 | import com.rick.scaffold.core.entity.user.Company;
6 |
7 | @MyBatisDao
8 | public interface CompanyDao extends BaseDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/user/PhotoDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.user;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.BaseDao;
5 | import com.rick.scaffold.core.entity.user.Photo;
6 |
7 | @MyBatisDao
8 | public interface PhotoDao extends BaseDao {
9 |
10 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/user/UserDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.user;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
8 | import com.rick.scaffold.core.dao.generic.CrudDao;
9 | import com.rick.scaffold.core.entity.user.FullUser;
10 | import com.rick.scaffold.core.entity.user.User;
11 |
12 | @MyBatisDao
13 | public interface UserDao extends CrudDao {
14 |
15 | User findOne1(@Param("id") Long id, @Param("name") String name);
16 |
17 | List findCascade(Long id);
18 |
19 | List findLazy(Long id);
20 |
21 | User findByName(String name);
22 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/dao/user/UsersDao.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.dao.user;
2 |
3 | import com.rick.scaffold.common.persistence.annotation.MyBatisDao;
4 | import com.rick.scaffold.core.dao.generic.CrudDao;
5 | import com.rick.scaffold.core.entity.user.Users;
6 |
7 | @MyBatisDao
8 | public interface UsersDao extends CrudDao {
9 |
10 | Users findByName(String name);
11 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/address/Address.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.address;
2 |
3 | import com.rick.scaffold.core.entity.generic.DataEntity;
4 |
5 | public class Address extends DataEntity {
6 |
7 | private String addressName;
8 |
9 | private Long userId;
10 |
11 | private String consignee;
12 |
13 | private String email;
14 |
15 | private Integer province;
16 |
17 | private Integer city;
18 |
19 | private Integer district;
20 |
21 | private String fullAddress;
22 |
23 | private String zipcode;
24 |
25 | private String mobile;
26 |
27 |
28 | public String getAddressName() {
29 | return addressName;
30 | }
31 |
32 | public void setAddressName(String addressName) {
33 | this.addressName = addressName == null ? null : addressName.trim();
34 | }
35 |
36 | public Long getUserId() {
37 | return userId;
38 | }
39 |
40 | public void setUserId(Long userId) {
41 | this.userId = userId;
42 | }
43 |
44 | public String getConsignee() {
45 | return consignee;
46 | }
47 |
48 | public void setConsignee(String consignee) {
49 | this.consignee = consignee == null ? null : consignee.trim();
50 | }
51 |
52 | public String getEmail() {
53 | return email;
54 | }
55 |
56 | public void setEmail(String email) {
57 | this.email = email == null ? null : email.trim();
58 | }
59 |
60 | public Integer getProvince() {
61 | return province;
62 | }
63 |
64 | public void setProvince(Integer province) {
65 | this.province = province;
66 | }
67 |
68 | public Integer getCity() {
69 | return city;
70 | }
71 |
72 | public void setCity(Integer city) {
73 | this.city = city;
74 | }
75 |
76 | public Integer getDistrict() {
77 | return district;
78 | }
79 |
80 | public void setDistrict(Integer district) {
81 | this.district = district;
82 | }
83 |
84 | public String getFullAddress() {
85 | return fullAddress;
86 | }
87 |
88 | public void setFullAddress(String fullAddress) {
89 | this.fullAddress = fullAddress == null ? null : fullAddress.trim();
90 | }
91 |
92 | public String getZipcode() {
93 | return zipcode;
94 | }
95 |
96 | public void setZipcode(String zipcode) {
97 | this.zipcode = zipcode == null ? null : zipcode.trim();
98 | }
99 |
100 | public String getMobile() {
101 | return mobile;
102 | }
103 |
104 | public void setMobile(String mobile) {
105 | this.mobile = mobile == null ? null : mobile.trim();
106 | }
107 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/address/Region.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.address;
2 |
3 | import com.rick.scaffold.core.entity.generic.BaseEntity;
4 |
5 | public class Region extends BaseEntity {
6 |
7 | private Integer parentId;
8 |
9 | private String regionName;
10 |
11 | private Byte regionType;
12 |
13 |
14 | public Integer getParentId() {
15 | return parentId;
16 | }
17 |
18 | public void setParentId(Integer parentId) {
19 | this.parentId = parentId;
20 | }
21 |
22 | public String getRegionName() {
23 | return regionName;
24 | }
25 |
26 | public void setRegionName(String regionName) {
27 | this.regionName = regionName == null ? null : regionName.trim();
28 | }
29 |
30 | public Byte getRegionType() {
31 | return regionType;
32 | }
33 |
34 | public void setRegionType(Byte regionType) {
35 | this.regionType = regionType;
36 | }
37 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/admin/Admin.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.admin;
2 |
3 | import com.rick.scaffold.core.entity.generic.DataEntity;
4 |
5 | public class Admin extends DataEntity {
6 |
7 | private String username;
8 |
9 | private String password;
10 |
11 | private String nickName;
12 |
13 | private String mobile;
14 |
15 | private String avatar;
16 |
17 | private String email;
18 |
19 | private Byte role;
20 |
21 | private Long shopId;
22 |
23 | public String getUsername() {
24 | return username;
25 | }
26 |
27 | public void setUsername(String username) {
28 | this.username = username == null ? null : username.trim();
29 | }
30 |
31 | public String getPassword() {
32 | return password;
33 | }
34 |
35 | public void setPassword(String password) {
36 | this.password = password == null ? null : password.trim();
37 | }
38 |
39 | public String getNickName() {
40 | return nickName;
41 | }
42 |
43 | public void setNickName(String nickName) {
44 | this.nickName = nickName == null ? null : nickName.trim();
45 | }
46 |
47 | public String getMobile() {
48 | return mobile;
49 | }
50 |
51 | public void setMobile(String mobile) {
52 | this.mobile = mobile == null ? null : mobile.trim();
53 | }
54 |
55 | public String getAvatar() {
56 | return avatar;
57 | }
58 |
59 | public void setAvatar(String avatar) {
60 | this.avatar = avatar == null ? null : avatar.trim();
61 | }
62 |
63 | public String getEmail() {
64 | return email;
65 | }
66 |
67 | public void setEmail(String email) {
68 | this.email = email == null ? null : email.trim();
69 | }
70 |
71 | public Byte getRole() {
72 | return role;
73 | }
74 |
75 | public void setRole(Byte role) {
76 | this.role = role;
77 | }
78 |
79 | public Long getShopId() {
80 | return shopId;
81 | }
82 |
83 | public void setShopId(Long shopId) {
84 | this.shopId = shopId;
85 | }
86 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/cart/Cart.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.cart;
2 |
3 | import com.rick.scaffold.core.entity.generic.DataEntity;
4 |
5 | import java.math.BigDecimal;
6 |
7 | public class Cart extends DataEntity {
8 |
9 | private Long userId;
10 |
11 | private Long shopId;
12 |
13 | private BigDecimal productPrice;
14 |
15 | public Long getUserId() {
16 | return userId;
17 | }
18 |
19 | public void setUserId(Long userId) {
20 | this.userId = userId;
21 | }
22 |
23 | public Long getShopId() {
24 | return shopId;
25 | }
26 |
27 | public void setShopId(Long shopId) {
28 | this.shopId = shopId;
29 | }
30 |
31 | public BigDecimal getProductPrice() {
32 | return productPrice;
33 | }
34 |
35 | public void setProductPrice(BigDecimal productPrice) {
36 | this.productPrice = productPrice;
37 | }
38 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/cart/CartItem.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.cart;
2 |
3 | import com.rick.scaffold.core.entity.generic.BaseEntity;
4 |
5 | import java.math.BigDecimal;
6 |
7 | public class CartItem extends BaseEntity {
8 |
9 | private Long cartId;
10 |
11 | private Long goodsId;
12 |
13 | private String goodsName;
14 |
15 | private String goodsSn;
16 |
17 | private Integer goodsAmount;
18 |
19 | private String unit;
20 |
21 | private BigDecimal marketPrice;
22 |
23 | private BigDecimal goodsPrice;
24 |
25 | private Long shopId;
26 |
27 |
28 | public Long getCartId() {
29 | return cartId;
30 | }
31 |
32 | public void setCartId(Long cartId) {
33 | this.cartId = cartId;
34 | }
35 |
36 | public Long getGoodsId() {
37 | return goodsId;
38 | }
39 |
40 | public void setGoodsId(Long goodsId) {
41 | this.goodsId = goodsId;
42 | }
43 |
44 | public String getGoodsName() {
45 | return goodsName;
46 | }
47 |
48 | public void setGoodsName(String goodsName) {
49 | this.goodsName = goodsName == null ? null : goodsName.trim();
50 | }
51 |
52 | public String getGoodsSn() {
53 | return goodsSn;
54 | }
55 |
56 | public void setGoodsSn(String goodsSn) {
57 | this.goodsSn = goodsSn == null ? null : goodsSn.trim();
58 | }
59 |
60 | public Integer getGoodsAmount() {
61 | return goodsAmount;
62 | }
63 |
64 | public void setGoodsAmount(Integer goodsAmount) {
65 | this.goodsAmount = goodsAmount;
66 | }
67 |
68 | public String getUnit() {
69 | return unit;
70 | }
71 |
72 | public void setUnit(String unit) {
73 | this.unit = unit == null ? null : unit.trim();
74 | }
75 |
76 | public BigDecimal getMarketPrice() {
77 | return marketPrice;
78 | }
79 |
80 | public void setMarketPrice(BigDecimal marketPrice) {
81 | this.marketPrice = marketPrice;
82 | }
83 |
84 | public BigDecimal getGoodsPrice() {
85 | return goodsPrice;
86 | }
87 |
88 | public void setGoodsPrice(BigDecimal goodsPrice) {
89 | this.goodsPrice = goodsPrice;
90 | }
91 |
92 | public Long getShopId() {
93 | return shopId;
94 | }
95 |
96 | public void setShopId(Long shopId) {
97 | this.shopId = shopId;
98 | }
99 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/generic/BaseEntity.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.generic;
2 |
3 | import java.io.Serializable;
4 |
5 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 | import com.rick.scaffold.common.persistence.tool.IncrSequenceTimeHandler;
9 |
10 | /**
11 | * Entity支持类
12 | */
13 | public abstract class BaseEntity implements Serializable {
14 |
15 | private static final long serialVersionUID = 1L;
16 |
17 | /**
18 | * 实体编号(唯一标识)
19 | */
20 | @JsonProperty("_id")
21 | protected Long id;
22 |
23 |
24 | public BaseEntity() {
25 |
26 | }
27 |
28 | public BaseEntity(Long id) {
29 | this();
30 | this.id = id;
31 | }
32 |
33 | /**
34 | * 插入之前执行方法,需要手动调用
35 | */
36 | public void preInsert(){
37 | this.id = IncrSequenceTimeHandler.getInstance().nextId();
38 | }
39 |
40 | public Long getId() {
41 | return id;
42 | }
43 |
44 | public void setId(Long id) {
45 | this.id = id;
46 | }
47 |
48 |
49 | @Override
50 | public boolean equals(Object obj) {
51 | if (null == obj) {
52 | return false;
53 | }
54 | if (this == obj) {
55 | return true;
56 | }
57 | if (!getClass().equals(obj.getClass())) {
58 | return false;
59 | }
60 | BaseEntity> that = (BaseEntity>) obj;
61 | return null == this.getId() ? false : this.getId().equals(that.getId());
62 | }
63 |
64 | @Override
65 | public String toString() {
66 | return ReflectionToStringBuilder.toString(this);
67 | }
68 |
69 | }
70 |
71 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/generic/DataEntity.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.generic;
2 |
3 | import java.util.Date;
4 |
5 | import com.fasterxml.jackson.annotation.JsonFormat;
6 | import com.fasterxml.jackson.annotation.JsonIgnore;
7 |
8 | /**
9 | * 数据Entity类
10 | *
11 | */
12 | public abstract class DataEntity extends BaseEntity {
13 |
14 | private static final long serialVersionUID = 1L;
15 |
16 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
17 | protected Date createDate; // 创建日期
18 |
19 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
20 | protected Date modifyDate; // 更新日期
21 |
22 | @JsonIgnore
23 | protected Boolean delFlag = false; // 删除标记(false:正常;true:删除;)
24 |
25 | public DataEntity() {
26 | super();
27 | }
28 |
29 | public DataEntity(Long id) {
30 | super(id);
31 | }
32 |
33 | /**
34 | * 插入之前执行方法,需要手动调用
35 | */
36 | @Override
37 | public void preInsert(){
38 | super.preInsert();
39 | this.modifyDate = new Date();
40 | this.createDate = this.modifyDate;
41 | }
42 |
43 | /**
44 | * 更新之前执行方法,需要手动调用
45 | */
46 | public void preUpdate(){
47 | this.modifyDate = new Date();
48 | }
49 |
50 | public Date getCreateDate() {
51 | return createDate;
52 | }
53 |
54 | public void setCreateDate(Date createDate) {
55 | this.createDate = createDate;
56 | }
57 |
58 | public Date getModifyDate() {
59 | return modifyDate;
60 | }
61 |
62 | public void setModifyDate(Date modifyDate) {
63 | this.modifyDate = modifyDate;
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/goods/Category.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.goods;
2 |
3 | import com.rick.scaffold.core.entity.generic.DataEntity;
4 |
5 | public class Category extends DataEntity {
6 |
7 | private String name;
8 |
9 | private String desc;
10 |
11 | private String cateImage;
12 |
13 | private Long parentId;
14 |
15 | private Boolean showInNav;
16 |
17 | private Boolean isShow;
18 |
19 | private Long shopId;
20 |
21 | private Byte level;
22 |
23 |
24 | public String getName() {
25 | return name;
26 | }
27 |
28 | public void setName(String name) {
29 | this.name = name == null ? null : name.trim();
30 | }
31 |
32 | public String getDesc() {
33 | return desc;
34 | }
35 |
36 | public void setDesc(String desc) {
37 | this.desc = desc == null ? null : desc.trim();
38 | }
39 |
40 | public String getCateImage() {
41 | return cateImage;
42 | }
43 |
44 | public void setCateImage(String cateImage) {
45 | this.cateImage = cateImage == null ? null : cateImage.trim();
46 | }
47 |
48 | public Long getParentId() {
49 | return parentId;
50 | }
51 |
52 | public void setParentId(Long parentId) {
53 | this.parentId = parentId;
54 | }
55 |
56 | public Boolean getShowInNav() {
57 | return showInNav;
58 | }
59 |
60 | public void setShowInNav(Boolean showInNav) {
61 | this.showInNav = showInNav;
62 | }
63 |
64 | public Boolean getIsShow() {
65 | return isShow;
66 | }
67 |
68 | public void setIsShow(Boolean isShow) {
69 | this.isShow = isShow;
70 | }
71 |
72 | public Long getShopId() {
73 | return shopId;
74 | }
75 |
76 | public void setShopId(Long shopId) {
77 | this.shopId = shopId;
78 | }
79 |
80 | public Byte getLevel() {
81 | return level;
82 | }
83 |
84 | public void setLevel(Byte level) {
85 | this.level = level;
86 | }
87 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/goods/GoodsGallery.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.goods;
2 |
3 | import com.rick.scaffold.core.entity.generic.BaseEntity;
4 |
5 | public class GoodsGallery extends BaseEntity {
6 |
7 | private Long goodsId;
8 |
9 | private String imgUrl;
10 |
11 | private String imgDesc;
12 |
13 | private Byte imgType;
14 |
15 |
16 |
17 | public Long getGoodsId() {
18 | return goodsId;
19 | }
20 |
21 | public void setGoodsId(Long goodsId) {
22 | this.goodsId = goodsId;
23 | }
24 |
25 | public String getImgUrl() {
26 | return imgUrl;
27 | }
28 |
29 | public void setImgUrl(String imgUrl) {
30 | this.imgUrl = imgUrl == null ? null : imgUrl.trim();
31 | }
32 |
33 | public String getImgDesc() {
34 | return imgDesc;
35 | }
36 |
37 | public void setImgDesc(String imgDesc) {
38 | this.imgDesc = imgDesc == null ? null : imgDesc.trim();
39 | }
40 |
41 | public Byte getImgType() {
42 | return imgType;
43 | }
44 |
45 | public void setImgType(Byte imgType) {
46 | this.imgType = imgType;
47 | }
48 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/order/OrderItem.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.order;
2 |
3 | import com.rick.scaffold.core.entity.generic.BaseEntity;
4 |
5 | import java.math.BigDecimal;
6 |
7 | public class OrderItem extends BaseEntity {
8 |
9 | private Long orderId;
10 |
11 | private Long goodsId;
12 |
13 | private String goodsName;
14 |
15 | private String goodsSn;
16 |
17 | private Integer goodsAmount;
18 |
19 | private String unit;
20 |
21 | private BigDecimal marketPrice;
22 |
23 | private BigDecimal goodsPrice;
24 |
25 | private Long shopId;
26 |
27 |
28 |
29 | public Long getOrderId() {
30 | return orderId;
31 | }
32 |
33 | public void setOrderId(Long orderId) {
34 | this.orderId = orderId;
35 | }
36 |
37 | public Long getGoodsId() {
38 | return goodsId;
39 | }
40 |
41 | public void setGoodsId(Long goodsId) {
42 | this.goodsId = goodsId;
43 | }
44 |
45 | public String getGoodsName() {
46 | return goodsName;
47 | }
48 |
49 | public void setGoodsName(String goodsName) {
50 | this.goodsName = goodsName == null ? null : goodsName.trim();
51 | }
52 |
53 | public String getGoodsSn() {
54 | return goodsSn;
55 | }
56 |
57 | public void setGoodsSn(String goodsSn) {
58 | this.goodsSn = goodsSn == null ? null : goodsSn.trim();
59 | }
60 |
61 | public Integer getGoodsAmount() {
62 | return goodsAmount;
63 | }
64 |
65 | public void setGoodsAmount(Integer goodsAmount) {
66 | this.goodsAmount = goodsAmount;
67 | }
68 |
69 | public String getUnit() {
70 | return unit;
71 | }
72 |
73 | public void setUnit(String unit) {
74 | this.unit = unit == null ? null : unit.trim();
75 | }
76 |
77 | public BigDecimal getMarketPrice() {
78 | return marketPrice;
79 | }
80 |
81 | public void setMarketPrice(BigDecimal marketPrice) {
82 | this.marketPrice = marketPrice;
83 | }
84 |
85 | public BigDecimal getGoodsPrice() {
86 | return goodsPrice;
87 | }
88 |
89 | public void setGoodsPrice(BigDecimal goodsPrice) {
90 | this.goodsPrice = goodsPrice;
91 | }
92 |
93 | public Long getShopId() {
94 | return shopId;
95 | }
96 |
97 | public void setShopId(Long shopId) {
98 | this.shopId = shopId;
99 | }
100 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/product/Product.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.product;
2 |
3 | import java.math.BigDecimal;
4 |
5 | import com.rick.scaffold.core.entity.generic.DataEntity;
6 |
7 | public class Product extends DataEntity {
8 |
9 | /**
10 | *
11 | */
12 | private static final long serialVersionUID = 1L;
13 |
14 | private String image;
15 |
16 | private String remark;
17 |
18 | private String name;
19 |
20 | private BigDecimal price;
21 |
22 | private String sn;
23 |
24 | private String unit;
25 |
26 | private Float amount;
27 |
28 | public String getImage() {
29 | return image;
30 | }
31 |
32 | public void setImage(String image) {
33 | this.image = image == null ? null : image.trim();
34 | }
35 |
36 | public String getRemark() {
37 | return remark;
38 | }
39 |
40 | public void setRemark(String remark) {
41 | this.remark = remark == null ? null : remark.trim();
42 | }
43 |
44 | public String getName() {
45 | return name;
46 | }
47 |
48 | public void setName(String name) {
49 | this.name = name == null ? null : name.trim();
50 | }
51 |
52 | public BigDecimal getPrice() {
53 | return price;
54 | }
55 |
56 | public void setPrice(BigDecimal price) {
57 | this.price = price;
58 | }
59 |
60 | public String getSn() {
61 | return sn;
62 | }
63 |
64 | public void setSn(String sn) {
65 | this.sn = sn == null ? null : sn.trim();
66 | }
67 |
68 | public String getUnit() {
69 | return unit;
70 | }
71 |
72 | public void setUnit(String unit) {
73 | this.unit = unit == null ? null : unit.trim();
74 | }
75 |
76 | public Float getAmount() {
77 | return amount;
78 | }
79 |
80 | public void setAmount(Float amount) {
81 | this.amount = amount;
82 | }
83 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/shop/Shop.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.shop;
2 |
3 | import com.rick.scaffold.core.entity.generic.DataEntity;
4 |
5 | public class Shop extends DataEntity {
6 |
7 | private String shopName;
8 |
9 | private String shopImage;
10 |
11 | private String phone;
12 |
13 | private String address;
14 |
15 |
16 | public String getShopName() {
17 | return shopName;
18 | }
19 |
20 | public void setShopName(String shopName) {
21 | this.shopName = shopName == null ? null : shopName.trim();
22 | }
23 |
24 | public String getShopImage() {
25 | return shopImage;
26 | }
27 |
28 | public void setShopImage(String shopImage) {
29 | this.shopImage = shopImage == null ? null : shopImage.trim();
30 | }
31 |
32 | public String getPhone() {
33 | return phone;
34 | }
35 |
36 | public void setPhone(String phone) {
37 | this.phone = phone == null ? null : phone.trim();
38 | }
39 |
40 | public String getAddress() {
41 | return address;
42 | }
43 |
44 | public void setAddress(String address) {
45 | this.address = address == null ? null : address.trim();
46 | }
47 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/user/Company.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.user;
2 |
3 | import com.rick.scaffold.core.entity.generic.BaseEntity;
4 |
5 | public class Company extends BaseEntity {
6 |
7 | private static final long serialVersionUID = 1L;
8 |
9 | private String name;
10 | private String phone;
11 |
12 | public String getName() {
13 | return name;
14 | }
15 | public void setName(String name) {
16 | this.name = name;
17 | }
18 | public String getPhone() {
19 | return phone;
20 | }
21 | public void setPhone(String phone) {
22 | this.phone = phone;
23 | }
24 |
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/user/FullUser.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.user;
2 |
3 | import java.util.List;
4 |
5 | public class FullUser extends User {
6 |
7 | /**
8 | *
9 | */
10 | private static final long serialVersionUID = 1L;
11 |
12 | private Company company;
13 | private List photos;
14 |
15 | public Company getCompany() {
16 | return company;
17 | }
18 | public void setCompany(Company company) {
19 | this.company = company;
20 | }
21 | public List getPhotos() {
22 | return photos;
23 | }
24 | public void setPhotos(List photos) {
25 | this.photos = photos;
26 | }
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/user/Photo.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.user;
2 |
3 | import com.rick.scaffold.core.entity.generic.BaseEntity;
4 |
5 | public class Photo extends BaseEntity {
6 |
7 | /**
8 | *
9 | */
10 | private static final long serialVersionUID = 1L;
11 |
12 | private String url;
13 | private int size;
14 | private Long userId;
15 |
16 |
17 |
18 | public Long getUserId() {
19 | return userId;
20 | }
21 | public void setUserId(Long userId) {
22 | this.userId = userId;
23 | }
24 | public String getUrl() {
25 | return url;
26 | }
27 | public void setUrl(String url) {
28 | this.url = url;
29 | }
30 | public int getSize() {
31 | return size;
32 | }
33 | public void setSize(int size) {
34 | this.size = size;
35 | }
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/user/User.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.user;
2 |
3 | import java.util.Date;
4 |
5 | import com.rick.scaffold.core.entity.generic.DataEntity;
6 |
7 | public class User extends DataEntity {
8 |
9 | /**
10 | *
11 | */
12 | private static final long serialVersionUID = 1L;
13 |
14 | private String loginName;
15 |
16 | private String password;
17 |
18 | private String name;
19 |
20 | private String email;
21 |
22 | private String phone;
23 |
24 | private Long userTag;
25 |
26 | private String avatar;
27 |
28 | private String loginIp;
29 |
30 | private Date loginDate;
31 |
32 | private Long companyId;
33 |
34 |
35 |
36 | public Long getCompanyId() {
37 | return companyId;
38 | }
39 |
40 | public void setCompanyId(Long companyId) {
41 | this.companyId = companyId;
42 | }
43 |
44 | public String getLoginName() {
45 | return loginName;
46 | }
47 |
48 | public void setLoginName(String loginName) {
49 | this.loginName = loginName == null ? null : loginName.trim();
50 | }
51 |
52 | public String getPassword() {
53 | return password;
54 | }
55 |
56 | public void setPassword(String password) {
57 | this.password = password == null ? null : password.trim();
58 | }
59 |
60 | public String getName() {
61 | return name;
62 | }
63 |
64 | public void setName(String name) {
65 | this.name = name == null ? null : name.trim();
66 | }
67 |
68 | public String getEmail() {
69 | return email;
70 | }
71 |
72 | public void setEmail(String email) {
73 | this.email = email == null ? null : email.trim();
74 | }
75 |
76 | public String getPhone() {
77 | return phone;
78 | }
79 |
80 | public void setPhone(String phone) {
81 | this.phone = phone == null ? null : phone.trim();
82 | }
83 |
84 | public Long getUserTag() {
85 | return userTag;
86 | }
87 |
88 | public void setUserTag(Long userTag) {
89 | this.userTag = userTag;
90 | }
91 |
92 | public String getAvatar() {
93 | return avatar;
94 | }
95 |
96 | public void setAvatar(String avatar) {
97 | this.avatar = avatar == null ? null : avatar.trim();
98 | }
99 |
100 | public String getLoginIp() {
101 | return loginIp;
102 | }
103 |
104 | public void setLoginIp(String loginIp) {
105 | this.loginIp = loginIp == null ? null : loginIp.trim();
106 | }
107 |
108 | public Date getLoginDate() {
109 | return loginDate;
110 | }
111 |
112 | public void setLoginDate(Date loginDate) {
113 | this.loginDate = loginDate;
114 | }
115 |
116 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/entity/user/Users.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.entity.user;
2 |
3 | import com.rick.scaffold.core.entity.generic.DataEntity;
4 |
5 | public class Users extends DataEntity {
6 |
7 | private String email;
8 |
9 | private String username;
10 |
11 | private String password;
12 |
13 | private Byte sex;
14 |
15 | private Integer point;
16 |
17 | private String nickName;
18 |
19 |
20 | public String getEmail() {
21 | return email;
22 | }
23 |
24 | public void setEmail(String email) {
25 | this.email = email;
26 | }
27 |
28 | public String getUsername() {
29 | return username;
30 | }
31 |
32 | public void setUsername(String username) {
33 | this.username = username;
34 | }
35 |
36 | public String getPassword() {
37 | return password;
38 | }
39 |
40 | public void setPassword(String password) {
41 | this.password = password;
42 | }
43 |
44 | public Byte getSex() {
45 | return sex;
46 | }
47 |
48 | public void setSex(Byte sex) {
49 | this.sex = sex;
50 | }
51 |
52 | public Integer getPoint() {
53 | return point;
54 | }
55 |
56 | public void setPoint(Integer point) {
57 | this.point = point;
58 | }
59 |
60 | public String getNickName() {
61 | return nickName;
62 | }
63 |
64 | public void setNickName(String nickName) {
65 | this.nickName = nickName;
66 | }
67 | }
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/address/AddressService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.address;
2 |
3 | import com.rick.scaffold.core.dao.address.AddressDao;
4 | import com.rick.scaffold.core.entity.address.Address;
5 | import com.rick.scaffold.core.service.generic.CrudService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class AddressService extends CrudService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/address/RegionService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.address;
2 |
3 | import com.rick.scaffold.core.dao.address.RegionDao;
4 | import com.rick.scaffold.core.entity.address.Region;
5 | import com.rick.scaffold.core.service.generic.BaseService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class RegionService extends BaseService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/admin/AdminService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.admin;
2 |
3 | import com.rick.scaffold.core.dao.admin.AdminDao;
4 | import com.rick.scaffold.core.entity.admin.Admin;
5 | import com.rick.scaffold.core.service.generic.CrudService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class AdminService extends CrudService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/cart/CartItemService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.cart;
2 |
3 | import com.rick.scaffold.core.dao.cart.CartItemDao;
4 | import com.rick.scaffold.core.entity.cart.CartItem;
5 | import com.rick.scaffold.core.service.generic.BaseService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class CartItemService extends BaseService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/cart/CartService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.cart;
2 |
3 | import com.rick.scaffold.core.dao.cart.CartDao;
4 | import com.rick.scaffold.core.entity.cart.Cart;
5 | import com.rick.scaffold.core.service.generic.CrudService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class CartService extends CrudService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/generic/BaseService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.generic;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.transaction.annotation.Transactional;
7 |
8 | import com.rick.scaffold.common.utils.JedisUtils;
9 | import com.rick.scaffold.core.dao.generic.BaseDao;
10 | import com.rick.scaffold.core.entity.generic.BaseEntity;
11 |
12 | /**
13 | * Service基类
14 | */
15 | @Transactional(readOnly = true)
16 | public abstract class BaseService, T extends BaseEntity> {
17 |
18 | /**
19 | * 持久层对象
20 | */
21 | @Autowired
22 | protected D dao;
23 |
24 | /**
25 | * 获取单条数据
26 | * @param id
27 | * @return
28 | */
29 | public T findOne(Long id) {
30 | return dao.findOne(id);
31 | }
32 |
33 | /**
34 | * 查询列表数据
35 | * @param entity
36 | * @return
37 | */
38 | public List findAll() {
39 | return dao.findAll();
40 | }
41 |
42 | /**
43 | * 保存数据(插入或更新)
44 | * @param entity
45 | */
46 | @Transactional(readOnly = false)
47 | public int saveAndCache(T entity, int cacheExpireTime) {
48 | entity.preInsert();
49 | int res = dao.insert(entity);
50 | JedisUtils.setObject(entity.getId().toString(), entity, cacheExpireTime);
51 | return res;
52 | }
53 |
54 | @Transactional(readOnly = false)
55 | public int saveAndCache(T entity) {
56 | entity.preInsert();
57 | int res = dao.insert(entity);
58 | JedisUtils.setObject(entity.getId().toString(), entity, 0);
59 | return res;
60 | }
61 |
62 | @Transactional(readOnly = false)
63 | public int save(T entity) {
64 | entity.preInsert();
65 | return dao.insert(entity);
66 | }
67 |
68 | /**
69 | * 更新数据(插入或更新)
70 | * @param entity
71 | */
72 | @Transactional(readOnly = false)
73 | public int updateAndCache(T entity, int cacheExpireTime) {
74 | int res = dao.update(entity);
75 | JedisUtils.setObject(entity.getId().toString(), entity, cacheExpireTime);
76 | return res;
77 | }
78 |
79 | @Transactional(readOnly = false)
80 | public int updateAndCache(T entity) {
81 | int res = dao.update(entity);
82 | JedisUtils.setObject(entity.getId().toString(), entity, 0);
83 | return res;
84 | }
85 |
86 | @Transactional(readOnly = false)
87 | public int update(T entity) {
88 | return dao.update(entity);
89 | }
90 |
91 | /**
92 | * 删除数据
93 | * @param entity
94 | */
95 | @Transactional(readOnly = false)
96 | public int delete(Long id) {
97 | return dao.delete(id);
98 | }
99 |
100 | @Transactional(readOnly = false)
101 | public int deleteAndCache(Long id) {
102 | JedisUtils.delObject(id.toString());
103 | return dao.delete(id);
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/generic/CrudService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.generic;
2 |
3 | import org.springframework.transaction.annotation.Transactional;
4 |
5 | import com.rick.scaffold.common.utils.JedisUtils;
6 | import com.rick.scaffold.core.dao.generic.CrudDao;
7 | import com.rick.scaffold.core.entity.generic.DataEntity;
8 |
9 | /**
10 | * Service基类
11 | */
12 | public abstract class CrudService, T extends DataEntity> extends BaseService {
13 |
14 | /**
15 | * 保存数据(插入或更新)
16 | * @param entity
17 | */
18 | @Override
19 | @Transactional(readOnly = false)
20 | public int save(T entity) {
21 | entity.preInsert();
22 | return dao.insert(entity);
23 | }
24 |
25 | @Override
26 | @Transactional(readOnly = false)
27 | public int saveAndCache(T entity) {
28 | entity.preInsert();
29 | int res = dao.insert(entity);
30 | JedisUtils.setObject(entity.getId().toString(), entity, 0);
31 | return res;
32 | }
33 |
34 | @Override
35 | @Transactional(readOnly = false)
36 | public int saveAndCache(T entity, int cacheExpireTime) {
37 | entity.preInsert();
38 | int res = dao.insert(entity);
39 | JedisUtils.setObject(entity.getId().toString(), entity, cacheExpireTime);
40 | return res;
41 | }
42 |
43 | /**
44 | * 更新数据(插入或更新)
45 | * @param entity
46 | */
47 | @Override
48 | @Transactional(readOnly = false)
49 | public int update(T entity) {
50 | entity.preUpdate();
51 | return dao.update(entity);
52 | }
53 |
54 | @Override
55 | @Transactional(readOnly = false)
56 | public int updateAndCache(T entity, int cacheExpireTime) {
57 | entity.preUpdate();
58 | int res = dao.update(entity);
59 | JedisUtils.setObject(entity.getId().toString(), entity, cacheExpireTime);
60 | return res;
61 | }
62 |
63 | @Override
64 | @Transactional(readOnly = false)
65 | public int updateAndCache(T entity) {
66 | entity.preUpdate();
67 | int res = dao.update(entity);
68 | JedisUtils.setObject(entity.getId().toString(), entity, 0);
69 | return res;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/goods/CategoryService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.goods;
2 |
3 | import com.rick.scaffold.core.dao.goods.CategoryDao;
4 | import com.rick.scaffold.core.entity.goods.Category;
5 | import com.rick.scaffold.core.service.generic.CrudService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class CategoryService extends CrudService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/goods/GoodsGalleryService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.goods;
2 |
3 | import com.rick.scaffold.core.dao.goods.GoodsGalleryDao;
4 | import com.rick.scaffold.core.entity.goods.GoodsGallery;
5 | import com.rick.scaffold.core.service.generic.BaseService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class GoodsGalleryService extends BaseService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/goods/GoodsService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.goods;
2 |
3 | import com.rick.scaffold.core.dao.goods.GoodsDao;
4 | import com.rick.scaffold.core.entity.goods.Goods;
5 | import com.rick.scaffold.core.service.generic.CrudService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class GoodsService extends CrudService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/order/OrderItemService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.order;
2 |
3 | import com.rick.scaffold.core.dao.order.OrderItemDao;
4 | import com.rick.scaffold.core.entity.order.OrderItem;
5 | import com.rick.scaffold.core.service.generic.BaseService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class OrderItemService extends BaseService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/order/OrderService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.order;
2 |
3 | import com.rick.scaffold.core.dao.order.OrderDao;
4 | import com.rick.scaffold.core.entity.order.Order;
5 | import com.rick.scaffold.core.service.generic.CrudService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class OrderService extends CrudService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/product/ProductService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.product;
2 |
3 | import org.springframework.stereotype.Service;
4 | import org.springframework.transaction.annotation.Transactional;
5 |
6 | import com.rick.scaffold.core.dao.product.ProductDao;
7 | import com.rick.scaffold.core.entity.product.Product;
8 | import com.rick.scaffold.core.service.generic.CrudService;
9 |
10 | @Service
11 | public class ProductService extends CrudService {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/shop/ShopService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.shop;
2 |
3 | import com.rick.scaffold.core.dao.shop.ShopDao;
4 | import com.rick.scaffold.core.entity.shop.Shop;
5 | import com.rick.scaffold.core.service.generic.CrudService;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * Created by user on 16/3/10.
10 | */
11 | @Service
12 | public class ShopService extends CrudService {
13 | }
14 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/user/CompanyService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.user;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.stereotype.Service;
5 | import org.springframework.transaction.annotation.Transactional;
6 |
7 | import com.rick.scaffold.core.dao.user.CompanyDao;
8 | import com.rick.scaffold.core.entity.user.Company;
9 | import com.rick.scaffold.core.service.generic.BaseService;
10 |
11 | @Service
12 | public class CompanyService extends BaseService {
13 |
14 | @Autowired
15 | private CompanyDao companyDao;
16 |
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/user/PhotoService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.user;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.stereotype.Service;
5 | import org.springframework.transaction.annotation.Transactional;
6 |
7 | import com.rick.scaffold.core.dao.user.PhotoDao;
8 | import com.rick.scaffold.core.entity.user.Photo;
9 | import com.rick.scaffold.core.service.generic.BaseService;
10 |
11 | @Service
12 | public class PhotoService extends BaseService {
13 |
14 | @Autowired
15 | private PhotoDao photoDao;
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/user/UserService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.user;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | import org.springframework.beans.BeanUtils;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.cache.annotation.CachePut;
9 | import org.springframework.cache.annotation.Cacheable;
10 | import org.springframework.stereotype.Service;
11 | import org.springframework.transaction.annotation.Transactional;
12 |
13 | import com.github.pagehelper.Page;
14 | import com.github.pagehelper.PageHelper;
15 | import com.google.common.collect.Maps;
16 | import com.rick.scaffold.core.dao.user.UserDao;
17 | import com.rick.scaffold.core.entity.user.FullUser;
18 | import com.rick.scaffold.core.entity.user.User;
19 | import com.rick.scaffold.core.service.generic.CrudService;
20 | import com.rick.scaffold.core.vo.Paginator;
21 |
22 | @Service
23 | public class UserService extends CrudService {
24 |
25 | @Autowired
26 | private UserDao userDao;
27 |
28 | public Map findAll1() {
29 | PageHelper.startPage(1, 10, "id desc");
30 | List users = userDao.findAll();
31 | Page page = (Page)users;
32 | Paginator p = new Paginator();
33 | BeanUtils.copyProperties(page, p);
34 | Map map = Maps.newHashMap();
35 | map.put("users", users);
36 | map.put("page", p);
37 | return map;
38 | }
39 |
40 | @Override
41 | public User findOne(Long id) {
42 | return userDao.findOne(id);
43 | }
44 |
45 |
46 | @Override
47 | @Transactional(readOnly = false)
48 | public int save(User entity) {
49 | return super.save(entity);
50 | }
51 |
52 | public User findOne1() {
53 | return userDao.findOne1(56886380597248L, "zzh");
54 | }
55 |
56 | public List findCascade(Long id) {
57 | return userDao.findCascade(id);
58 | }
59 |
60 | public List findLazy(Long id) {
61 | return userDao.findLazy(id);
62 | }
63 |
64 | public User findByName(String name) {
65 | return userDao.findByName(name);
66 | }
67 | }
68 |
69 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/service/user/UsersService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.service.user;
2 |
3 | import com.rick.scaffold.core.dao.user.UsersDao;
4 | import com.rick.scaffold.core.entity.user.Users;
5 | import com.rick.scaffold.core.service.generic.CrudService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | /**
10 | * Created by user on 16/3/10.
11 | */
12 | @Service
13 | public class UsersService extends CrudService {
14 |
15 | @Autowired
16 | private UsersDao usersDao;
17 |
18 | public Users findByName(String name) {
19 | return usersDao.findByName(name);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/rz-core/src/main/java/com/rick/scaffold/core/vo/Paginator.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.core.vo;
2 |
3 | public class Paginator {
4 |
5 | private int pageNum;
6 | private int pageSize;
7 | private long total;
8 |
9 | public int getPageNum() {
10 | return pageNum;
11 | }
12 | public void setPageNum(int pageNum) {
13 | this.pageNum = pageNum;
14 | }
15 | public int getPageSize() {
16 | return pageSize;
17 | }
18 | public void setPageSize(int pageSize) {
19 | this.pageSize = pageSize;
20 | }
21 | public long getTotal() {
22 | return total;
23 | }
24 | public void setTotal(long total) {
25 | this.total = total;
26 | }
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/rz-core/src/main/resources/config/cache/ehcache-local.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
19 |
20 |
21 |
28 |
29 |
--------------------------------------------------------------------------------
/rz-core/src/main/resources/config/spring/spring-core.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 | Spring Configuration
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/rz-core/src/main/resources/config/spring/spring-ehcache.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/rz-core/src/main/resources/config/spring/spring-jedis.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | Jedis Configuration
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/rz-core/src/main/resources/mappings/address/RegionMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | id, parent_id, region_name, region_type
12 |
13 |
19 |
20 | delete from cs_region
21 | where id = #{id}
22 |
23 |
24 | insert into cs_region
25 |
26 |
27 | id,
28 |
29 |
30 | parent_id,
31 |
32 |
33 | region_name,
34 |
35 |
36 | region_type,
37 |
38 |
39 |
40 |
41 | #{id,jdbcType=INTEGER},
42 |
43 |
44 | #{parentId,jdbcType=INTEGER},
45 |
46 |
47 | #{regionName,jdbcType=VARCHAR},
48 |
49 |
50 | #{regionType,jdbcType=TINYINT},
51 |
52 |
53 |
54 |
55 |
56 | update cs_region
57 |
58 |
59 | parent_id = #{parentId},
60 |
61 |
62 | region_name = #{regionName,jdbcType=VARCHAR},
63 |
64 |
65 | region_type = #{regionType,jdbcType=TINYINT},
66 |
67 |
68 | where id = #{id}
69 |
70 |
--------------------------------------------------------------------------------
/rz-core/src/main/resources/mappings/user/CompanyMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | id, name, phone
11 |
12 |
18 |
19 | delete from sys_company
20 | where id = #{id}
21 |
22 |
23 | insert into sys_company (id, name, phone
24 | )
25 | values (#{id}, #{name,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}
26 | )
27 |
28 |
29 |
30 | update sys_company
31 |
32 |
33 | name = #{name,jdbcType=VARCHAR},
34 |
35 |
36 | phone = #{phone,jdbcType=VARCHAR},
37 |
38 |
39 | where id = #{id}
40 |
41 |
--------------------------------------------------------------------------------
/rz-core/src/main/resources/mappings/user/PhotoMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | id, url, size, user_id
12 |
13 |
19 |
25 |
26 | delete from sys_photo
27 | where id = #{id}
28 |
29 |
30 | insert into sys_photo (id, url, size,
31 | user_id)
32 | values (#{id}, #{url,jdbcType=VARCHAR}, #{size,jdbcType=INTEGER},
33 | #{userId,jdbcType=BIGINT})
34 |
35 |
36 |
37 | update sys_photo
38 |
39 |
40 | url = #{url,jdbcType=VARCHAR},
41 |
42 |
43 | size = #{size,jdbcType=INTEGER},
44 |
45 |
46 | user_id = #{userId,jdbcType=BIGINT},
47 |
48 |
49 | where id = #{id}
50 |
51 |
--------------------------------------------------------------------------------
/rz-core/src/main/resources/mybatis-generator/mybatis-generator.properties:
--------------------------------------------------------------------------------
1 | db.driver=com.mysql.jdbc.Driver
2 | db.url=jdbc:mysql://localhost:3306/cloudshop?useUnicode=true&characterEncoding=UTF-8
3 | db.user=root
4 | db.password=eros
5 |
6 | #ubuntu path
7 | #mybatis.driver.path=/home/eros/.m2/repository/mysql/mysql-connector-java/5.1.31/mysql-connector-java-5.1.31.jar
8 | #mac path
9 | mybatis.driver.path=/Users/user/.m2/repository/mysql/mysql-connector-java/5.1.31/mysql-connector-java-5.1.31.jar
10 | #windows office
11 | #mybatis.driver.path=C:/Users/user/.m2/repository/mysql/mysql-connector-java/5.1.31/mysql-connector-java-5.1.31.jar
12 |
13 | mybatis.model.package=com.rick.scaffold.core.entity
14 | mybatis.mapper.package=mappings
15 | mybatis.dao.package=com.rick.scaffold.core.dao
--------------------------------------------------------------------------------
/rz-core/src/test/java/com/rick/scaffold/base/BaseTest.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.base;
2 |
3 | import org.junit.runner.RunWith;
4 | import org.springframework.test.context.ContextConfiguration;
5 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
6 |
7 | @RunWith(SpringJUnit4ClassRunner.class)
8 | @ContextConfiguration(locations = "classpath:test-applicationContext-core.xml")
9 | public abstract class BaseTest {
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/rz-core/src/test/java/com/rick/scaffold/service/address/TestRegion.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.service.address;
2 |
3 | import com.rick.scaffold.base.BaseTest;
4 | import com.rick.scaffold.common.jsontool.JsonMapper;
5 | import com.rick.scaffold.core.entity.address.Region;
6 | import com.rick.scaffold.core.service.address.RegionService;
7 | import org.junit.Test;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 |
10 | /**
11 | * Created by user on 16/3/10.
12 | */
13 | public class TestRegion extends BaseTest {
14 |
15 | @Autowired
16 | private RegionService rs;
17 |
18 | @Test
19 | public void testGetRegion() {
20 | Region region = rs.findOne(3L);
21 | System.out.println(JsonMapper.getInstance().toJson(region));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/rz-core/src/test/java/com/rick/scaffold/service/user/TestObjectId.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.service.user;
2 |
3 | import org.junit.Test;
4 |
5 | import com.rick.scaffold.common.persistence.tool.IncrSequenceTimeHandler;
6 |
7 | public class TestObjectId {
8 |
9 | // @Test
10 | // public void testObjectId() {
11 | // System.out.println(ObjectId.get().toString());
12 | // }
13 |
14 | @Test
15 | public void testSequence() {
16 | long id = IncrSequenceTimeHandler.getInstance().nextId();
17 | System.out.println(id);
18 | }
19 |
20 | @Test
21 | public void testCurrentTime() {
22 | System.out.println(System.currentTimeMillis());
23 | System.out.println(1288834974657L);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/rz-hbase/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 |
--------------------------------------------------------------------------------
/rz-hbase/src/main/java/com/rick/scaffold/hbase/HbaseConstants.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.hbase;
2 |
3 | public interface HbaseConstants {
4 |
5 | String DBNAME = "scaffold";
6 | }
7 |
--------------------------------------------------------------------------------
/rz-hbase/src/main/java/com/rick/scaffold/hbase/delegate/HbaseService.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.hbase.delegate;
2 |
3 | import com.rick.scaffold.soa.hbase.HbaseResult;
4 |
5 | import java.io.IOException;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by user on 16/3/18.
10 | */
11 | public interface HbaseService {
12 |
13 | void createTable(String tableName, String[] cols) throws IOException;
14 |
15 | void deleteTable(String tableName) throws IOException;
16 |
17 | void insertRow(String tableName, String rowkey, String colFamily, String col, String val) throws IOException;
18 |
19 | List getData(String tableName, String rowkey, String colFamily, String col) throws IOException;
20 |
21 | List scanData(String tableName, String startRow, String stopRow) throws IOException;
22 |
23 | void deleRow(String tableName, String rowkey, String colFamily, String col) throws IOException;
24 | }
25 |
--------------------------------------------------------------------------------
/rz-hbase/src/main/java/com/rick/scaffold/hbase/module/goods/GoodsHbaseImpl.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.hbase.module.goods;
2 |
3 | import com.rick.scaffold.hbase.HbaseConstants;
4 | import com.rick.scaffold.hbase.delegate.HbaseService;
5 | import com.rick.scaffold.soa.hbase.HbaseResult;
6 | import com.rick.scaffold.soa.hbase.service.GoodsHbase;
7 | import org.apache.log4j.Logger;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 |
11 | import javax.annotation.PostConstruct;
12 | import java.io.IOException;
13 | import java.util.List;
14 |
15 | /**
16 | * Created by user on 16/3/18.
17 | */
18 | @Service("goodsHbaseService")
19 | public class GoodsHbaseImpl implements GoodsHbase {
20 |
21 | private static Logger logger = Logger.getLogger(GoodsHbaseImpl.class);
22 |
23 | @Autowired
24 | private HbaseService service;
25 |
26 | @Override
27 | @PostConstruct
28 | public void createTable() {
29 | String[] cols = {"goods", "order"};
30 | try {
31 | service.createTable(HbaseConstants.DBNAME, cols);
32 | } catch (Exception e) {
33 | logger.error("Create table fail.", e);
34 | }
35 |
36 | }
37 |
38 | @Override
39 | public void deleteTable() {
40 | try {
41 | service.deleteTable(HbaseConstants.DBNAME);
42 | } catch (Exception e) {
43 | logger.error("Delete table fail.", e);
44 | }
45 | }
46 |
47 | @Override
48 | public void insertDescription(String rowkey, String val) {
49 | try {
50 | service.insertRow(HbaseConstants.DBNAME, rowkey, "goods", "description", val);
51 | } catch (IOException e) {
52 | logger.error("Insert goods description fail.", e);
53 | }
54 | }
55 |
56 | @Override
57 | public List getDescription(String rowkey) {
58 | try {
59 | return service.getData(HbaseConstants.DBNAME, rowkey, "goods", "description");
60 | } catch (IOException e) {
61 | logger.error("Get goods description fail.", e);
62 | return null;
63 | }
64 | }
65 |
66 | @Override
67 | public List scanData(String startRow, String stopRow) {
68 | try {
69 | return service.scanData(HbaseConstants.DBNAME, startRow, stopRow);
70 | } catch (IOException e) {
71 | logger.error("Scan goods description fail.", e);
72 | return null;
73 | }
74 | }
75 |
76 | @Override
77 | public void delDescription(String rowkey) throws IOException {
78 | try {
79 | service.deleRow(HbaseConstants.DBNAME, rowkey, "goods", "description");
80 | } catch (IOException e) {
81 | logger.error("Get goods description fail.", e);
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/rz-hbase/src/main/java/com/rick/scaffold/hbase/utils/HbaseClient.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.hbase.utils;
2 |
3 | import org.apache.hadoop.conf.Configuration;
4 | import org.apache.hadoop.hbase.HBaseConfiguration;
5 | import org.apache.hadoop.hbase.client.Admin;
6 | import org.apache.hadoop.hbase.client.Connection;
7 | import org.apache.hadoop.hbase.client.ConnectionFactory;
8 | import org.apache.log4j.Logger;
9 |
10 | import javax.annotation.PreDestroy;
11 | import java.io.IOException;
12 |
13 | /**
14 | * Created by user on 16/3/18.
15 | */
16 | public class HbaseClient {
17 |
18 | private static Logger logger = Logger.getLogger(HbaseClient.class);
19 |
20 | private Configuration configuration;
21 |
22 | private Connection connection;
23 |
24 | private Admin admin;
25 |
26 |
27 | private HbaseClient(String host, String port) {
28 | if(configuration == null) {
29 | init(host, port);
30 | }
31 | }
32 |
33 | public synchronized void init(String host, String port) {
34 | if(configuration == null) {
35 | configuration = HBaseConfiguration.create();
36 | configuration.set("hbase.zookeeper.quorum", host);
37 | configuration.set("hbase.zookeeper.property.clientPort", port);
38 | // configuration.set("zookeeper.znode.parent", "/hbase");
39 | try {
40 | connection = ConnectionFactory.createConnection(configuration);
41 | admin = connection.getAdmin();
42 | } catch (IOException e) {
43 | logger.error("Connect to hbase fail.", e);
44 | }
45 | }
46 |
47 | }
48 |
49 | @PreDestroy
50 | public void close() {
51 | try {
52 | if (null != admin) admin.close();
53 | if (null != connection) connection.close();
54 | } catch (IOException e) {
55 | logger.error("Can't close hbase client.", e);
56 | }
57 | }
58 |
59 | public Configuration getConfiguration() {
60 | return configuration;
61 | }
62 |
63 | public Connection getConnection() {
64 | return connection;
65 | }
66 |
67 | public Admin getAdmin() {
68 | return admin;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/rz-hbase/src/main/java/com/rick/scaffold/soa/hbase/HbaseResult.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.soa.hbase;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by user on 16/3/18.
7 | */
8 | public class HbaseResult implements Serializable {
9 |
10 | private static final long serialVersionUID = 1L;
11 |
12 | private String rowKey;
13 |
14 | private Long timestamp;
15 |
16 | private String colFamily;
17 |
18 | private String colName;
19 |
20 | private String value;
21 |
22 | public String getRowKey() {
23 | return rowKey;
24 | }
25 |
26 | public void setRowKey(String rowKey) {
27 | this.rowKey = rowKey;
28 | }
29 |
30 | public Long getTimestamp() {
31 | return timestamp;
32 | }
33 |
34 | public void setTimestamp(Long timestamp) {
35 | this.timestamp = timestamp;
36 | }
37 |
38 | public String getColFamily() {
39 | return colFamily;
40 | }
41 |
42 | public void setColFamily(String colFamily) {
43 | this.colFamily = colFamily;
44 | }
45 |
46 | public String getColName() {
47 | return colName;
48 | }
49 |
50 | public void setColName(String colName) {
51 | this.colName = colName;
52 | }
53 |
54 | public String getValue() {
55 | return value;
56 | }
57 |
58 | public void setValue(String value) {
59 | this.value = value;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/rz-hbase/src/main/java/com/rick/scaffold/soa/hbase/service/GoodsHbase.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.soa.hbase.service;
2 |
3 | import com.rick.scaffold.soa.hbase.HbaseResult;
4 |
5 | import java.io.IOException;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by user on 16/3/18.
10 | */
11 | public interface GoodsHbase {
12 |
13 | void createTable();
14 |
15 | void deleteTable();
16 |
17 | void insertDescription(String rowkey, String val);
18 |
19 | List getDescription(String rowkey);
20 |
21 | List scanData(String startRow, String stopRow);
22 |
23 | void delDescription(String rowkey) throws IOException;
24 | }
25 |
--------------------------------------------------------------------------------
/rz-hbase/src/main/resources/config/spring/spring-hbase-soa.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/rz-hbase/src/main/resources/config/spring/spring-hbase.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/rz-hbase/src/main/resources/log4j.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/rz-hbase/src/test/java/com/rick/scaffold/base/BaseTest.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.base;
2 |
3 | import org.junit.runner.RunWith;
4 | import org.springframework.test.context.ContextConfiguration;
5 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
6 |
7 |
8 | @RunWith(SpringJUnit4ClassRunner.class)
9 | @ContextConfiguration(locations = "classpath:test-spring-hbase.xml")
10 | public abstract class BaseTest {
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/rz-hbase/src/test/java/com/rick/scaffold/hbase/TestHbase.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.hbase;
2 |
3 | import com.rick.scaffold.base.BaseTest;
4 | import com.rick.scaffold.hbase.utils.HbaseClient;
5 | import com.rick.scaffold.soa.hbase.HbaseResult;
6 | import com.rick.scaffold.soa.hbase.service.GoodsHbase;
7 | import org.apache.hadoop.hbase.TableName;
8 | import org.junit.Test;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * Created by user on 16/3/18.
15 | */
16 | public class TestHbase extends BaseTest {
17 |
18 | @Autowired
19 | private HbaseClient client;
20 |
21 | @Autowired
22 | private GoodsHbase gh;
23 |
24 | @Test
25 | public void testConnection() throws Exception {
26 | System.out.println(client.getAdmin().getMasterInfoPort());
27 | }
28 |
29 | @Test
30 | public void testCreateTable() throws Exception {
31 | gh.createTable();
32 | TableName tableName = TableName.valueOf(HbaseConstants.DBNAME);
33 | System.out.println(client.getAdmin().tableExists(tableName));
34 | }
35 |
36 | @Test
37 | public void testDeleteTable() throws Exception {
38 | gh.deleteTable();
39 | TableName tableName = TableName.valueOf(HbaseConstants.DBNAME);
40 | System.out.println(client.getAdmin().tableExists(tableName));
41 | }
42 |
43 | @Test
44 | public void testInsertGoodsDescription() throws Exception {
45 | gh.insertDescription("1-4", "Rick帅的一比");
46 | }
47 |
48 | @Test
49 | public void testGetData() throws Exception {
50 | List hrs = gh.getDescription("1-4");
51 | for(HbaseResult hr: hrs) {
52 | System.out.println(hr.getValue());
53 | }
54 | System.out.println(hrs.size());
55 | }
56 |
57 | @Test
58 | public void testScanData() throws Exception {
59 | List hrs = gh.scanData("1-4", "1-5");
60 | for(HbaseResult hr: hrs) {
61 | System.out.println(hr.getValue());
62 | }
63 | System.out.println(hrs.size());
64 | }
65 |
66 | @Test
67 | public void testDeleteRow() throws Exception {
68 | gh.delDescription("1-4");
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/rz-hbase/src/test/resources/test-spring-hbase.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/rz-search/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 |
--------------------------------------------------------------------------------
/rz-search/maven-eclipse.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/rz-search/src/main/java/com/rick/scaffold/search/SearchConstants.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.search;
2 |
3 | public interface SearchConstants {
4 |
5 | String INDICE = "scaffold";
6 | String KEYWORD = "keyword";
7 | }
8 |
--------------------------------------------------------------------------------
/rz-search/src/main/java/com/rick/scaffold/search/services/RZEntry.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.search.services;
2 |
3 | public class RZEntry {
4 |
5 | private String name;
6 | private int count;
7 |
8 | public String getName() {
9 | return name;
10 | }
11 |
12 | public void setName(String name) {
13 | this.name = name;
14 | }
15 |
16 | public int getCount() {
17 | return count;
18 | }
19 |
20 | public void setCount(int count) {
21 | this.count = count;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/rz-search/src/main/java/com/rick/scaffold/search/services/RZFacet.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.search.services;
2 |
3 | import java.util.List;
4 |
5 | public class RZFacet {
6 |
7 | private String name;
8 | private List entries;
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | public void setName(String name) {
15 | this.name = name;
16 | }
17 |
18 | public List getEntries() {
19 | return entries;
20 | }
21 |
22 | public void setEntries(List entries) {
23 | this.entries = entries;
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/rz-search/src/main/java/com/rick/scaffold/search/services/RZGetResponse.java:
--------------------------------------------------------------------------------
1 | package com.rick.scaffold.search.services;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | import com.rick.scaffold.common.jsontool.JsonMapper;
7 | import org.elasticsearch.action.get.GetResponse;
8 | import org.elasticsearch.index.get.GetField;
9 |
10 | public class RZGetResponse {
11 |
12 | private GetResponse response;
13 |
14 | public RZGetResponse(GetResponse r) {
15 | response = r;
16 | }
17 |
18 | public String getResponseAsString() {
19 | return JsonMapper.toJsonString(this.getFields());
20 | }
21 |
22 | public Map getFields() {
23 | return response.getSource();
24 | }
25 |
26 | public List