|
- <?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.WxLegionActivityUserMapper">
-
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLegionActivityUser">
- <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="phone" column="phone" jdbcType="VARCHAR"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="address" column="address" jdbcType="VARCHAR"/>
- <result property="vipNum" column="vip_num" jdbcType="VARCHAR"/>
- <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="status" column="status" jdbcType="INTEGER"/>
- <result property="createBy" column="create_by" jdbcType="BIGINT"/>
- <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
- <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
- </resultMap>
-
- <sql id="allColumns">
- id,tenant_id,parent_tenant_id,
- activity_id,phone,`name`,
- address,vip_num,merchant_id,
- legion_id,union_id,status,create_by,
- create_date,update_date
- </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 != phone and phone != '' ">
- and `phone` like concat('%', #{phone},'%')
- </if>
- <if test=" null != name and name != '' ">
- and `name` like concat('%', #{name},'%')
- </if>
- <if test=" null != vipNum and vipNum != '' ">
- and `vip_num` like concat('%', #{vipNum},'%')
- </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 != createDateBegin">
- and `create_date` >= #{createDateBegin}
- </if>
-
- <if test=" null != createDateEnd">
- and `create_date` <= #{createDateEnd}
- </if>
-
- <if test=" null != status ">
- and `status` = #{status}
- </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.WxLegionActivityUser" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_legion_activity_user
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="findIdList" parameterType="com.iformall.domain.po.WxLegionActivityUser" resultType="Long">
- select id from wx_legion_activity_user
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select <include refid="allColumns" /> from wx_legion_activity_user where id = #{id} and tenant_id=#{tenantId}
- </select>
-
- <select id="merchantCountStatistics" parameterType="com.iformall.domain.po.WxLegionActivityUser" resultType="com.iformall.domain.vo.LegionActivityUserStatistics">
- SELECT merchant_id as 'merchantId',
- count(1) as 'count'
- FROM wx_legion_activity_user
- 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 != merchantId ">
- and `merchant_id` = #{merchantId}
- </if>
-
- <if test=" null != createDateBegin">
- and `create_date` >= #{createDateBegin}
- </if>
-
- <if test=" null != createDateEnd">
- and `create_date` <= #{createDateEnd}
- </if>
-
- <if test=" null != status ">
- and `status` = #{status}
- </if>
- GROUP BY merchant_id
- </select>
-
- <update id="updateStatus" parameterType="com.iformall.domain.po.WxLegionActivityUser">
- update wx_legion_activity_user
- set `status` = #{status},
- `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 != merchantIdList ">
- and merchant_id in
- <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")">
- #{midItem}
- </foreach>
- </if>
- </update>
- </mapper>
|