You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
216 lines
6.7 KiB
216 lines
6.7 KiB
<?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.ccsens.tall.persist.dao.SysUserDao">
|
|
<resultMap id="getTokenBeanByUserId" type="com.ccsens.tall.bean.vo.UserVo$TokenBean">
|
|
<id column="id" property="id"/>
|
|
<result column="account" property="account"/>
|
|
<result column="phone" property="phone"/>
|
|
<collection property="wxInfo" ofType="com.ccsens.tall.bean.vo.UserVo$WxInfo">
|
|
<result column="nickname" property="nickname"/>
|
|
<result column="headImgUrl" property="headImgUrl"/>
|
|
<result column="sex" property="sex"/>
|
|
<result column="province" property="province"/>
|
|
<result column="city" property="city"/>
|
|
<result column="country" property="country"/>
|
|
<result column="language" property="language"/>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
|
|
<update id="replaceAuth" parameterType="java.util.Map">
|
|
update
|
|
t_sys_auth
|
|
set
|
|
user_id = #{newUserId}
|
|
where
|
|
user_id = #{oldUserId}
|
|
</update>
|
|
|
|
<update id="replaceAttention" parameterType="java.util.Map">
|
|
update
|
|
t_sys_user_attention
|
|
set
|
|
user_id = #{newUserId}
|
|
where
|
|
user_id = #{oldUserId}
|
|
</update>
|
|
|
|
<update id="replaceBalance" parameterType="java.util.Map">
|
|
update
|
|
t_sys_balance_log
|
|
set
|
|
user_id = #{newUserId}
|
|
where
|
|
user_id = #{oldUserId}
|
|
</update>
|
|
|
|
<update id="replaceProject" parameterType="java.util.Map">
|
|
update
|
|
t_sys_project
|
|
set
|
|
creator_id = #{newUserId}
|
|
where
|
|
creator_id = #{oldUserId}
|
|
</update>
|
|
|
|
<update id="replaceMember" parameterType="java.util.Map">
|
|
update
|
|
t_pro_member
|
|
set
|
|
user_id = #{newUserId}
|
|
where
|
|
user_id = #{oldUserId}
|
|
</update>
|
|
|
|
<update id="replaceDeliverPostLog" parameterType="java.util.Map">
|
|
update
|
|
t_pro_task_deliver_post_log
|
|
set
|
|
user_id = #{newUserId}
|
|
where
|
|
user_id = #{oldUserId}
|
|
</update>
|
|
|
|
<update id="replaceProLog" parameterType="java.util.Map">
|
|
update
|
|
t_pro_log
|
|
set
|
|
user_id = #{newUserId}
|
|
where
|
|
user_id = #{oldUserId}
|
|
</update>
|
|
|
|
<update id="replaceComment" parameterType="java.util.Map">
|
|
update
|
|
t_pro_task_comment
|
|
set
|
|
user_id = #{newUserId}
|
|
where
|
|
user_id = #{oldUserId}
|
|
</update>
|
|
|
|
<select id="getUserNameByUserId" parameterType="java.util.Map" resultType="java.lang.String">
|
|
SELECT
|
|
IF( u.nickname = '', a.identifier, u.nickname ) AS userName
|
|
FROM
|
|
t_sys_user u
|
|
LEFT JOIN t_sys_auth a ON u.id = a.user_id
|
|
AND a.identify_type = 3
|
|
WHERE
|
|
u.rec_status = 0
|
|
and
|
|
a.rec_status = 0
|
|
and
|
|
u.id = #{userId}
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="getUserInfoByUserId" resultType="com.ccsens.tall.bean.vo.UserVo$UserInfo">
|
|
SELECT
|
|
u.id,
|
|
IF( u.nickname = '', a.identifier, u.nickname ) AS nickname,
|
|
u.avatar_url as avatarUrl
|
|
FROM
|
|
t_sys_user u
|
|
LEFT JOIN t_sys_auth a ON u.id = a.user_id
|
|
AND a.identify_type = 3
|
|
WHERE
|
|
u.rec_status = 0
|
|
and
|
|
a.rec_status = 0
|
|
and
|
|
u.id = #{userId}
|
|
limit 1
|
|
</select>
|
|
<select id="queryUserInfos" resultType="com.ccsens.tall.bean.vo.UserVo$UserInfo">
|
|
SELECT
|
|
u.id,
|
|
IF( u.nickname = '', a.identifier, u.nickname ) AS nickname,
|
|
u.avatar_url as avatarUrl
|
|
FROM
|
|
t_sys_user u
|
|
LEFT JOIN t_sys_auth a ON u.id = a.user_id
|
|
AND a.identify_type = 3
|
|
WHERE
|
|
u.rec_status = 0
|
|
and
|
|
a.rec_status = 0
|
|
and
|
|
u.id in
|
|
<foreach collection="array" item="item" separator="," open="(" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="selectUserInfo" parameterType="java.util.Map" resultType="com.ccsens.tall.bean.vo.UserVo$SelectUserInfo">
|
|
SELECT
|
|
u.id as id,
|
|
(SELECT identifier FROM t_sys_auth WHERE rec_status = 0 AND user_id = #{userId} and identify_type = 3 order by updated_at limit 1) as account,
|
|
(SELECT identifier FROM t_sys_auth WHERE rec_status = 0 AND user_id = #{userId} and identify_type = 1 order by updated_at limit 1) as phone,
|
|
u.nickname as nickname,
|
|
u.avatar_url as avatarUrl,
|
|
i.signature as signature,
|
|
i.introduction as introduction,
|
|
i.birthday as birthday,
|
|
i.address as address,
|
|
i.web_path as webPath,
|
|
i.company as company,
|
|
i.position as `position`,
|
|
u.created_at as createdAt
|
|
FROM
|
|
t_sys_user u LEFT JOIN t_sys_user_info i on u.id = i.user_id
|
|
WHERE
|
|
u.rec_status = 0
|
|
and
|
|
u.id = #{userId}
|
|
GROUP BY u.id
|
|
</select>
|
|
|
|
<select id="selectInterspace" parameterType="java.util.Map" resultType="com.ccsens.tall.bean.vo.UserVo$Interspace">
|
|
SELECT
|
|
count(id) as projectNum
|
|
FROM
|
|
t_sys_project
|
|
WHERE
|
|
rec_status = 0
|
|
and
|
|
creator_id = #{userId}
|
|
</select>
|
|
|
|
<select id="getTokenBeanByUserId" parameterType="java.util.Map" resultMap="getTokenBeanByUserId">
|
|
SELECT
|
|
u.id as id ,
|
|
t.account as account,
|
|
x.phone as phone,
|
|
u.nickname as nickname,
|
|
u.avatar_url as headImgUrl,
|
|
u.gender as sex,
|
|
u.province,
|
|
u.city,
|
|
u.country,
|
|
u.`language`
|
|
FROM
|
|
t_sys_user u
|
|
LEFT JOIN ( SELECT user_id, identifier AS account FROM t_sys_auth WHERE identify_type = 3 AND rec_status = 0) t ON u.id = t.user_id
|
|
LEFT JOIN ( SELECT user_id, identifier AS phone FROM t_sys_auth WHERE identify_type = 1 AND rec_status = 0) x ON u.id = x.user_id
|
|
WHERE
|
|
u.id = #{userId}
|
|
AND
|
|
rec_status = 0
|
|
</select>
|
|
|
|
<select id="selectWxInfo" resultType="com.ccsens.tall.bean.vo.UserVo$WxInfo">
|
|
SELECT
|
|
u.city As city,
|
|
u.country AS country,
|
|
u.avatar_url As headImgUrl,
|
|
u.`language` As `language`,
|
|
u.nickname AS nickname,
|
|
u.province AS province,
|
|
u.gender AS sex
|
|
FROM
|
|
t_sys_user AS u
|
|
WHERE
|
|
id = #{userId}
|
|
</select>
|
|
</mapper>
|