|
|
@@ -27,32 +27,54 @@
|
|
|
|
|
|
<!-- 根据电话号码获取用户信息 -->
|
|
|
<select id="getByPhone" resultMap="ResultMap">
|
|
|
- SELECT
|
|
|
- txu.user_id, txu.user_wxid, txu.user_name, txu.user_phone, txu.user_pwd, txu.current_cp, txu.flg_valid,txu.joined_cps,
|
|
|
- tac.cp_id AS "join_cp_id",tac.cp_code AS "join_cp_code",tac.cp_name AS "join_cp_name",tac.svc_code AS "join_svc_code",
|
|
|
- tss.svc_ip AS "join_svc_ip",tss.svc_port AS "join_svc_port"
|
|
|
+ SELECT txu.user_id,
|
|
|
+ txu.user_wxid,
|
|
|
+ txu.user_name,
|
|
|
+ txu.user_phone,
|
|
|
+ txu.user_pwd,
|
|
|
+ txu.current_cp,
|
|
|
+ txu.flg_valid,
|
|
|
+ txu.joined_cps,
|
|
|
+ tac.cp_id AS "join_cp_id",
|
|
|
+ tac.cp_code AS "join_cp_code",
|
|
|
+ tac.cp_name AS "join_cp_name",
|
|
|
+ tac.svc_code AS "join_svc_code",
|
|
|
+ tss.svc_ip AS "join_svc_ip",
|
|
|
+ tss.svc_port AS "join_svc_port"
|
|
|
FROM dkic_a.t_wx_user txu
|
|
|
- LEFT JOIN dkic_a.t_a_company tac
|
|
|
- ON tac.cp_id = ANY(txu.joined_cps)
|
|
|
- AND (tac.end_date is null or tac.end_date > now())
|
|
|
- LEFT JOIN dkic_a.t_s_service tss
|
|
|
- ON tac.svc_code = tss.svc_code
|
|
|
- AND tss.flg_valid
|
|
|
+ LEFT JOIN dkic_a.t_a_company tac
|
|
|
+ ON tac.cp_id = ANY (txu.joined_cps)
|
|
|
+ AND (tac.end_date is null or tac.end_date > now())
|
|
|
+ LEFT JOIN dkic_a.t_s_service tss
|
|
|
+ ON tac.svc_code = tss.svc_code
|
|
|
+ AND tss.flg_valid
|
|
|
where txu.user_phone = #{userPhone}
|
|
|
- AND txu.flg_valid
|
|
|
+ AND txu.flg_valid
|
|
|
</select>
|
|
|
|
|
|
<select id="getByWxid" resultMap="ResultMap">
|
|
|
- SELECT
|
|
|
- txu.user_id, txu.user_wxid, txu.user_name, txu.user_phone, txu.user_pwd, txu.current_cp, txu.joined_cps,txu.flg_valid
|
|
|
+ SELECT txu.user_id,
|
|
|
+ txu.user_wxid,
|
|
|
+ txu.user_name,
|
|
|
+ txu.user_phone,
|
|
|
+ txu.user_pwd,
|
|
|
+ txu.current_cp,
|
|
|
+ txu.joined_cps,
|
|
|
+ txu.flg_valid
|
|
|
FROM dkic_a.t_wx_user txu
|
|
|
where txu.user_wxid = #{userWxid}
|
|
|
AND txu.flg_valid
|
|
|
</select>
|
|
|
|
|
|
<select id="selectById" resultMap="ResultMap">
|
|
|
- SELECT
|
|
|
- user_id, user_wxid, user_name, user_phone, user_pwd, current_cp,joined_cps, flg_valid
|
|
|
+ SELECT user_id,
|
|
|
+ user_wxid,
|
|
|
+ user_name,
|
|
|
+ user_phone,
|
|
|
+ user_pwd,
|
|
|
+ current_cp,
|
|
|
+ joined_cps,
|
|
|
+ flg_valid
|
|
|
FROM dkic_a.t_wx_user
|
|
|
where user_id = #{userId}::uuid
|
|
|
</select>
|
|
|
@@ -63,29 +85,34 @@
|
|
|
</insert>
|
|
|
|
|
|
<update id="cleanPhone">
|
|
|
- update dkic_a.t_wx_user set user_phone = null
|
|
|
+ update dkic_a.t_wx_user
|
|
|
+ set user_phone = null
|
|
|
where user_phone = #{userPhone}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateWxid">
|
|
|
- update dkic_a.t_wx_user set user_wxid = #{userWxid}
|
|
|
+ update dkic_a.t_wx_user
|
|
|
+ set user_wxid = #{userWxid}
|
|
|
where user_id = #{userId}::uuid
|
|
|
</update>
|
|
|
|
|
|
<update id="updatePhone">
|
|
|
- update dkic_a.t_wx_user set user_phone = #{userPhone}
|
|
|
+ update dkic_a.t_wx_user
|
|
|
+ set user_phone = #{userPhone}
|
|
|
where user_id = #{userId}::uuid
|
|
|
</update>
|
|
|
-<!--更新微信用的公司-->
|
|
|
+ <!--更新微信用的公司-->
|
|
|
<update id="updateCpid">
|
|
|
- update dkic_a.t_wx_user set current_cp = #{currentCp},
|
|
|
- joined_cps = #{joinedCps,typeHandler=IntListTypeHandler}
|
|
|
+ update dkic_a.t_wx_user set current_cp = #{currentCp}
|
|
|
+ <if test="joinedCps != null">
|
|
|
+ ,joined_cps = #{joinedCps,typeHandler=IntListTypeHandler}
|
|
|
+ </if>
|
|
|
where user_id = #{userId}::uuid
|
|
|
</update>
|
|
|
|
|
|
<!--新建用户状态表-->
|
|
|
<insert id="insertOrUpdateUserLogin">
|
|
|
- insert into dkic_a.t_wx_user_login
|
|
|
+ insert into dkic_a.t_wx_user_login
|
|
|
(
|
|
|
<trim suffixOverrides=",">
|
|
|
user_id,
|
|
|
@@ -110,8 +137,10 @@
|
|
|
|
|
|
<!--查询用户状态-->
|
|
|
<select id="selectUserLogin" resultType="java.util.Map">
|
|
|
- SELECT
|
|
|
- user_id AS "userId", app_code AS "appCode", token_key AS "tokenKey", op_update_time AS "opUpdateTime"
|
|
|
+ SELECT user_id AS "userId",
|
|
|
+ app_code AS "appCode",
|
|
|
+ token_key AS "tokenKey",
|
|
|
+ op_update_time AS "opUpdateTime"
|
|
|
FROM dkic_a.t_wx_user_login
|
|
|
WHERE user_id = #{userId}::uuid
|
|
|
AND app_code = #{appCode}
|
|
|
@@ -121,9 +150,7 @@
|
|
|
<update id="updatePassword">
|
|
|
update dkic_a.t_wx_user
|
|
|
<set>
|
|
|
- <if test="userPwd != null">
|
|
|
- user_pwd = #{userPwd},
|
|
|
- </if>
|
|
|
+ user_pwd = #{userPwd}
|
|
|
</set>
|
|
|
where user_id = #{userId}
|
|
|
</update>
|