Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
engine-class-work
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuchengjiu
engine-class-work
Commits
41ed864a
Commit
41ed864a
authored
Jul 21, 2023
by
Ryan Loong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 表结构
parent
d2b51d56
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
195 additions
and
23 deletions
+195
-23
generatorConfig.xml
server-db/mybatis-generator/generatorConfig.xml
+4
-0
StudentInfo.java
...ava/cn/exploring/engine/server/db/domain/StudentInfo.java
+81
-0
StudentVo.java
...va/cn/exploring/engine/server/db/domain/vo/StudentVo.java
+2
-3
StudentInfoMapper.xml
...s/cn/exploring/engine/server/db/dao/StudentInfoMapper.xml
+108
-20
No files found.
server-db/mybatis-generator/generatorConfig.xml
View file @
41ed864a
...
...
@@ -71,6 +71,8 @@
<!-- autoScan为false,这里可以定义全局需要检查生成枚举类的列名 -->
<property
name=
"enumColumns"
value=
"type, status"
/>
</plugin>
<!-- 增量插件 -->
<plugin
type=
"com.itfsw.mybatis.generator.plugins.IncrementPlugin"
/>
<commentGenerator>
<property
name=
"suppressDate"
value=
"true"
/>
...
...
@@ -123,6 +125,8 @@
<generatedKey
column=
"id"
sqlStatement=
"MySql"
identity=
"true"
/>
</table>
<table
tableName=
"student_info"
>
<!-- 配置需要进行增量操作的列名称(英文半角逗号分隔) -->
<property
name=
"incrementColumns"
value=
"call_times"
/>
<generatedKey
column=
"id"
sqlStatement=
"MySql"
identity=
"true"
/>
</table>
</context>
...
...
server-db/src/main/java/cn/exploring/engine/server/db/domain/StudentInfo.java
View file @
41ed864a
...
...
@@ -3,6 +3,8 @@ package cn.exploring.engine.server.db.domain;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
StudentInfo
{
/**
...
...
@@ -102,6 +104,14 @@ public class StudentInfo {
*/
private
Boolean
deleted
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table student_info
*
* @mbg.generated
*/
protected
final
Map
<
String
,
Object
>
incrementColumnsInfoMap
=
new
HashMap
<>();
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column student_info.id
...
...
@@ -416,6 +426,17 @@ public class StudentInfo {
return
new
StudentInfo
.
Builder
();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table student_info
*
* @mbg.generated
*/
public
StudentInfo
increment
(
Increment
.
Item
increment
)
{
this
.
incrementColumnsInfoMap
.
put
(
increment
.
getColumn
().
value
(),
increment
);
return
this
;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table student_info
...
...
@@ -857,4 +878,64 @@ public class StudentInfo {
return
this
.
getEscapedColumnName
();
}
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table student_info
*
* @mbg.generated
*/
public
enum
Increment
{
callTimes
(
Column
.
callTimes
);
private
final
Column
column
;
Increment
(
Column
column
)
{
this
.
column
=
column
;
}
public
Column
getColumn
()
{
return
this
.
column
;
}
public
Increment
.
Item
inc
(
Object
value
)
{
return
new
Increment
.
Item
(
this
.
column
,
"+"
,
value
);
}
public
Increment
.
Item
dec
(
Object
value
)
{
return
new
Increment
.
Item
(
this
.
column
,
"-"
,
value
);
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table student_info
*
* @mbg.generated
*/
class
Item
{
private
Column
column
;
private
String
operate
;
private
Object
value
;
public
Column
getColumn
()
{
return
this
.
column
;
}
public
String
getOperate
()
{
return
this
.
operate
;
}
public
Object
getValue
()
{
return
this
.
value
;
}
public
Item
(
Column
column
,
String
operate
,
Object
value
)
{
this
.
column
=
column
;
this
.
operate
=
operate
;
this
.
value
=
value
;
}
}
}
}
\ No newline at end of file
server-db/src/main/java/cn/exploring/engine/server/db/domain/vo/StudentVo.java
View file @
41ed864a
...
...
@@ -4,11 +4,10 @@ import cn.exploring.engine.server.db.domain.StudentInfo;
import
cn.zhxu.bs.bean.DbField
;
import
cn.zhxu.bs.bean.SearchBean
;
import
java.time.LocalDateTime
;
@SearchBean
(
tables
=
"(select * from student_info where deleted = false) st left join (select * from class_info where deleted = false) cl on cl.id = st.class_id"
,
autoMapTo
=
"st"
autoMapTo
=
"st"
,
ignoreFields
=
{
"incrementColumnsInfoMap"
}
)
public
class
StudentVo
extends
StudentInfo
{
...
...
server-db/src/main/resources/cn/exploring/engine/server/db/dao/StudentInfoMapper.xml
View file @
41ed864a
...
...
@@ -318,7 +318,17 @@
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
<choose>
<when
test=
"'call_times'.toString() == column.value and record.incrementColumnsInfoMap.call_times != null"
>
${column.escapedColumnName} = ${column.escapedColumnName} ${record.incrementColumnsInfoMap.call_times.operate} #{record.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER}
</when>
<when
test=
"'call_times'.toString() == column.value"
>
${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=INTEGER}
</when>
<otherwise>
${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}}
</otherwise>
</choose>
</foreach>
</when>
<otherwise>
...
...
@@ -338,9 +348,14 @@
<if
test=
"record.head != null"
>
head = #{record.head,jdbcType=VARCHAR},
</if>
<if
test=
"record.callTimes != null"
>
<choose>
<when
test=
"record.incrementColumnsInfoMap.call_times != null"
>
call_times = call_times ${record.incrementColumnsInfoMap.call_times.operate} #{record.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER},
</when>
<when
test=
"record.callTimes != null"
>
call_times = #{record.callTimes,jdbcType=INTEGER},
</if>
</when>
</choose>
<if
test=
"record.addTime != null"
>
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
...
...
@@ -368,7 +383,14 @@
class_id = #{record.classId,jdbcType=INTEGER},
`name` = #{record.name,jdbcType=VARCHAR},
head = #{record.head,jdbcType=VARCHAR},
<choose>
<when
test=
"record.incrementColumnsInfoMap.call_times != null"
>
call_times = call_times ${record.incrementColumnsInfoMap.call_times.operate} #{record.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER},
</when>
<otherwise>
call_times = #{record.callTimes,jdbcType=INTEGER},
</otherwise>
</choose>
add_time = #{record.addTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
deleted = #{record.deleted,jdbcType=BIT}
...
...
@@ -386,7 +408,17 @@
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
<choose>
<when
test=
"'call_times'.toString() == column.value and record.incrementColumnsInfoMap.call_times != null"
>
${column.escapedColumnName} = ${column.escapedColumnName} ${record.incrementColumnsInfoMap.call_times.operate} #{record.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER}
</when>
<when
test=
"'call_times'.toString() == column.value"
>
${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=INTEGER}
</when>
<otherwise>
${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}}
</otherwise>
</choose>
</foreach>
</when>
<otherwise>
...
...
@@ -403,9 +435,14 @@
<if
test=
"record.head != null"
>
head = #{record.head,jdbcType=VARCHAR},
</if>
<if
test=
"record.callTimes != null"
>
<choose>
<when
test=
"record.incrementColumnsInfoMap.call_times != null"
>
call_times = call_times ${record.incrementColumnsInfoMap.call_times.operate} #{record.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER},
</when>
<when
test=
"record.callTimes != null"
>
call_times = #{record.callTimes,jdbcType=INTEGER},
</if>
</when>
</choose>
<if
test=
"record.addTime != null"
>
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
...
...
@@ -430,7 +467,14 @@
class_id = #{classId,jdbcType=INTEGER},
`name` = #{name,jdbcType=VARCHAR},
head = #{head,jdbcType=VARCHAR},
<choose>
<when
test=
"_parameter.incrementColumnsInfoMap.call_times != null"
>
call_times = call_times ${_parameter.incrementColumnsInfoMap.call_times.operate} #{_parameter.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER},
</when>
<otherwise>
call_times = #{callTimes,jdbcType=INTEGER},
</otherwise>
</choose>
add_time = #{addTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
deleted = #{deleted,jdbcType=BIT}
...
...
@@ -640,7 +684,17 @@
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
<choose>
<when
test=
"'call_times'.toString() == column.value and record.incrementColumnsInfoMap.call_times != null"
>
${column.escapedColumnName} = ${column.escapedColumnName} ${record.incrementColumnsInfoMap.call_times.operate} #{record.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER}
</when>
<when
test=
"'call_times'.toString() == column.value"
>
${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=INTEGER}
</when>
<otherwise>
${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}}
</otherwise>
</choose>
</foreach>
</when>
<otherwise>
...
...
@@ -660,9 +714,14 @@
<if
test=
"record.head != null"
>
head = #{record.head,jdbcType=VARCHAR},
</if>
<if
test=
"record.callTimes != null"
>
<choose>
<when
test=
"record.incrementColumnsInfoMap.call_times != null"
>
call_times = call_times ${record.incrementColumnsInfoMap.call_times.operate} #{record.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER},
</when>
<when
test=
"record.callTimes != null"
>
call_times = #{record.callTimes,jdbcType=INTEGER},
</if>
</when>
</choose>
<if
test=
"record.addTime != null"
>
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
...
...
@@ -686,7 +745,17 @@
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
<choose>
<when
test=
"'call_times'.toString() == column.value and record.incrementColumnsInfoMap.call_times != null"
>
${column.escapedColumnName} = ${column.escapedColumnName} ${record.incrementColumnsInfoMap.call_times.operate} #{record.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER}
</when>
<when
test=
"'call_times'.toString() == column.value"
>
${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=INTEGER}
</when>
<otherwise>
${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}}
</otherwise>
</choose>
</foreach>
</when>
<otherwise>
...
...
@@ -706,9 +775,14 @@
<if
test=
"record.head != null"
>
head = #{record.head,jdbcType=VARCHAR},
</if>
<if
test=
"record.callTimes != null"
>
<choose>
<when
test=
"record.incrementColumnsInfoMap.call_times != null"
>
call_times = call_times ${record.incrementColumnsInfoMap.call_times.operate} #{record.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER},
</when>
<when
test=
"record.callTimes != null"
>
call_times = #{record.callTimes,jdbcType=INTEGER},
</if>
</when>
</choose>
<if
test=
"record.addTime != null"
>
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
...
...
@@ -854,7 +928,14 @@
class_id = #{classId,jdbcType=INTEGER},
`name` = #{name,jdbcType=VARCHAR},
head = #{head,jdbcType=VARCHAR},
<choose>
<when
test=
"_parameter.incrementColumnsInfoMap.call_times != null"
>
call_times = call_times ${_parameter.incrementColumnsInfoMap.call_times.operate} #{_parameter.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER},
</when>
<when
test=
"callTimes != null"
>
call_times = #{callTimes,jdbcType=INTEGER},
</when>
</choose>
add_time = #{addTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
deleted = #{deleted,jdbcType=BIT},
...
...
@@ -875,7 +956,14 @@
class_id = #{record.classId,jdbcType=INTEGER},
`name` = #{record.name,jdbcType=VARCHAR},
head = #{record.head,jdbcType=VARCHAR},
<choose>
<when
test=
"record.incrementColumnsInfoMap.call_times != null"
>
call_times = call_times ${record.incrementColumnsInfoMap.call_times.operate} #{record.incrementColumnsInfoMap.call_times.value,jdbcType=INTEGER},
</when>
<when
test=
"record.callTimes != null"
>
call_times = #{record.callTimes,jdbcType=INTEGER},
</when>
</choose>
add_time = #{record.addTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
deleted = #{record.deleted,jdbcType=BIT},
...
...
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