Commit 87cd2402 authored by lizhichao's avatar lizhichao

计算应收、应付、账户总额

parent 341a4ad4
......@@ -13,6 +13,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isDel" column="is_del" />
<result property="remark" column="remark" />
<result property="deptName" column="dept_name"/>
<result property="payableTotalAmount" column="payableTotalAmount"/>
<result property="incomeAbleTotalAmount" column="incomeAbleTotalAmount"/>
<result property="totalAmount" column="totalAmount"/>
</resultMap>
<sql id="selectTAccountVo">
......@@ -20,12 +23,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectTAccountList" parameterType="TAccount" resultMap="TAccountResult">
<include refid="selectTAccountVo"/>
select tt.*,(able_amount+incomeAbleTotalAmount- payableTotalAmount) as totalAmount from(
select account_id, dept_id AS deptId , able_amount, IFNULL((select sum(pending_payment) from t_trade_project where trade_status=5 and apply_dept_id =t.dept_id ),0)incomeAbleTotalAmount,IFNULL((select sum(pending_payment) from t_trade_project where trade_status=5 and trade_dept_id =t.dept_id ),0)payableTotalAmount, create_time, update_time, is_del, remark,(SELECT dept.dept_name FROM sys_dept dept WHERE dept.dept_id = deptId)AS dept_name from t_account t
<where>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="ableAmount != null "> and able_amount = #{ableAmount}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="deptId != null "> and t.dept_id = #{deptId}</if>
<if test="ableAmount != null "> and t.able_amount = #{ableAmount}</if>
<if test="isDel != null and isDel != ''"> and t.is_del = #{isDel}</if>
</where>
) tt
</select>
<select id="selectTAccountById" parameterType="Long" resultMap="TAccountResult">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment