parent
126887e651
commit
2e6f528a79
@ -0,0 +1,6 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding//src/test/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
@ -1,5 +1,5 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.tamguo;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||
|
||||
@SpringBootApplication
|
||||
@ComponentScan("com.tamguo")
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new SpringApplicationBuilder(Application.class).run(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* FastJson替代Jackson
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public HttpMessageConverters fastJsonHttpMessageConverters() {
|
||||
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
|
||||
FastJsonConfig fastJsonConfig = new FastJsonConfig();
|
||||
fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);
|
||||
fastConverter.setFastJsonConfig(fastJsonConfig);
|
||||
FastJsonHttpMessageConverter converter = fastConverter;
|
||||
return new HttpMessageConverters(converter);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.tamguo.config.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 注入公共字段自动填充,任选注入方式即可
|
||||
*/
|
||||
//@Component
|
||||
public class MyMetaObjectHandler extends MetaObjectHandler {
|
||||
|
||||
protected final static Logger logger = LoggerFactory.getLogger(MyMetaObjectHandler.class);
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.tamguo.config.web;
|
||||
|
||||
import org.springframework.boot.web.server.ErrorPage;
|
||||
import org.springframework.boot.web.server.ErrorPageRegistrar;
|
||||
import org.springframework.boot.web.server.ErrorPageRegistry;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ErrorConfigurar implements ErrorPageRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerErrorPages(ErrorPageRegistry registry) {
|
||||
ErrorPage[] errorPages=new ErrorPage[2];
|
||||
errorPages[0]=new ErrorPage(HttpStatus.NOT_FOUND,"/error404");
|
||||
errorPages[1]=new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/error500");
|
||||
|
||||
registry.addErrorPages(errorPages);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.tamguo.config.web;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
|
||||
|
||||
import com.tamguo.common.utils.SystemConstant;
|
||||
|
||||
@Component
|
||||
public class ThymeleafConfig implements EnvironmentAware{
|
||||
|
||||
@Resource
|
||||
private Environment env;
|
||||
|
||||
@Resource
|
||||
private void configureThymeleafStaticVars(ThymeleafViewResolver viewResolver) {
|
||||
if(viewResolver != null) {
|
||||
Map<String, Object> vars = new HashMap<>();
|
||||
vars.put("domainName", env.getProperty("domain.name"));
|
||||
vars.put("adminDomain", env.getProperty("admin.domain.name"));
|
||||
vars.put("PAPER_TYPE_ZHENTI", SystemConstant.ZHENGTI_PAPER_ID);
|
||||
vars.put("PAPER_TYPE_MONI", SystemConstant.MONI_PAPER_ID);
|
||||
vars.put("PAPER_TYPE_YATI", SystemConstant.YATI_PAPER_ID);
|
||||
vars.put("PAPER_TYPE_MINGXIAO", SystemConstant.MINGXIAO_PAPER_ID);
|
||||
vars.put("BEIJING_AREA_ID", SystemConstant.BEIJING_AREA_ID);
|
||||
viewResolver.setStaticVariables(vars);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Environment environment) {
|
||||
env = environment;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.tamguo.config.web;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
@Value("${file.storage.path}")
|
||||
private String fileStoragePath;
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/files/**").addResourceLocations("file:"+fileStoragePath);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
domain.name=http://localhost:8083/
|
||||
admin.domain.name=http://localhost:8083/
|
||||
server.port=8083
|
||||
jasypt.encryptor.password=tamguo
|
||||
|
||||
spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.filters=stat,wall,log4j
|
||||
spring.datasource.initialSize=5
|
||||
spring.datasource.maxActive=20
|
||||
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
|
||||
spring.datasource.maxWait=60000
|
||||
spring.datasource.minEvictableIdleTimeMillis=300000
|
||||
spring.datasource.minIdle=5
|
||||
spring.datasource.password=123456
|
||||
spring.datasource.poolPreparedStatements=true
|
||||
spring.datasource.testOnBorrow=false
|
||||
spring.datasource.testOnReturn=false
|
||||
spring.datasource.testWhileIdle=true
|
||||
spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tamguo_20181110?useUnicode=true&characterEncoding=UTF-8&useSSL=false
|
||||
spring.datasource.username=root
|
||||
spring.datasource.validationQuery=SELECT 1 FROM DUAL
|
||||
|
||||
mybatis-plus.mapper-locations=classpath:/mappers/*Mapper.xml
|
||||
mybatis-plus.typeAliasesPackage=com.tamguo.modules.*.model
|
||||
mybatis-plus.typeEnumsPackage=com.tamguo.modules.*.model.enums
|
||||
mybatis-plus.global-config.id-type=5
|
||||
mybatis-plus.global-config.field-strategy=2
|
||||
mybatis-plus.global-config.db-column-underline=true
|
||||
mybatis-plus.global-config.refresh-mapper=true
|
||||
mybatis-plus.global-config.key-generator=com.baomidou.mybatisplus.incrementer.H2KeyGenerator
|
||||
mybatis-plus.global-config.logic-delete-value=0
|
||||
mybatis-plus.global-config.logic-not-delete-value=1
|
||||
mybatis-plus.global-config.sql-injector=com.baomidou.mybatisplus.mapper.LogicSqlInjector
|
||||
mybatis-plus.global-config.meta-object-handler=com.tamguo.config.dao.MyMetaObjectHandler
|
||||
mybatis-plus.global-config.sql-parser-cache=true
|
||||
mybatis-plus.configuration.map-underscore-to-camel-case=true
|
||||
mybatis-plus.configuration.cache-enabled=false
|
||||
|
||||
spring.thymeleaf.prefix=classpath:/templates/
|
||||
spring.thymeleaf.suffix=.html
|
||||
spring.thymeleaf.mode=LEGACYHTML5
|
||||
spring.thymeleaf.encoding=UTF-8
|
||||
spring.thymeleaf.content-type=text/html
|
||||
spring.thymeleaf.cache=false
|
||||
|
||||
redis.hostname=127.0.0.1
|
||||
redis.port=6379
|
||||
redis.password=
|
||||
|
||||
logging.level.root=INFO
|
||||
logging.level.org.springframework.web=INFO
|
||||
logging.file=/home/webdata/log/tamguo.log
|
||||
logging.pattern.console=%d{yyyy/MM/dd-HH:mm:ss} [%thread] %-5level %logger- %msg%n
|
||||
logging.pattern.file=%d{yyyy/MM/dd-HH:mm} [%thread] %-5level %logger- %msg%n
|
||||
|
||||
server.compression.enabled=true
|
||||
server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain
|
||||
|
||||
file.storage.path=/home/webdata/files/
|
@ -0,0 +1,11 @@
|
||||
<ehcache updateCheck="false" name="shiroCache">
|
||||
<defaultCache
|
||||
maxElementsInMemory="10000"
|
||||
eternal="false"
|
||||
timeToIdleSeconds="120"
|
||||
timeToLiveSeconds="120"
|
||||
overflowToDisk="false"
|
||||
diskPersistent="false"
|
||||
diskExpiryThreadIntervalSeconds="120"
|
||||
/>
|
||||
</ehcache>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<redis>
|
||||
<preKey value="TAMGUO:" />
|
||||
<pool maxActive="50" maxIdle="20" maxWait="1000" />
|
||||
<servers>
|
||||
<!-- test -->
|
||||
<server ip="127.0.0.1" port="6379"/>
|
||||
</servers>
|
||||
</redis>
|
@ -0,0 +1,8 @@
|
||||
package com.tamguo.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.tamguo.modules.book.model.BookCategoryEntity;
|
||||
|
||||
public interface BookCategoryMapper extends BaseMapper<BookCategoryEntity>{
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.tamguo.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.tamguo.modules.book.model.BookEntity;
|
||||
|
||||
public interface BookMapper extends BaseMapper<BookEntity> {
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.tamguo.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.tamguo.modules.book.model.DocumentEntity;
|
||||
|
||||
public interface DocumentMapper extends BaseMapper<DocumentEntity>{
|
||||
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package com.tamguo.modules.book.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
|
||||
@TableName(value="b_book_category")
|
||||
public class BookCategoryEntity {
|
||||
|
||||
@TableId
|
||||
private String id;
|
||||
private String parentCode;
|
||||
private String parentCodes;
|
||||
private String treeSort;
|
||||
private String treeSorts;
|
||||
private String treeLeaf;
|
||||
private String treeLevel;
|
||||
private String treeNames;
|
||||
private String name;
|
||||
private String seoTitle;
|
||||
private String seoKeywords;
|
||||
private String seoDescription;
|
||||
private Date createDate;
|
||||
private Date updateDate;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getParentCode() {
|
||||
return parentCode;
|
||||
}
|
||||
public void setParentCode(String parentCode) {
|
||||
this.parentCode = parentCode;
|
||||
}
|
||||
public String getParentCodes() {
|
||||
return parentCodes;
|
||||
}
|
||||
public void setParentCodes(String parentCodes) {
|
||||
this.parentCodes = parentCodes;
|
||||
}
|
||||
public String getTreeSort() {
|
||||
return treeSort;
|
||||
}
|
||||
public void setTreeSort(String treeSort) {
|
||||
this.treeSort = treeSort;
|
||||
}
|
||||
public String getTreeSorts() {
|
||||
return treeSorts;
|
||||
}
|
||||
public void setTreeSorts(String treeSorts) {
|
||||
this.treeSorts = treeSorts;
|
||||
}
|
||||
public String getTreeLeaf() {
|
||||
return treeLeaf;
|
||||
}
|
||||
public void setTreeLeaf(String treeLeaf) {
|
||||
this.treeLeaf = treeLeaf;
|
||||
}
|
||||
public String getTreeLevel() {
|
||||
return treeLevel;
|
||||
}
|
||||
public void setTreeLevel(String treeLevel) {
|
||||
this.treeLevel = treeLevel;
|
||||
}
|
||||
public String getTreeNames() {
|
||||
return treeNames;
|
||||
}
|
||||
public void setTreeNames(String treeNames) {
|
||||
this.treeNames = treeNames;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getSeoTitle() {
|
||||
return seoTitle;
|
||||
}
|
||||
public void setSeoTitle(String seoTitle) {
|
||||
this.seoTitle = seoTitle;
|
||||
}
|
||||
public String getSeoKeywords() {
|
||||
return seoKeywords;
|
||||
}
|
||||
public void setSeoKeywords(String seoKeywords) {
|
||||
this.seoKeywords = seoKeywords;
|
||||
}
|
||||
public String getSeoDescription() {
|
||||
return seoDescription;
|
||||
}
|
||||
public void setSeoDescription(String seoDescription) {
|
||||
this.seoDescription = seoDescription;
|
||||
}
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.tamguo.modules.book.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
|
||||
@TableName(value="b_book")
|
||||
public class BookEntity {
|
||||
|
||||
@TableId
|
||||
private String id;
|
||||
private String categoryId;
|
||||
private String bookImage;
|
||||
private String owner;
|
||||
private String name;
|
||||
private String seoTitle;
|
||||
private String seoKeywords;
|
||||
private String seoDescription;
|
||||
private Date createDate;
|
||||
private Date updateDate;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getCategoryId() {
|
||||
return categoryId;
|
||||
}
|
||||
public void setCategoryId(String categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
public void setOwner(String owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getSeoTitle() {
|
||||
return seoTitle;
|
||||
}
|
||||
public void setSeoTitle(String seoTitle) {
|
||||
this.seoTitle = seoTitle;
|
||||
}
|
||||
public String getSeoKeywords() {
|
||||
return seoKeywords;
|
||||
}
|
||||
public void setSeoKeywords(String seoKeywords) {
|
||||
this.seoKeywords = seoKeywords;
|
||||
}
|
||||
public String getSeoDescription() {
|
||||
return seoDescription;
|
||||
}
|
||||
public void setSeoDescription(String seoDescription) {
|
||||
this.seoDescription = seoDescription;
|
||||
}
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
public String getBookImage() {
|
||||
return bookImage;
|
||||
}
|
||||
public void setBookImage(String bookImage) {
|
||||
this.bookImage = bookImage;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.tamguo.modules.book.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
|
||||
@TableName(value="b_document")
|
||||
public class DocumentEntity {
|
||||
|
||||
@TableId
|
||||
private String id;
|
||||
private String bookId;
|
||||
private String owner;
|
||||
private String name;
|
||||
private String status;
|
||||
private Date createDate;
|
||||
private Date updateDate;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
public void setBookId(String bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
public void setOwner(String owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.tamguo.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.service.IService;
|
||||
import com.tamguo.modules.book.model.BookEntity;
|
||||
|
||||
public interface BookService extends IService<BookEntity>{
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.tamguo.modules.book.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
||||
import com.tamguo.modules.book.dao.BookMapper;
|
||||
import com.tamguo.modules.book.model.BookEntity;
|
||||
import com.tamguo.modules.book.service.BookService;
|
||||
|
||||
@Service(value="bbookServiceImpl")
|
||||
public class BookServiceImpl extends ServiceImpl<BookMapper, BookEntity> implements BookService{
|
||||
|
||||
}
|
Loading…
Reference in new issue