| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631 |
- <?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.goafanti.common.dao.TOrderInvoiceMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderInvoice">
- <id column="id" jdbcType="INTEGER" property="id" />
- <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
- <result column="type" jdbcType="INTEGER" property="type" />
- <result column="status" jdbcType="INTEGER" property="status" />
- <result column="reject_reason" jdbcType="VARCHAR" property="rejectReason" />
- <result column="remarks" jdbcType="VARCHAR" property="remarks" />
- <result column="invoice_type" jdbcType="INTEGER" property="invoiceType" />
- <result column="unit_name" jdbcType="VARCHAR" property="unitName" />
- <result column="tax_number" jdbcType="VARCHAR" property="taxNumber" />
- <result column="amount" jdbcType="DECIMAL" property="amount" />
- <result column="banks" jdbcType="VARCHAR" property="banks" />
- <result column="content" jdbcType="VARCHAR" property="content" />
- <result column="unit_address" jdbcType="VARCHAR" property="unitAddress" />
- <result column="invoice_remarks" jdbcType="VARCHAR" property="invoiceRemarks" />
- <result column="unit_mobile" jdbcType="VARCHAR" property="unitMobile" />
- <result column="voucher_url" jdbcType="VARCHAR" property="voucherUrl" />
- <result column="post" jdbcType="INTEGER" property="post" />
- <result column="addressee" jdbcType="VARCHAR" property="addressee" />
- <result column="addressee_mobile" jdbcType="VARCHAR" property="addresseeMobile" />
- <result column="addressee_province" jdbcType="INTEGER" property="addresseeProvince" />
- <result column="addressee_city" jdbcType="INTEGER" property="addresseeCity" />
- <result column="addressee_area" jdbcType="INTEGER" property="addresseeArea" />
- <result column="recipient_address" jdbcType="VARCHAR" property="recipientAddress" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="approval" jdbcType="INTEGER" property="approval" />
- <result column="already_amount" jdbcType="DECIMAL" property="alreadyAmount" />
- <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
- </resultMap>
- <sql id="Base_Column_List">
- id, order_no, `type`, `status`, reject_reason, remarks, invoice_type, unit_name,
- tax_number, amount, banks, content, unit_address, invoice_remarks, unit_mobile, voucher_url,
- post, addressee, addressee_mobile, addressee_province, addressee_city, addressee_area,
- recipient_address, create_time, update_time, approval, already_amount, examine_name
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from t_order_invoice
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
- delete from t_order_invoice
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderInvoice" useGeneratedKeys="true">
- insert into t_order_invoice (order_no, `type`, `status`,
- reject_reason, remarks, invoice_type,
- unit_name, tax_number, amount,
- banks, content, unit_address,
- invoice_remarks, unit_mobile, voucher_url,
- post, addressee, addressee_mobile,
- addressee_province, addressee_city, addressee_area,
- recipient_address, create_time, update_time,
- approval, already_amount, examine_name
- )
- values (#{orderNo,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
- #{rejectReason,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{invoiceType,jdbcType=INTEGER},
- #{unitName,jdbcType=VARCHAR}, #{taxNumber,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL},
- #{banks,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{unitAddress,jdbcType=VARCHAR},
- #{invoiceRemarks,jdbcType=VARCHAR}, #{unitMobile,jdbcType=VARCHAR}, #{voucherUrl,jdbcType=VARCHAR},
- #{post,jdbcType=INTEGER}, #{addressee,jdbcType=VARCHAR}, #{addresseeMobile,jdbcType=VARCHAR},
- #{addresseeProvince,jdbcType=INTEGER}, #{addresseeCity,jdbcType=INTEGER}, #{addresseeArea,jdbcType=INTEGER},
- #{recipientAddress,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
- #{approval,jdbcType=INTEGER}, #{alreadyAmount,jdbcType=DECIMAL}, #{examineName,jdbcType=VARCHAR}
- )
- </insert>
- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderInvoice" useGeneratedKeys="true">
- insert into t_order_invoice
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="orderNo != null">
- order_no,
- </if>
- <if test="type != null">
- `type`,
- </if>
- <if test="status != null">
- `status`,
- </if>
- <if test="rejectReason != null">
- reject_reason,
- </if>
- <if test="remarks != null">
- remarks,
- </if>
- <if test="invoiceType != null">
- invoice_type,
- </if>
- <if test="unitName != null">
- unit_name,
- </if>
- <if test="taxNumber != null">
- tax_number,
- </if>
- <if test="amount != null">
- amount,
- </if>
- <if test="banks != null">
- banks,
- </if>
- <if test="content != null">
- content,
- </if>
- <if test="unitAddress != null">
- unit_address,
- </if>
- <if test="invoiceRemarks != null">
- invoice_remarks,
- </if>
- <if test="unitMobile != null">
- unit_mobile,
- </if>
- <if test="voucherUrl != null">
- voucher_url,
- </if>
- <if test="post != null">
- post,
- </if>
- <if test="addressee != null">
- addressee,
- </if>
- <if test="addresseeMobile != null">
- addressee_mobile,
- </if>
- <if test="addresseeProvince != null">
- addressee_province,
- </if>
- <if test="addresseeCity != null">
- addressee_city,
- </if>
- <if test="addresseeArea != null">
- addressee_area,
- </if>
- <if test="recipientAddress != null">
- recipient_address,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="updateTime != null">
- update_time,
- </if>
- <if test="approval != null">
- approval,
- </if>
- <if test="alreadyAmount != null">
- already_amount,
- </if>
- <if test="examineName != null">
- examine_name,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="orderNo != null">
- #{orderNo,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- #{type,jdbcType=INTEGER},
- </if>
- <if test="status != null">
- #{status,jdbcType=INTEGER},
- </if>
- <if test="rejectReason != null">
- #{rejectReason,jdbcType=VARCHAR},
- </if>
- <if test="remarks != null">
- #{remarks,jdbcType=VARCHAR},
- </if>
- <if test="invoiceType != null">
- #{invoiceType,jdbcType=INTEGER},
- </if>
- <if test="unitName != null">
- #{unitName,jdbcType=VARCHAR},
- </if>
- <if test="taxNumber != null">
- #{taxNumber,jdbcType=VARCHAR},
- </if>
- <if test="amount != null">
- #{amount,jdbcType=DECIMAL},
- </if>
- <if test="banks != null">
- #{banks,jdbcType=VARCHAR},
- </if>
- <if test="content != null">
- #{content,jdbcType=VARCHAR},
- </if>
- <if test="unitAddress != null">
- #{unitAddress,jdbcType=VARCHAR},
- </if>
- <if test="invoiceRemarks != null">
- #{invoiceRemarks,jdbcType=VARCHAR},
- </if>
- <if test="unitMobile != null">
- #{unitMobile,jdbcType=VARCHAR},
- </if>
- <if test="voucherUrl != null">
- #{voucherUrl,jdbcType=VARCHAR},
- </if>
- <if test="post != null">
- #{post,jdbcType=INTEGER},
- </if>
- <if test="addressee != null">
- #{addressee,jdbcType=VARCHAR},
- </if>
- <if test="addresseeMobile != null">
- #{addresseeMobile,jdbcType=VARCHAR},
- </if>
- <if test="addresseeProvince != null">
- #{addresseeProvince,jdbcType=INTEGER},
- </if>
- <if test="addresseeCity != null">
- #{addresseeCity,jdbcType=INTEGER},
- </if>
- <if test="addresseeArea != null">
- #{addresseeArea,jdbcType=INTEGER},
- </if>
- <if test="recipientAddress != null">
- #{recipientAddress,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="approval != null">
- #{approval,jdbcType=INTEGER},
- </if>
- <if test="alreadyAmount != null">
- #{alreadyAmount,jdbcType=DECIMAL},
- </if>
- <if test="examineName != null">
- #{examineName,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderInvoice">
- update t_order_invoice
- <set>
- <if test="orderNo != null">
- order_no = #{orderNo,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- `type` = #{type,jdbcType=INTEGER},
- </if>
- <if test="status != null">
- `status` = #{status,jdbcType=INTEGER},
- </if>
- <if test="rejectReason != null">
- reject_reason = #{rejectReason,jdbcType=VARCHAR},
- </if>
- <if test="remarks != null">
- remarks = #{remarks,jdbcType=VARCHAR},
- </if>
- <if test="invoiceType != null">
- invoice_type = #{invoiceType,jdbcType=INTEGER},
- </if>
- <if test="unitName != null">
- unit_name = #{unitName,jdbcType=VARCHAR},
- </if>
- <if test="taxNumber != null">
- tax_number = #{taxNumber,jdbcType=VARCHAR},
- </if>
- <if test="amount != null">
- amount = #{amount,jdbcType=DECIMAL},
- </if>
- <if test="banks != null">
- banks = #{banks,jdbcType=VARCHAR},
- </if>
- <if test="content != null">
- content = #{content,jdbcType=VARCHAR},
- </if>
- <if test="unitAddress != null">
- unit_address = #{unitAddress,jdbcType=VARCHAR},
- </if>
- <if test="invoiceRemarks != null">
- invoice_remarks = #{invoiceRemarks,jdbcType=VARCHAR},
- </if>
- <if test="unitMobile != null">
- unit_mobile = #{unitMobile,jdbcType=VARCHAR},
- </if>
- <if test="voucherUrl != null">
- voucher_url = #{voucherUrl,jdbcType=VARCHAR},
- </if>
- <if test="post != null">
- post = #{post,jdbcType=INTEGER},
- </if>
- <if test="addressee != null">
- addressee = #{addressee,jdbcType=VARCHAR},
- </if>
- <if test="addresseeMobile != null">
- addressee_mobile = #{addresseeMobile,jdbcType=VARCHAR},
- </if>
- <if test="addresseeProvince != null">
- addressee_province = #{addresseeProvince,jdbcType=INTEGER},
- </if>
- <if test="addresseeCity != null">
- addressee_city = #{addresseeCity,jdbcType=INTEGER},
- </if>
- <if test="addresseeArea != null">
- addressee_area = #{addresseeArea,jdbcType=INTEGER},
- </if>
- <if test="recipientAddress != null">
- recipient_address = #{recipientAddress,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="approval != null">
- approval = #{approval,jdbcType=INTEGER},
- </if>
- <if test="alreadyAmount != null">
- already_amount = #{alreadyAmount,jdbcType=DECIMAL},
- </if>
- <if test="examineName != null">
- examine_name = #{examineName,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderInvoice">
- update t_order_invoice
- set order_no = #{orderNo,jdbcType=VARCHAR},
- `type` = #{type,jdbcType=INTEGER},
- `status` = #{status,jdbcType=INTEGER},
- reject_reason = #{rejectReason,jdbcType=VARCHAR},
- remarks = #{remarks,jdbcType=VARCHAR},
- invoice_type = #{invoiceType,jdbcType=INTEGER},
- unit_name = #{unitName,jdbcType=VARCHAR},
- tax_number = #{taxNumber,jdbcType=VARCHAR},
- amount = #{amount,jdbcType=DECIMAL},
- banks = #{banks,jdbcType=VARCHAR},
- content = #{content,jdbcType=VARCHAR},
- unit_address = #{unitAddress,jdbcType=VARCHAR},
- invoice_remarks = #{invoiceRemarks,jdbcType=VARCHAR},
- unit_mobile = #{unitMobile,jdbcType=VARCHAR},
- voucher_url = #{voucherUrl,jdbcType=VARCHAR},
- post = #{post,jdbcType=INTEGER},
- addressee = #{addressee,jdbcType=VARCHAR},
- addressee_mobile = #{addresseeMobile,jdbcType=VARCHAR},
- addressee_province = #{addresseeProvince,jdbcType=INTEGER},
- addressee_city = #{addresseeCity,jdbcType=INTEGER},
- addressee_area = #{addresseeArea,jdbcType=INTEGER},
- recipient_address = #{recipientAddress,jdbcType=VARCHAR},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- approval = #{approval,jdbcType=INTEGER},
- already_amount = #{alreadyAmount,jdbcType=DECIMAL},
- examine_name = #{examineName,jdbcType=VARCHAR}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <select id="checkApplyAmount" resultType="java.lang.String">
- select ifnull(sum(amount),0) from t_order_invoice
- where order_no= #{orderNo,jdbcType=VARCHAR} and status in (0,1,2,3)
- <if test="id != null">
- and id != #{id,jdbcType=INTEGER}
- </if>
- </select>
- <select id="financeOrderInvoiceList" resultType="com.goafanti.order.bo.TOrderInvoiceBo">
- select a.id,a.unit_name as unitName,a.order_no as orderNo,c.name,b.project_status as projectStatus,a.amount,a.approval,b.contract_no contractNo,
- ifnull(d.sumAmount,0) as sumAmount, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')as createTime ,a.status,b.process_status processStatus,
- b.settlement_amount as settlementAmount, (b.total_amount-b.settlement_amount) as notAmount,tm.buyer_name userName
- from t_order_invoice a
- left join t_order_new b on a.order_no=b.order_no left join admin c on b.salesman_id=c.id
- left join (select order_no,sum(amount)as sumAmount from t_order_invoice where status =2 group by order_no) d
- on a.order_no=d.order_no left join department e on b.order_dep=e.id
- left join t_order_mid tm on a.order_no =tm.order_no
- where b.delete_sign in (0,2)
- <if test="all ==0">
- and a.status in (1,2)
- and a.approval in (0,2)
- </if>
- <if test="all ==1">
- and a.status in (1,2,3)
- </if>
- <if test="type !=null">
- and a.`type`= #{type,jdbcType=INTEGER}
- </if>
- <if test="status == 1">
- and a.status=1
- </if>
- <if test="orderNo !=null">
- and a.order_no = #{orderNo,jdbcType=VARCHAR}
- </if>
- <if test="contractNo != null">
- and b.contract_no like concat('%',#{contractNo},'%')
- </if>
- <if test="userName != null">
- and tm.buyer_name like concat('%',#{userName},'%')
- </if>
- <if test="invoiceType != null">
- and a.status =#{invoiceType}
- </if>
- <if test="startTime != null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- <if test="name !=null">
- and c.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="deps !=null">
- and b.order_dep in
- <foreach close=")" collection="deps" item="depId" open="(" separator=",">
- #{depId}
- </foreach>
- </if>
- <if test="status !=null">
- and a.status= #{status,jdbcType=INTEGER}
- </if>
- <if test="approval !=null">
- and a.approval= #{approval,jdbcType=INTEGER}
- </if>
- <if test="aDep !=null">
- and b.order_dep in
- <foreach collection="aDep" index="index" item="depid" open="(" separator="," close=")">
- #{depid}
- </foreach>
- </if>
- order by a.status ,a.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="financeOrderInvoiceCount" resultType="java.lang.Integer">
- select count(*) from t_order_invoice a
- left join t_order_new b on a.order_no=b.order_no
- left join admin c on b.salesman_id=c.id
- left join department e on b.order_dep=e.id
- left join t_order_mid tm on a.order_no =tm.order_no
- where b.delete_sign in (0,2)
- <if test="all ==0">
- and a.status in (1,2)
- and a.approval in (0,2)
- </if>
- <if test="all ==1">
- and a.status in (1,2,3)
- </if>
- <if test="type !=null">
- and a.`type`= #{type,jdbcType=INTEGER}
- </if>
- <if test="status == 1">
- and a.status=1
- </if>
- <if test="orderNo !=null">
- and a.order_no = #{orderNo,jdbcType=VARCHAR}
- </if>
- <if test="contractNo != null">
- and b.contract_no like concat('%',#{contractNo},'%')
- </if>
- <if test="userName != null">
- and tm.buyer_name like concat('%',#{userName},'%')
- </if>
- <if test="invoiceType != null">
- and a.status =#{invoiceType}
- </if>
- <if test="startTime != null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- <if test="name !=null">
- and c.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="deps !=null">
- and b.order_dep in
- <foreach close=")" collection="deps" item="depId" open="(" separator=",">
- #{depId}
- </foreach>
- </if>
- <if test="status !=null">
- and a.status= #{status,jdbcType=INTEGER}
- </if>
- <if test="approval !=null">
- and a.approval= #{approval,jdbcType=INTEGER}
- </if>
- <if test="aDep !=null">
- and b.order_dep in
- <foreach collection="aDep" index="index" item="depid" open="(" separator="," close=")">
- #{depid}
- </foreach>
- </if>
- </select>
- <select id="salesmanOrderInvoiceList" resultType="com.goafanti.order.bo.TOrderInvoiceBo">
- select a.id ,a.order_no as orderNo,b.contract_no contractNo,a.amount,date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
- a.reject_reason as rejectReason,a.status ,a.approval,a.examine_name examineName
- from t_order_invoice a left join t_order_new b on a.order_no=b.order_no
- where a.status in (0,1,2,3)
- <if test="orderNo !=null">
- and a.order_no = #{orderNo,jdbcType=VARCHAR}
- </if>
- order by a.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="salesmanOrderInvoiceCount" resultType="java.lang.Integer">
- select count(*) from t_order_invoice where status in (0,1,2,3)
- <if test="orderNo !=null">
- and order_no = #{orderNo,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="approvalOrderInvoiceList" resultType="com.goafanti.order.bo.TOrderInvoiceBo">
- select a.id,a.unit_name as unitName,a.order_no as orderNo,c.name,b.project_status as projectStatus,a.amount,b.process_status processStatus,
- ifnull(d.sumAmount,0) as sumAmount, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')as createTime ,a.status, a.approval,
- b.settlement_amount as settlementAmount, (b.total_amount-b.settlement_amount) as notAmount from t_order_invoice a
- left join t_order_new b on a.order_no=b.order_no left join admin c on b.salesman_id=c.id
- left join (select order_no,sum(amount)as sumAmount from t_order_invoice where status =2 group by order_no) d
- on a.order_no=d.order_no where b.delete_sign in (0,2)
- <if test="status ==null">
- and a.status in(1,2)
- </if>
- <if test="status != null">
- and a.status = #{status,jdbcType=INTEGER}
- </if>
- <if test="approval ==null and special==null">
- and a.approval in(1,2)
- </if>
- <if test="approval != null">
- and a.approval = #{approval,jdbcType=INTEGER}
- </if>
- <if test="type !=null">
- and a.type= #{type,jdbcType=INTEGER}
- </if>
- <if test="orderNo !=null">
- and a.order_no = #{orderNo,jdbcType=VARCHAR}
- </if>
- <if test="name !=null">
- and c.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="userName !=null">
- and a.unit_name like CONCAT('%',#{userName,jdbcType=VARCHAR},'%')
- </if>
- <if test="orderDep !=null">
- and b.order_dep= #{orderDep,jdbcType=VARCHAR}
- </if>
- <if test="aDep !=null">
- and c.department_id= #{aDep,jdbcType=VARCHAR}
- </if>
- order by a.approval,a.status,a.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="approvalOrderInvoiceCount" resultType="java.lang.Integer">
- select count(*) from t_order_invoice a
- left join t_order_new b on a.order_no=b.order_no left join admin c on b.salesman_id=c.id
- where b.delete_sign in (0,2)
- <if test="status ==null">
- and a.status in(1,2)
- </if>
- <if test="status != null">
- and a.status = #{status,jdbcType=INTEGER}
- </if>
- <if test="approval ==null and special==null">
- and a.approval in(1,2)
- </if>
- <if test="approval != null">
- and a.approval = #{approval,jdbcType=INTEGER}
- </if>
- <if test="type !=null">
- and a.type= #{type,jdbcType=INTEGER}
- </if>
- <if test="orderNo !=null">
- and a.order_no = #{orderNo,jdbcType=VARCHAR}
- </if>
- <if test="name !=null">
- and c.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="userName !=null">
- and a.unit_name like CONCAT('%',#{userName,jdbcType=VARCHAR},'%')
- </if>
- <if test="orderDep !=null">
- and b.order_dep= #{orderDep,jdbcType=VARCHAR}
- </if>
- <if test="aDep !=null">
- and c.department_id= #{aDep,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="selectByInvoiceDitails" parameterType="java.lang.Integer" resultType="com.goafanti.order.bo.TOrderInvoiceDetails">
- select a.id ,a.order_no as orderNo,a.`type`,a.status,a.reject_reason as rejectReason,a.remarks,a.invoice_type as invoiceType,
- a.unit_name as unitName,a.tax_number as taxNumber,a.amount,a.banks,a.content,a.unit_address as unitAddress,
- a.invoice_remarks as invoiceRemarks,a.unit_mobile as unitMobile,a.voucher_url as voucherUrl ,a.post,a.addressee,
- a.addressee_area as addresseeArea,a.addressee_city as addresseeCity,a.addressee_province as addresseeProvince,
- a.addressee_mobile as addresseeMobile,a.recipient_address as recipientAddress,a.create_time,a.update_time,a.approval,
- a.already_amount as alreadyAmount,b.contract_no as contractNo from t_order_invoice a
- left join t_order_new b on a.order_no=b.order_no
- where id = #{id,jdbcType=INTEGER}
- </select>
- <select id="getInvoiceDetails" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderInvoiceDetails">
- select a.id ,a.order_no as orderNo,a.`type`,a.status,a.reject_reason as rejectReason,a.remarks,a.invoice_type as invoiceType,
- a.unit_name as unitName,a.tax_number as taxNumber,a.amount,a.banks,a.content,a.unit_address as unitAddress,
- a.invoice_remarks as invoiceRemarks,a.unit_mobile as unitMobile,a.voucher_url as voucherUrl ,a.post,a.addressee,
- a.addressee_area as addresseeArea,a.addressee_city as addresseeCity,a.addressee_province as addresseeProvince,
- a.addressee_mobile as addresseeMobile,a.recipient_address as recipientAddress,a.create_time,a.update_time,a.approval,
- a.already_amount as alreadyAmount,b.contract_no as contractNo from t_order_invoice a
- left join t_order_new b on a.order_no=b.order_no
- where a.order_no= #{orderNo,jdbcType=VARCHAR}
- and a.create_time=(select max(create_time) from t_order_invoice where order_no= #{orderNo,jdbcType=VARCHAR})
- </select>
- <select id="conutAmountByOrderNo" resultType="java.math.BigDecimal">
- select ifnull(sum(a.amount),0) amount from t_order_invoice a
- where a.status=2 and a.order_no= #{orderNo,jdbcType=VARCHAR}
- </select>
- <select id="selectByOrderNo" resultType="com.goafanti.order.bo.InvoiceBo">
- select date_format(a.create_time,'%Y-%m-%d %H:%i:%S') createTime,a.amount from t_order_invoice a
- where a.status=2 and a.order_no= #{orderNo,jdbcType=VARCHAR}
- </select>
- <select id="selectInvoiceLog" resultType="com.goafanti.order.bo.OutInvoiceLog">
- select a.id,a.invoice_id invoiceId ,a.status,a.aid,a.create_time createTime,
- b.name adminName,date_format(a.create_time,'%Y-%m-%d %H:%i:%S')as createTimes
- from invoice_log a left join admin b on a.aid =b.id
- where a.invoice_id =#{id} order by a.create_time
- </select>
- </mapper>
|