Commit 8d2963a6 by whl

mybatis逆向工程配置

parent db240044
...@@ -91,6 +91,14 @@ ...@@ -91,6 +91,14 @@
</dependency> </dependency>
<!--endregion--> <!--endregion-->
<!--region Oracle-->
<dependency>
<groupId>org.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>6.0</version>
</dependency>
<!--endregion-->
<!--region mssql--> <!--region mssql-->
<dependency> <dependency>
<groupId>com.microsoft.sqlserver</groupId> <groupId>com.microsoft.sqlserver</groupId>
......
package com.bsoft.api.mapper; package com.bsoft.api.mapper;
import com.bsoft.api.model.SysUser; import com.bsoft.api.model.SysUser;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
public interface SysUserMapper { public interface SysUserMapper {
int deleteByPrimaryKey(Integer id); /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LL.SYS_USER
*
* @mbg.generated Mon Oct 21 11:03:43 CST 2019
*/
int deleteByPrimaryKey(BigDecimal id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LL.SYS_USER
*
* @mbg.generated Mon Oct 21 11:03:43 CST 2019
*/
int insert(SysUser record); int insert(SysUser record);
SysUser selectByPrimaryKey(Integer id); /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LL.SYS_USER
*
* @mbg.generated Mon Oct 21 11:03:43 CST 2019
*/
SysUser selectByPrimaryKey(BigDecimal id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LL.SYS_USER
*
* @mbg.generated Mon Oct 21 11:03:43 CST 2019
*/
List<SysUser> selectAll(); List<SysUser> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LL.SYS_USER
*
* @mbg.generated Mon Oct 21 11:03:43 CST 2019
*/
int updateByPrimaryKey(SysUser record); int updateByPrimaryKey(SysUser record);
SysUser selectByCode(String code);
} }
\ No newline at end of file
...@@ -2,62 +2,84 @@ ...@@ -2,62 +2,84 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsoft.api.mapper.SysUserMapper"> <mapper namespace="com.bsoft.api.mapper.SysUserMapper">
<resultMap id="BaseResultMap" type="com.bsoft.api.model.SysUser"> <resultMap id="BaseResultMap" type="com.bsoft.api.model.SysUser">
<id column="ID" jdbcType="INTEGER" property="id" /> <!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Oct 21 11:03:43 CST 2019.
-->
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" /> <result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="INTEGER" property="createUserid" /> <result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="INTEGER" property="state" /> <result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="USER_CODE" jdbcType="VARCHAR" property="userCode" /> <result column="USER_CODE" jdbcType="OTHER" property="userCode" />
<result column="USER_NAME" jdbcType="VARCHAR" property="userName" /> <result column="USER_NAME" jdbcType="OTHER" property="userName" />
<result column="PASSWORD" jdbcType="VARCHAR" property="password" /> <result column="PASSWORD" jdbcType="OTHER" property="password" />
<result column="IDCARD" jdbcType="VARCHAR" property="idcard" /> <result column="IDCARD" jdbcType="OTHER" property="idcard" />
<result column="SEX" jdbcType="VARCHAR" property="sex" /> <result column="SEX" jdbcType="OTHER" property="sex" />
<result column="MOBILE" jdbcType="VARCHAR" property="mobile" /> <result column="MOBILE" jdbcType="OTHER" property="mobile" />
</resultMap> </resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
delete from sys_user <!--
where ID = #{id,jdbcType=INTEGER} WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Oct 21 11:03:43 CST 2019.
-->
delete from LL.SYS_USER
where ID = #{id,jdbcType=DECIMAL}
</delete> </delete>
<insert id="insert" parameterType="com.bsoft.api.model.SysUser"> <insert id="insert" parameterType="com.bsoft.api.model.SysUser">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <!--
SELECT LAST_INSERT_ID() WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Oct 21 11:03:43 CST 2019.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.math.BigDecimal">
select SEQ_SYS_USER_ID.nextval from dual
</selectKey> </selectKey>
insert into sys_user (CREATE_DATE, CREATE_USERID, STATE, insert into LL.SYS_USER (CREATE_DATE, CREATE_USERID, STATE,
USER_CODE, USER_NAME, PASSWORD, USER_CODE, USER_NAME, PASSWORD,
IDCARD, SEX, MOBILE IDCARD, SEX, MOBILE)
) values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=INTEGER}, #{state,jdbcType=INTEGER}, #{userCode,jdbcType=OTHER}, #{userName,jdbcType=OTHER}, #{password,jdbcType=OTHER},
#{userCode,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{idcard,jdbcType=OTHER}, #{sex,jdbcType=OTHER}, #{mobile,jdbcType=OTHER})
#{idcard,jdbcType=VARCHAR}, #{sex,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}
)
</insert> </insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SysUser"> <update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SysUser">
update sys_user <!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Oct 21 11:03:43 CST 2019.
-->
update LL.SYS_USER
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP}, set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
CREATE_USERID = #{createUserid,jdbcType=INTEGER}, CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
STATE = #{state,jdbcType=INTEGER}, STATE = #{state,jdbcType=DECIMAL},
USER_CODE = #{userCode,jdbcType=VARCHAR}, USER_CODE = #{userCode,jdbcType=OTHER},
USER_NAME = #{userName,jdbcType=VARCHAR}, USER_NAME = #{userName,jdbcType=OTHER},
PASSWORD = #{password,jdbcType=VARCHAR}, PASSWORD = #{password,jdbcType=OTHER},
IDCARD = #{idcard,jdbcType=VARCHAR}, IDCARD = #{idcard,jdbcType=OTHER},
SEX = #{sex,jdbcType=VARCHAR}, SEX = #{sex,jdbcType=OTHER},
MOBILE = #{mobile,jdbcType=VARCHAR} MOBILE = #{mobile,jdbcType=OTHER}
where ID = #{id,jdbcType=INTEGER} where ID = #{id,jdbcType=DECIMAL}
</update> </update>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Oct 21 11:03:43 CST 2019.
-->
select ID, CREATE_DATE, CREATE_USERID, STATE, USER_CODE, USER_NAME, PASSWORD, IDCARD, select ID, CREATE_DATE, CREATE_USERID, STATE, USER_CODE, USER_NAME, PASSWORD, IDCARD,
SEX, MOBILE SEX, MOBILE
from sys_user from LL.SYS_USER
where ID = #{id,jdbcType=INTEGER} where ID = #{id,jdbcType=DECIMAL}
</select> </select>
<select id="selectAll" resultMap="BaseResultMap"> <select id="selectAll" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Oct 21 11:03:43 CST 2019.
-->
select ID, CREATE_DATE, CREATE_USERID, STATE, USER_CODE, USER_NAME, PASSWORD, IDCARD, select ID, CREATE_DATE, CREATE_USERID, STATE, USER_CODE, USER_NAME, PASSWORD, IDCARD,
SEX, MOBILE SEX, MOBILE
from sys_user from LL.SYS_USER
</select>
<select id="selectByCode" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, USER_CODE, USER_NAME, PASSWORD, IDCARD,
SEX, MOBILE
from sys_user
where USER_CODE=#{code,jdbcType=VARCHAR}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<!-- 引入配置文件 --> <!-- 引入配置文件 -->
<properties resource="./application-dev.properties"/> <properties resource="./application-dev.properties"/>
<context id="Mysql" targetRuntime="MyBatis3Simple" defaultModelType="flat"> <context id="Oracle" targetRuntime="MyBatis3Simple" defaultModelType="flat">
<property name="beginningDelimiter" value="`"/> <property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/> <property name="endingDelimiter" value="`"/>
<!-- 生成的文件编码 --> <!-- 生成的文件编码 -->
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
<!--<property enName="mappers" value="com.suvalue.demo.mapper.BaseMapper"/>--> <!--<property enName="mappers" value="com.suvalue.demo.mapper.BaseMapper"/>-->
<!--</plugin>--> <!--</plugin>-->
<commentGenerator> <commentGenerator>
<property name="suppressAllComments" value="true"/> <property name="suppressAllComments" value="false"/>
<!-- 数据库注释支持 -->
<!-- <property name="addRemarkComments" value="true"/>-->
</commentGenerator> </commentGenerator>
<!-- 数据库连接属性 --> <!-- 数据库连接属性 -->
<jdbcConnection driverClass="${spring.datasource.driver-class-name}" <jdbcConnection driverClass="${spring.datasource.driver-class-name}"
...@@ -24,9 +26,9 @@ ...@@ -24,9 +26,9 @@
userId="${spring.datasource.username}" userId="${spring.datasource.username}"
password="${spring.datasource.password}"> password="${spring.datasource.password}">
<!-- 针对oracle数据库 获取字段注释 --> <!-- 针对oracle数据库 获取字段注释 -->
<!--<property enName="remarksReporting" value="true"></property>--> <property name="remarksReporting" value="true"></property>
<!-- 针对mysql数据库 获取字段注释 --> <!-- 针对mysql数据库 获取字段注释 -->
<property name="useInformationSchema" value="true"></property> <!-- <property name="useInformationSchema" value="true"></property>-->
</jdbcConnection> </jdbcConnection>
<!-- 生成实体类配置 --> <!-- 生成实体类配置 -->
<javaModelGenerator targetPackage="com.bsoft.api.model" targetProject="src/main/java"/> <javaModelGenerator targetPackage="com.bsoft.api.model" targetProject="src/main/java"/>
...@@ -35,8 +37,9 @@ ...@@ -35,8 +37,9 @@
<!-- 生成映射接口配置 --> <!-- 生成映射接口配置 -->
<javaClientGenerator targetPackage="com.bsoft.api.mapper" targetProject="src/main/java" type="XMLMAPPER"/> <javaClientGenerator targetPackage="com.bsoft.api.mapper" targetProject="src/main/java" type="XMLMAPPER"/>
<table tableName="sys_user"> <table tableName="sys_user" schema="ll" >
<generatedKey column="id" sqlStatement="Mysql" identity="true"/> <!-- 主键生成方式 -->
<generatedKey column="id" sqlStatement="select SEQ_SYS_USER_ID.nextval from dual" identity="true" />
</table> </table>
</context> </context>
<!--<context id="sqlserver" targetRuntime="MyBatis3Simple" defaultModelType="flat">--> <!--<context id="sqlserver" targetRuntime="MyBatis3Simple" defaultModelType="flat">-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment