优化收款单
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
<result column="bill_no" jdbcType="VARCHAR" property="billNo" />
|
||||
<result column="bill_time" jdbcType="TIMESTAMP" property="billTime" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="file_name" jdbcType="VARCHAR" property="fileName" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
|
||||
</resultMap>
|
||||
@@ -76,7 +77,7 @@
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, type, organ_id, hands_person_id, creator, change_amount, total_price, account_id,
|
||||
bill_no, bill_time, remark, tenant_id, delete_flag
|
||||
bill_no, bill_time, remark, file_name, tenant_id, delete_flag
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -112,13 +113,13 @@
|
||||
insert into jsh_account_head (id, type, organ_id,
|
||||
hands_person_id, creator, change_amount,
|
||||
total_price, account_id, bill_no,
|
||||
bill_time, remark, tenant_id,
|
||||
delete_flag)
|
||||
bill_time, remark, file_name,
|
||||
tenant_id, delete_flag)
|
||||
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{organId,jdbcType=BIGINT},
|
||||
#{handsPersonId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT}, #{changeAmount,jdbcType=DECIMAL},
|
||||
#{totalPrice,jdbcType=DECIMAL}, #{accountId,jdbcType=BIGINT}, #{billNo,jdbcType=VARCHAR},
|
||||
#{billTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},
|
||||
#{deleteFlag,jdbcType=VARCHAR})
|
||||
#{billTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR},
|
||||
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.AccountHead">
|
||||
insert into jsh_account_head
|
||||
@@ -156,6 +157,9 @@
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
<if test="fileName != null">
|
||||
file_name,
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
</if>
|
||||
@@ -197,6 +201,9 @@
|
||||
<if test="remark != null">
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="fileName != null">
|
||||
#{fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@@ -247,6 +254,9 @@
|
||||
<if test="record.remark != null">
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.fileName != null">
|
||||
file_name = #{record.fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.tenantId != null">
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@@ -271,6 +281,7 @@
|
||||
bill_no = #{record.billNo,jdbcType=VARCHAR},
|
||||
bill_time = #{record.billTime,jdbcType=TIMESTAMP},
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
file_name = #{record.fileName,jdbcType=VARCHAR},
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
@@ -310,6 +321,9 @@
|
||||
<if test="remark != null">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="fileName != null">
|
||||
file_name = #{fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@@ -331,6 +345,7 @@
|
||||
bill_no = #{billNo,jdbcType=VARCHAR},
|
||||
bill_time = #{billTime,jdbcType=TIMESTAMP},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
file_name = #{fileName,jdbcType=VARCHAR},
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
<result column="account_id" jdbcType="BIGINT" property="accountId" />
|
||||
<result column="in_out_item_id" jdbcType="BIGINT" property="inOutItemId" />
|
||||
<result column="bill_id" jdbcType="BIGINT" property="billId" />
|
||||
<result column="need_debt" jdbcType="DECIMAL" property="needDebt" />
|
||||
<result column="finish_debt" jdbcType="DECIMAL" property="finishDebt" />
|
||||
<result column="each_amount" jdbcType="DECIMAL" property="eachAmount" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
@@ -71,8 +73,8 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, header_id, account_id, in_out_item_id, bill_id, each_amount, remark, tenant_id,
|
||||
delete_flag
|
||||
id, header_id, account_id, in_out_item_id, bill_id, need_debt, finish_debt, each_amount,
|
||||
remark, tenant_id, delete_flag
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.AccountItemExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -106,13 +108,13 @@
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.AccountItem">
|
||||
insert into jsh_account_item (id, header_id, account_id,
|
||||
in_out_item_id, bill_id, each_amount,
|
||||
remark, tenant_id, delete_flag
|
||||
)
|
||||
in_out_item_id, bill_id, need_debt,
|
||||
finish_debt, each_amount, remark,
|
||||
tenant_id, delete_flag)
|
||||
values (#{id,jdbcType=BIGINT}, #{headerId,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT},
|
||||
#{inOutItemId,jdbcType=BIGINT}, #{billId,jdbcType=BIGINT}, #{eachAmount,jdbcType=DECIMAL},
|
||||
#{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
|
||||
)
|
||||
#{inOutItemId,jdbcType=BIGINT}, #{billId,jdbcType=BIGINT}, #{needDebt,jdbcType=DECIMAL},
|
||||
#{finishDebt,jdbcType=DECIMAL}, #{eachAmount,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR},
|
||||
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.AccountItem">
|
||||
insert into jsh_account_item
|
||||
@@ -132,6 +134,12 @@
|
||||
<if test="billId != null">
|
||||
bill_id,
|
||||
</if>
|
||||
<if test="needDebt != null">
|
||||
need_debt,
|
||||
</if>
|
||||
<if test="finishDebt != null">
|
||||
finish_debt,
|
||||
</if>
|
||||
<if test="eachAmount != null">
|
||||
each_amount,
|
||||
</if>
|
||||
@@ -161,6 +169,12 @@
|
||||
<if test="billId != null">
|
||||
#{billId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="needDebt != null">
|
||||
#{needDebt,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="finishDebt != null">
|
||||
#{finishDebt,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="eachAmount != null">
|
||||
#{eachAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
@@ -199,6 +213,12 @@
|
||||
<if test="record.billId != null">
|
||||
bill_id = #{record.billId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.needDebt != null">
|
||||
need_debt = #{record.needDebt,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.finishDebt != null">
|
||||
finish_debt = #{record.finishDebt,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.eachAmount != null">
|
||||
each_amount = #{record.eachAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
@@ -223,6 +243,8 @@
|
||||
account_id = #{record.accountId,jdbcType=BIGINT},
|
||||
in_out_item_id = #{record.inOutItemId,jdbcType=BIGINT},
|
||||
bill_id = #{record.billId,jdbcType=BIGINT},
|
||||
need_debt = #{record.needDebt,jdbcType=DECIMAL},
|
||||
finish_debt = #{record.finishDebt,jdbcType=DECIMAL},
|
||||
each_amount = #{record.eachAmount,jdbcType=DECIMAL},
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
@@ -246,6 +268,12 @@
|
||||
<if test="billId != null">
|
||||
bill_id = #{billId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="needDebt != null">
|
||||
need_debt = #{needDebt,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="finishDebt != null">
|
||||
finish_debt = #{finishDebt,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="eachAmount != null">
|
||||
each_amount = #{eachAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
@@ -267,6 +295,8 @@
|
||||
account_id = #{accountId,jdbcType=BIGINT},
|
||||
in_out_item_id = #{inOutItemId,jdbcType=BIGINT},
|
||||
bill_id = #{billId,jdbcType=BIGINT},
|
||||
need_debt = #{needDebt,jdbcType=DECIMAL},
|
||||
finish_debt = #{finishDebt,jdbcType=DECIMAL},
|
||||
each_amount = #{eachAmount,jdbcType=DECIMAL},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
)
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
<update id="batchDeleteAccountItemByHeadIds">
|
||||
update jsh_account_item
|
||||
set delete_flag='1'
|
||||
@@ -112,4 +113,15 @@
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
|
||||
<select id="getEachAmountByBillId" resultType="java.math.BigDecimal">
|
||||
select
|
||||
ifnull(sum(each_amount),0)
|
||||
from jsh_account_item
|
||||
where 1=1
|
||||
<if test="billId != null">
|
||||
and bill_id=#{billId}
|
||||
</if>
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -18,6 +18,7 @@
|
||||
<result column="pay_type" jdbcType="VARCHAR" property="payType" />
|
||||
<result column="bill_type" jdbcType="VARCHAR" property="billType" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="file_name" jdbcType="VARCHAR" property="fileName" />
|
||||
<result column="sales_man" jdbcType="VARCHAR" property="salesMan" />
|
||||
<result column="account_id_list" jdbcType="VARCHAR" property="accountIdList" />
|
||||
<result column="account_money_list" jdbcType="VARCHAR" property="accountMoneyList" />
|
||||
@@ -93,8 +94,8 @@
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, type, sub_type, default_number, number, create_time, oper_time, organ_id, hands_person_id,
|
||||
creator, account_id, change_amount, total_price, pay_type, bill_type, remark, sales_man,
|
||||
account_id_list, account_money_list, discount, discount_money, discount_last_money,
|
||||
creator, account_id, change_amount, total_price, pay_type, bill_type, remark, file_name,
|
||||
sales_man, account_id_list, account_money_list, discount, discount_money, discount_last_money,
|
||||
other_money, other_money_list, other_money_item, account_day, status, link_number,
|
||||
tenant_id, delete_flag
|
||||
</sql>
|
||||
@@ -134,23 +135,23 @@
|
||||
oper_time, organ_id, hands_person_id,
|
||||
creator, account_id, change_amount,
|
||||
total_price, pay_type, bill_type,
|
||||
remark, sales_man, account_id_list,
|
||||
account_money_list, discount, discount_money,
|
||||
discount_last_money, other_money, other_money_list,
|
||||
other_money_item, account_day, status,
|
||||
link_number, tenant_id, delete_flag
|
||||
)
|
||||
remark, file_name, sales_man,
|
||||
account_id_list, account_money_list, discount,
|
||||
discount_money, discount_last_money, other_money,
|
||||
other_money_list, other_money_item, account_day,
|
||||
status, link_number, tenant_id,
|
||||
delete_flag)
|
||||
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{subType,jdbcType=VARCHAR},
|
||||
#{defaultNumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{operTime,jdbcType=TIMESTAMP}, #{organId,jdbcType=BIGINT}, #{handsPersonId,jdbcType=BIGINT},
|
||||
#{creator,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{changeAmount,jdbcType=DECIMAL},
|
||||
#{totalPrice,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR}, #{billType,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}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
|
||||
)
|
||||
#{remark,jdbcType=VARCHAR}, #{fileName,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}, #{tenantId,jdbcType=BIGINT},
|
||||
#{deleteFlag,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotHead">
|
||||
insert into jsh_depot_head
|
||||
@@ -203,6 +204,9 @@
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
<if test="fileName != null">
|
||||
file_name,
|
||||
</if>
|
||||
<if test="salesMan != null">
|
||||
sales_man,
|
||||
</if>
|
||||
@@ -295,6 +299,9 @@
|
||||
<if test="remark != null">
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="fileName != null">
|
||||
#{fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="salesMan != null">
|
||||
#{salesMan,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -396,6 +403,9 @@
|
||||
<if test="record.remark != null">
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.fileName != null">
|
||||
file_name = #{record.fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.salesMan != null">
|
||||
sales_man = #{record.salesMan,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -461,6 +471,7 @@
|
||||
pay_type = #{record.payType,jdbcType=VARCHAR},
|
||||
bill_type = #{record.billType,jdbcType=VARCHAR},
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
file_name = #{record.fileName,jdbcType=VARCHAR},
|
||||
sales_man = #{record.salesMan,jdbcType=VARCHAR},
|
||||
account_id_list = #{record.accountIdList,jdbcType=VARCHAR},
|
||||
account_money_list = #{record.accountMoneyList,jdbcType=VARCHAR},
|
||||
@@ -527,6 +538,9 @@
|
||||
<if test="remark != null">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="fileName != null">
|
||||
file_name = #{fileName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="salesMan != null">
|
||||
sales_man = #{salesMan,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -589,6 +603,7 @@
|
||||
pay_type = #{payType,jdbcType=VARCHAR},
|
||||
bill_type = #{billType,jdbcType=VARCHAR},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
file_name = #{fileName,jdbcType=VARCHAR},
|
||||
sales_man = #{salesMan,jdbcType=VARCHAR},
|
||||
account_id_list = #{accountIdList,jdbcType=VARCHAR},
|
||||
account_money_list = #{accountMoneyList,jdbcType=VARCHAR},
|
||||
|
||||
@@ -448,4 +448,57 @@
|
||||
</if>
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
<select id="debtList" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
|
||||
select distinct dh.*, s.supplier OrganName, u.username userName
|
||||
from jsh_depot_head dh
|
||||
left join jsh_supplier s on dh.organ_id=s.id and ifnull(s.delete_Flag,'0') !='1'
|
||||
left join jsh_user u on dh.creator=u.id and ifnull(u.Status,'0') ='0'
|
||||
left join jsh_depot_item di on dh.id = di.header_id and ifnull(di.delete_flag,'0') !='1'
|
||||
left join jsh_material m on di.material_id = m.id and ifnull(m.delete_flag,'0') !='1'
|
||||
where 1=1
|
||||
<if test="organId != null">
|
||||
and dh.organ_id = #{organId}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and dh.type=#{type}
|
||||
</if>
|
||||
<if test="subType != null">
|
||||
and dh.sub_type=#{subType}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and dh.status =#{status}
|
||||
</if>
|
||||
<if test="number != null">
|
||||
<bind name="bindNumber" value="'%'+number+'%'"/>
|
||||
and dh.number like #{bindNumber}
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and dh.oper_time >= #{beginTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and dh.oper_time <= #{endTime}
|
||||
</if>
|
||||
<if test="materialParam != null and materialParam !=''">
|
||||
<bind name="bindKey" value="'%'+materialParam+'%'"/>
|
||||
and (m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
|
||||
</if>
|
||||
<if test="depotArray != null and depotArray !=''">
|
||||
and di.depot_id in (
|
||||
<foreach collection="depotArray" item="depotId" separator=",">
|
||||
#{depotId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="creatorArray != null">
|
||||
and dh.creator in (
|
||||
<foreach collection="creatorArray" item="creator" separator=",">
|
||||
#{creator}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
and abs(dh.change_amount) < dh.discount_last_money
|
||||
and ifnull(dh.delete_flag,'0') !='1'
|
||||
order by dh.id desc
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user