فهرست منبع

收藏应用专项工具与非专项

yonghuifan 1 سال پیش
والد
کامیت
cb1cd5b12b

+ 3 - 1
src/main/java/com/dragon/tj/portal/service/SysDictService.java

@@ -5,6 +5,8 @@ import com.dragon.tj.portal.common.base.R;
 import com.dragon.tj.portal.entity.SysDict;
 import com.dragon.tj.portal.entity.SysDictItem;
 
+import java.util.List;
+
 /**
  * <p>
  * 字典表 服务类
@@ -34,5 +36,5 @@ public interface SysDictService extends IService<SysDict> {
      * @param type 字典类型
      * @return
      */
-    R getDict(String type);
+    List<SysDict> getDict(String type);
 }

+ 25 - 4
src/main/java/com/dragon/tj/portal/service/impl/AppServiceImpl.java

@@ -6,12 +6,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dragon.tj.portal.auth.model.LoginUser;
 import com.dragon.tj.portal.common.base.R;
-import com.dragon.tj.portal.entity.AppInfo;
-import com.dragon.tj.portal.entity.InstallInfo;
-import com.dragon.tj.portal.entity.PageParam;
+import com.dragon.tj.portal.entity.*;
 import com.dragon.tj.portal.mapper.app.AppInfoMapper;
 import com.dragon.tj.portal.mapper.app.InstallInfoMapper;
 import com.dragon.tj.portal.service.AppService;
+import com.dragon.tj.portal.service.SysDictItemService;
 import com.dragon.tj.portal.service.SysDictService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,6 +34,17 @@ public class AppServiceImpl implements AppService {
     @Autowired
     private SysDictService sysDictService;
 
+
+    private static List<SysDict> appTypeDict;
+
+    public List<SysDict> getAppTypeDict(){
+        if (appTypeDict == null || appTypeDict.size() == 0) {
+            appTypeDict = sysDictService.getDict("app_type");
+        }
+
+        return appTypeDict;
+    }
+
     /*
      * CRUD
      * */
@@ -69,7 +79,7 @@ public class AppServiceImpl implements AppService {
      * */
     @Override
     public R getType() {
-        return sysDictService.getDict("app_type");
+        return R.ok(sysDictService.getDict("app_type"));
     }
 
     /*
@@ -149,6 +159,17 @@ public class AppServiceImpl implements AppService {
         Map map = new HashMap();
 
         map.put("delFlag", params.getDelFlag());
+        Integer appType = params.getAppType();
+        if (appType != null){
+            List<SysDict> appTypeList = getAppTypeDict();
+            SysDict  specialToolDict = appTypeList.stream().filter(item -> "专项工具".equals(item.getDescription())).findFirst().get();
+            map.put("std", specialToolDict.getId());//专项工具
+
+            if (appType == specialToolDict.getId()){
+                map.put("isSt", 1);//专项工具查询
+            }
+        }
+
         map.put("idcard", loginUser.getIdCard());
 
         return appInfoMapper.getInstalledApp(iPage,map);

+ 1 - 1
src/main/java/com/dragon/tj/portal/service/impl/BusinessServiceImpl.java

@@ -90,7 +90,7 @@ public class BusinessServiceImpl implements BusinessService {
      * */
     @Override
     public R getType() {
-        return sysDictService.getDict("app_type");
+        return R.ok(sysDictService.getDict("app_type"));
     }
 
     /*

+ 7 - 3
src/main/java/com/dragon/tj/portal/service/impl/SysDictServiceImpl.java

@@ -15,6 +15,8 @@ import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
+
 /**
  * <p>
  * 字典表 服务实现类
@@ -70,10 +72,12 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
      * @return
      */
     @Override
-    public R getDict(String type) {
-        QueryWrapper wrapper = new QueryWrapper();
+    public List<SysDict> getDict(String type) {
+        QueryWrapper<SysDict> wrapper = new QueryWrapper();
         wrapper.eq("type",type);
         wrapper.eq("del_flag",0);
-        return R.ok(dictMapper.selectList(wrapper));
+        List<SysDict> sysDicts = dictMapper.selectList(wrapper);
+
+        return sysDicts;
     }
 }

+ 13 - 0
src/main/resources/mapper/app/AppInfoMapper.xml

@@ -39,6 +39,19 @@
             <if test="map.delFlag != null">
                 and t2.del_flag = #{map.delFlag}
             </if>
+
+            <if test="map.std != null">
+                <if test="map.isSt != null">
+                    and t1.app_type = #{map.std}
+                </if>
+                <if test="map.isSt == null">
+                    and t1.app_type != #{map.std}
+                </if>
+
+            </if>
+
+
+
         </where>
 
         order by t2.seq desc