<?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.nq.dao.UserMapper">
|
<resultMap id="BaseResultMap" type="com.nq.pojo.User">
|
<id column="id" property="id"/>
|
<result column="agent_id" property="agentId"/>
|
<result column="agent_name" property="agentName"/>
|
<result column="phone" property="phone"/>
|
<result column="user_pwd" property="userPwd"/>
|
<result column="with_pwd" property="withPwd"/>
|
<result column="nick_name" property="nickName"/>
|
<result column="real_name" property="realName"/>
|
<result column="id_card" property="idCard"/>
|
<result column="account_type" property="accountType"/>
|
<result column="is_lock" property="isLock"/>
|
<result column="is_login" property="isLogin"/>
|
<result column="reg_time" property="regTime"/>
|
<result column="reg_ip" property="regIp"/>
|
<result column="reg_address" property="regAddress"/>
|
<result column="img1_key" property="img1Key"/>
|
<result column="img2_key" property="img2Key"/>
|
<result column="img3_key" property="img3Key"/>
|
<result column="is_active" property="isActive"/>
|
<result column="auth_msg" property="authMsg"/>
|
<result column="withdrawal_Pwd" property="withdrawalPwd"/>
|
<result column="vaild_number" property="vaildNumber"/>
|
<result column="lever" property="lever"/>
|
<result column="fund_ratio" property="fundRatio"/>
|
|
</resultMap>
|
<sql id="Base_Column_List">
|
id, agent_id, agent_name, phone, user_pwd, with_pwd, nick_name, real_name, id_card,
|
account_type, is_lock, is_login,
|
reg_time, reg_ip, reg_address, img1_key, img2_key, img3_key, is_active, auth_msg,
|
withdrawal_Pwd,vaild_number,lever,fund_ratio
|
</sql>
|
|
|
<select id="findByPhone" parameterType="string" resultType="com.nq.pojo.User">
|
select * from user where phone= #{phone}
|
</select>
|
|
<select id="login" resultMap="BaseResultMap" parameterType="map">
|
SELECT
|
<include refid="Base_Column_List"/>
|
FROM user
|
WHERE phone = #{phone} and user_pwd = #{userPwd}
|
</select>
|
|
<select id="listByAgent" resultMap="BaseResultMap" parameterType="map">
|
SELECT
|
<include refid="Base_Column_List"/>
|
FROM user
|
<where>
|
(agent_id = #{searchId} or
|
agent_id in (select a.id FROM agent_user a left join agent_distribution_user d on a.id = d.agent_id WHERE d.parent_id = #{searchId})
|
)
|
<if test="realName != null and realName != '' ">
|
and real_name like CONCAT('%','${realName}','%')
|
</if>
|
<if test="phone != null and phone != '' ">
|
and phone like CONCAT('%','${phone}','%')
|
</if>
|
<if test="accountType != null ">
|
and account_type = #{accountType}
|
</if>
|
</where>
|
ORDER BY id DESC
|
</select>
|
|
<select id="querySumTodayRegCount" resultType="int">
|
select count(*) from user where TO_DAYS(reg_time) = TO_DAYS(NOW())
|
</select>
|
|
|
<select id="querySumTodayRegCount" resultType="int" parameterType="integer">
|
select count(*) from user where TO_DAYS(reg_time) = TO_DAYS(NOW()) and agent_id = #{id}
|
</select>
|
|
|
<select id="queryAgintSumTodayRegCount" parameterType="integer" resultType="int">
|
select count(*) from user where agent_id =#{id} TO_DAYS(reg_time) = TO_DAYS(NOW())
|
</select>
|
|
<select id="listByAdmin" resultMap="BaseResultMap" parameterType="map">
|
SELECT
|
<include refid="Base_Column_List"/>
|
FROM user
|
<where>
|
<if test="searchId != null ">
|
and agent_id = #{searchId}
|
</if>
|
<if test="realName != null and realName != '' ">
|
and real_name like CONCAT('%','${realName}','%')
|
</if>
|
<if test="phone != null and phone != '' ">
|
and phone like CONCAT('%','${phone}','%')
|
</if>
|
<if test="accountType != null ">
|
and account_type = #{accountType}
|
</if>
|
</where>
|
ORDER BY id DESC
|
</select>
|
</mapper>
|