| @@ -1,274 +0,0 @@ | |||
| <?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.iformall.mapper.WxPayOrderMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxPayOrder"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||
| <result column="order_id" jdbcType="BIGINT" property="orderId"/> | |||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/> | |||
| <result column="open_id" jdbcType="VARCHAR" property="openId"/> | |||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId"/> | |||
| <result column="auth_code" jdbcType="VARCHAR" property="authCode"/> | |||
| <result column="ip" jdbcType="VARCHAR" property="ip"/> | |||
| <result column="pay_amount" jdbcType="INTEGER" property="payAmount"/> | |||
| <result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart"/> | |||
| <result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd"/> | |||
| <result column="prepay_id" jdbcType="VARCHAR" property="prepayId"/> | |||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId"/> | |||
| <result column="pay_vendor" jdbcType="INTEGER" property="payVendor"/> | |||
| <result column="pay_version" jdbcType="INTEGER" property="payVersion"/> | |||
| <result column="tt_pay_way" jdbcType="INTEGER" property="ttPayWay"/> | |||
| <result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo"/> | |||
| <result column="pay_order_status" jdbcType="INTEGER" property="payOrderStatus"/> | |||
| <result column="pay_param" jdbcType="VARCHAR" property="payParam"/> | |||
| <result column="mch_type" jdbcType="INTEGER" property="mchType"/> | |||
| <result column="share" jdbcType="INTEGER" property="share"/> | |||
| <result column="share_amount" jdbcType="INTEGER" property="shareAmount"/> | |||
| <result column="system_amount" jdbcType="INTEGER" property="systemAmount"/> | |||
| <result column="commission_amount" jdbcType="INTEGER" property="commissionAmount"/> | |||
| <result column="rate_amount" jdbcType="INTEGER" property="rateAmount"/> | |||
| <result column="fail_reason" jdbcType="VARCHAR" property="failReason"/> | |||
| <result column="pos_pay_order_id" jdbcType="BIGINT" property="posPayOrderId"/> | |||
| <result column="pos_pay_order_time" jdbcType="BIGINT" property="posPayOrderTime"/> | |||
| <result column="pos_payment_type" jdbcType="INTEGER" property="posPaymentType"/> | |||
| <result column="pos_pay_order_no" jdbcType="INTEGER" property="posPayOrderNo"/> | |||
| <result column="pos_pay_des" jdbcType="INTEGER" property="posPayDes"/> | |||
| <result column="compose_order" jdbcType="INTEGER" property="composeOrder"/> | |||
| <result column="child_order_share" jdbcType="VARCHAR" property="childOrderShare"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`order_id`,`c_user_id`,`open_id`,`b_user_id`, | |||
| `auth_code`,`ip`,`pay_amount`,`pay_time_start`,`pay_time_end`, | |||
| `prepay_id`,`transaction_id`,`pay_vendor`,`pay_version`,`tt_pay_way`,`pay_order_no`, | |||
| `pay_order_status`,`pay_param`,`mch_type`,`share`,`share_amount`,`system_amount`,`commission_amount`,`rate_amount`,`fail_reason`, | |||
| `pos_pay_order_id`,`pos_pay_order_time`,`pos_payment_type`,`pos_pay_order_no`,`pos_pay_des`,`compose_order`, | |||
| `child_order_share` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| </if> | |||
| <if test=" null != updateTime "> | |||
| and `update_time` = #{updateTime} | |||
| </if> | |||
| <if test=" null != orderId "> | |||
| and `order_id` = #{orderId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != openId "> | |||
| and `open_id` = #{openId} | |||
| </if> | |||
| <if test=" null != bUserId "> | |||
| and `b_user_id` = #{bUserId} | |||
| </if> | |||
| <if test=" null != authCode "> | |||
| and `auth_code` = #{authCode} | |||
| </if> | |||
| <if test=" null != ip "> | |||
| and `ip` like concat('%', #{ip},'%') | |||
| </if> | |||
| <if test=" null != payAmount "> | |||
| and `pay_amount` = #{payAmount} | |||
| </if> | |||
| <if test=" null != payTimeStart "> | |||
| and `pay_time_start` = #{payTimeStart} | |||
| </if> | |||
| <if test=" null != payTimeEnd "> | |||
| and `pay_time_end` = #{payTimeEnd} | |||
| </if> | |||
| <if test=" null != prepayId "> | |||
| and `prepay_id` like concat('%', #{prepayId},'%') | |||
| </if> | |||
| <if test=" null != transactionId "> | |||
| and `transaction_id` like concat('%', #{transactionId},'%') | |||
| </if> | |||
| <if test=" null != payVendor "> | |||
| and `pay_vendor` = #{payVendor} | |||
| </if> | |||
| <if test=" null != payVersion "> | |||
| and `pay_version` = #{payVersion} | |||
| </if> | |||
| <if test=" null != ttPayWay "> | |||
| and `tt_pay_way` = #{ttPayWay} | |||
| </if> | |||
| <if test=" null != payOrderNo "> | |||
| and `pay_order_no` like concat('%', #{payOrderNo},'%') | |||
| </if> | |||
| <if test=" null != payOrderStatus "> | |||
| and `pay_order_status` = #{payOrderStatus} | |||
| </if> | |||
| <if test=" null != share "> | |||
| and `share` = #{share} | |||
| </if> | |||
| <if test=" null != shareAmount "> | |||
| and `share_amount` = #{shareAmount} | |||
| </if> | |||
| <if test=" null != failReason "> | |||
| and `fail_reason` like concat('%', #{failReason},'%') | |||
| </if> | |||
| <if test=" null != posPayOrderId "> | |||
| and `pos_pay_order_id` = #{posPayOrderId} | |||
| </if> | |||
| <if test=" null != posPayOrderTime "> | |||
| and `pos_pay_order_time` = #{posPayOrderTime} | |||
| </if> | |||
| <if test=" null != posPaymentType "> | |||
| and `pos_payment_type` = #{posPaymentType} | |||
| </if> | |||
| <if test=" null != posPayOrderNo "> | |||
| and `pos_pay_order_no` = #{posPayOrderNo} | |||
| </if> | |||
| <if test=" null != composeOrder "> | |||
| and `compose_order` = #{composeOrder} | |||
| </if> | |||
| <if test=" null != orderIds "> | |||
| and order_id in | |||
| <foreach collection="orderIds" index="index" item="orderIdItem" open="(" separator="," close=")"> | |||
| #{orderIdItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from wx_pay_order where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxPayOrder" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_pay_order | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findListForUnPs" parameterType="com.iformall.domain.po.WxPayOrder" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_pay_order | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and id not in ( | |||
| select order_id from wx_profit_sharing_order where create_time>'2019-10-15' | |||
| ) | |||
| and `create_time` > '2019-10-15' | |||
| and share = 1 and pay_order_status = 1 and `prepay_id` is null | |||
| and tenant_id in (select tenant_id from wx_pay_account where share =1) and tenant_id != '789' and tenant_id != '1000' ; | |||
| </select> | |||
| <select id="findExpListForMicroPay" parameterType="com.iformall.domain.po.WxPayOrder" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_pay_order | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| and order_id in ( | |||
| select id from wx_order where `tenant_id` = #{tenantId} and type = 1 and order_status = 0 | |||
| ); | |||
| </select> | |||
| <resultMap id="VBaseResultMap" type="com.iformall.domain.vo.WxPayOrderVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||
| <result column="order_id" jdbcType="BIGINT" property="orderId"/> | |||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/> | |||
| <result column="open_id" jdbcType="VARCHAR" property="openId"/> | |||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId"/> | |||
| <result column="auth_code" jdbcType="VARCHAR" property="authCode"/> | |||
| <result column="ip" jdbcType="VARCHAR" property="ip"/> | |||
| <result column="pay_amount" jdbcType="INTEGER" property="payAmount"/> | |||
| <result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart"/> | |||
| <result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd"/> | |||
| <result column="prepay_id" jdbcType="VARCHAR" property="prepayId"/> | |||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId"/> | |||
| <result column="pay_vendor" jdbcType="INTEGER" property="payVendor"/> | |||
| <result column="pay_version" jdbcType="INTEGER" property="payVersion"/> | |||
| <result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo"/> | |||
| <result column="pay_order_status" jdbcType="INTEGER" property="payOrderStatus"/> | |||
| <result column="share" jdbcType="INTEGER" property="share"/> | |||
| <result column="share_amount" jdbcType="INTEGER" property="shareAmount"/> | |||
| <result column="system_amount" jdbcType="INTEGER" property="systemAmount"/> | |||
| <result column="commission_amount" jdbcType="INTEGER" property="commissionAmount"/> | |||
| <result column="rate_amount" jdbcType="INTEGER" property="rateAmount"/> | |||
| <result column="fail_reason" jdbcType="VARCHAR" property="failReason"/> | |||
| <result column="app_id" jdbcType="VARCHAR" property="appId"/> | |||
| <result column="pay_id" jdbcType="BIGINT" property="payId"/> | |||
| </resultMap> | |||
| <sql id="allVColumns"> | |||
| p.`id`,p.`tenant_id`,p.`parent_tenant_id`,p.`create_time`,p.`update_time`,p.`order_id`,p.`c_user_id`,p.`open_id`,p.`b_user_id`, | |||
| p.`auth_code`,p.`ip`,p.`pay_amount`,p.`pay_time_start`,p.`pay_time_end`, | |||
| p.`prepay_id`,p.`transaction_id`,p.`pay_vendor`,p.`pay_version`,p.`pay_order_no`, | |||
| p.`pay_order_status`,p.`share`,p.`share_amount`,p.`system_amount`,p.`commission_amount`,p.`rate_amount`,p.`fail_reason`, | |||
| a.`app_id`, a.`pay_id` | |||
| </sql> | |||
| <select id="findListOfPaidOrderByDate" parameterType="map" resultMap="VBaseResultMap"> | |||
| select | |||
| <include refid="allVColumns"/> | |||
| from wx_pay_order p | |||
| left join wx_appinfo a on a.`tenant_id` = p.`tenant_id` and a.`type` = 2 | |||
| where p.`pay_order_status` = '1' and p.`pay_vendor` = 0 | |||
| <if test="startDate != null"> | |||
| AND unix_timestamp(p.`pay_time_end`) > unix_timestamp(#{startDate,jdbcType=TIMESTAMP}) | |||
| </if> | |||
| </select> | |||
| </mapper> | |||