<?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.yeshi.location.app.dao.user.UserInfoDao">
|
<resultMap id="BaseResultMap"
|
type="com.yeshi.location.app.entity.user.UserInfo">
|
<id column="id" property="id" jdbcType="BIGINT"/>
|
<result column="system" property="system" jdbcType="VARCHAR"/>
|
<result column="nick_name" property="nickName" jdbcType="VARCHAR"/>
|
<result column="portrait" property="portrait" jdbcType="VARCHAR"/>
|
<result column="phone" property="phone" jdbcType="VARCHAR"/>
|
<result column="email" property="email" jdbcType="VARCHAR"/>
|
<result column="pwd" property="pwd" jdbcType="VARCHAR"/>
|
<result column="status" property="status" jdbcType="INTEGER"/>
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
<association property="wxUser" column="wx_id" javaType="com.yeshi.location.app.entity.user.WXUserInfo">
|
<id column="wx_id" property="id"></id>
|
</association>
|
|
<association property="qqUser" column="qq_id" javaType="com.yeshi.location.app.entity.user.QQUserInfo">
|
<id column="qq_id" property="id"></id>
|
</association>
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
<trim suffixOverrides=",">
|
id,system,nick_name,portrait,phone,email,pwd,wx_id,qq_id,status,create_time,update_time,
|
</trim>
|
</sql>
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List"/>
|
from lt_user where id = #{id, jdbcType=BIGINT}
|
</select>
|
|
<select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List"/>
|
from lt_user where id = #{id,jdbcType=BIGINT} for update
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
delete from
|
lt_user where id = #{id,jdbcType=BIGINT}
|
</delete>
|
<insert id="insert"
|
parameterType="com.yeshi.location.app.entity.user.UserInfo"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into
|
lt_user
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
system,
|
nick_name,
|
portrait,
|
phone,
|
email,
|
pwd,
|
wx_id,
|
qq_id,
|
status,
|
create_time,
|
update_time,
|
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
#{system},jdbcType=VARCHAR},
|
#{nickName},jdbcType=VARCHAR},
|
#{portrait},jdbcType=VARCHAR},
|
#{phone},jdbcType=VARCHAR},
|
#{email},jdbcType=VARCHAR},
|
#{pwd},jdbcType=VARCHAR},
|
#{wxUser.id},jdbcType=BIGINT},
|
#{qqUser.id},jdbcType=BIGINT},
|
#{status},jdbcType=INTEGER},
|
#{createTime},jdbcType=TIMESTAMP},
|
#{updateTime},jdbcType=TIMESTAMP},
|
|
</trim>
|
|
</insert>
|
<insert id="insertSelective"
|
parameterType="com.yeshi.location.app.entity.user.UserInfo"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into lt_user
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="system != null">system,</if>
|
<if test="nickName != null">nick_name,</if>
|
<if test="portrait != null">portrait,</if>
|
<if test="phone != null">phone,</if>
|
<if test="email != null">email,</if>
|
<if test="pwd != null">pwd,</if>
|
<if test="wxUser != null">wx_id,</if>
|
<if test="qqUser != null">qq_id,</if>
|
<if test="status != null">status,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="system != null">#{system,jdbcType=VARCHAR},</if>
|
<if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if>
|
<if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if>
|
<if test="phone != null">#{phone,jdbcType=VARCHAR},</if>
|
<if test="email != null">#{email,jdbcType=VARCHAR},</if>
|
<if test="pwd != null">#{pwd,jdbcType=VARCHAR},</if>
|
<if test="wxUser != null">#{wxUser.id,jdbcType=BIGINT},</if>
|
<if test="qqUser != null">#{qqUser.id,jdbcType=BIGINT},</if>
|
<if test="status != null">#{status,jdbcType=INTEGER},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey"
|
parameterType="com.yeshi.location.app.entity.user.UserInfo">
|
update lt_user
|
<set>
|
<if test="id != null">id = #{id,jdbcType=BIGINT},</if>
|
<if test="system != null">system = #{system,jdbcType=VARCHAR},</if>
|
<if test="nickName != null">nick_name = #{nickName,jdbcType=VARCHAR},</if>
|
<if test="portrait != null">portrait = #{portrait,jdbcType=VARCHAR},</if>
|
<if test="phone != null">phone = #{phone,jdbcType=VARCHAR},</if>
|
<if test="email != null">email = #{email,jdbcType=VARCHAR},</if>
|
<if test="pwd != null">pwd = #{pwd,jdbcType=VARCHAR},</if>
|
<if test="wxUser != null">wx_id = #{wxUser.id,jdbcType=BIGINT},</if>
|
<if test="qqUser != null">qq_id = #{qqUser.id,jdbcType=BIGINT},</if>
|
<if test="status != null">status = #{status,jdbcType=INTEGER},</if>
|
<if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
|
</set>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKeySelective"
|
parameterType="com.yeshi.location.app.entity.user.UserInfo">
|
update lt_user
|
<set>
|
<if test="system != null">system = #{system,jdbcType=VARCHAR},</if>
|
<if test="nickName != null">nick_name = #{nickName,jdbcType=VARCHAR},</if>
|
<if test="portrait != null">portrait = #{portrait,jdbcType=VARCHAR},</if>
|
<if test="phone != null">phone = #{phone,jdbcType=VARCHAR},</if>
|
<if test="email != null">email = #{email,jdbcType=VARCHAR},</if>
|
<if test="pwd != null">pwd = #{pwd,jdbcType=VARCHAR},</if>
|
<if test="wxUser != null">wx_id = #{wxUser.id,jdbcType=BIGINT},</if>
|
<if test="qqUser != null">qq_id = #{qqUser.id,jdbcType=BIGINT},</if>
|
<if test="status != null">status = #{status,jdbcType=INTEGER},</if>
|
<if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
|
</set>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<sql id="listWhere">
|
|
<if test="query.system!=null">
|
and system = #{query.system}
|
</if>
|
|
<if test="query.wxId!=null">
|
and wx_id = #{query.wxId}
|
</if>
|
|
<if test="query.qqId!=null">
|
and qq_id = #{query.qqId}
|
</if>
|
|
<if test="query.nickName!=null">
|
and nick_name = '%#{query.nickName}%'
|
</if>
|
<if test="query.phone!=null">
|
and phone = #{query.phone}
|
</if>
|
<if test="query.email!=null">
|
and email = #{query.email}
|
</if>
|
<if test="query.maxCreateTime!=null">
|
and create_time <![CDATA[<]]> #{query.maxCreateTime}
|
</if>
|
<if test="query.minCreateTime!=null">
|
and create_time >= #{query.minCreateTime}
|
</if>
|
|
<if test="query.status!=null">
|
and status >= #{query.status}
|
</if>
|
</sql>
|
|
<select id="list"
|
resultMap="BaseResultMap">
|
SELECT * FROM lt_user
|
<where>
|
<include refid="listWhere">
|
</include>
|
</where>
|
<if test="query.sortList!=null">
|
<foreach collection="query.sortList" open=" order by " separator="," item="item">
|
#{item}
|
</foreach>
|
</if>
|
limit #{query.start},#{query.count}
|
</select>
|
|
<select id="listByUids"
|
resultMap="BaseResultMap">
|
SELECT * FROM lt_user
|
<foreach collection="uidList" open=" where " separator=" or " item="uid">
|
id= #{uid}
|
</foreach>
|
</select>
|
|
|
<select id="count"
|
resultType="java.lang.Long">
|
SELECT count(*) FROM lt_user
|
<where>
|
<include refid="listWhere">
|
</include>
|
</where>
|
</select>
|
|
|
<select id="statisticByCreateTime"
|
resultMap="com.yeshi.location.app.mapper.basemapper.Statistic_Number_BaseResultMap">
|
|
SELECT DATE_FORMAT(l.`create_time`,'${timeQuery.timeFormat}') AS time,COUNT(*) AS number FROM lt_user l WHERE
|
l.`create_time`>#{timeQuery.startTime} AND #{timeQuery.endTime}>l.`create_time`
|
<if test="system!=null">
|
and system=#{system}
|
</if>
|
GROUP BY DATE_FORMAT( l.`create_time`,'${timeQuery.timeFormat}')
|
</select>
|
|
|
</mapper>
|