Browse Source

运营人员

chao 4 years ago
parent
commit
3915d81d44

+ 0 - 33
src/main/java/com/caimei365/user/mapper/LoginMapper.java

@@ -35,14 +35,6 @@ public interface LoginMapper {
      * @return BaseUser
      */
     UserLoginVo getLoginUserByMobile(@Param("mobile") String mobile);
-    /**
-     * 根据手机号获取运营人员
-     *
-     * @param mobile 手机号
-     * @return BaseUser
-     */
-    OperationPo getOperationByMobile(@Param("mobile") String mobile);
-
     /**
      * 根据openId获取协销
      * @param openId openId
@@ -91,18 +83,6 @@ public interface LoginMapper {
      * @return
      */
     UserLoginVo getOperationUserByOperationId(Integer operationId);
-    /**
-     * 根据用户ID更新运营人员openId
-     * @param userId
-     * @param openId
-     */
-    void updateOperationOpenId(@Param("userId") Integer userId, @Param("openId") String openId);
-    /**
-     * 根据用户ID更新运营人员unionId
-     * @param userId
-     * @param unionId
-     */
-    void updateOperationUnionId(@Param("userId") Integer userId, @Param("unionId") String unionId);
     /**
      * 根据openId获取用户Id
      * @param openId
@@ -110,19 +90,6 @@ public interface LoginMapper {
      * @return
      */
     Integer getUserIdByOpenId(@Param("openId") String openId, @Param("source") String source);
-
-    /**
-     * 邀请码登录更新运营人员信息
-     * @param operationPo 运营人员信息
-     */
-    void updateOperationByInvitation(OperationPo operationPo);
-
-    /**
-     * 解绑更新运营人员信息
-     * @param operation 运营人员信息
-     */
-    void updateOperationByUnbind(OperationPo operation);
-
     /**
      * 根据机构名称获取机构数量
      *

+ 46 - 0
src/main/java/com/caimei365/user/mapper/OperationMapper.java

@@ -0,0 +1,46 @@
+package com.caimei365.user.mapper;
+
+import com.caimei365.user.model.po.OperationPo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/3/26
+ */
+@Mapper
+public interface OperationMapper {
+    /**
+     * 根据手机号获取运营人员
+     *
+     * @param mobile 手机号
+     * @return BaseUser
+     */
+    OperationPo getOperationByMobile(@Param("mobile") String mobile);
+    /**
+     * 根据用户ID更新运营人员openId
+     * @param userId
+     * @param openId
+     */
+    void updateOperationOpenId(@Param("userId") Integer userId, @Param("openId") String openId);
+    /**
+     * 根据用户ID更新运营人员unionId
+     * @param userId
+     * @param unionId
+     */
+    void updateOperationUnionId(@Param("userId") Integer userId, @Param("unionId") String unionId);
+
+    /**
+     * 邀请码登录更新运营人员信息
+     * @param operationPo 运营人员信息
+     */
+    void updateOperationByInvitation(OperationPo operationPo);
+
+    /**
+     * 解绑更新运营人员信息
+     * @param operation 运营人员信息
+     */
+    void updateOperationByUnbind(OperationPo operation);
+}

+ 7 - 6
src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.caimei365.user.components.CommonService;
 import com.caimei365.user.components.WeChatService;
 import com.caimei365.user.mapper.LoginMapper;
+import com.caimei365.user.mapper.OperationMapper;
 import com.caimei365.user.mapper.RegisterMapper;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.AuthBindDto;
@@ -44,6 +45,8 @@ public class LoginServiceImpl implements LoginService {
     private LoginMapper loginMapper;
     @Resource
     private RegisterMapper registerMapper;
+    @Resource
+    private OperationMapper operationMapper;
 
     /**
      * 小程序邀请码过期天数
@@ -231,12 +234,12 @@ public class LoginServiceImpl implements LoginService {
                 return ResponseJson.error("您的微信尚未绑定任何机构", operation);
             } else {
                 // 表示 openId存在, unionId不存在
-                loginMapper.updateOperationUnionId(operation.getUserId(), unionId);
+                operationMapper.updateOperationUnionId(operation.getUserId(), unionId);
             }
         }
         // 如果unionId存在, openId不存在
         if (StringUtils.isEmpty(operation.getOpenId()) || StringUtils.isBlank(operation.getOpenId())) {
-            loginMapper.updateOperationOpenId(operation.getUserId(), openId);
+            operationMapper.updateOperationOpenId(operation.getUserId(), openId);
         }
         operation.setOpenId(openId);
         operation.setUnionId(unionId);
@@ -422,7 +425,7 @@ public class LoginServiceImpl implements LoginService {
             operationPo.setUserType(2);
         }
         // 更新运营人员信息
-        loginMapper.updateOperationByInvitation(operationPo);
+        operationMapper.updateOperationByInvitation(operationPo);
         // 返回登录校验结果
         return logonVerify(operation);
     }
@@ -529,8 +532,6 @@ public class LoginServiceImpl implements LoginService {
         registerMapper.insertOperation(operation);
         return ResponseJson.success("绑定微信成功", user);
     }
-
-
     /**
      * 解绑运营人员
      *
@@ -547,6 +548,6 @@ public class LoginServiceImpl implements LoginService {
         operation.setStatus(1);
         operation.setDelFlag(1);
         // 解绑运营人员
-        loginMapper.updateOperationByUnbind(operation);
+        operationMapper.updateOperationByUnbind(operation);
     }
 }

+ 0 - 61
src/main/resources/mapper/LoginMapper.xml

@@ -68,17 +68,6 @@
         and u.userIdentity in (1,2,3,4)
         limit 1
     </select>
-    <select id="getOperationByMobile" resultType="com.caimei365.user.model.po.OperationPo">
-        select o.id as id,
-               o.userID as userId,
-               o.mobile as mobile,
-               o.clubID as clubId,
-               o.shopID as shopId,
-               o.unionId as unionId
-        from cm_mall_operation_user o
-        where o.mobile = #{mobile} and o.delFlag = '0'
-        limit 1
-    </select>
     <select id="getServiceProviderUserByOpenId" resultType="com.caimei365.user.model.vo.UserLoginVo">
         select u.userID as userId,
                u.userName as userName,
@@ -180,55 +169,6 @@
         set unionId = #{unionId}
         where userID = #{userId}
     </update>
-    <update id="updateOperationOpenId">
-        update cm_mall_operation_user
-        set openid = #{openId}
-        where userID = #{userId}
-    </update>
-    <update id="updateOperationUnionId">
-        update cm_mall_operation_user
-        set unionId = #{unionId}
-        where userID = #{userId}
-    </update>
-    <update id="updateOperationByInvitation">
-        update cm_mall_operation_user
-        set unionId = #{unionId},
-            openId = #{openId},
-            nickName = #{nickName},
-            headimgurl = #{avatarUrl},
-            status = #{status},
-            <if test="clubId != null">
-                clubId = #{clubId},
-                shopId = null,
-            </if>
-            <if test="shopId != null">
-                shopId = #{shopId},
-                clubId = null,
-            </if>
-            userType = #{userType}
-        where id = #{id}
-    </update>
-    <update id="updateOperationByUnbind">
-        update cm_mall_operation_user
-        set unionId = #{unionId},
-            openId = #{openId},
-            nickName = #{nickName},
-            bindTime = #{bindTime},
-            updateTime = #{updateTime},
-            status = #{status},
-            userType = #{userType},
-            <if test="clubId != null">
-                clubId = #{clubId},
-                shopId = null,
-            </if>
-            <if test="shopId != null">
-                shopId = #{shopId},
-                clubId = null,
-            </if>
-            delFlag = #{delFlag}
-        where id = #{id}
-    </update>
-
     <select id="getUserIdByOpenId" resultType="java.lang.Integer">
         select o.userID as userId
         from
@@ -247,7 +187,6 @@
         and userOrganizeID=0
         limit 1
     </select>
-
     <select id="getOperationUserByInvitationCode" resultType="com.caimei365.user.model.vo.UserLoginVo">
         SELECT
             cou.id as operationId,

+ 64 - 0
src/main/resources/mapper/OperationMapper.xml

@@ -0,0 +1,64 @@
+<?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.caimei365.user.mapper.OperationMapper">
+    <select id="getOperationByMobile" resultType="com.caimei365.user.model.po.OperationPo">
+        select o.id as id,
+               o.userID as userId,
+               o.mobile as mobile,
+               o.clubID as clubId,
+               o.shopID as shopId,
+               o.unionId as unionId
+        from cm_mall_operation_user o
+        where o.mobile = #{mobile} and o.delFlag = '0'
+        limit 1
+    </select>
+    <update id="updateOperationOpenId">
+        update cm_mall_operation_user
+        set openid = #{openId}
+        where userID = #{userId}
+    </update>
+    <update id="updateOperationUnionId">
+        update cm_mall_operation_user
+        set unionId = #{unionId}
+        where userID = #{userId}
+    </update>
+    <update id="updateOperationByInvitation">
+        update cm_mall_operation_user
+        set unionId = #{unionId},
+            openId = #{openId},
+            nickName = #{nickName},
+            headimgurl = #{avatarUrl},
+            status = #{status},
+            <if test="clubId != null">
+                clubId = #{clubId},
+                shopId = null,
+            </if>
+            <if test="shopId != null">
+                shopId = #{shopId},
+                clubId = null,
+            </if>
+            userType = #{userType}
+        where id = #{id}
+    </update>
+    <update id="updateOperationByUnbind">
+        update cm_mall_operation_user
+        set unionId = #{unionId},
+            openId = #{openId},
+            nickName = #{nickName},
+            bindTime = #{bindTime},
+            updateTime = #{updateTime},
+            status = #{status},
+            userType = #{userType},
+            <if test="clubId != null">
+                clubId = #{clubId},
+                shopId = null,
+            </if>
+            <if test="shopId != null">
+                shopId = #{shopId},
+                clubId = null,
+            </if>
+            delFlag = #{delFlag}
+        where id = #{id}
+    </update>
+
+</mapper>