Ver código fonte

获取推送用户信息

黄远 5 anos atrás
pai
commit
c8160ce51d

+ 0 - 1
lift-system-service/src/main/java/cn/com/ty/lift/system/user/controller/UserController.java

@@ -123,5 +123,4 @@ public class UserController {
     }
 
 
-
 }

+ 19 - 14
lift-system-service/src/main/java/cn/com/ty/lift/system/user/dao/mapper/IPushUserMapper.java

@@ -1,9 +1,11 @@
 package cn.com.ty.lift.system.user.dao.mapper;
 
 import cn.com.ty.lift.common.model.PushUserInfo;
+import cn.com.ty.lift.common.utils.MybatisSqlUtils;
 import cn.com.xwy.boot.mybatis.MyBatisMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.SelectProvider;
 
 import java.util.List;
 
@@ -27,17 +29,20 @@ public interface IPushUserMapper extends BaseMapper<PushUserInfo> {
      * @description 获取要推送的用户信息
      * @date 2020/4/17 2:03 下午
      */
-    @Select("select ui.user_id as userId, "
-            + "ui.name as userName, "
-            + "ua.mobile as mobile, "
-            + "ua.device_model as deviceModel, "
-            + "ua.device_flag as deviceFlag, "
-            + "r.name as roleName from "
-            + "user_account ua "
-            + "left join user_info ui on ua.user_id = ui.user_id "
-            + "left join user_role ur on ua.user_id = ur.user_id "
-            + "left join role r on r.id = ur.role_id"
-            + "where r.code in#{roleCodes} "
-            + "and ur.company_id=#{companyId}")
-    List<PushUserInfo> getPushUserInfo(Long companyId, List<String> roleCodes);
+    @SelectProvider(type = MybatisSqlUtils.class, method = "getPushUserInfoByRoleCodesSql")
+    List<PushUserInfo> getPushUserInfoByRoleCodes(@Param("companyId") Long companyId,
+                                                  @Param("roleCodeList") List<String> roleCodes);
+
+    /**
+     * 获取要推送的用户信息
+     *
+     * @param companyId  当前公司id
+     * @param userIdList 用户id集合
+     * @return 用户信息
+     * @description 获取要推送的用户信息
+     * @date 2020/4/18 7:24 下午
+     */
+    @SelectProvider(type = MybatisSqlUtils.class, method = "getPushUserInfoByIdsSql")
+    List<PushUserInfo> getPushUserInfoByUserIds(@Param("companyId") Long companyId,
+                                                @Param("companyId") List<Long> userIdList);
 }

+ 17 - 5
lift-system-service/src/main/java/cn/com/ty/lift/system/user/service/impl/PushUserService.java

@@ -35,9 +35,9 @@ public class PushUserService extends BaseServiceImpl<IPushUserMapper, PushUserIn
      * @date 2020/4/17 11:14 上午
      */
     public List<PushUserInfo> getPushUserInfo(int pushSituation) {
-        String [] roleCodes = PushMessageConstants.PUSH_VALUE_TO_ROLE_CODE.get(pushSituation);
-        if(roleCodes != null && roleCodes.length > 0) {
-            return getPushUserInfo(Arrays.asList(roleCodes));
+        String[] roleCodes = PushMessageConstants.PUSH_VALUE_TO_ROLE_CODE.get(pushSituation);
+        if (roleCodes != null && roleCodes.length > 0) {
+            return getPushUserInfoByRoleCodes(Arrays.asList(roleCodes));
         }
         return null;
     }
@@ -48,10 +48,22 @@ public class PushUserService extends BaseServiceImpl<IPushUserMapper, PushUserIn
      * @description
      * @date 2020/4/17 3:38 下午
      */
-    public List<PushUserInfo> getPushUserInfo(List<String> roleCodes) {
+    public List<PushUserInfo> getPushUserInfoByRoleCodes(List<String> roleCodes) {
         //获取当前公司id
         Long companyId = getCurrentCompanyId();
-        return this.baseMapper.getPushUserInfo(companyId, roleCodes);
+        return this.baseMapper.getPushUserInfoByRoleCodes(companyId, roleCodes);
+    }
+
+    /**
+     * @param userIdList 用户id集合
+     * @return 用户信息
+     * @description
+     * @date 2020/4/18 7:16 下午
+     */
+    public List<PushUserInfo> getPushUserInfoByUserIds(List<Long> userIdList) {
+        //获取当前公司id
+        Long companyId = getCurrentCompanyId();
+        return this.baseMapper.getPushUserInfoByUserIds(companyId, userIdList);
     }
 
     /**