|
- <?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.JmSportOrderMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.JmSportOrder">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="order_id" jdbcType="VARCHAR" property="orderId"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
- <result column="user_phone" jdbcType="VARCHAR" property="userPhone"/>
- <result column="user_id" jdbcType="BIGINT" property="userId"/>
- <result column="product_name" jdbcType="VARCHAR" property="productName"/>
- <result column="num" jdbcType="INTEGER" property="num"/>
-
- <result column="price" jdbcType="VARCHAR" property="price"/>
- <result column="payment" jdbcType="INTEGER" property="payment"/>
- <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/>
- <result column="pay_way" jdbcType="VARCHAR" property="payWay"/>
-
- <result column="gym_name" jdbcType="VARCHAR" property="gymName"/>
-
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`order_id`,`tenant_id`,`parent_tenant_id`,`user_phone`,`user_id`,
- `product_name`,`num`,`price`,`payment`,`payment_time`,`pay_way`,
- `gym_name`,
- `create_date`,`update_date`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != orderId and '' != orderId">
- and `order_id` = #{orderId}
- </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 != userPhone and '' != userPhone">
- and `user_phone` like concat('%', #{userPhone},'%')
- </if>
-
- <if test=" null != userId ">
- and `user_id` = #{userId}
- </if>
-
- <if test=" null != productName and '' != productName">
- and `product_name` like concat('%', #{productName},'%')
- </if>
-
- <if test="startDate != null">
- and `payment_time` >= #{startDate}
- </if>
- <if test="endDate != null">
- and `payment_time` <= #{endDate}
- </if>
-
- <if test=" null != payWay and '' != payWay">
- and `pay_way` like concat('%', #{payWay},'%')
- </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.JmSportOrder" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from jm_sport_order
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findCount" parameterType="com.iformall.domain.po.JmSportOrder" resultType="Integer">
- select count(1)
- from jm_sport_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 != userId ">
- and `user_id` = #{userId}
- </if>
- <if test="startDate != null">
- and `payment_time` >= #{startDate}
- </if>
- <if test="endDate != null">
- and `payment_time` <= #{endDate}
- </if>
- </select>
-
-
- <select id="findAvgPayment" parameterType="com.iformall.domain.po.JmSportOrder" resultType="Integer">
- select TRUNCATE(Avg(payment),0)
- from jm_sport_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 != userId ">
- and `user_id` = #{userId}
- </if>
-
- <if test="startDate != null">
- and `payment_time` >= #{startDate}
- </if>
- <if test="endDate != null">
- and `payment_time` <= #{endDate}
- </if>
- </select>
-
- </mapper>
|