集成mybatis和改造maven

dev
IT-xiaoXiong 2021-12-16 13:02:39 +08:00
parent d4176b69c4
commit 2461fb044c
6 changed files with 87 additions and 1 deletions

2
.gitignore vendored
View File

@ -18,7 +18,7 @@ log
classbeanLib/*
weaverLib/*
/web/**/*.properties
/web/**/*.xml
!/web/**/*.xml
/target
/classbean
.idea/

View File

@ -0,0 +1,15 @@
package mybatisTest.dao;
import mybatisTest.entity.License;
import java.util.Map;
/**
* @author EBU7-dev1-ayh
* create 2021/12/14 0014 13:20
*/
public interface ITestDAO {
License selectOne();
}

View File

@ -0,0 +1,16 @@
package mybatisTest.entity;
import lombok.Data;
/**
* @author EBU7-dev1-ayh
* create 2021/12/14 0014 16:31
*/
@Data
public class License {
private String license;
private String companyName;
private String cVersion;
private String expireDate;
}

19
web/WEB-INF/log4j.xml Normal file
View File

@ -0,0 +1,19 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration debug="false">
<!--Console appender -->
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %p %m%n"/>
</layout>
</appender>
<logger name="java.sql">
<level value="debug" />
</logger>
<logger name="org.apache.ibatis">
<level value="info" />
</logger>
<root>
<level value="DEBUG"/>
<appender-ref ref="stdout"/>
</root>
</log4j:configuration>

View File

@ -0,0 +1,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="mybatisTest.dao.ITestDAO">
<select id="selectOne" resultType="License">
select companyname company_name,license,expiredate expire_date,CVERSION c_version from license;
</select>
</mapper>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<properties resource="WEB-INF/prop/weaver.properties" />
<settings>
<!-- 下换线转驼峰-->
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
<typeAliases>
<package name="mybatisTest.entity"/>
</typeAliases>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<dataSource type="POOLED">
<property name="driver" value="${DriverClasses}" />
<property name="url" value="${ecology.url}" />
<property name="username" value="${ecology.user}" />
<property name="password" value="${ecology.password}" />
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="WEB-INF/mapper/test-mapper/ItestDAO.xml"/>
</mappers>
</configuration>