代码优化

master
gk 2022-02-24 15:04:37 +08:00
parent 723558ffdf
commit 7d778beb58
21 changed files with 1504 additions and 309 deletions

View File

@ -1,27 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1 +1 @@
/target/
/target/

View File

@ -1,45 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>kdayun-demo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.springframework.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>kdayun-demo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.springframework.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -1,8 +1,8 @@
cd /d %~dp0
set JAVA_HOME="D:\BS\Server\tomcat8\jdk"
set mavenpath=H:\M\BS\maven\apache-maven-3.2.5\bin\mvn
call jar.bat
call jar-source.bat
call maveninstall.bat
cd /d %~dp0
set JAVA_HOME="D:\BS\Server\tomcat8\jdk"
set mavenpath=H:\M\BS\maven\apache-maven-3.2.5\bin\mvn
call jar.bat
call jar-source.bat
call maveninstall.bat

View File

@ -1,5 +1,5 @@
cd /d %~dp0
mvn source:jar -Dmaven.test.skip=true
cd /d %~dp0
mvn source:jar -Dmaven.test.skip=true

View File

@ -1,3 +1,3 @@
cd /d %~dp0
cd /d %~dp0
mvn clean package -Dmaven.test.skip=true

View File

@ -1,6 +1,6 @@
cd /d %~dp0
set JAVA_HOME="D:\BS\Server\tomcat8\jdk"
set mavenpath=H:\M\BS\maven\apache-maven-3.2.5\bin\mvn
mvn deploy -Dmaven.test.skip=true
cd /d %~dp0
set JAVA_HOME="D:\BS\Server\tomcat8\jdk"
set mavenpath=H:\M\BS\maven\apache-maven-3.2.5\bin\mvn
mvn deploy -Dmaven.test.skip=true
pause

View File

@ -1 +1 @@
%mavenpath% install -Dmaven.test.skip=true
%mavenpath% install -Dmaven.test.skip=true

View File

@ -1,122 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>kdayun-root</artifactId>
<groupId>com.kdayun</groupId>
<version>5.0.0</version>
<relativePath>../..</relativePath>
</parent>
<version>1.0.1</version>
<artifactId>kdayun-demo</artifactId>
<name>kdayun-demo</name>
<!-- FIXME change it to the project's website -->
<url>http://www.kdayun.com</url>
<description>快搭科技(上海)有限公司-企业微信库</description>
<dependencies>
<dependency>
<groupId>com.kdayun</groupId>
<artifactId>kdayun-core</artifactId>
<version>${base.version}</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<repository>
<id>kdayun-releases</id>
<url>http://develop.kdayun.com:8081/repository/maven-local/</url>
</repository>
<snapshotRepository>
<id>kdayun-snapshots</id>
<url>http://develop.kdayun.com:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<!-- 生成源码包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-xmls</id>
<phase>process-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>jdk-${jdk.version}</id>
<!-- 另外一种激活方式 -->
<activation>
<activeByDefault>true</activeByDefault>
<jdk>${jdk.version}</jdk>
</activation>
<properties>
<maven.compiler.source>${jdk.version}</maven.compiler.source>
<maven.compiler.target>${jdk.version}</maven.compiler.target>
<maven.compiler.compilerVersion>${jdk.version}</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>kdayun-root</artifactId>
<groupId>com.kdayun</groupId>
<version>5.0.0</version>
<relativePath>../..</relativePath>
</parent>
<version>1.0.1</version>
<artifactId>kdayun-demo</artifactId>
<name>kdayun-demo</name>
<!-- FIXME change it to the project's website -->
<url>http://www.kdayun.com</url>
<description>快搭科技(上海)有限公司-企业微信库</description>
<dependencies>
<dependency>
<groupId>com.kdayun</groupId>
<artifactId>kdayun-core</artifactId>
<version>${base.version}</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<repository>
<id>kdayun-releases</id>
<url>http://develop.kdayun.com:8081/repository/maven-local/</url>
</repository>
<snapshotRepository>
<id>kdayun-snapshots</id>
<url>http://develop.kdayun.com:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<!-- 生成源码包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-xmls</id>
<phase>process-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>jdk-${jdk.version}</id>
<!-- 另外一种激活方式 -->
<activation>
<activeByDefault>true</activeByDefault>
<jdk>${jdk.version}</jdk>
</activation>
<properties>
<maven.compiler.source>${jdk.version}</maven.compiler.source>
<maven.compiler.target>${jdk.version}</maven.compiler.target>
<maven.compiler.compilerVersion>${jdk.version}</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
</project>

