| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <?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.ydtech.modules.inv.dao.InvAccountMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.inv.model.InvAccount">
- <id property="accountId" column="account_id" jdbcType="BIGINT"/>
- <result property="accountName" column="account_name" jdbcType="VARCHAR"/>
- <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- <result property="outerFlag" column="outer_flag" jdbcType="CHAR"/>
- <result property="businessQuality" column="business_quality" jdbcType="CHAR"/>
- <result property="owned" column="owned" jdbcType="VARCHAR"/>
- <result property="juridicalPerson" column="juridical_person" jdbcType="VARCHAR"/>
- <result property="establishTime" column="establish_time" jdbcType="TIMESTAMP"/>
- <result property="biller" column="biller" jdbcType="VARCHAR"/>
- <result property="invoicingAmount" column="invoicing_amount" jdbcType="VARCHAR"/>
- <result property="invoicingAmountExcess" column="invoicing_amount_excess" jdbcType="VARCHAR"/>
- <result property="sumInvoicingAmount" column="sum_invoicing_amount" jdbcType="VARCHAR"/>
- <result property="tentativeEstimates" column="tentative_estimates" jdbcType="VARCHAR"/>
- <collection property="invAccountCardList" ofType="com.ydtech.modules.inv.model.InvAccountCard"
- resultMap="invAccountCardList"/>
- </resultMap>
- <resultMap id="invAccountCardList" type="com.ydtech.modules.inv.model.InvAccountCard">
- <result property="bankCardNum" column="bank_card_num" jdbcType="VARCHAR"/>
- <result property="accountId" column="account_id" jdbcType="VARCHAR"/>
- <result property="bankName" column="bank_name" jdbcType="VARCHAR"/>
- <result property="bank" column="bank" jdbcType="VARCHAR"/>
- <result property="bankNum" column="bank_num" jdbcType="VARCHAR"/>
- <result property="startCertExpirationDate" column="start_cert_expiration_date" jdbcType="TIMESTAMP"/>
- <result property="accountQuality" column="account_quality" jdbcType="CHAR"/>
- <result property="pubSingleLines" column="pub_single_lines" jdbcType="VARCHAR"/>
- <result property="priSingleLines" column="pri_single_lines" jdbcType="VARCHAR"/>
- <result property="pubYearLines" column="pub_year_lines" jdbcType="VARCHAR"/>
- <result property="priYearLines" column="pri_year_lines" jdbcType="VARCHAR"/>
- <result property="dayStrokeNum" column="day_stroke_num" jdbcType="VARCHAR"/>
- <result property="pubDayLines" column="pub_day_lines" jdbcType="VARCHAR"/>
- <result property="priDayLines" column="pri_day_lines" jdbcType="VARCHAR"/>
- <result property="pubYearExcess" column="pub_year_excess" jdbcType="VARCHAR"/>
- <result property="priYearExcess" column="pri_year_excess" jdbcType="VARCHAR"/>
- <result property="fiscalProfit" column="fiscal_profit" jdbcType="VARCHAR"/>
- <result property="insuranceProfit" column="insurance_profit" jdbcType="VARCHAR"/>
- <result property="clearingProfit" column="clearing_profit" jdbcType="VARCHAR"/>
- <result property="exteriorProfit" column="exterior_profit" jdbcType="VARCHAR"/>
- <result property="parkProfit" column="park_profit" jdbcType="VARCHAR"/>
- <result property="tianqinProfit" column="tianqin_profit" jdbcType="VARCHAR"/>
- <result property="otherProfit" column="other_profit" jdbcType="VARCHAR"/>
- <result property="endCertExpirationDate" column="end_cert_expiration_date" jdbcType="TIMESTAMP"/>
- <result property="balance" column="balance" jdbcType="VARCHAR"/>
- <result property="dayStrokeNumExcess" column="day_stroke_num_excess" jdbcType="VARCHAR"/>
- <result property="pubDayLinesExcess" column="pub_day_lines_excess" jdbcType="VARCHAR"/>
- <result property="priDayLinesExcess" column="pri_day_lines_excess" jdbcType="VARCHAR"/>
- <result property="spend" column="spend" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="Base_Column_List">
- a.account_id,
- a.account_name,
- a.create_by,
- a.create_time,
- a.update_by,
- a.update_time,
- a.outer_flag,
- a.del_flag,
- a.business_quality,
- a.owned,
- a.juridical_person,
- a.establish_time,
- a.biller,
- a.invoicing_amount,
- a.sum_invoicing_amount,
- a.tentative_estimates,
- ABS(sum(c.invoice_money) - 5000000) as invoicing_amount_excess,
- b.bank_card_num,
- b.bank_name,
- b.bank,
- b.bank_num,
- b.start_cert_expiration_date,
- b.end_cert_expiration_date,
- b.account_quality,
- b.pub_single_lines,
- b.pri_single_lines,
- b.pub_year_lines,
- b.pri_year_lines,
- b.day_stroke_num,
- b.pub_day_lines,
- b.pri_day_lines,
- b.pub_year_excess,
- b.pri_year_excess,
- b.fiscal_profit,
- b.insurance_profit,
- b.clearing_profit,
- b.exterior_profit,
- b.park_profit,
- b.tianqin_profit,
- b.other_profit,
- b.balance,
- b.day_stroke_num_excess,
- b.pub_day_lines_excess,
- b.pri_day_lines_excess,
- b.spend
- </sql>
- <select id="selectAccountsListPage" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from inv_account a
- left join inv_account_card b on a.account_id = b.account_id
- left join inv_account_incoice c on a.account_id = c.account_id
- <if test="account.invoiceTimeStart!= null">
- and c.invoice_time >= #{account.invoiceTimeStart}
- </if>
- <if test="account.invoiceTimeEnd!= null">
- and c.invoice_time <= #{account.invoiceTimeEnd}
- </if>
- where a.del_flag = '0'
- <if test="account.accountId != null and account.accountId != ''">
- and a.account_id like concat('%',#{account.accountId},'%')
- </if>
- <if test="account.accountName!= null and account.accountName!= ''">
- and a.account_name like concat('%',#{account.accountName},'%')
- </if>
- <if test="account.outerFlag!= null and account.outerFlag!= ''">
- and a.outer_flag like concat('%',#{account.outerFlag},'%')
- </if>
- <if test="account.accountQuality!= null and account.accountQuality!= ''">
- and b.account_quality like concat('%',#{account.accountQuality},'%')
- </if>
- <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
- and b.bank_card_num like concat('%',#{account.bankCardNum},'%')
- </if>
- GROUP BY
- a.account_id,
- b.bank_card_num
- </select>
- <select id="getSumInvoicingAmount" resultMap="BaseResultMap">
- select a.account_id, SUM(b.invoice_money) as sum_invoicing_amount
- from inv_account a
- left join inv_account_incoice b on a.account_id = b.account_id
- left join inv_account_card c on a.account_id = c.account_id
- where
- a.del_flag = '0'
- <if test="account.accountId != null and account.accountId != ''">
- and a.account_id like concat('%',#{account.accountId},'%')
- </if>
- <if test="account.accountName!= null and account.accountName!= ''">
- and a.account_name like concat('%',#{account.accountName},'%')
- </if>
- <if test="account.outerFlag!= null and account.outerFlag!= ''">
- and a.outer_flag like concat('%',#{account.outerFlag},'%')
- </if>
- <if test="account.accountQuality!= null and account.accountQuality!= ''">
- and c.account_quality like concat('%',#{account.accountQuality},'%')
- </if>
- <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
- and c.bank_card_num like concat('%',#{account.bankCardNum},'%')
- </if>
- GROUP BY a.account_id
- </select>
- <select id="selectAccountsList" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from inv_account a
- left join inv_account_card b on a.account_id = b.account_id
- left join inv_account_incoice c on a.account_id = c.account_id
- <if test="account.invoiceTimeStart!= null">
- and c.invoice_time >= #{account.invoiceTimeStart}
- </if>
- <if test="account.invoiceTimeEnd!= null">
- and c.invoice_time <= #{account.invoiceTimeEnd}
- </if>
- where a.del_flag = '0'
- <if test="account.accountId != null and account.accountId != ''">
- and a.account_id like concat('%',#{account.accountId},'%')
- </if>
- <if test="account.accountName!= null and account.accountName!= ''">
- and a.account_name like concat('%',#{account.accountName},'%')
- </if>
- <if test="account.outerFlag!= null and account.outerFlag!= ''">
- and a.outer_flag like concat('%',#{account.outerFlag},'%')
- </if>
- <if test="account.accountQuality!= null and account.accountQuality!= ''">
- and b.account_quality like concat('%',#{account.accountQuality},'%')
- </if>
- <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
- and b.bank_card_num like concat('%',#{account.bankCardNum},'%')
- </if>
- GROUP BY
- a.account_id,
- b.bank_card_num
- </select>
- </mapper>
|