|
- <?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.WxLegionActivityOrderMapper">
-
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLegionActivityOrder">
- <id property="id" column="id" jdbcType="BIGINT"/>
- <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
- <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/>
- <result property="activityId" column="activity_id" jdbcType="BIGINT"/>
- <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
- <result property="orderMoney" column="order_money" jdbcType="DECIMAL"/>
- <result property="cusId" column="cus_id" jdbcType="BIGINT"/>
- <result property="cusName" column="cus_name" jdbcType="VARCHAR"/>
- <result property="cusAddress" column="cus_address" jdbcType="VARCHAR"/>
- <result property="cusMerchantId" column="cus_merchant_id" jdbcType="BIGINT"/>
- <result property="cusLegionId" column="cus_legion_id" jdbcType="BIGINT"/>
- <result property="cusUnionId" column="cus_union_id" jdbcType="BIGINT"/>
- <result property="merchantId" column="merchant_id" jdbcType="BIGINT"/>
- <result property="legionId" column="legion_id" jdbcType="BIGINT"/>
- <result property="unionId" column="union_id" jdbcType="BIGINT"/>
- <result property="orderType" column="order_type" jdbcType="SMALLINT"/>
- <result property="createBy" column="create_by" jdbcType="BIGINT"/>
- <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
- <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
- <result property="auditRemark" column="audit_remark" jdbcType="VARCHAR"/>
- <result property="auditStatus" column="audit_status" jdbcType="INTEGER"/>
- <result property="auditBy" column="audit_by" jdbcType="BIGINT"/>
- <result property="auditTime" column="audit_time" jdbcType="TIMESTAMP"/>
- </resultMap>
-
- <sql id="allColumns">
- id,tenant_id,parent_tenant_id,
- activity_id,order_no,order_money,
- cus_id,cus_name,cus_address,
- cus_merchant_id,cus_legion_id,cus_union_id,
- merchant_id,legion_id,union_id,
- order_type,create_by,create_date,
- update_date,audit_remark,audit_status,
- audit_by,audit_time
- </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 != activityId ">
- and `activity_id` = #{activityId}
- </if>
- <if test=" null != orderNo and orderNo != '' ">
- and `order_no` like concat('%', #{orderNo},'%')
- </if>
- <if test=" null != cusId">
- and `cus_id` = #{cusId}
- </if>
- <if test=" null != cusName and cusName != '' ">
- and `cus_name` like concat('%', #{cusName},'%')
- </if>
- <if test=" null != merchantId ">
- and `merchant_id` = #{merchantId}
- </if>
- <if test=" null != legionId ">
- and `legion_id` = #{legionId}
- </if>
- <if test=" null != unionId ">
- and `union_id` = #{unionId}
- </if>
- <if test=" null != orderType ">
- and `order_type` = #{orderType}
- </if>
-
- <if test=" null != createDateBegin">
- and `create_date` >= #{createDateBegin}
- </if>
-
- <if test=" null != createDateEnd">
- and `create_date` <= #{createDateEnd}
- </if>
-
- <if test=" null != auditTimeBegin">
- and `audit_time` >= #{auditTimeBegin}
- </if>
-
- <if test=" null != auditTimeEnd">
- and `audit_time` <= #{auditTimeEnd}
- </if>
-
- <if test=" null != auditStatus ">
- and `audit_status` = #{auditStatus}
- </if>
-
- <if test=" null != orderTypeList ">
- and order_type in
- <foreach collection="orderTypeList" index="index" item="otyItem" open="(" separator="," close=")">
- #{otyItem}
- </foreach>
- </if>
-
- <if test=" null != cusIdList ">
- and cus_id in
- <foreach collection="cusIdList" index="index" item="cidItem" open="(" separator="," close=")">
- #{cidItem}
- </foreach>
- </if>
-
- <if test=" null != merchantIdList ">
- and merchant_id in
- <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")">
- #{midItem}
- </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="findList" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_legion_activity_order
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_legion_activity_order where id = #{id} and tenant_id=#{tenantId}
- </select>
-
- <update id="updateAuditStatus" parameterType="com.iformall.domain.po.WxLegionActivityOrder">
- update wx_legion_activity_order
- set `audit_status` = #{auditStatus},
-
- <if test=" null != auditRemark and '' != auditRemark">
- `audit_remark` = #{auditRemark},
- </if>
- <if test=" null != auditTime">
- `audit_time` = #{auditTime},
- </if>
- <if test=" null != auditBy">
- `audit_by` = #{auditBy},
- </if>
- `update_date` = #{updateDate}
- 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 != activityId ">
- and `activity_id` = #{activityId}
- </if>
- <if test=" null != cusId">
- and `cus_id` = #{cusId}
- </if>
- <if test=" null != merchantIdList ">
- and merchant_id in
- <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")">
- #{midItem}
- </foreach>
- </if>
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- </update>
-
- <select id="auditStatusStatistics" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivityOrderStatistics">
- SELECT audit_status as 'auditStatus',
- count(1) as 'count',
- IFNULL(sum(order_money),0) as 'sumMoney'
- FROM wx_legion_activity_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>
- <if test=" null != activityId ">
- and `activity_id` = #{activityId}
- </if>
- <if test=" null != legionId ">
- and `legion_id` = #{legionId}
- </if>
- <if test=" null != merchantId ">
- and `merchant_id` = #{merchantId}
- </if>
-
- <if test=" null != cusId">
- and `cus_id` = #{cusId}
- </if>
-
- <if test=" null != createDateBegin">
- and `create_date` >= #{createDateBegin}
- </if>
-
- <if test=" null != createDateEnd">
- and `create_date` <= #{createDateEnd}
- </if>
-
- <if test=" null != auditStatus ">
- and `audit_status` = #{auditStatus}
- </if>
- GROUP BY audit_status
- </select>
-
-
- <select id="orderTypeStatistics" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivityOrderTypeStatistics">
- SELECT order_type as 'orderType',
- count(1) as 'count'
- FROM wx_legion_activity_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>
- <if test=" null != activityId ">
- and `activity_id` = #{activityId}
- </if>
- <if test=" null != cusLegionId ">
- and `cus_legion_id` = #{cusLegionId}
- </if>
- <if test=" null != cusMerchantId ">
- and `cus_merchant_id` = #{cusMerchantId}
- </if>
- <if test=" null != auditStatus ">
- and `audit_status` = #{auditStatus}
- </if>
- GROUP BY order_type
- </select>
-
-
- <select id="merchantStatistics" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivityOrderTypeStatistics">
- SELECT cus_merchant_id as 'cusMerchantId',
- order_type as 'orderType',
- count(1) as 'count'
- FROM wx_legion_activity_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>
- <if test=" null != activityId ">
- and `activity_id` = #{activityId}
- </if>
- <if test=" null != cusLegionId ">
- and `cus_legion_id` = #{cusLegionId}
- </if>
- <if test=" null != cusMerchantId ">
- and `cus_merchant_id` = #{cusMerchantId}
- </if>
- <if test=" null != auditStatus ">
- and `audit_status` = #{auditStatus}
- </if>
- GROUP BY merchant_id,order_type
- </select>
-
- <select id="findOrderUser" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivitySellOrder">
- SELECT o.id as 'orderId',
- o.order_no as 'orderNo',
- o.order_money as 'orderMoney',
- o.merchant_id as 'orderMerchantId',
- o.legion_id as 'orderLegionId',
- o.union_id as 'orderUnionId',
- o.order_type as 'orderType',
- o.create_date as 'orderCreateDate',
- u.id as 'cusId',
- u.phone as 'cusPhone',
- u.vip_num as 'cusVipNum',
- u.merchant_id as 'cusMerchantId',
- u.legion_id as 'cusLegionId',
- u.union_id as 'cusUnionId',
- u.create_date as 'cusCreateDate'
- FROM wx_legion_activity_order o
- left join wx_legion_activity_user u on u.id = o.cus_id
- where 1 = 1
- <if test=" null != tenantId and '' != tenantId">
- and o.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and o.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != activityId ">
- and o.`activity_id` = #{activityId}
- </if>
- <if test=" null != auditStatus ">
- and o.`audit_status` = #{auditStatus}
- </if>
- <if test=" null != orderType ">
- and o.`order_type` = #{orderType}
- </if>
- <if test=" null != orderTypeList ">
- and o.order_type in
- <foreach collection="orderTypeList" index="index" item="otyItem" open="(" separator="," close=")">
- #{otyItem}
- </foreach>
- </if>
- </select>
- </mapper>
|