优化用户和单据的sql

This commit is contained in:
季圣华
2019-12-24 22:03:12 +08:00
parent 193144f133
commit 8cfdc3dc17
15 changed files with 27 additions and 1552 deletions

View File

@@ -2,10 +2,6 @@
<!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.DepotHeadMapper">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.DepotHead">
<!--
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="SubType" jdbcType="VARCHAR" property="subtype" />
@@ -39,10 +35,6 @@
<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">
@@ -72,10 +64,6 @@
</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">
@@ -105,10 +93,6 @@
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
Id, Type, SubType, ProjectId, DefaultNumber, Number, OperPersonName, CreateTime,
OperTime, OrganId, HandsPersonId, AccountId, ChangeAmount, AllocationProjectId, TotalPrice,
PayType, Remark, Salesman, AccountIdList, AccountMoneyList, Discount, DiscountMoney,
@@ -116,10 +100,6 @@
LinkNumber, tenant_id, delete_Flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="BaseResultMap">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
@@ -134,38 +114,25 @@
</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_depothead
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_depothead
where Id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_depothead
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.DepotHead">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into jsh_depothead (Id, Type, SubType,
ProjectId, DefaultNumber, Number,
OperPersonName, CreateTime, OperTime,
@@ -190,15 +157,12 @@
#{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotHead">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into jsh_depothead
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
Id,
</if>
Id,
<if test="type != null">
Type,
</if>
@@ -291,9 +255,7 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
#{id,jdbcType=BIGINT},
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
@@ -387,20 +349,12 @@
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultType="java.lang.Integer">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_depothead
<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_depothead
<set>
<if test="record.id != null">
@@ -502,10 +456,6 @@
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_depothead
set Id = #{record.id,jdbcType=BIGINT},
Type = #{record.type,jdbcType=VARCHAR},
@@ -543,10 +493,6 @@
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.DepotHead">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_depothead
<set>
<if test="type != null">
@@ -643,10 +589,6 @@
where Id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.DepotHead">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_depothead
set Type = #{type,jdbcType=VARCHAR},
SubType = #{subtype,jdbcType=VARCHAR},

View File

@@ -324,30 +324,6 @@
and ifnull(dh.delete_Flag,'0') !='1'
</select>
<insert id="adddepotHead" parameterType="com.jsh.erp.datasource.entities.DepotHead"
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into jsh_depothead (Type, SubType,
ProjectId, DefaultNumber, Number,
OperPersonName, CreateTime, OperTime,
OrganId, HandsPersonId, AccountId,
ChangeAmount, AllocationProjectId, TotalPrice,
PayType, Remark, Salesman,
AccountIdList, AccountMoneyList, Discount,
DiscountMoney, DiscountLastMoney, OtherMoney,
OtherMoneyList, OtherMoneyItem, AccountDay,
Status, LinkNumber)
values (#{type,jdbcType=VARCHAR}, #{subtype,jdbcType=VARCHAR},
#{projectid,jdbcType=BIGINT}, #{defaultnumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR},
#{operpersonname,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP}, #{opertime,jdbcType=TIMESTAMP},
#{organid,jdbcType=BIGINT}, #{handspersonid,jdbcType=BIGINT}, #{accountid,jdbcType=BIGINT},
#{changeamount,jdbcType=DECIMAL}, #{allocationprojectid,jdbcType=BIGINT}, #{totalprice,jdbcType=DECIMAL},
#{paytype,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{salesman,jdbcType=VARCHAR},
#{accountidlist,jdbcType=VARCHAR}, #{accountmoneylist,jdbcType=VARCHAR}, #{discount,jdbcType=DECIMAL},
#{discountmoney,jdbcType=DECIMAL}, #{discountlastmoney,jdbcType=DECIMAL}, #{othermoney,jdbcType=DECIMAL},
#{othermoneylist,jdbcType=VARCHAR}, #{othermoneyitem,jdbcType=VARCHAR}, #{accountday,jdbcType=INTEGER},
#{status,jdbcType=VARCHAR}, #{linknumber,jdbcType=VARCHAR})
</insert>
<update id="updateBuildOnlyNumber">
update jsh_sequence set current_val = current_val + 1 where seq_name = 'depot_number_seq'
</update>

View File

@@ -2,10 +2,6 @@
<!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.UserMapper">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.User">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="loginame" jdbcType="VARCHAR" property="loginame" />
@@ -22,10 +18,6 @@
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
</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">
@@ -55,10 +47,6 @@
</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">
@@ -88,18 +76,10 @@
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, username, loginame, password, position, department, email, phonenum, ismanager,
isystem, Status, description, remark, tenant_id
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.UserExample" resultMap="BaseResultMap">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
@@ -114,38 +94,25 @@
</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_user
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_user
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.UserExample">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.User">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into jsh_user (id, username, loginame,
password, position, department,
email, phonenum, ismanager,
@@ -158,15 +125,12 @@
#{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.User">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into jsh_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
id,
<if test="username != null">
username,
</if>
@@ -208,9 +172,7 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
#{id,jdbcType=BIGINT},
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
@@ -253,20 +215,12 @@
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.UserExample" resultType="java.lang.Integer">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_user
<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_user
<set>
<if test="record.id != null">
@@ -317,10 +271,6 @@
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_user
set id = #{record.id,jdbcType=BIGINT},
username = #{record.username,jdbcType=VARCHAR},
@@ -341,10 +291,6 @@
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.User">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_user
<set>
<if test="username != null">
@@ -390,10 +336,6 @@
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.User">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_user
set username = #{username,jdbcType=VARCHAR},
loginame = #{loginame,jdbcType=VARCHAR},

View File

@@ -54,61 +54,6 @@
</if>
order by user.id desc
</select>
<insert id="addUser" parameterType="com.jsh.erp.datasource.entities.UserEx"
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into jsh_user (username, loginame,
password, position,
email, phonenum, ismanager,
isystem, status, description,
remark)
values (#{username,jdbcType=VARCHAR}, #{loginame,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
#{email,jdbcType=VARCHAR}, #{phonenum,jdbcType=VARCHAR}, #{ismanager,jdbcType=TINYINT},
#{isystem,jdbcType=TINYINT}, #{status,jdbcType=TINYINT}, #{description,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR})
</insert>
<update id="updateUser" parameterType="com.jsh.erp.datasource.entities.UserEx">
update jsh_user
<set>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="loginame != null">
loginame = #{loginame,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="position != null">
position = #{position,jdbcType=VARCHAR},
</if>
<if test="department != null">
department = #{department,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="phonenum != null">
phonenum = #{phonenum,jdbcType=VARCHAR},
</if>
<if test="ismanager != null">
ismanager = #{ismanager,jdbcType=TINYINT},
</if>
<if test="isystem != null">
isystem = #{isystem,jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status,jdbcType=TINYINT},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="getUserListByUserNameOrLoginName" resultMap="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap">
select user.id, user.username, user.loginame, user.position, user.email, user.phonenum,
user.description, user.remark,user.isystem