代码优化

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"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"> <classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="maven.pomderived" value="true"/> </attributes>
<attribute name="test" value="true"/> </classpathentry>
</attributes> <classpathentry kind="src" output="target/test-classes" path="src/test/java">
</classpathentry> <attributes>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <attribute name="test" value="true"/>
<attributes> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
</classpath> <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"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>kdayun-demo</name> <name>kdayun-demo</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name> <name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name> <name>org.eclipse.jdt.core.javabuilder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>com.genuitec.eclipse.springframework.springbuilder</name> <name>com.genuitec.eclipse.springframework.springbuilder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name> <name>org.eclipse.wst.validation.validationbuilder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name> <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name> <name>org.eclipse.m2e.core.maven2Builder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures> </natures>
</projectDescription> </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 cd /d %~dp0
set JAVA_HOME="D:\BS\Server\tomcat8\jdk" set JAVA_HOME="D:\BS\Server\tomcat8\jdk"
set mavenpath=H:\M\BS\maven\apache-maven-3.2.5\bin\mvn set mavenpath=H:\M\BS\maven\apache-maven-3.2.5\bin\mvn
call jar.bat call jar.bat
call jar-source.bat call jar-source.bat
call maveninstall.bat call maveninstall.bat

View File

@ -1,5 +1,5 @@
cd /d %~dp0 cd /d %~dp0
mvn source:jar -Dmaven.test.skip=true 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 mvn clean package -Dmaven.test.skip=true

View File

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

View File

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

View File

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

View File

@ -1,17 +1,17 @@
package com.kdayun.demo.service.impl; package com.kdayun.demo.service.impl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.kdayun.demo.service.DemoService; import com.kdayun.demo.service.DemoService;
@Service @Service
public class DemoServiceImpl implements DemoService { public class DemoServiceImpl implements DemoService {
@Override @Override
public String hello() { public String hello() {
return "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; package com.kdayun.report;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.junit.Test; import org.junit.Test;
/** /**
* *
* @package com.kdayun.demo * @package com.kdayun.demo
* @author qjb * @author qjb
* @email qjb@kdayun.com.cn * @email qjb@kdayun.com.cn
* @date 20193265:05:43 * @date 20193265:05:43
* @company () * @company ()
* @desc * @desc
*/ */
public class AppTest { public class AppTest {
/** /**
* Rigorous Test :-) * Rigorous Test :-)
*/ */
@Test @Test
public void shouldAnswerWithTrue() { public void shouldAnswerWithTrue() {
assertTrue(true); assertTrue(true);
} }
} }