Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv-springboot
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bsoft
sv-springboot
Commits
8d2963a6
Commit
8d2963a6
authored
Oct 21, 2019
by
whl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mybatis逆向工程配置
parent
db240044
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
52 deletions
+114
-52
bsoft-api/pom.xml
+8
-0
bsoft-api/src/main/java/com/bsoft/api/mapper/SysUserMapper.java
+33
-5
bsoft-api/src/main/java/com/bsoft/api/model/SysUser.java
+0
-0
bsoft-api/src/main/resources/mapper/SysUserMapper.xml
+64
-41
bsoft-api/src/test/resources/generatorConfig.xml
+9
-6
No files found.
bsoft-api/pom.xml
View file @
8d2963a6
...
...
@@ -91,6 +91,14 @@
</dependency>
<!--endregion-->
<!--region Oracle-->
<dependency>
<groupId>
org.oracle
</groupId>
<artifactId>
ojdbc6
</artifactId>
<version>
6.0
</version>
</dependency>
<!--endregion-->
<!--region mssql-->
<dependency>
<groupId>
com.microsoft.sqlserver
</groupId>
...
...
bsoft-api/src/main/java/com/bsoft/api/mapper/SysUserMapper.java
View file @
8d2963a6
package
com
.
bsoft
.
api
.
mapper
;
import
com.bsoft.api.model.SysUser
;
import
java.math.BigDecimal
;
import
java.util.List
;
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
);
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
();
/**
* 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
);
SysUser
selectByCode
(
String
code
);
}
\ No newline at end of file
bsoft-api/src/main/java/com/bsoft/api/model/SysUser.java
View file @
8d2963a6
This diff is collapsed.
Click to expand it.
bsoft-api/src/main/resources/mapper/SysUserMapper.xml
View file @
8d2963a6
...
...
@@ -2,62 +2,84 @@
<!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"
>
<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_USERID"
jdbcType=
"
INTEGER
"
property=
"createUserid"
/>
<result
column=
"STATE"
jdbcType=
"
INTEGER
"
property=
"state"
/>
<result
column=
"USER_CODE"
jdbcType=
"
VARCHA
R"
property=
"userCode"
/>
<result
column=
"USER_NAME"
jdbcType=
"
VARCHA
R"
property=
"userName"
/>
<result
column=
"PASSWORD"
jdbcType=
"
VARCHA
R"
property=
"password"
/>
<result
column=
"IDCARD"
jdbcType=
"
VARCHA
R"
property=
"idcard"
/>
<result
column=
"SEX"
jdbcType=
"
VARCHA
R"
property=
"sex"
/>
<result
column=
"MOBILE"
jdbcType=
"
VARCHA
R"
property=
"mobile"
/>
<result
column=
"CREATE_USERID"
jdbcType=
"
DECIMAL
"
property=
"createUserid"
/>
<result
column=
"STATE"
jdbcType=
"
DECIMAL
"
property=
"state"
/>
<result
column=
"USER_CODE"
jdbcType=
"
OTHE
R"
property=
"userCode"
/>
<result
column=
"USER_NAME"
jdbcType=
"
OTHE
R"
property=
"userName"
/>
<result
column=
"PASSWORD"
jdbcType=
"
OTHE
R"
property=
"password"
/>
<result
column=
"IDCARD"
jdbcType=
"
OTHE
R"
property=
"idcard"
/>
<result
column=
"SEX"
jdbcType=
"
OTHE
R"
property=
"sex"
/>
<result
column=
"MOBILE"
jdbcType=
"
OTHE
R"
property=
"mobile"
/>
</resultMap>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from sys_user
where ID = #{id,jdbcType=INTEGER}
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.math.BigDecimal"
>
<!--
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>
<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>
insert into
sys_user
(CREATE_DATE, CREATE_USERID, STATE,
insert into
LL.SYS_USER
(CREATE_DATE, CREATE_USERID, STATE,
USER_CODE, USER_NAME, PASSWORD,
IDCARD, SEX, MOBILE
)
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=INTEGER}, #{state,jdbcType=INTEGER},
#{userCode,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{idcard,jdbcType=VARCHAR}, #{sex,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}
)
IDCARD, SEX, MOBILE)
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{userCode,jdbcType=OTHER}, #{userName,jdbcType=OTHER}, #{password,jdbcType=OTHER},
#{idcard,jdbcType=OTHER}, #{sex,jdbcType=OTHER}, #{mobile,jdbcType=OTHER})
</insert>
<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},
CREATE_USERID = #{createUserid,jdbcType=
INTEGER
},
STATE = #{state,jdbcType=
INTEGER
},
USER_CODE = #{userCode,jdbcType=
VARCHA
R},
USER_NAME = #{userName,jdbcType=
VARCHA
R},
PASSWORD = #{password,jdbcType=
VARCHA
R},
IDCARD = #{idcard,jdbcType=
VARCHA
R},
SEX = #{sex,jdbcType=
VARCHA
R},
MOBILE = #{mobile,jdbcType=
VARCHA
R}
where ID = #{id,jdbcType=
INTEGER
}
CREATE_USERID = #{createUserid,jdbcType=
DECIMAL
},
STATE = #{state,jdbcType=
DECIMAL
},
USER_CODE = #{userCode,jdbcType=
OTHE
R},
USER_NAME = #{userName,jdbcType=
OTHE
R},
PASSWORD = #{password,jdbcType=
OTHE
R},
IDCARD = #{idcard,jdbcType=
OTHE
R},
SEX = #{sex,jdbcType=
OTHE
R},
MOBILE = #{mobile,jdbcType=
OTHE
R}
where ID = #{id,jdbcType=
DECIMAL
}
</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,
SEX, MOBILE
from
sys_user
where ID = #{id,jdbcType=
INTEGER
}
from
LL.SYS_USER
where ID = #{id,jdbcType=
DECIMAL
}
</select>
<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,
SEX, MOBILE
from 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}
from LL.SYS_USER
</select>
</mapper>
\ No newline at end of file
bsoft-api/src/test/resources/generatorConfig.xml
View file @
8d2963a6
...
...
@@ -6,7 +6,7 @@
<!-- 引入配置文件 -->
<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=
"endingDelimiter"
value=
"`"
/>
<!-- 生成的文件编码 -->
...
...
@@ -16,7 +16,9 @@
<!--<property enName="mappers" value="com.suvalue.demo.mapper.BaseMapper"/>-->
<!--</plugin>-->
<commentGenerator>
<property
name=
"suppressAllComments"
value=
"true"
/>
<property
name=
"suppressAllComments"
value=
"false"
/>
<!-- 数据库注释支持 -->
<!-- <property name="addRemarkComments" value="true"/>-->
</commentGenerator>
<!-- 数据库连接属性 -->
<jdbcConnection
driverClass=
"${spring.datasource.driver-class-name}"
...
...
@@ -24,9 +26,9 @@
userId=
"${spring.datasource.username}"
password=
"${spring.datasource.password}"
>
<!-- 针对oracle数据库 获取字段注释 -->
<
!--<property enName="remarksReporting" value="true"></property>--
>
<
property
name=
"remarksReporting"
value=
"true"
></property
>
<!-- 针对mysql数据库 获取字段注释 -->
<property
name=
"useInformationSchema"
value=
"true"
></property
>
<!-- <property name="useInformationSchema" value="true"></property>--
>
</jdbcConnection>
<!-- 生成实体类配置 -->
<javaModelGenerator
targetPackage=
"com.bsoft.api.model"
targetProject=
"src/main/java"
/>
...
...
@@ -35,8 +37,9 @@
<!-- 生成映射接口配置 -->
<javaClientGenerator
targetPackage=
"com.bsoft.api.mapper"
targetProject=
"src/main/java"
type=
"XMLMAPPER"
/>
<table
tableName=
"sys_user"
>
<generatedKey
column=
"id"
sqlStatement=
"Mysql"
identity=
"true"
/>
<table
tableName=
"sys_user"
schema=
"ll"
>
<!-- 主键生成方式 -->
<generatedKey
column=
"id"
sqlStatement=
"select SEQ_SYS_USER_ID.nextval from dual"
identity=
"true"
/>
</table>
</context>
<!--<context id="sqlserver" targetRuntime="MyBatis3Simple" defaultModelType="flat">-->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment