|
- <?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.WxOfflineActivityGrantAwardMapper">
-
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxOfflineActivityGrantAward">
- <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="orderMoneySum" column="order_money_sum" jdbcType="DECIMAL"/>
- <result property="orderCount" column="order_count" jdbcType="INTEGER"/>
- <result property="cusName" column="cus_name" jdbcType="VARCHAR"/>
- <result property="cusPhone" column="cus_phone" jdbcType="VARCHAR"/>
- <result property="realName" column="real_name" jdbcType="VARCHAR"/>
- <result property="realCard" column="real_card" jdbcType="VARCHAR"/>
- <result property="signImg" column="sign_img" jdbcType="VARCHAR"/>
- <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="lotteryNum" column="lottery_num" jdbcType="VARCHAR"/>
- <result property="lotteryCount" column="lottery_count" jdbcType="INTEGER"/>
- <result property="anniversaryLotteryNum" column="anniversary_lottery_num" jdbcType="VARCHAR"/>
- </resultMap>
-
- <sql id="allColumns">
- id,tenant_id,parent_tenant_id,
- activity_id,order_money_sum,order_count,
- cus_name,cus_phone,real_name,
- real_card,sign_img,create_by,
- create_date,update_date,lottery_num,
- lottery_count,anniversary_lottery_num
- </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 != cusName and cusName != '' ">
- and `cus_name` like concat('%', #{cusName},'%')
- </if>
-
- <if test=" null != cusPhone and cusPhone != '' ">
- and `cus_phone` = #{cusPhone}
- </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.WxOfflineActivityGrantAward" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_offline_activity_grant_award
- <include refid="dynamicWhereConditions" />
- </select>
-
-
- <select id="getCusCount" parameterType="com.iformall.domain.po.WxOfflineActivityGrantAward" resultType="Integer">
- SELECT COUNT(DISTINCT cus_phone) FROM wx_offline_activity_grant_award
- 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 != createDateBegin">
- and `create_date` >= #{createDateBegin}
- </if>
-
- <if test=" null != createDateEnd">
- and `create_date` <= #{createDateEnd}
- </if>
- </select>
-
-
- <select id="getRecordIdList" parameterType="com.iformall.domain.po.WxOfflineActivityGrantAward" resultType="Long">
- SELECT DISTINCT rg.record_id
- from wx_offline_activity_record_grant rg
- left join wx_offline_activity_grant_award ga on ga.id = rg.grant_id
- where 1 = 1
- <if test=" null != tenantId and '' != tenantId">
- and ga.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and ga.`parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != createDateBegin">
- and ga.`create_date` >= #{createDateBegin}
- </if>
-
- <if test=" null != createDateEnd">
- and ga.`create_date` <= #{createDateEnd}
- </if>
- <if test=" null != createByIds ">
- and ga.create_by in
- <foreach collection="createByIds" index="index" item="sendItem" open="(" separator="," close=")">
- #{sendItem}
- </foreach>
- </if>
- </select>
-
- <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_offline_activity_grant_award where id = #{id} and tenant_id=#{tenantId}
- </select>
- </mapper>
|