Files
biz-api-cloud-zax/pjcloud-hardware/pjcloud-hardware-biz/src/main/resources/mapper/HardInvoiceMapper.xml
T
2026-08-25 12:49:36 +08:00

88 lines
3.4 KiB
XML

<?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.bsd.pjcloud.hard.mapper.HardInvoiceMapper">
<resultMap id="hardInvoiceMap" type="com.bsd.pjcloud.hard.api.entity.HardInvoiceEntity">
<id property="id" column="id"/>
<result property="deptId" column="dept_id"/>
<result property="hardId" column="hard_id"/>
<result property="orderId" column="hard_order_id"/>
<result property="status" column="status"/>
<result property="pic" column="pic"/>
<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="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
<sql id="selectA">
select a.id,
a.dept_id as invoiceDeptId,
a.hard_id,
a.order_id,
a.status,
a.pic,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.tenant_id,
</sql>
<sql id="whereA">
a.del_flag = '0'
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
</if>
</sql>
<select id="scopePageList" resultType="com.bsd.pjcloud.hard.api.vo.HardInvoiceVo">
<include refid="selectA"/>
m.name as hardName,
m.type as hardType,
o.hard_id as orderHardId,
o.user_id as orderUserId,
o.user_id as userId,
o.merchant_id as orderMchId,
o.merchant_id as merchantId,
o.dept_id as dept_id,
o.wallet_id as orderWalletId,
o.parent_car_id as orderParentCarId,
o.total_price as orderTotalPrice,
o.extra_price as orderExtraPrice,
o.pay_price as orderPayPrice,
o.pay_time as orderPayTime
from hard_invoice a
left join hard_manager m on m.id = a.hard_id
left join hard_order o on o.id = a.order_id
<where>
<include refid="whereA"/>
<if test="dto.merchantIds != null and dto.merchantIds.size() != 0">
and o.merchant_id IN
<foreach collection="dto.merchantIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.hardType != null and dto.hardType != '' ">
and m.type = #{dto.hardType}
</if>
<if test="dto.userIds != null and dto.userIds.size() != 0">
and o.user_id IN
<foreach collection="dto.userIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
and o.dept_id IN
<foreach collection="dto.deptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
order by a.create_time desc, a.id desc
</select>
</mapper>