框架拆分
This commit is contained in:
28
pom.xml
28
pom.xml
@@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>zyplayer-doc</name>
|
||||
@@ -17,32 +17,6 @@
|
||||
<fastjson.version>1.2.53</fastjson.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<modules>
|
||||
<module>zyplayer-doc-db</module>
|
||||
<module>zyplayer-doc-manage</module>
|
||||
|
||||
@@ -3,12 +3,8 @@
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<name>zyplayer-doc-core</name>
|
||||
@@ -18,9 +14,24 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<fastjson.version>1.2.53</fastjson.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -20,16 +20,10 @@
|
||||
<java.version>1.8</java.version>
|
||||
<mybatis.plus.boot.starter.version>3.0.6</mybatis.plus.boot.starter.version>
|
||||
<fastjson.version>1.2.53</fastjson.version>
|
||||
<zyplayer.doc.swagger.version>2.0.1</zyplayer.doc.swagger.version>
|
||||
<zyplayer.doc.core.version>1.0.0</zyplayer.doc.core.version>
|
||||
<velocity.engine.core.version>2.0</velocity.engine.core.version>
|
||||
<dozer.core.version>6.1.0</dozer.core.version>
|
||||
<alibaba.druid.version>1.1.9</alibaba.druid.version>
|
||||
<swagger.bootstrap.ui.version>1.8.9</swagger.bootstrap.ui.version>
|
||||
<springfox.swagger.ui.version>2.9.2</springfox.swagger.ui.version>
|
||||
<springfox.swagger.version>2.9.2</springfox.swagger.version>
|
||||
<zyplayer.doc.db.version>1.0.1</zyplayer.doc.db.version>
|
||||
<zyplayer.doc.dubbo.version>1.0.1</zyplayer.doc.dubbo.version>
|
||||
<zyplayer.doc.version>1.0.1</zyplayer.doc.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -80,7 +74,7 @@
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
<version>${zyplayer.doc.core.version}</version>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<!-- velocity 模板引擎, 默认 -->
|
||||
<dependency>
|
||||
@@ -100,13 +94,5 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-05
|
||||
*/
|
||||
public class AuthInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 权限名
|
||||
*/
|
||||
private String authName;
|
||||
|
||||
/**
|
||||
* 权限说明
|
||||
*/
|
||||
private String authDesc;
|
||||
|
||||
/**
|
||||
* 是否可编辑 0=否 1=是
|
||||
*/
|
||||
private Integer canEdit;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUid;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date creationTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getAuthName() {
|
||||
return authName;
|
||||
}
|
||||
|
||||
public void setAuthName(String authName) {
|
||||
this.authName = authName;
|
||||
}
|
||||
public String getAuthDesc() {
|
||||
return authDesc;
|
||||
}
|
||||
|
||||
public void setAuthDesc(String authDesc) {
|
||||
this.authDesc = authDesc;
|
||||
}
|
||||
public Integer getCanEdit() {
|
||||
return canEdit;
|
||||
}
|
||||
|
||||
public void setCanEdit(Integer canEdit) {
|
||||
this.canEdit = canEdit;
|
||||
}
|
||||
public Long getCreateUid() {
|
||||
return createUid;
|
||||
}
|
||||
|
||||
public void setCreateUid(Long createUid) {
|
||||
this.createUid = createUid;
|
||||
}
|
||||
public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthInfo{" +
|
||||
"id=" + id +
|
||||
", authName=" + authName +
|
||||
", authDesc=" + authDesc +
|
||||
", canEdit=" + canEdit +
|
||||
", createUid=" + createUid +
|
||||
", creationTime=" + creationTime +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-05
|
||||
*/
|
||||
public class UserAuth implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 权限ID
|
||||
*/
|
||||
private Long authId;
|
||||
|
||||
/**
|
||||
* 创建用户ID
|
||||
*/
|
||||
private Long createUid;
|
||||
|
||||
/**
|
||||
* 更新用户ID
|
||||
*/
|
||||
private Long updateUid;
|
||||
|
||||
/**
|
||||
* 是否删除 0=未删除 1=已删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date creationTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
public Long getAuthId() {
|
||||
return authId;
|
||||
}
|
||||
|
||||
public void setAuthId(Long authId) {
|
||||
this.authId = authId;
|
||||
}
|
||||
public Long getCreateUid() {
|
||||
return createUid;
|
||||
}
|
||||
|
||||
public void setCreateUid(Long createUid) {
|
||||
this.createUid = createUid;
|
||||
}
|
||||
public Long getUpdateUid() {
|
||||
return updateUid;
|
||||
}
|
||||
|
||||
public void setUpdateUid(Long updateUid) {
|
||||
this.updateUid = updateUid;
|
||||
}
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserAuth{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", authId=" + authId +
|
||||
", createUid=" + createUid +
|
||||
", updateUid=" + updateUid +
|
||||
", delFlag=" + delFlag +
|
||||
", creationTime=" + creationTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-05
|
||||
*/
|
||||
public class UserInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户编号,用于登录等
|
||||
*/
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 是否删除 0=未删除 1=已删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUid;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date creationTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getUserNo() {
|
||||
return userNo;
|
||||
}
|
||||
|
||||
public void setUserNo(String userNo) {
|
||||
this.userNo = userNo;
|
||||
}
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
public Long getCreateUid() {
|
||||
return createUid;
|
||||
}
|
||||
|
||||
public void setCreateUid(Long createUid) {
|
||||
this.createUid = createUid;
|
||||
}
|
||||
public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserInfo{" +
|
||||
"id=" + id +
|
||||
", userNo=" + userNo +
|
||||
", password=" + password +
|
||||
", userName=" + userName +
|
||||
", email=" + email +
|
||||
", avatar=" + avatar +
|
||||
", delFlag=" + delFlag +
|
||||
", createUid=" + createUid +
|
||||
", creationTime=" + creationTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-11-27
|
||||
*/
|
||||
public class ZyplayerStorage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String docKey;
|
||||
|
||||
private String docValue;
|
||||
|
||||
private Date creationTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDocKey() {
|
||||
return docKey;
|
||||
}
|
||||
|
||||
public void setDocKey(String docKey) {
|
||||
this.docKey = docKey;
|
||||
}
|
||||
|
||||
public String getDocValue() {
|
||||
return docValue;
|
||||
}
|
||||
|
||||
public void setDocValue(String docValue) {
|
||||
this.docValue = docValue;
|
||||
}
|
||||
|
||||
public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ZyplayerStorage{" + "id=" + id + ", docKey=" + docKey + ", docValue=" + docValue + ", creationTime=" + creationTime + "}";
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.AuthInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
*/
|
||||
public interface AuthInfoMapper extends BaseMapper<AuthInfo> {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserAuth;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
*/
|
||||
public interface UserAuthMapper extends BaseMapper<UserAuth> {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
*/
|
||||
public interface UserInfoMapper extends BaseMapper<UserInfo> {
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.ZyplayerStorage;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-11-27
|
||||
*/
|
||||
public interface ZyplayerStorageMapper extends BaseMapper<ZyplayerStorage> {
|
||||
|
||||
Integer selectTop();
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package com.zyplayer.doc.manage.repository.support.generator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.FileOutConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.PackageConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.TemplateConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DateType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
|
||||
|
||||
public class CodeGenerator {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
final String moduleName = "manage";
|
||||
final String[] tableName = { "zyplayer_storage", "auth_info", "user_auth", "user_info" };
|
||||
// final String[] tableName = { "zyplayer_storage" };
|
||||
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
final String projectPath = System.getProperty("user.dir");
|
||||
gc.setOutputDir(projectPath + "/src/main/java");
|
||||
gc.setAuthor("暮光:城中城");
|
||||
gc.setOpen(false);
|
||||
gc.setDateType(DateType.ONLY_DATE);
|
||||
gc.setServiceName("%sService");
|
||||
gc.setControllerName("Generator%sController");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl("jdbc:mysql://127.0.0.1:3306/zyplayer-doc-manage?useUnicode=true&useSSL=false&characterEncoding=utf8");
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName("com.mysql.jdbc.Driver");
|
||||
dsc.setUsername("root");
|
||||
dsc.setPassword("root");
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
final PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(null);
|
||||
pc.setParent("com.zyplayer.doc.manage");
|
||||
pc.setController("web.generator");
|
||||
pc.setEntity("repository.manage.entity");
|
||||
pc.setMapper("repository.manage.mapper");
|
||||
pc.setService("service.manage");
|
||||
pc.setServiceImpl("service.manage.impl");
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 自定义配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
// to do nothing
|
||||
}
|
||||
};
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig("/templates/mapper.xml.ftl") {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
return projectPath + "/src/main/resources/mapper/" + moduleName + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
|
||||
}
|
||||
});
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
mpg.setTemplate(new TemplateConfig().setXml(null));
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
// strategy.setSuperEntityClass("com.baomidou.ant.common.BaseEntity");
|
||||
strategy.setEntityLombokModel(false);
|
||||
strategy.setRestControllerStyle(true);
|
||||
// strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
|
||||
// strategy.setSuperEntityColumns("id");
|
||||
strategy.setInclude(tableName);// 表名
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
strategy.setTablePrefix(pc.getModuleName() + "_");
|
||||
mpg.setStrategy(strategy);
|
||||
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package com.zyplayer.doc.manage.repository.support.interceptor;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.ParameterMapping;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.apache.ibatis.plugin.Intercepts;
|
||||
import org.apache.ibatis.plugin.Invocation;
|
||||
import org.apache.ibatis.plugin.Plugin;
|
||||
import org.apache.ibatis.plugin.Signature;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.session.ResultHandler;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
import org.apache.ibatis.type.TypeHandlerRegistry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Intercepts({
|
||||
@Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }),
|
||||
@Signature(type = Executor.class, method = "query", args = { MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class })
|
||||
})
|
||||
public class SqlLogInterceptor implements Interceptor {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SqlLogInterceptor.class);
|
||||
|
||||
@Override
|
||||
public Object intercept(Invocation invocation) throws Throwable {
|
||||
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
|
||||
Object parameter = null;
|
||||
if (invocation.getArgs().length > 1) {
|
||||
parameter = invocation.getArgs()[1];
|
||||
}
|
||||
BoundSql boundSql = mappedStatement.getBoundSql(parameter);
|
||||
Configuration configuration = mappedStatement.getConfiguration();
|
||||
// 获取sql语句
|
||||
String sql = getSqlString(configuration, boundSql);
|
||||
LOGGER.info(sql);
|
||||
// 执行结果
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object plugin(Object target) {
|
||||
if (target instanceof Executor) {
|
||||
return Plugin.wrap(target, this);
|
||||
} else {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Properties properties) {
|
||||
}
|
||||
|
||||
private String getParameterValue(Object obj) {
|
||||
String value = null;
|
||||
if (obj instanceof String) {
|
||||
value = "'" + obj.toString() + "'";
|
||||
} else if (obj instanceof Date) {
|
||||
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.CHINA);
|
||||
value = "'" + formatter.format(obj) + "'";
|
||||
//System.out.println(value);
|
||||
} else {
|
||||
if (obj != null) {
|
||||
value = obj.toString();
|
||||
} else {
|
||||
value = "'null'";
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getSqlString(Configuration configuration, BoundSql boundSql) {
|
||||
Object parameterObject = boundSql.getParameterObject();
|
||||
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
|
||||
StringBuilder sqlSb = new StringBuilder(boundSql.getSql().replaceAll("[\\s]+", " "));
|
||||
int fromIndex = 0;
|
||||
if (parameterMappings.size() > 0 && parameterObject != null) {
|
||||
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
|
||||
if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(parameterObject));
|
||||
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(parameterObject));
|
||||
} else {
|
||||
MetaObject metaObject = configuration.newMetaObject(parameterObject);
|
||||
for (ParameterMapping parameterMapping : parameterMappings) {
|
||||
String propertyName = parameterMapping.getProperty();
|
||||
if (metaObject.hasGetter(propertyName)) {
|
||||
Object obj = metaObject.getValue(propertyName);
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(obj));
|
||||
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(obj));
|
||||
} else if (boundSql.hasAdditionalParameter(propertyName)) {
|
||||
Object obj = boundSql.getAdditionalParameter(propertyName);
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(obj));
|
||||
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlSb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换?占位符
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年10月27日
|
||||
* @param sql
|
||||
* @param fromIndex
|
||||
* @param replaceStr
|
||||
* @return
|
||||
*/
|
||||
private int replacePlaceholder(StringBuilder sql, int fromIndex, String replaceStr) {
|
||||
int index = sql.indexOf("?", fromIndex);
|
||||
if (index >= 0) {
|
||||
sql.replace(index, index + 1, replaceStr);
|
||||
}
|
||||
return index + replaceStr.length();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.zyplayer.doc.manage.service.manage;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.AuthInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
*/
|
||||
public interface AuthInfoService extends IService<AuthInfo> {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.zyplayer.doc.manage.service.manage;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserAuth;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
*/
|
||||
public interface UserAuthService extends IService<UserAuth> {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.zyplayer.doc.manage.service.manage;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
*/
|
||||
public interface UserInfoService extends IService<UserInfo> {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.zyplayer.doc.manage.service.manage;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.ZyplayerStorage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-11-27
|
||||
*/
|
||||
public interface ZyplayerStorageService extends IService<ZyplayerStorage> {
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.zyplayer.doc.manage.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.AuthInfo;
|
||||
import com.zyplayer.doc.manage.repository.manage.mapper.AuthInfoMapper;
|
||||
import com.zyplayer.doc.manage.service.manage.AuthInfoService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
*/
|
||||
@Service
|
||||
public class AuthInfoServiceImpl extends ServiceImpl<AuthInfoMapper, AuthInfo> implements AuthInfoService {
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.zyplayer.doc.manage.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserAuth;
|
||||
import com.zyplayer.doc.manage.repository.manage.mapper.UserAuthMapper;
|
||||
import com.zyplayer.doc.manage.service.manage.UserAuthService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
*/
|
||||
@Service
|
||||
public class UserAuthServiceImpl extends ServiceImpl<UserAuthMapper, UserAuth> implements UserAuthService {
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.zyplayer.doc.manage.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserInfo;
|
||||
import com.zyplayer.doc.manage.repository.manage.mapper.UserInfoMapper;
|
||||
import com.zyplayer.doc.manage.service.manage.UserInfoService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
*/
|
||||
@Service
|
||||
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService {
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.zyplayer.doc.manage.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.ZyplayerStorage;
|
||||
import com.zyplayer.doc.manage.repository.manage.mapper.ZyplayerStorageMapper;
|
||||
import com.zyplayer.doc.manage.service.manage.ZyplayerStorageService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-11-27
|
||||
*/
|
||||
@Service
|
||||
public class ZyplayerStorageServiceImpl extends ServiceImpl<ZyplayerStorageMapper, ZyplayerStorage> implements ZyplayerStorageService {
|
||||
|
||||
}
|
||||
@@ -55,13 +55,4 @@
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user