Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
70f0dae4
Commit
70f0dae4
authored
Jul 21, 2020
by
季圣华
Browse files
优化表结构
parent
13932441
Changes
104
Hide whitespace changes
Inline
Side-by-side
src/main/resources/mapper_xml/UnitMapperEx.xml
View file @
70f0dae4
...
...
@@ -6,9 +6,9 @@
FROM jsh_unit
where 1=1
<if
test=
"name != null"
>
and
UN
ame like '%${name}%'
and
n
ame like '%${name}%'
</if>
and ifnull(delete_
F
lag,'0') !='1'
and ifnull(delete_
f
lag,'0') !='1'
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
...
...
@@ -19,13 +19,13 @@
FROM jsh_unit
WHERE 1=1
<if
test=
"name != null"
>
and
UN
ame like '%${name}%'
and
n
ame like '%${name}%'
</if>
and ifnull(delete_
F
lag,'0') !='1'
and ifnull(delete_
f
lag,'0') !='1'
</select>
<update
id=
"batchDeleteUnitByIds"
>
update jsh_unit
set delete_
F
lag='1'
set delete_
f
lag='1'
where 1=1
and id in (
<foreach
collection=
"ids"
item=
"id"
separator=
","
>
...
...
src/main/resources/mapper_xml/UserBusinessMapper.xml
View file @
70f0dae4
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jsh.erp.datasource.mappers.UserBusinessMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.jsh.erp.datasource.entities.UserBusiness"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id
column=
"Id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"Type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"KeyId"
jdbcType=
"VARCHAR"
property=
"keyid"
/>
<result
column=
"Value"
jdbcType=
"VARCHAR"
property=
"value"
/>
<result
column=
"BtnStr"
jdbcType=
"VARCHAR"
property=
"btnstr"
/>
<result
column=
"delete_Flag"
jdbcType=
"VARCHAR"
property=
"deleteFlag"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
Id, Type, KeyId, Value, BtnStr, delete_Flag
</sql>
<select
id=
"selectByExample"
parameterType=
"com.jsh.erp.datasource.entities.UserBusinessExample"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from jsh_userbusiness
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include
refid=
"Base_Column_List"
/>
from jsh_userbusiness
where Id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_userbusiness
where Id = #{id,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"com.jsh.erp.datasource.entities.UserBusinessExample"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_userbusiness
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"com.jsh.erp.datasource.entities.UserBusiness"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_userbusiness (Id, Type, KeyId,
Value, BtnStr, delete_Flag
)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{keyid,jdbcType=VARCHAR},
#{value,jdbcType=VARCHAR}, #{btnstr,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.jsh.erp.datasource.entities.UserBusiness"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_userbusiness
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
Id,
</if>
<if
test=
"type != null"
>
Type,
</if>
<if
test=
"keyid != null"
>
KeyId,
</if>
<if
test=
"value != null"
>
Value,
</if>
<if
test=
"btnstr != null"
>
BtnStr,
</if>
<if
test=
"deleteFlag != null"
>
delete_Flag,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=VARCHAR},
</if>
<if
test=
"keyid != null"
>
#{keyid,jdbcType=VARCHAR},
</if>
<if
test=
"value != null"
>
#{value,jdbcType=VARCHAR},
</if>
<if
test=
"btnstr != null"
>
#{btnstr,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.jsh.erp.datasource.entities.UserBusinessExample"
resultType=
"java.lang.Integer"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_userbusiness
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_userbusiness
<set>
<if
test=
"record.id != null"
>
Id = #{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.type != null"
>
Type = #{record.type,jdbcType=VARCHAR},
</if>
<if
test=
"record.keyid != null"
>
KeyId = #{record.keyid,jdbcType=VARCHAR},
</if>
<if
test=
"record.value != null"
>
Value = #{record.value,jdbcType=VARCHAR},
</if>
<if
test=
"record.btnstr != null"
>
BtnStr = #{record.btnstr,jdbcType=VARCHAR},
</if>
<if
test=
"record.deleteFlag != null"
>
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_userbusiness
set Id = #{record.id,jdbcType=BIGINT},
Type = #{record.type,jdbcType=VARCHAR},
KeyId = #{record.keyid,jdbcType=VARCHAR},
Value = #{record.value,jdbcType=VARCHAR},
BtnStr = #{record.btnstr,jdbcType=VARCHAR},
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.jsh.erp.datasource.entities.UserBusiness"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_userbusiness
<set>
<if
test=
"type != null"
>
Type = #{type,jdbcType=VARCHAR},
</if>
<if
test=
"keyid != null"
>
KeyId = #{keyid,jdbcType=VARCHAR},
</if>
<if
test=
"value != null"
>
Value = #{value,jdbcType=VARCHAR},
</if>
<if
test=
"btnstr != null"
>
BtnStr = #{btnstr,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.jsh.erp.datasource.entities.UserBusiness"
>
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_userbusiness
set Type = #{type,jdbcType=VARCHAR},
KeyId = #{keyid,jdbcType=VARCHAR},
Value = #{value,jdbcType=VARCHAR},
BtnStr = #{btnstr,jdbcType=VARCHAR},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
where Id = #{id,jdbcType=BIGINT}
</update>
<mapper
namespace=
"com.jsh.erp.datasource.mappers.UserBusinessMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.jsh.erp.datasource.entities.UserBusiness"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"key_id"
jdbcType=
"VARCHAR"
property=
"keyId"
/>
<result
column=
"value"
jdbcType=
"VARCHAR"
property=
"value"
/>
<result
column=
"btn_str"
jdbcType=
"VARCHAR"
property=
"btnStr"
/>
<result
column=
"delete_flag"
jdbcType=
"VARCHAR"
property=
"deleteFlag"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, type, key_id, value, btn_str, delete_flag
</sql>
<select
id=
"selectByExample"
parameterType=
"com.jsh.erp.datasource.entities.UserBusinessExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from jsh_user_business
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from jsh_user_business
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from jsh_user_business
where id = #{id,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"com.jsh.erp.datasource.entities.UserBusinessExample"
>
delete from jsh_user_business
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"com.jsh.erp.datasource.entities.UserBusiness"
>
insert into jsh_user_business (id, type, key_id,
value, btn_str, delete_flag
)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{keyId,jdbcType=VARCHAR},
#{value,jdbcType=VARCHAR}, #{btnStr,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.jsh.erp.datasource.entities.UserBusiness"
>
insert into jsh_user_business
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"type != null"
>
type,
</if>
<if
test=
"keyId != null"
>
key_id,
</if>
<if
test=
"value != null"
>
value,
</if>
<if
test=
"btnStr != null"
>
btn_str,
</if>
<if
test=
"deleteFlag != null"
>
delete_flag,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=VARCHAR},
</if>
<if
test=
"keyId != null"
>
#{keyId,jdbcType=VARCHAR},
</if>
<if
test=
"value != null"
>
#{value,jdbcType=VARCHAR},
</if>
<if
test=
"btnStr != null"
>
#{btnStr,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.jsh.erp.datasource.entities.UserBusinessExample"
resultType=
"java.lang.Long"
>
select count(*) from jsh_user_business
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update jsh_user_business
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.type != null"
>
type = #{record.type,jdbcType=VARCHAR},
</if>
<if
test=
"record.keyId != null"
>
key_id = #{record.keyId,jdbcType=VARCHAR},
</if>
<if
test=
"record.value != null"
>
value = #{record.value,jdbcType=VARCHAR},
</if>
<if
test=
"record.btnStr != null"
>
btn_str = #{record.btnStr,jdbcType=VARCHAR},
</if>
<if
test=
"record.deleteFlag != null"
>
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update jsh_user_business
set id = #{record.id,jdbcType=BIGINT},
type = #{record.type,jdbcType=VARCHAR},
key_id = #{record.keyId,jdbcType=VARCHAR},
value = #{record.value,jdbcType=VARCHAR},
btn_str = #{record.btnStr,jdbcType=VARCHAR},
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.jsh.erp.datasource.entities.UserBusiness"
>
update jsh_user_business
<set>
<if
test=
"type != null"
>
type = #{type,jdbcType=VARCHAR},
</if>
<if
test=
"keyId != null"
>
key_id = #{keyId,jdbcType=VARCHAR},
</if>
<if
test=
"value != null"
>
value = #{value,jdbcType=VARCHAR},
</if>
<if
test=
"btnStr != null"
>
btn_str = #{btnStr,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.jsh.erp.datasource.entities.UserBusiness"
>
update jsh_user_business
set type = #{type,jdbcType=VARCHAR},
key_id = #{keyId,jdbcType=VARCHAR},
value = #{value,jdbcType=VARCHAR},
btn_str = #{btnStr,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
src/main/resources/mapper_xml/UserBusinessMapperEx.xml
View file @
70f0dae4
...
...
@@ -2,8 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jsh.erp.datasource.mappers.UserBusinessMapperEx"
>
<update
id=
"batchDeleteUserBusinessByIds"
>
update jsh_ser
ial_number
set delete_
F
lag='1'
update jsh_
u
ser
_business
set delete_
f
lag='1'
where 1=1
and id in (
<foreach
collection=
"ids"
item=
"id"
separator=
","
>
...
...
src/test/resources/generatorConfig.xml
View file @
70f0dae4
...
...
@@ -47,22 +47,22 @@
<table tableName="jsh_depot" domainObjectName="Depot"></table>
<table tableName="jsh_depothead" domainObjectName="DepotHead"></table>
<table tableName="jsh_depotitem" domainObjectName="DepotItem"></table>
<table tableName="jsh_function
s
" domainObjectName="Functions"></table>
<table tableName="jsh_function" domainObjectName="Functions"></table>
<table tableName="jsh_inoutitem" domainObjectName="InOutItem"></table>
<table tableName="jsh_log" domainObjectName="Log"></table>
<table tableName="jsh_material" domainObjectName="Material"></table>
<table tableName="jsh_material_extend" domainObjectName="MaterialExtend"></table>
<table tableName="jsh_material_current_stock" domainObjectName="MaterialCurrentStock"></table>
<table tableName="jsh_material_initial_stock" domainObjectName="MaterialInitialStock"></table>
<table tableName="jsh_materialcategory" domainObjectName="MaterialCategory"></table>
<table tableName="jsh_materialproperty" domainObjectName="MaterialProperty"></table>
<table tableName="jsh_material
_
category" domainObjectName="MaterialCategory"></table>
<table tableName="jsh_material
_
property" domainObjectName="MaterialProperty"></table>
<table tableName="jsh_person" domainObjectName="Person"></table>
<table tableName="jsh_role" domainObjectName="Role"></table>
<table tableName="jsh_supplier" domainObjectName="Supplier"></table>
<table tableName="jsh_systemconfig" domainObjectName="SystemConfig"></table>
<table tableName="jsh_system
_
config" domainObjectName="SystemConfig"></table>
<table tableName="jsh_unit" domainObjectName="Unit"></table>
<table tableName="jsh_user" domainObjectName="User"></table>
<table tableName="jsh_userbusiness" domainObjectName="UserBusiness"></table>
<table tableName="jsh_user
_
business" domainObjectName="UserBusiness"></table>
<table tableName="jsh_serial_number" domainObjectName="SerialNumber"></table>
<table tableName="jsh_organization" domainObjectName="Organization"></table>
<table tableName="jsh_orga_user_rel" domainObjectName="OrgaUserRel"></table>
...
...
Prev
1
2
3
4
5
6
Next
Write
Preview
Supports
Markdown
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