|
- <?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.WxCUserBasicInfoMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserBasicInfo">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="phone" jdbcType="VARCHAR" property="phone"/>
- <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
- <result column="education" jdbcType="VARCHAR" property="education"/>
- <result column="sex" jdbcType="INTEGER" property="sex"/>
- <result column="email" jdbcType="VARCHAR" property="email"/>
- <result column="address" jdbcType="VARCHAR" property="address"/>
- <result column="poins" jdbcType="INTEGER" property="poins"/>
- <result column="tag_id" jdbcType="BIGINT" property="tagId"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="level" jdbcType="VARCHAR" property="level"/>
- <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
- <result column="credit" jdbcType="INTEGER" property="credit"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,
- `create_date`,`update_date`,`tenant_id`,`name`,`level`,`nick_name`,`credit`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != tenantId ">
- and `tenant_id` = #{tenantId}
- </if>
-
- <if test=" null != phone ">
- and `phone` like concat('%', #{phone},'%')
- </if>
-
- <if test=" null != birthdate ">
- and `birthdate` = #{birthdate}
- </if>
-
- <if test=" null != education ">
- and `education` like concat('%', #{education},'%')
- </if>
-
- <if test=" null != sex ">
- and `sex` = #{sex}
- </if>
-
- <if test=" null != email ">
- and `email` like concat('%', #{email},'%')
- </if>
-
- <if test=" null != address ">
- and `address` like concat('%', #{address},'%')
- </if>
-
- <if test=" null != poins ">
- and `poins` = #{poins}
- </if>
-
- <if test=" null != credit ">
- and `credit` = #{credit}
- </if>
-
- <if test=" null != tagId ">
- and `tag_id` = #{tagId}
- </if>
-
- <if test=" null != createDate ">
- and `create_date` = #{createDate}
- </if>
-
- <if test=" null != updateDate ">
- and `update_date` = #{updateDate}
- </if>
-
- <if test=" null != name ">
- and `name` like concat('%', #{name},'%')
- </if>
- <if test=" null != startTime and null!=endTime">
- and `create_date` between #{startTime} and #{endTime}
- </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.WxCUserBasicInfo" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_c_user_basic_info
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <sql id="allUserColumns">
- c.`id`,c.`phone`,cb.`birthdate`,cb.`education`,cb.`sex`,cb.`email`,cb.`address`,cb.`poins`,cb.`tag_id`,
- cb.`create_date`,cb.`update_date`,c.`tenant_id`,cb.`name`,cb.level,cb.nick_name
- </sql>
-
- <update id="updateScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo">
- update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId}
- and id=#{id}
- </update>
-
- <update id="updateNewId" parameterType="com.iformall.domain.vo.CUserBaseVo">
- update wx_c_user_basic_info set id=#{newId} where tenant_id=#{tenantId}
- and id = #{id}
- </update>
-
- <select id="findCountBySex" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
- select count(id) from wx_c_user_basic_info
- where sex =#{sex}
- <if test=" null != startTime ">
- and create_date >= #{startTime}
- </if>
- <if test=" null != endTime">
- and create_date <= #{endTime}
- </if>
- <if test="null != tenantId">
- and tenant_id =#{tenantId}
- </if>
- </select>
-
-
- <select id="findCountByAge" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
- select count(id) from wx_c_user_basic_info where 1=1
- <if test=" null != startTime ">
- and create_date >= #{startTime}
- </if>
- <if test=" null != endTime">
- and create_date <= #{endTime}
- </if>
-
- <if test=" null != birthStartTime ">
- and birthdate >= #{birthStartTime}
- </if>
-
- <if test=" null != birthEndTime">
- and birthdate <= #{birthEndTime}
- </if>
-
- <if test=" null == birthStartTime and null == birthEndTime">
- and birthdate is null
- </if>
-
- <if test="null != tenantId">
- and tenant_id =#{tenantId}
- </if>
-
- </select>
-
- <select id="findCountByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
- select count(id) from wx_c_user_basic_info where 1=1
- <if test=" null != startTime ">
- and create_date >= #{startTime}
- </if>
- <if test=" null != endTime">
- and create_date <= #{endTime}
- </if>
-
- <if test=" null != levelStartScore ">
- and poins >= #{levelStartScore}
- </if>
-
- <if test=" null != levelEndScore">
- and poins < #{levelEndScore}
- </if>
-
- <if test=" null == levelStartScore and null == levelEndScore">
- and poins is null
- </if>
-
- <if test="null != tenantId">
- and tenant_id =#{tenantId}
- </if>
-
- </select>
-
- <sql id="allColumnsOfScoreList">
- cub.id,cub.phone,cub.birthdate,cub.education,cub.sex,cub.email,cub.address,cub.poins,cub.tag_id,
- cub.create_date,cub.update_date,cub.tenant_id,cub.name,cub.level,cub.nick_name
- </sql>
-
- <select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap">
- select <include refid="allColumnsOfScoreList"/>
- from wx_c_user_basic_info cub
- inner join wx_c_user cu on cu.id = cub.id
-
- where 1=1
-
- <if test=" null != levelStartScore ">
- and cub.poins >= #{levelStartScore}
- </if>
-
- <if test=" null != levelEndScore">
- and cub.poins <= #{levelEndScore}
- </if>
-
- <if test=" null == levelStartScore and null == levelEndScore">
- and cub.poins is null
- </if>
-
- <if test="null != tenantId">
- and cub.tenant_id =#{tenantId}
- </if>
-
- </select>
-
- <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
- select count(id) from wx_c_user_basic_info where 1=1
- <if test=" null != startTime ">
- and create_date >= #{startTime}
- </if>
- <if test=" null != endTime">
- and create_date < #{endTime}
- </if>
- <if test="null != tenantId">
- and tenant_id =#{tenantId}
- </if>
- </select>
-
- <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCUserBasicInfoVo">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="phone" jdbcType="VARCHAR" property="phone"/>
- <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
- <result column="education" jdbcType="VARCHAR" property="education"/>
- <result column="sex" jdbcType="INTEGER" property="sex"/>
- <result column="email" jdbcType="VARCHAR" property="email"/>
- <result column="address" jdbcType="VARCHAR" property="address"/>
- <result column="poins" jdbcType="INTEGER" property="poins"/>
- <result column="tag_id" jdbcType="BIGINT" property="tagId"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="level" jdbcType="VARCHAR" property="level"/>
- <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
-
- <result column="tags" jdbcType="VARCHAR" property="tags"/>
- </resultMap>
-
- <sql id="allVoColumns">
- cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_id`,
- cu.`create_date`,cu.`update_date`,cu.`tenant_id`,cu.`name`,cu.`level`,cu.`nick_name`,
- cut.`tags`
- </sql>
-
- <sql id="dynamicVoWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and cu.`id` = #{id}
- </if>
-
- <if test=" null != tenantId ">
- and cu.`tenant_id` = #{tenantId}
- </if>
-
- <if test=" null != phone ">
- and cu.`phone` like concat('%', #{phone},'%')
- </if>
-
- <if test=" null != birthdate ">
- and cu.`birthdate` = #{birthdate}
- </if>
-
- <if test=" null != education ">
- and cu.`education` like concat('%', #{education},'%')
- </if>
-
- <if test=" null != sex ">
- and cu.`sex` = #{sex}
- </if>
-
- <if test=" null != email ">
- and cu.`email` like concat('%', #{email},'%')
- </if>
-
- <if test=" null != address ">
- and cu.`address` like concat('%', #{address},'%')
- </if>
-
- <if test=" null != poins ">
- and cu.`poins` = #{poins}
- </if>
-
- <if test=" null != tagId ">
- and cu.`tag_id` = #{tagId}
- </if>
-
- <if test=" null != createDate ">
- and cu.`create_date` = #{createDate}
- </if>
-
- <if test=" null != updateDate ">
- and cu.`update_date` = #{updateDate}
- </if>
-
- <if test=" null != name ">
- and `name` like concat('%', #{name},'%')
- </if>
- <if test=" null != startTime and null!=endTime">
- and cu.`create_date` between #{startTime} and #{endTime}
- </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="findVoList" parameterType="com.iformall.domain.vo.WxCUserBasicInfoVo" resultMap="VoBaseResultMap">
- select
- <include refid="allVoColumns"/>
- from wx_c_user_basic_info cu
- left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
- <include refid="dynamicVoWhereConditions"/>
- </select>
-
- <select id="countVoList" parameterType="com.iformall.domain.vo.WxCUserBasicInfoVo" resultType="java.lang.Integer">
- select
- count(*)
- from wx_c_user_basic_info cu
- left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
- <include refid="dynamicVoWhereConditions"/>
- </select>
-
-
- <sql id="msgColumns">
- cu.`id`,cu.`phone`,cu.`email`
- </sql>
-
- <sql id="filterWhereConditions">
- where 1=1
- <if test="null != tenantId">
- and cu.tenant_id =#{tenantId}
- </if>
-
- <if test=" null != startTime ">
- and cu.create_date >= #{startTime}
- </if>
-
- <if test=" null != endTime">
- and cu.create_date <= #{endTime}
- </if>
-
- <if test=" null != levelStartScore and (0 != levelStartScore and '' != levelStartScore)">
- and cu.poins >= #{levelStartScore}
- <if test=" null != levelEndScore">
- and cu.poins < #{levelEndScore}
- </if>
- </if>
-
- <if test=" null != levelStartScore and (0 == levelStartScore or '' == levelStartScore)">
- and (cu.poins is null or
- (cu.poins >= #{levelStartScore}
- <if test=" null != levelEndScore">
- and cu.poins < #{levelEndScore}
- </if>
- ))
- </if>
-
- <if test=" null != tagIds ">
- and JSON_CONTAINS(JSON_ARRAY(cut.tags),JSON_ARRAY
- <foreach collection="tagIds" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- )
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findCountByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
- select count(*) from wx_c_user_basic_info cu
- join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
- <include refid="filterWhereConditions"/>
- </select>
-
- <select id="findListByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap">
- select <include refid="msgColumns"/>
- from wx_c_user_basic_info cu
- join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
- <include refid="filterWhereConditions"/>
- </select>
-
-
- </mapper>
|