|
@@ -0,0 +1,300 @@
|
|
|
+<?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.ruoyi.orderManagement.finance.mapper.FTmsaccbillsMapper">
|
|
|
+
|
|
|
+ <resultMap type="FTmsaccbills" id="FTmsaccbillsResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="accYear" column="acc_year" />
|
|
|
+ <result property="accMonth" column="acc_month" />
|
|
|
+ <result property="actId" column="act_id" />
|
|
|
+ <result property="billNo" column="bill_no" />
|
|
|
+ <result property="corpId" column="corp_id" />
|
|
|
+ <result property="transactId" column="transact_id" />
|
|
|
+ <result property="fromDate" column="from_date" />
|
|
|
+ <result property="toDate" column="to_date" />
|
|
|
+ <result property="amt" column="amt" />
|
|
|
+ <result property="refNo" column="ref_no" />
|
|
|
+ <result property="postDate" column="post_date" />
|
|
|
+ <result property="billStatus" column="bill_status" />
|
|
|
+ <result property="delFlag" column="del_flag" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="remarks" column="remarks" />
|
|
|
+ <result property="fCtrlcorpid" column="f_ctrlcorpid" />
|
|
|
+ <result property="tMblno" column="t_mblno" />
|
|
|
+ <result property="fBilltype" column="f_billtype" />
|
|
|
+ <result property="fAccbilldate" column="f_accbilldate" />
|
|
|
+ <result property="fBillno" column="f_billno" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectFTmsaccbillsVo">
|
|
|
+ select id, acc_year, acc_month, act_id, bill_no, corp_id, transact_id, from_date, to_date, amt, ref_no, post_date, bill_status, del_flag, create_by, create_time, update_by, update_time, remarks ,
|
|
|
+ f_ctrlcorpid ,t_mblno ,f_billtype,f_accbilldate,f_billno from F_TMSACCBILLS
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectFTmsaccbillsList" parameterType="FTmsaccbills" resultMap="FTmsaccbillsResult">
|
|
|
+ <include refid="selectFTmsaccbillsVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="accYear != null "> and acc_year = #{accYear}</if>
|
|
|
+ <if test="accMonth != null "> and acc_month = #{accMonth}</if>
|
|
|
+ <if test="actId != null "> and act_id = #{actId}</if>
|
|
|
+ <if test="billNo != null and billNo != ''"> and bill_no = #{billNo}</if>
|
|
|
+ <if test="corpId != null "> and corp_id = #{corpId}</if>
|
|
|
+ <if test="transactId != null "> and transact_id = #{transactId}</if>
|
|
|
+ <if test="fromDate != null "> and from_date = #{fromDate}</if>
|
|
|
+ <if test="toDate != null "> and to_date = #{toDate}</if>
|
|
|
+ <if test="amt != null "> and amt = #{amt}</if>
|
|
|
+ <if test="refNo != null and refNo != ''"> and ref_no = #{refNo}</if>
|
|
|
+ <if test="postDate != null "> and post_date = #{postDate}</if>
|
|
|
+ <if test="billStatus != null "> and bill_status = #{billStatus}</if>
|
|
|
+ <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFTmsaccbillsById" parameterType="Long" resultMap="FTmsaccbillsResult">
|
|
|
+ <include refid="selectFTmsaccbillsVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <insert id="insertFTmsaccbills" parameterType="FTmsaccbills" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into F_TMSACCBILLS
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="accYear != null">acc_year,</if>
|
|
|
+ <if test="accMonth != null">acc_month,</if>
|
|
|
+ <if test="actId != null">act_id,</if>
|
|
|
+ <if test="billNo != null">bill_no,</if>
|
|
|
+ <if test="corpId != null">corp_id,</if>
|
|
|
+ <if test="transactId != null">transact_id,</if>
|
|
|
+ <if test="fromDate != null">from_date,</if>
|
|
|
+ <if test="toDate != null">to_date,</if>
|
|
|
+ <if test="amt != null">amt,</if>
|
|
|
+ <if test="refNo != null">ref_no,</if>
|
|
|
+ <if test="postDate != null">post_date,</if>
|
|
|
+ <if test="billStatus != null">bill_status,</if>
|
|
|
+ <if test="delFlag != null">del_flag,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="remarks != null">remarks,</if>
|
|
|
+ <if test="fCtrlcorpid != null">f_ctrlcorpid,</if>
|
|
|
+ <if test="tMblno != null">t_mblno,</if>
|
|
|
+ <if test="fBilltype != null">f_billtype,</if>
|
|
|
+ <if test="fAccbilldate != null">f_accbilldate,</if>
|
|
|
+ <if test="fBillno != null">f_billno,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="accYear != null">#{accYear},</if>
|
|
|
+ <if test="accMonth != null">#{accMonth},</if>
|
|
|
+ <if test="actId != null">#{actId},</if>
|
|
|
+ <if test="billNo != null">#{billNo},</if>
|
|
|
+ <if test="corpId != null">#{corpId},</if>
|
|
|
+ <if test="transactId != null">#{transactId},</if>
|
|
|
+ <if test="fromDate != null">#{fromDate},</if>
|
|
|
+ <if test="toDate != null">#{toDate},</if>
|
|
|
+ <if test="amt != null">#{amt},</if>
|
|
|
+ <if test="refNo != null">#{refNo},</if>
|
|
|
+ <if test="postDate != null">#{postDate},</if>
|
|
|
+ <if test="billStatus != null">#{billStatus},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="remarks != null">#{remarks},</if>
|
|
|
+ <if test="fCtrlcorpid != null">#{fCtrlcorpid},</if>
|
|
|
+ <if test="tMblno != null">#{tMblno},</if>
|
|
|
+ <if test="fBilltype != null">#{fBilltype},</if>
|
|
|
+ <if test="fAccbilldate != null">#{fAccbilldate},</if>
|
|
|
+ <if test="fBillno != null">#{fBillno},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateFTmsaccbills" parameterType="FTmsaccbills">
|
|
|
+ update F_TMSACCBILLS
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="accYear != null">acc_year = #{accYear},</if>
|
|
|
+ <if test="accMonth != null">acc_month = #{accMonth},</if>
|
|
|
+ <if test="actId != null">act_id = #{actId},</if>
|
|
|
+ <if test="billNo != null">bill_no = #{billNo},</if>
|
|
|
+ <if test="corpId != null">corp_id = #{corpId},</if>
|
|
|
+ <if test="transactId != null">transact_id = #{transactId},</if>
|
|
|
+ <if test="fromDate != null">from_date = #{fromDate},</if>
|
|
|
+ <if test="toDate != null">to_date = #{toDate},</if>
|
|
|
+ <if test="amt != null">amt = #{amt},</if>
|
|
|
+ <if test="refNo != null">ref_no = #{refNo},</if>
|
|
|
+ <if test="postDate != null">post_date = #{postDate},</if>
|
|
|
+ <if test="billStatus != null">bill_status = #{billStatus},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="remarks != null">remarks = #{remarks},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteFTmsaccbillsById" parameterType="Long">
|
|
|
+ delete from F_TMSACCBILLS where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteFTmsaccbillsByIds" parameterType="String">
|
|
|
+ delete from F_TMSACCBILLS where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="fTmsaccbillsListAccamount" resultType="java.util.Map">
|
|
|
+ SELECT
|
|
|
+ w.f_id AS fSrcid,
|
|
|
+ t.id AS fSrcpid,
|
|
|
+ t.corp_id AS fCorpid,
|
|
|
+ c.f_name AS fName,
|
|
|
+ w.fName AS fFeesName,
|
|
|
+ w.f_mblno AS fMblno,
|
|
|
+ w.f_product_name AS fProductName,
|
|
|
+ w.f_bsdate AS fBsdate,
|
|
|
+ t.bill_type AS fBilltype,
|
|
|
+ w.f_review_date AS fReviewDate,
|
|
|
+ w.f_marks AS fMarks,
|
|
|
+ w.f_feeid AS fFeeid,
|
|
|
+ w.f_billtype AS fBilltype,
|
|
|
+ w.f_chargedate AS fChargedate,
|
|
|
+ w.f_originalbilldate AS fOriginalbilldate,
|
|
|
+ w.f_billing_deadline AS fBillingDeadline,
|
|
|
+ w.f_billing_days AS fBillingDays,
|
|
|
+ w.f_inventory_days AS fInventoryDays,
|
|
|
+ f.f_name AS fFeeName,
|
|
|
+ w.f_dc AS fSrcdc,
|
|
|
+ ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
|
|
|
+ ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
|
|
|
+ w.f_qty AS fQty,
|
|
|
+ w.f_unitprice AS fUnitprice
|
|
|
+ FROM
|
|
|
+ f_tmsorderbills t
|
|
|
+ LEFT JOIN t_corps c ON c.f_id = t.corp_id
|
|
|
+ LEFT JOIN f_tmsorderbillscars car ON car.p_id = t.id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ f.f_id,
|
|
|
+ f.f_pid,
|
|
|
+ f.act_id,
|
|
|
+ f.org_id,
|
|
|
+ f.f_lineno,
|
|
|
+ f.f_corpid,
|
|
|
+ f.f_feeid,
|
|
|
+ f.f_feeUnitid,
|
|
|
+ f.f_qty,
|
|
|
+ f.f_unitprice,
|
|
|
+ f.f_amount,
|
|
|
+ f.f_currency,
|
|
|
+ f.f_exrate,
|
|
|
+ f.f_taxrate,
|
|
|
+ f.f_dc,
|
|
|
+ f.f_review_date,
|
|
|
+ f.f_billstatus,
|
|
|
+ f.f_statement_no,
|
|
|
+ f.f_accamount,
|
|
|
+ f.f_accamount_date,
|
|
|
+ f.f_stlamount_no,
|
|
|
+ f.f_stlamount,
|
|
|
+ f.f_stlamount_date,
|
|
|
+ f.f_invnos,
|
|
|
+ f.f_invamount,
|
|
|
+ f.f_askamount,
|
|
|
+ f.f_status,
|
|
|
+ f.del_flag,
|
|
|
+ f.create_by,
|
|
|
+ f.update_by,
|
|
|
+ f.create_time,
|
|
|
+ f.update_time,
|
|
|
+ f.remark,
|
|
|
+ f.src_id,
|
|
|
+ f.src_bill_no,
|
|
|
+ f.f_mblno,
|
|
|
+ f.f_product_name,
|
|
|
+ f.f_marks,
|
|
|
+ f.f_chargedate,
|
|
|
+ f.f_billing_deadline,
|
|
|
+ f.f_inventory_days,
|
|
|
+ f.f_amt,
|
|
|
+ f.f_billing_days,
|
|
|
+ f.f_billing_qty,
|
|
|
+ f.f_billtype,
|
|
|
+ f.f_billingway,
|
|
|
+ f.f_bsdate,
|
|
|
+ f.f_originalbilldate,
|
|
|
+ f.f_stltypeid,
|
|
|
+ f.remarks,
|
|
|
+ c.f_id AS fId,
|
|
|
+ c.f_name AS fName
|
|
|
+ FROM
|
|
|
+ f_tmsorderbillsfees AS f
|
|
|
+ LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
|
|
|
+ ) w ON w.f_pid = car.id
|
|
|
+ LEFT JOIN t_fees f ON w.f_feeid = f.f_id
|
|
|
+ LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
|
|
|
+ <where>
|
|
|
+ dict.status = '0'
|
|
|
+ AND dict.dict_type = 'data_unitfees'
|
|
|
+ <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.corp_id = #{map.tWareHouseFees.fCorpid} </if>
|
|
|
+ <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid = #{map.tWareHouseFees.fToCorpid} </if>
|
|
|
+ <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like concat('%', #{map.tWareHouseFees.fMblno}, '%') </if>
|
|
|
+ <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%') </if>
|
|
|
+
|
|
|
+ <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
|
|
|
+ and w.f_accamount_date IS NOT NULL
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
|
|
|
+ and w.f_accamount_date IS NULL
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
|
|
|
+ and w.f_dc = #{map.tWareHouseFees.fDc}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
|
|
|
+ and w.f_dc = #{map.tWareHouseFees.fDc}
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
|
|
|
+ and w.f_feeid in
|
|
|
+ <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
|
|
|
+ and w.f_review_date >= #{map.tWareHouseFees.timeExamine[0]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
|
|
|
+ and w.f_review_date <= #{map.tWareHouseFees.timeExamine[1]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
|
|
|
+ and t.f_bsdate >= #{map.tWareHouseFees.timeInterval[0]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
|
|
|
+ and t.f_bsdate <= #{map.tWareHouseFees.timeInterval[1]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
|
|
|
+ and w.f_accamount_date >= #{map.tWareHouseFees.timeReconci[0]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
|
|
|
+ and w.f_accamount_date <= #{map.tWareHouseFees.timeReconci[1]}
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
|
|
|
+ and w.f_business_type in
|
|
|
+ <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ and w.f_review_date IS NOT NULL
|
|
|
+ and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) != 0
|
|
|
+ GROUP BY w.f_id
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+</mapper>
|