瀏覽代碼

交易记录

姜永辉 2 年之前
父節點
當前提交
a7398fa8d4

+ 21 - 0
src/main/java/com/dk/oauth/controller/CompanyController.java

@@ -37,6 +37,16 @@ public class CompanyController {
     }
     }
 
 
     /**
     /**
+     * @desc   : 通过openid查询
+     * @author : admin
+     * @date   : 2023/2/3 13:32
+     */
+    @PostMapping({"select_company/{openid}"})
+    public ResponseResultVO<?> selectByOpenId(@PathVariable String openid) {
+        return companyService.selectByOpenId(openid);
+    }
+
+    /**
      * @desc : 更新 被邀请人员的微信用户的cpid 加入公司
      * @desc : 更新 被邀请人员的微信用户的cpid 加入公司
      * @author : 姜永辉
      * @author : 姜永辉
      * @date : 2023/1/9 10:49
      * @date : 2023/1/9 10:49
@@ -48,6 +58,17 @@ public class CompanyController {
     }
     }
 
 
     /**
     /**
+     * @desc : 选择公司更新微信用户的所在当前的公司
+     * @author : 姜永辉
+     * @date : 2023/1/9 10:49
+     */
+    @ApiOperation(value = "更新微信用的公司", notes = "更新微信用的公司")
+    @PostMapping(value = "/update_current_cp_by_wxid")
+    public ResponseResultVO<Boolean> updateCurrentCpByWxid(@RequestBody Map<String,Object> map) {
+        return companyService.updateCurrentCpByWxid(map);
+    }
+
+    /**
      * @desc   : 注册商户
      * @desc   : 注册商户
      * @author : admin
      * @author : admin
      * @date   : 2024/2/1 14:55
      * @date   : 2024/2/1 14:55

+ 7 - 0
src/main/java/com/dk/oauth/mapper/CompanyMapper.java

@@ -38,6 +38,13 @@ public interface CompanyMapper extends BaseMapper<Company> {
     Company selectById(@Param("cpId") Integer cpId);
     Company selectById(@Param("cpId") Integer cpId);
 
 
     /**
     /**
+     * @desc : 通过openid查询
+     * @author : 洪旭东
+     * @date : 2024-02-18 15:21
+     */
+    List<Company> selectByOpenId(@Param("openid") String openid);
+
+    /**
      * @desc : 获取商户的地址服务
      * @desc : 获取商户的地址服务
      * @author : 姜永辉
      * @author : 姜永辉
      * @date : 2024-02-18 15:21
      * @date : 2024-02-18 15:21

+ 7 - 0
src/main/java/com/dk/oauth/mapper/UserMapper.java

@@ -66,6 +66,13 @@ public interface UserMapper  extends BaseMapper<UserLogin> {
     int updateCpid(@Param("userId") String userId, @Param("currentCp") Integer currentCp,@Param("joinedCps") List<Integer> joinedCps);
     int updateCpid(@Param("userId") String userId, @Param("currentCp") Integer currentCp,@Param("joinedCps") List<Integer> joinedCps);
 
 
     /**
     /**
+     * @desc : 选择公司更新微信用户的所在当前的公司
+     * @author : 姜永辉
+     * @date : 2024-02-20 14:12
+     */
+    int updateCurrentCpByWxid(@Param("userWxid") String userWxid, @Param("currentCp") Integer currentCp);
+
+    /**
      * @desc : 通过ID查询
      * @desc : 通过ID查询
      * @author : 洪旭东
      * @author : 洪旭东
      * @date : 2024-02-18 15:21
      * @date : 2024-02-18 15:21

+ 4 - 0
src/main/java/com/dk/oauth/service/ICompanyService.java

@@ -20,4 +20,8 @@ public interface ICompanyService  extends IService<Company> {
     ResponseResultVO selectById(Integer id);
     ResponseResultVO selectById(Integer id);
 
 
     ResponseResultVO updateWxUserCompany(Map<String,Object> map);
     ResponseResultVO updateWxUserCompany(Map<String,Object> map);
+
+    ResponseResultVO updateCurrentCpByWxid(Map<String,Object> map);
+
+    ResponseResultVO selectByOpenId(String openid);
 }
 }

+ 24 - 0
src/main/java/com/dk/oauth/service/impl/CompanyServiceImpl.java

@@ -58,6 +58,16 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
     }
     }
 
 
     /**
     /**
+     * @desc : 通过ID查询
+     * @author : admin
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    public ResponseResultVO selectByOpenId(String openid) {
+        return ResponseResultUtil.success(companyMapper.selectByOpenId(openid));
+    }
+
+    /**
      * @desc : 更新微信用的公司
      * @desc : 更新微信用的公司
      * @author : admin
      * @author : admin
      * @date : 2023/2/3 13:32
      * @date : 2023/2/3 13:32
@@ -74,6 +84,20 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
     }
     }
 
 
     /**
     /**
+     * @desc : 选择公司更新微信用户的所在当前的公司
+     * @author : admin
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public ResponseResultVO updateCurrentCpByWxid(Map<String, Object> map) {
+        String userWxid = map.get("openid") + "";
+        Integer cpId = Integer.valueOf(map.get("cpId") + "");
+        int i = userMapper.updateCurrentCpByWxid(userWxid, cpId);
+        return ResponseResultUtil.success(true);
+    }
+
+    /**
      * @desc : 注册-商户
      * @desc : 注册-商户
      * @author : 姜永辉
      * @author : 姜永辉
      * @date : 2024-02-20 13:55
      * @date : 2024-02-20 13:55

+ 8 - 0
src/main/resources/mapper/CompanyMapper.xml

@@ -135,6 +135,14 @@
         WHERE t.cp_id = #{cpId}
         WHERE t.cp_id = #{cpId}
     </select>
     </select>
 
 
+    <!-- 查询表t_a_company,(条件查询+分页)列表 -->
+    <select id="selectByOpenId" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_a.t_a_company t
+        where t.cp_id = any( (select joined_cps from dkic_a.t_wx_user where user_wxid = #{openid})::Integer[] )
+    </select>
+
     <insert id="insert">
     <insert id="insert">
         insert into dkic_a.t_a_company
         insert into dkic_a.t_a_company
         (cp_name,
         (cp_name,

+ 6 - 0
src/main/resources/mapper/UserMapper.xml

@@ -83,6 +83,12 @@
         where user_id = #{userId}::uuid
         where user_id = #{userId}::uuid
     </update>
     </update>
 
 
+    <!--更新微信用的公司-->
+    <update id="updateCurrentCpByWxid">
+        update dkic_a.t_wx_user set current_cp = #{currentCp}
+        where user_wxid = #{userWxid}
+    </update>
+
     <!--新建用户状态表-->
     <!--新建用户状态表-->
     <insert id="insertOrUpdateUserLogin">
     <insert id="insertOrUpdateUserLogin">
         insert into  dkic_a.t_wx_user_login
         insert into  dkic_a.t_wx_user_login