View File

@ -1,3 +1,3 @@
Manifest-Version: 1.0
Class-Path:
Manifest-Version: 1.0
Class-Path:

View File

@ -1,39 +1,37 @@
package com.kdayun.demo.controller;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.kdayun.demo.service.DemoService;
import com.kdayun.z1.core.base.BaseController;
import com.kdayun.z1.core.base.RetVo;
import com.kdayun.z1.core.base.RetVo.retstate;
/**
*
*
* @author gk
*
*/
@Controller
@RequestMapping("demo")
public class DemoController extends BaseController {
@Autowired
DemoService demoService;
/**
*
*/
@RequestMapping(value = "hello", method = RequestMethod.GET)
public RetVo upload(HttpServletRequest request, HttpServletResponse response) throws Exception {
return RetVo.getNewInstance(retstate.OK, "hello", null);
}
}
package com.kdayun.demo.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.kdayun.demo.service.DemoService;
import com.kdayun.z1.core.base.BaseController;
import com.kdayun.z1.core.base.RetVo;
import com.kdayun.z1.core.base.RetVo.retstate;
/**
* Contoller
*
* @author gk
*
*/
@Controller
@RequestMapping("demo")
public class DemoController extends BaseController {
@Autowired
DemoService demoService;
/**
*
*/
@RequestMapping(value = "hello", method = RequestMethod.GET)
public RetVo upload(HttpServletRequest request, HttpServletResponse response) throws Exception {
return RetVo.getNewInstance(retstate.OK, "hello", null);
}
}

View File

@ -0,0 +1,82 @@
package com.kdayun.demo.entity;
import java.math.BigDecimal;
import com.kdayun.z1.core.base.BaseEntity;
public class CoreRole extends BaseEntity{
/**
*
*/
private static final long serialVersionUID = 1L;
private String RWID;
private String OBJCODE;
private String OBJNAME;
private String DES;
private Integer VISIBILITY;
private Integer ROLELEV;
private BigDecimal SYS_SORT;
public String getRWID() {
return RWID;
}
public void setRWID(String RWID) {
this.RWID = RWID == null ? null : RWID.trim();
}
public String getOBJCODE() {
return OBJCODE;
}
public void setOBJCODE(String OBJCODE) {
this.OBJCODE = OBJCODE == null ? null : OBJCODE.trim();
}
public String getOBJNAME() {
return OBJNAME;
}
public void setOBJNAME(String OBJNAME) {
this.OBJNAME = OBJNAME == null ? null : OBJNAME.trim();
}
public String getDES() {
return DES;
}
public void setDES(String DES) {
this.DES = DES == null ? null : DES.trim();
}
public Integer getVISIBILITY() {
return VISIBILITY;
}
public void setVISIBILITY(Integer VISIBILITY) {
this.VISIBILITY = VISIBILITY;
}
public Integer getROLELEV() {
return ROLELEV;
}
public void setROLELEV(Integer ROLELEV) {
this.ROLELEV = ROLELEV;
}
public BigDecimal getSYS_SORT() {
return SYS_SORT;
}
public void setSYS_SORT(BigDecimal SYS_SORT) {
this.SYS_SORT = SYS_SORT;
}
}

View File

