2021-12-21 11:49:15 +08:00
|
|
|
<?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.xhpc.invoice.mapper.XhpcInvoiceMapper">
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.xhpc.invoice.pojo.XhpcInvoice">
|
|
|
|
|
<id column="invoice_id" jdbcType="BIGINT" property="invoiceId"/>
|
2022-01-03 21:02:32 +08:00
|
|
|
<result column="invoice_type" jdbcType="INTEGER" property="invoiceType"/>
|
2021-12-21 11:49:15 +08:00
|
|
|
<result column="receive_email" jdbcType="VARCHAR" property="receiveEmail"/>
|
|
|
|
|
<result column="title_type" jdbcType="INTEGER" property="titleType"/>
|
|
|
|
|
<result column="title_content" jdbcType="VARCHAR" property="titleContent"/>
|
|
|
|
|
<result column="duty_number" jdbcType="VARCHAR" property="dutyNumber"/>
|
|
|
|
|
<result column="invoice_content" jdbcType="VARCHAR" property="invoiceContent"/>
|
|
|
|
|
<result column="invoice_money" jdbcType="DECIMAL" property="invoiceMoney"/>
|
|
|
|
|
<result column="invoice_order_eletric_total_money" jdbcType="DECIMAL" property="invoiceOrderEletricTotalMoney"/>
|
|
|
|
|
<result column="invoice_order_service_total_money" jdbcType="DECIMAL" property="invoiceOrderServiceTotalMoney"/>
|
|
|
|
|
<result column="firm_address" jdbcType="VARCHAR" property="firmAddress"/>
|
|
|
|
|
<result column="firm_phone" jdbcType="VARCHAR" property="firmPhone"/>
|
|
|
|
|
<result column="firm_bank" jdbcType="VARCHAR" property="firmBank"/>
|
|
|
|
|
<result column="firm_bank_account" jdbcType="VARCHAR" property="firmBankAccount"/>
|
|
|
|
|
<result column="is_show_date" jdbcType="INTEGER" property="isShowDate"/>
|
|
|
|
|
<result column="user_notes" jdbcType="VARCHAR" property="userNotes"/>
|
|
|
|
|
<result column="creator_id" jdbcType="BIGINT" property="creatorId"/>
|
|
|
|
|
<result column="creator_type" jdbcType="INTEGER" property="creatorType"/>
|
|
|
|
|
<result column="creator" jdbcType="VARCHAR" property="creator"/>
|
|
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
|
|
|
<result column="status" jdbcType="INTEGER" property="status"/>
|
|
|
|
|
<result column="invoicing_time" jdbcType="TIMESTAMP" property="invoicingTime"/>
|
|
|
|
|
<result column="drawer" jdbcType="VARCHAR" property="drawer"/>
|
|
|
|
|
<result column="finance_notes" jdbcType="VARCHAR" property="financeNotes"/>
|
|
|
|
|
<result column="electric_invoice_url" jdbcType="VARCHAR" property="electricInvoiceUrl"/>
|
|
|
|
|
<result column="updator" jdbcType="BIGINT" property="updator"/>
|
|
|
|
|
<result column="update_time" jdbcType="DATE" property="updateTime"/>
|
2022-01-06 13:04:19 +08:00
|
|
|
<result column="is_read" jdbcType="TINYINT" property="isRead"/>
|
2021-12-21 11:49:15 +08:00
|
|
|
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
|
|
|
|
|
</resultMap>
|
2021-12-29 14:46:24 +08:00
|
|
|
|
2021-12-21 11:49:15 +08:00
|
|
|
<sql id="Base_Column_List">
|
2021-12-29 14:46:24 +08:00
|
|
|
`invoice_id`
|
2022-01-06 13:04:19 +08:00
|
|
|
,invoice_type,
|
2021-12-29 14:46:24 +08:00
|
|
|
`receive_email`,
|
|
|
|
|
`title_type`,
|
|
|
|
|
`title_content`,
|
|
|
|
|
`duty_number`,
|
|
|
|
|
`invoice_content`,
|
|
|
|
|
`invoice_money`,
|
|
|
|
|
`invoice_order_eletric_total_money`,
|
|
|
|
|
`invoice_order_service_total_money`,
|
|
|
|
|
`firm_address`,
|
|
|
|
|
`firm_phone`,
|
|
|
|
|
`firm_bank`,
|
|
|
|
|
`firm_bank_account`,
|
|
|
|
|
`is_show_date`,
|
|
|
|
|
`user_notes`,
|
|
|
|
|
`creator_id`,
|
|
|
|
|
`creator_type`,
|
|
|
|
|
`creator`,
|
|
|
|
|
`create_time`,
|
|
|
|
|
`status`,
|
|
|
|
|
`invoicing_time`,
|
|
|
|
|
`drawer`,
|
|
|
|
|
`finance_notes`,
|
|
|
|
|
`electric_invoice_url`,
|
|
|
|
|
`updator`,
|
|
|
|
|
`update_time`,
|
|
|
|
|
`is_read`,
|
|
|
|
|
`del_flag`
|
2021-12-21 11:49:15 +08:00
|
|
|
</sql>
|
2021-12-29 14:46:24 +08:00
|
|
|
|
2021-12-21 11:49:15 +08:00
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
from xhpc_invoice
|
|
|
|
|
where invoice_id = #{invoiceId,jdbcType=BIGINT} and del_flag is null;
|
|
|
|
|
</select>
|
2021-12-22 20:16:42 +08:00
|
|
|
<select id="selectAllInvoiceOrdersByCondition" resultMap="BaseResultMap">
|
|
|
|
|
SELECT
|
|
|
|
|
invoice_id,
|
2022-01-03 21:02:32 +08:00
|
|
|
invoice_type,
|
2022-01-04 15:01:05 +08:00
|
|
|
tenant_id,
|
2021-12-22 20:16:42 +08:00
|
|
|
creator,
|
|
|
|
|
creator_type,
|
|
|
|
|
invoice_money,
|
|
|
|
|
status,
|
|
|
|
|
create_time,
|
|
|
|
|
invoicing_time,
|
|
|
|
|
drawer
|
|
|
|
|
FROM
|
|
|
|
|
xhpc_invoice
|
|
|
|
|
<where>
|
|
|
|
|
del_flag IS NULL
|
2022-03-03 10:48:46 +08:00
|
|
|
<if test="creator!=null and creator!='' ">
|
2021-12-22 20:16:42 +08:00
|
|
|
and creator = #{creator}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorType!=null">
|
2022-01-03 21:02:32 +08:00
|
|
|
and creator_type = #{creatorType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceType!=null">
|
|
|
|
|
and invoice_type = #{invoiceType}
|
2021-12-22 20:16:42 +08:00
|
|
|
</if>
|
2022-03-02 14:19:54 +08:00
|
|
|
<if test="tenantId!=null and tenantId !=''">
|
2022-01-04 15:01:05 +08:00
|
|
|
and tenant_id = #{tenantId}
|
|
|
|
|
</if>
|
2021-12-22 20:16:42 +08:00
|
|
|
<if test="status!=null">
|
|
|
|
|
and status = #{status}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startCreatorTime!=null">
|
|
|
|
|
and create_time >= #{startCreatorTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endCreatorTime!=null">
|
|
|
|
|
and create_time <= #{endCreatorTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startInvoicingTime!=null">
|
|
|
|
|
and invoicing_time >= #{startInvoicingTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endInvoicingTime!=null">
|
|
|
|
|
and invoicing_time <= #{endInvoicingTime}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
2022-03-08 18:16:20 +08:00
|
|
|
ORDER BY
|
|
|
|
|
STATUS ASC,
|
|
|
|
|
create_time DESC
|
2021-12-22 20:16:42 +08:00
|
|
|
LIMIT #{currentPage},#{items}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="sumItemsInvoice" resultType="java.lang.Long">
|
|
|
|
|
SELECT
|
|
|
|
|
count(invoice_id)
|
|
|
|
|
FROM
|
|
|
|
|
xhpc_invoice
|
|
|
|
|
<where>
|
|
|
|
|
del_flag IS NULL
|
|
|
|
|
<if test="creator!=null">
|
|
|
|
|
and creator = #{creator}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorType!=null">
|
2022-01-03 21:02:32 +08:00
|
|
|
and creator_type = #{creatorType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceType!=null">
|
|
|
|
|
and invoice_type = #{invoiceType}
|
2021-12-22 20:16:42 +08:00
|
|
|
</if>
|
2022-01-04 15:01:05 +08:00
|
|
|
<if test="tenantId!=null">
|
|
|
|
|
and tenant_id = #{tenantId}
|
|
|
|
|
</if>
|
2021-12-22 20:16:42 +08:00
|
|
|
<if test="status!=null">
|
|
|
|
|
and status = #{status}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startCreatorTime!=null">
|
|
|
|
|
and create_time >= #{startCreatorTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endCreatorTime!=null">
|
|
|
|
|
and create_time <= #{endCreatorTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startInvoicingTime!=null">
|
|
|
|
|
and invoicing_time >= #{startInvoicingTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endInvoicingTime!=null">
|
|
|
|
|
and invoicing_time <= #{endInvoicingTime}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="allInvoicedMoney" resultType="java.math.BigDecimal">
|
|
|
|
|
SELECT sum(invoice_money)
|
|
|
|
|
FROM xhpc_invoice
|
|
|
|
|
WHERE del_flag IS NULL
|
|
|
|
|
AND `status` = 1
|
|
|
|
|
</select>
|
|
|
|
|
<select id="allNotInvoicedMoney" resultType="java.math.BigDecimal">
|
|
|
|
|
SELECT sum(invoice_money)
|
|
|
|
|
FROM xhpc_invoice
|
|
|
|
|
WHERE del_flag IS NULL
|
|
|
|
|
AND `status` = 0
|
|
|
|
|
</select>
|
2021-12-23 17:57:28 +08:00
|
|
|
<select id="selectInvoiceTitleInfo" resultMap="BaseResultMap">
|
|
|
|
|
SELECT title_content,
|
|
|
|
|
duty_number
|
|
|
|
|
FROM `xhpc_invoice`
|
|
|
|
|
WHERE title_content LIKE concat("%", #{firmName}, "%")
|
|
|
|
|
GROUP BY title_content LIMIT 0,3
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectUserLastInputInvoiceInfo" resultMap="BaseResultMap">
|
2021-12-29 14:46:24 +08:00
|
|
|
SELECT
|
|
|
|
|
<include refid="Base_Column_List"/>
|
2021-12-23 17:57:28 +08:00
|
|
|
FROM `xhpc_invoice`
|
|
|
|
|
WHERE creator_id = #{creatorId}
|
2021-12-29 14:46:24 +08:00
|
|
|
AND creator_type = #{creatorType}
|
2021-12-23 17:57:28 +08:00
|
|
|
ORDER BY invoice_id DESC LIMIT 0,1
|
|
|
|
|
</select>
|
2021-12-27 17:23:43 +08:00
|
|
|
<select id="findInvoicesByCreatorIdAndCreatorType" resultMap="BaseResultMap">
|
2021-12-29 14:46:24 +08:00
|
|
|
SELECT
|
|
|
|
|
<include refid="Base_Column_List"/>
|
2021-12-27 17:23:43 +08:00
|
|
|
FROM xhpc_invoice
|
|
|
|
|
WHERE del_flag IS NULL
|
2021-12-29 14:46:24 +08:00
|
|
|
AND creator_id = #{creatorId}
|
|
|
|
|
AND creator_type = #{creatorType}
|
2022-03-15 14:53:25 +08:00
|
|
|
ORDER BY create_time DESC
|
2021-12-29 14:46:24 +08:00
|
|
|
LIMIT #{currentPage}, #{items}
|
2021-12-27 17:23:43 +08:00
|
|
|
</select>
|
|
|
|
|
<select id="getUserInvoiceItemsByCreatorIdAndCreatorType" resultType="java.lang.Long">
|
|
|
|
|
SELECT count(invoice_id)
|
|
|
|
|
FROM xhpc_invoice
|
|
|
|
|
WHERE del_flag IS NULL
|
|
|
|
|
AND creator_id = #{creatorId}
|
|
|
|
|
AND creator_type = #{creatorType}
|
|
|
|
|
</select>
|
2021-12-29 14:46:24 +08:00
|
|
|
<select id="findNotReadCount" resultType="java.lang.Long">
|
|
|
|
|
SELECT count(invoice_id)
|
|
|
|
|
FROM xhpc_invoice
|
|
|
|
|
WHERE del_flag IS NULL
|
|
|
|
|
AND is_read = 0
|
|
|
|
|
AND creator_id = #{creatorId}
|
|
|
|
|
AND creator_type = #{creatorType}
|
|
|
|
|
</select>
|
2022-01-03 12:45:05 +08:00
|
|
|
<select id="selectExcelInvoiceById" resultType="com.xhpc.invoice.domain.ExcelInvoiceRow">
|
2022-01-03 23:00:05 +08:00
|
|
|
SELECT case i.invoice_type when 0 then '普票' when 1 then '专票' end as invoiceType,
|
|
|
|
|
i.receive_email as receiveEmail,
|
|
|
|
|
case i.title_type when 0 THEN '企业' ELSE '个人/非企业' END as titleType,
|
|
|
|
|
i.title_content as titleContent,
|
|
|
|
|
i.duty_number as dutyNumber,
|
|
|
|
|
i.invoice_content as invoiceContent,
|
|
|
|
|
i.invoice_money as invoiceMoney,
|
|
|
|
|
i.invoice_order_service_total_money as invoiceOrderServiceTotalMoney,
|
2022-03-18 16:52:50 +08:00
|
|
|
i.invoice_order_eletric_total_money as invoiceOrderElectricTotalMoney,
|
2022-01-03 23:00:05 +08:00
|
|
|
i.firm_address as firmAddress,
|
|
|
|
|
i.firm_phone as firmPhone,
|
|
|
|
|
i.firm_bank as firmBank,
|
|
|
|
|
i.firm_bank_account as firmBankAccount,
|
|
|
|
|
case i.is_show_date when 0 then '开票者要求展示交易日期' ELSE '开票者不要求展示交易日期' END as isShowDate,
|
|
|
|
|
i.user_notes as userNotes,
|
2022-01-03 12:45:05 +08:00
|
|
|
case i.creator_type
|
|
|
|
|
when 0 then 'C端用户'
|
|
|
|
|
when 1 then '流量方'
|
|
|
|
|
when 2 then '社区用户'
|
|
|
|
|
when 3
|
2022-01-03 23:00:05 +08:00
|
|
|
then '企业用户' END as creatorType,
|
|
|
|
|
i.creator as creator,
|
|
|
|
|
i.create_time as iCreateTime,
|
|
|
|
|
case i.status when 0 then '未开票' when 1 then '已开票' when 2 then '开票失败' END as status,
|
|
|
|
|
i.invoicing_time as invoicingTime,
|
2022-01-03 12:45:05 +08:00
|
|
|
i.drawer,
|
2022-01-03 23:00:05 +08:00
|
|
|
i.finance_notes as financeNotes,
|
|
|
|
|
i.electric_invoice_url as electricInvoiceUrl,
|
|
|
|
|
case i.is_read when 1 then '已阅读' when 0 then '未阅读' else '该发票还未处理' END as isRead,
|
|
|
|
|
h.history_serial_number as historySerialNumber,
|
|
|
|
|
h.power_price_total as powerPriceTotal,
|
|
|
|
|
h.service_price_total as servicePriceTotal,
|
|
|
|
|
h.promotion_discount as promotionDiscount,
|
|
|
|
|
history_act_price as historyActPrice,
|
|
|
|
|
h.create_time as hCreateTime,
|
|
|
|
|
h.charging_mode as chargingMode
|
2022-01-03 12:45:05 +08:00
|
|
|
FROM xhpc_invoice AS i
|
|
|
|
|
INNER JOIN xhpc_invoice_map_history_order AS h ON i.invoice_id = h.invoice_id
|
|
|
|
|
WHERE i.invoice_id = #{invoiceId}
|
|
|
|
|
AND i.del_flag IS NULL
|
|
|
|
|
AND h.del_flag IS NULL
|
|
|
|
|
</select>
|
2021-12-21 11:49:15 +08:00
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
|
|
|
|
delete
|
|
|
|
|
from xhpc_invoice
|
|
|
|
|
where invoice_id = #{invoiceId,jdbcType=BIGINT}
|
|
|
|
|
</delete>
|
|
|
|
|
<insert id="insert" keyColumn="invoice_id" keyProperty="invoiceId" parameterType="com.xhpc.invoice.pojo.XhpcInvoice"
|
|
|
|
|
useGeneratedKeys="true">
|
|
|
|
|
insert into xhpc_invoice (receive_email, title_type, title_content,
|
|
|
|
|
duty_number, invoice_content, invoice_money,
|
|
|
|
|
invoice_order_eletric_total_money, invoice_order_service_total_money,
|
|
|
|
|
firm_address, firm_phone, firm_bank,
|
|
|
|
|
firm_bank_account, is_show_date, user_notes,
|
|
|
|
|
creator_id, creator_type, creator,
|
|
|
|
|
create_time, `status`, invoicing_time,
|
|
|
|
|
drawer, finance_notes, electric_invoice_url,
|
2022-01-10 16:52:46 +08:00
|
|
|
updator, update_time, del_flag, tenant_id)
|
2021-12-21 11:49:15 +08:00
|
|
|
values (#{receiveEmail,jdbcType=VARCHAR}, #{titleType,jdbcType=INTEGER}, #{titleContent,jdbcType=VARCHAR},
|
|
|
|
|
#{dutyNumber,jdbcType=VARCHAR}, #{invoiceContent,jdbcType=VARCHAR}, #{invoiceMoney,jdbcType=DECIMAL},
|
|
|
|
|
#{invoiceOrderEletricTotalMoney,jdbcType=DECIMAL}, #{invoiceOrderServiceTotalMoney,jdbcType=DECIMAL},
|
|
|
|
|
#{firmAddress,jdbcType=VARCHAR}, #{firmPhone,jdbcType=VARCHAR}, #{firmBank,jdbcType=VARCHAR},
|
|
|
|
|
#{firmBankAccount,jdbcType=VARCHAR}, #{isShowDate,jdbcType=INTEGER}, #{userNotes,jdbcType=VARCHAR},
|
|
|
|
|
#{creatorId,jdbcType=BIGINT}, #{creatorType,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR},
|
|
|
|
|
#{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{invoicingTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{drawer,jdbcType=VARCHAR}, #{financeNotes,jdbcType=VARCHAR}, #{electricInvoiceUrl,jdbcType=VARCHAR},
|
2022-01-10 16:52:46 +08:00
|
|
|
#{updator,jdbcType=BIGINT}, #{updateTime,jdbcType=DATE}, #{delFlag,jdbcType=INTEGER},
|
|
|
|
|
#{tenantId,jdbcType=VARCHAR})
|
2021-12-21 11:49:15 +08:00
|
|
|
</insert>
|
|
|
|
|
<insert id="insertSelective" keyColumn="invoice_id" keyProperty="invoiceId"
|
|
|
|
|
parameterType="com.xhpc.invoice.pojo.XhpcInvoice" useGeneratedKeys="true">
|
|
|
|
|
insert into xhpc_invoice
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="receiveEmail != null">
|
|
|
|
|
receive_email,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="titleType != null">
|
|
|
|
|
title_type,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="titleContent != null">
|
|
|
|
|
title_content,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dutyNumber != null">
|
|
|
|
|
duty_number,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceContent != null">
|
|
|
|
|
invoice_content,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceMoney != null">
|
|
|
|
|
invoice_money,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceOrderEletricTotalMoney != null">
|
|
|
|
|
invoice_order_eletric_total_money,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceOrderServiceTotalMoney != null">
|
|
|
|
|
invoice_order_service_total_money,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmAddress != null">
|
|
|
|
|
firm_address,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmPhone != null">
|
|
|
|
|
firm_phone,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmBank != null">
|
|
|
|
|
firm_bank,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmBankAccount != null">
|
|
|
|
|
firm_bank_account,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isShowDate != null">
|
|
|
|
|
is_show_date,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="userNotes != null">
|
|
|
|
|
user_notes,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorId != null">
|
|
|
|
|
creator_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorType != null">
|
|
|
|
|
creator_type,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creator != null">
|
|
|
|
|
creator,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
create_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null">
|
|
|
|
|
`status`,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoicingTime != null">
|
|
|
|
|
invoicing_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="drawer != null">
|
|
|
|
|
drawer,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="financeNotes != null">
|
|
|
|
|
finance_notes,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="electricInvoiceUrl != null">
|
|
|
|
|
electric_invoice_url,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updator != null">
|
|
|
|
|
updator,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
update_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
del_flag,
|
|
|
|
|
</if>
|
2022-01-10 16:52:46 +08:00
|
|
|
<if test="tenantId != null">
|
|
|
|
|
tenant_id
|
|
|
|
|
</if>
|
2021-12-21 11:49:15 +08:00
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="receiveEmail != null">
|
|
|
|
|
#{receiveEmail,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="titleType != null">
|
|
|
|
|
#{titleType,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="titleContent != null">
|
|
|
|
|
#{titleContent,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dutyNumber != null">
|
|
|
|
|
#{dutyNumber,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceContent != null">
|
|
|
|
|
#{invoiceContent,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceMoney != null">
|
|
|
|
|
#{invoiceMoney,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceOrderEletricTotalMoney != null">
|
|
|
|
|
#{invoiceOrderEletricTotalMoney,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceOrderServiceTotalMoney != null">
|
|
|
|
|
#{invoiceOrderServiceTotalMoney,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmAddress != null">
|
|
|
|
|
#{firmAddress,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmPhone != null">
|
|
|
|
|
#{firmPhone,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmBank != null">
|
|
|
|
|
#{firmBank,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmBankAccount != null">
|
|
|
|
|
#{firmBankAccount,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isShowDate != null">
|
|
|
|
|
#{isShowDate,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="userNotes != null">
|
|
|
|
|
#{userNotes,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorId != null">
|
|
|
|
|
#{creatorId,jdbcType=BIGINT},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorType != null">
|
|
|
|
|
#{creatorType,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creator != null">
|
|
|
|
|
#{creator,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null">
|
|
|
|
|
#{status,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoicingTime != null">
|
|
|
|
|
#{invoicingTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="drawer != null">
|
|
|
|
|
#{drawer,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="financeNotes != null">
|
|
|
|
|
#{financeNotes,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="electricInvoiceUrl != null">
|
|
|
|
|
#{electricInvoiceUrl,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updator != null">
|
|
|
|
|
#{updator,jdbcType=BIGINT},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
#{updateTime,jdbcType=DATE},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
#{delFlag,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
2022-01-10 16:52:46 +08:00
|
|
|
<if test="tenantId != null">
|
|
|
|
|
#{tenantId,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
2021-12-21 11:49:15 +08:00
|
|
|
</trim>
|
|
|
|
|
</insert>
|
2021-12-29 14:46:24 +08:00
|
|
|
<insert id="insertSelectiveAndReturnId" parameterType="com.xhpc.invoice.pojo.XhpcInvoice"
|
2022-01-03 21:02:32 +08:00
|
|
|
keyProperty="invoiceId" useGeneratedKeys="true">
|
2021-12-29 14:46:24 +08:00
|
|
|
insert into xhpc_invoice
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="receiveEmail != null">
|
|
|
|
|
receive_email,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="titleType != null">
|
|
|
|
|
title_type,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="titleContent != null">
|
|
|
|
|
title_content,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dutyNumber != null">
|
|
|
|
|
duty_number,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceContent != null">
|
|
|
|
|
invoice_content,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceMoney != null">
|
|
|
|
|
invoice_money,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceOrderEletricTotalMoney != null">
|
|
|
|
|
invoice_order_eletric_total_money,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceOrderServiceTotalMoney != null">
|
|
|
|
|
invoice_order_service_total_money,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmAddress != null">
|
|
|
|
|
firm_address,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmPhone != null">
|
|
|
|
|
firm_phone,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmBank != null">
|
|
|
|
|
firm_bank,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmBankAccount != null">
|
|
|
|
|
firm_bank_account,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isShowDate != null">
|
|
|
|
|
is_show_date,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="userNotes != null">
|
|
|
|
|
user_notes,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorId != null">
|
|
|
|
|
creator_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorType != null">
|
|
|
|
|
creator_type,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creator != null">
|
|
|
|
|
creator,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
create_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null">
|
|
|
|
|
`status`,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoicingTime != null">
|
|
|
|
|
invoicing_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="drawer != null">
|
|
|
|
|
drawer,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="financeNotes != null">
|
|
|
|
|
finance_notes,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="electricInvoiceUrl != null">
|
|
|
|
|
electric_invoice_url,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updator != null">
|
|
|
|
|
updator,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
update_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
del_flag,
|
|
|
|
|
</if>
|
2022-01-10 16:52:46 +08:00
|
|
|
<if test="tenantId != null">
|
|
|
|
|
tenant_id,
|
|
|
|
|
</if>
|
2021-12-29 14:46:24 +08:00
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="receiveEmail != null">
|
|
|
|
|
#{receiveEmail,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="titleType != null">
|
|
|
|
|
#{titleType,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="titleContent != null">
|
|
|
|
|
#{titleContent,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dutyNumber != null">
|
|
|
|
|
#{dutyNumber,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceContent != null">
|
|
|
|
|
#{invoiceContent,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceMoney != null">
|
|
|
|
|
#{invoiceMoney,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceOrderEletricTotalMoney != null">
|
|
|
|
|
#{invoiceOrderEletricTotalMoney,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceOrderServiceTotalMoney != null">
|
|
|
|
|
#{invoiceOrderServiceTotalMoney,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmAddress != null">
|
|
|
|
|
#{firmAddress,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmPhone != null">
|
|
|
|
|
#{firmPhone,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmBank != null">
|
|
|
|
|
#{firmBank,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmBankAccount != null">
|
|
|
|
|
#{firmBankAccount,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isShowDate != null">
|
|
|
|
|
#{isShowDate,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="userNotes != null">
|
|
|
|
|
#{userNotes,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorId != null">
|
|
|
|
|
#{creatorId,jdbcType=BIGINT},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorType != null">
|
|
|
|
|
#{creatorType,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creator != null">
|
|
|
|
|
#{creator,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null">
|
|
|
|
|
#{status,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoicingTime != null">
|
|
|
|
|
#{invoicingTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="drawer != null">
|
|
|
|
|
#{drawer,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="financeNotes != null">
|
|
|
|
|
#{financeNotes,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="electricInvoiceUrl != null">
|
|
|
|
|
#{electricInvoiceUrl,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updator != null">
|
|
|
|
|
#{updator,jdbcType=BIGINT},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
#{updateTime,jdbcType=DATE},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
#{delFlag,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
2022-01-10 16:52:46 +08:00
|
|
|
<if test="tenantId != null">
|
|
|
|
|
#{tenantId,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
2021-12-29 14:46:24 +08:00
|
|
|
</trim>
|
|
|
|
|
</insert>
|
2021-12-21 11:49:15 +08:00
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.invoice.pojo.XhpcInvoice">
|
|
|
|
|
update xhpc_invoice
|
|
|
|
|
<set>
|
|
|
|
|
<if test="receiveEmail != null">
|
|
|
|
|
receive_email = #{receiveEmail,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="titleType != null">
|
|
|
|
|
title_type = #{titleType,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="titleContent != null">
|
|
|
|
|
title_content = #{titleContent,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dutyNumber != null">
|
|
|
|
|
duty_number = #{dutyNumber,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceContent != null">
|
|
|
|
|
invoice_content = #{invoiceContent,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceMoney != null">
|
|
|
|
|
invoice_money = #{invoiceMoney,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceOrderEletricTotalMoney != null">
|
|
|
|
|
invoice_order_eletric_total_money = #{invoiceOrderEletricTotalMoney,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoiceOrderServiceTotalMoney != null">
|
|
|
|
|
invoice_order_service_total_money = #{invoiceOrderServiceTotalMoney,jdbcType=DECIMAL},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmAddress != null">
|
|
|
|
|
firm_address = #{firmAddress,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmPhone != null">
|
|
|
|
|
firm_phone = #{firmPhone,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmBank != null">
|
|
|
|
|
firm_bank = #{firmBank,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firmBankAccount != null">
|
|
|
|
|
firm_bank_account = #{firmBankAccount,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isShowDate != null">
|
|
|
|
|
is_show_date = #{isShowDate,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="userNotes != null">
|
|
|
|
|
user_notes = #{userNotes,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorId != null">
|
|
|
|
|
creator_id = #{creatorId,jdbcType=BIGINT},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorType != null">
|
|
|
|
|
creator_type = #{creatorType,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creator != null">
|
|
|
|
|
creator = #{creator,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null">
|
|
|
|
|
`status` = #{status,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invoicingTime != null">
|
|
|
|
|
invoicing_time = #{invoicingTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="drawer != null">
|
|
|
|
|
drawer = #{drawer,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="financeNotes != null">
|
|
|
|
|
finance_notes = #{financeNotes,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="electricInvoiceUrl != null">
|
|
|
|
|
electric_invoice_url = #{electricInvoiceUrl,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updator != null">
|
|
|
|
|
updator = #{updator,jdbcType=BIGINT},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
update_time = #{updateTime,jdbcType=DATE},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
del_flag = #{delFlag,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
</set>
|
|
|
|
|
where invoice_id = #{invoiceId,jdbcType=BIGINT}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateByPrimaryKey" parameterType="com.xhpc.invoice.pojo.XhpcInvoice">
|
|
|
|
|
update xhpc_invoice
|
|
|
|
|
set receive_email = #{receiveEmail,jdbcType=VARCHAR},
|
|
|
|
|
title_type = #{titleType,jdbcType=INTEGER},
|
|
|
|
|
title_content = #{titleContent,jdbcType=VARCHAR},
|
|
|
|
|
duty_number = #{dutyNumber,jdbcType=VARCHAR},
|
|
|
|
|
invoice_content = #{invoiceContent,jdbcType=VARCHAR},
|
|
|
|
|
invoice_money = #{invoiceMoney,jdbcType=DECIMAL},
|
|
|
|
|
invoice_order_eletric_total_money = #{invoiceOrderEletricTotalMoney,jdbcType=DECIMAL},
|
|
|
|
|
invoice_order_service_total_money = #{invoiceOrderServiceTotalMoney,jdbcType=DECIMAL},
|
|
|
|
|
firm_address = #{firmAddress,jdbcType=VARCHAR},
|
|
|
|
|
firm_phone = #{firmPhone,jdbcType=VARCHAR},
|
|
|
|
|
firm_bank = #{firmBank,jdbcType=VARCHAR},
|
|
|
|
|
firm_bank_account = #{firmBankAccount,jdbcType=VARCHAR},
|
|
|
|
|
is_show_date = #{isShowDate,jdbcType=INTEGER},
|
|
|
|
|
user_notes = #{userNotes,jdbcType=VARCHAR},
|
|
|
|
|
creator_id = #{creatorId,jdbcType=BIGINT},
|
|
|
|
|
creator_type = #{creatorType,jdbcType=INTEGER},
|
|
|
|
|
creator = #{creator,jdbcType=VARCHAR},
|
|
|
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
`status` = #{status,jdbcType=INTEGER},
|
|
|
|
|
invoicing_time = #{invoicingTime,jdbcType=TIMESTAMP},
|
|
|
|
|
drawer = #{drawer,jdbcType=VARCHAR},
|
|
|
|
|
finance_notes = #{financeNotes,jdbcType=VARCHAR},
|
|
|
|
|
electric_invoice_url = #{electricInvoiceUrl,jdbcType=VARCHAR},
|
|
|
|
|
updator = #{updator,jdbcType=BIGINT},
|
|
|
|
|
update_time = #{updateTime,jdbcType=DATE},
|
|
|
|
|
del_flag = #{delFlag,jdbcType=INTEGER}
|
|
|
|
|
where invoice_id = #{invoiceId,jdbcType=BIGINT}
|
|
|
|
|
</update>
|
2021-12-22 20:16:42 +08:00
|
|
|
|
2022-01-04 09:50:29 +08:00
|
|
|
<update id="updateInvoiceToUser">
|
2021-12-22 20:16:42 +08:00
|
|
|
UPDATE xhpc_invoice
|
|
|
|
|
SET finance_notes = #{financeNotes},
|
|
|
|
|
invoicing_time = #{invoicingTime},
|
|
|
|
|
electric_invoice_url = #{eletricInvoiceUrl},
|
|
|
|
|
`status` = #{status},
|
2021-12-29 14:46:24 +08:00
|
|
|
drawer = #{drawer},
|
|
|
|
|
is_read = 0
|
2021-12-22 20:16:42 +08:00
|
|
|
WHERE invoice_id = #{invoiceId};
|
|
|
|
|
</update>
|
|
|
|
|
|
2022-01-04 09:50:29 +08:00
|
|
|
<update id="updateFailInvoiceToUser">
|
2021-12-23 13:42:54 +08:00
|
|
|
UPDATE xhpc_invoice
|
|
|
|
|
SET finance_notes = #{financeNotes},
|
|
|
|
|
invoicing_time = #{invoicingTime},
|
|
|
|
|
electric_invoice_url = #{eletricInvoiceUrl},
|
|
|
|
|
`status` = #{status},
|
2022-01-03 23:00:05 +08:00
|
|
|
drawer = #{drawer},
|
|
|
|
|
is_read = 0
|
2021-12-23 13:42:54 +08:00
|
|
|
WHERE invoice_id = #{invoiceId}
|
|
|
|
|
</update>
|
2021-12-29 18:16:39 +08:00
|
|
|
<update id="updateByInvoiceId">
|
|
|
|
|
UPDATE xhpc_invoice
|
|
|
|
|
SET is_read = 1
|
|
|
|
|
WHERE del_flag IS NULL
|
|
|
|
|
AND invoice_id = #{invoiceId}
|
|
|
|
|
</update>
|
2022-01-03 21:02:32 +08:00
|
|
|
<update id="updateElectricAndServiceById">
|
|
|
|
|
UPDATE xhpc_invoice
|
|
|
|
|
SET invoice_order_eletric_total_money = #{invoiceOrderEletricTotalMoney},
|
|
|
|
|
invoice_order_service_total_money = #{invoiceOrderServiceTotalMoney}
|
|
|
|
|
WHERE invoice_id = #{invoiceId};
|
|
|
|
|
</update>
|
2021-12-23 13:42:54 +08:00
|
|
|
|
2022-01-10 16:52:46 +08:00
|
|
|
</mapper>
|