@ -0,0 +1,20 @@
package com.kdayun.demo.mapper;
import org.springframework.stereotype.Repository;
import com.kdayun.demo.entity.CoreRole;
@Repository
public interface CoreRoleMapper {
int deleteByPrimaryKey(String RWID);
int insert(CoreRole record);
int insertSelective(CoreRole record);
CoreRole selectByPrimaryKey(String RWID);
int updateByPrimaryKeySelective(CoreRole record);
int updateByPrimaryKey(CoreRole record);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
package com.kdayun.demo.service;
public interface DemoService {
/**
* 访AccessToken
*/
String hello();
}
package com.kdayun.demo.service;
public interface DemoService {
/**
* 访AccessToken
*/
String hello();
}

View File

@ -1,17 +1,17 @@
package com.kdayun.demo.service.impl;
import org.springframework.stereotype.Service;
import com.kdayun.demo.service.DemoService;
@Service
public class DemoServiceImpl implements DemoService {
@Override
public String hello() {
return "hello";
}
}
package com.kdayun.demo.service.impl;
import org.springframework.stereotype.Service;
import com.kdayun.demo.service.DemoService;
@Service
public class DemoServiceImpl implements DemoService {
@Override
public String hello() {
return "hello";
}
}

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="default" targetRuntime="MyBatis3">
<!--optional,旨在创建class时对注释进行控制-->
<commentGenerator>
<property name="suppressDate" value="true" />
<!-- 是否去除自动生成的注释 true false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!--jdbc的数据库连接-->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3706/dev?useSSL=false&amp;autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=Asia/Shanghai" userId="zl" password="zl123456zl">
</jdbcConnection>
<!--非必须类型处理器在数据库类型和java类型之间的转换控制-->
<javaTypeResolver>
<!-- 默认情况下数据库中的 decimalbigInt 在 Java 对应是 sql 下的 BigDecimal 类 -->
<!-- 不是 double 和 long 类型 -->
<!-- 使用常用的基本类型代替 sql 包下的引用类型 -->
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- targetPackage生成的实体类所在的包 -->
<!-- targetProject生成的实体类所在的硬盘位置 -->
<javaModelGenerator targetPackage="com.kdayun.demo.entity" targetProject="kdayun-demo">
<!-- 是否允许子包 -->
<property name="enableSubPackages" value="false" />
<!-- 是否对modal添加构造函数 -->
<property name="constructorBased" value="true" />
<!-- 是否清理从数据库中查询出的字符串左右两边的空白字符 -->
<property name="trimStrings" value="true" />
<!-- 建立modal对象是否不可改变 即生成的modal对象不会有setter方法只有构造方法 -->
<property name="immutable" value="false" />
</javaModelGenerator>
<!-- targetPackage 和 targetProject生成的 mapper 文件的包和位置 -->
<sqlMapGenerator targetPackage="com.kdayun.demo.mapper" targetProject="kdayun-demo">
<!-- 针对数据库的一个配置,是否把 schema 作为字包名 -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- targetPackage 和 targetProject生成的 interface 文件的包和位置 -->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.kdayun.demo.mapper" targetProject="kdayun-demo">
<!-- 针对 oracle 数据库的一个配置,是否把 schema 作为字包名 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!--这里配置需要生成代码的表 -->
<!--注意!注意!注意! 由于为了保证前后台的字段名一致性需要使用<property name="useActualColumnNames" value="true"/> 来保证生成实体与数据库一致.这里牺牲了java的实体的驼峰规范-->
<table tableName="core_role" domainObjectName="CoreRole" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">
<property name="useActualColumnNames" value="true"/>
</table>
</context>
</generatorConfiguration>

View File

@ -1,24 +1,24 @@
package com.kdayun.report;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
*
* @package com.kdayun.demo
* @author qjb
* @email qjb@kdayun.com.cn
* @date 20193265:05:43
* @company ()
* @desc
*/
public class AppTest {
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue() {
assertTrue(true);
}
}
package com.kdayun.report;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
*
* @package com.kdayun.demo
* @author qjb
* @email qjb@kdayun.com.cn
* @date 20193265:05:43
* @company ()
* @desc
*/
public class AppTest {
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue() {
assertTrue(true);
}
}