Sfoglia il codice sorgente

Fix 传统版图标兼容

Yue 2 anni fa
parent
commit
bc3ba1e77b

+ 32 - 31
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/dao/ApplySiteDao.java

@@ -1,44 +1,45 @@
 package cn.vbdsm.manage.dao;
 
-import java.util.List;
+import cn.vbdsm.model.ApplySite;
+import org.springframework.stereotype.Repository;
 
 import javax.annotation.Resource;
 import javax.core.common.jdbc.BaseDaoSupport;
 import javax.core.common.jdbc.QueryRule;
 import javax.sql.DataSource;
-
-import org.springframework.stereotype.Repository;
-
-import cn.vbdsm.model.ApplySite;
+import java.util.List;
 
 @Repository
 public class ApplySiteDao extends BaseDaoSupport<ApplySite, Long> {
 
-	@Resource(name="dynamicDataSource")
-	public void setDataSource(DataSource dataSource){
-		super.setDataSourceReadOnly(dataSource);
-		super.setDataSourceWrite(dataSource);
-	}
-	
-	@Override
-	protected String getPKColumn() { return "id"; }
-	
-	public List<ApplySite> selectBySiteId(Integer siteId) {
-		QueryRule queryRule = QueryRule.getInstance(); 
-		queryRule.andEqual("siteId", siteId);
-		return super.find(queryRule);
-	}
-
-	public List<ApplySite> selectList(Integer siteId, List<Long> roleIds) {
-		QueryRule queryRule = QueryRule.getInstance(); 
-		queryRule.andEqual("siteId", siteId);
-		queryRule.andIn("roleId", roleIds);
-		return super.find(queryRule);
-	}
-
-	public int deleteByAppId(Long appId) {
-		String sql="delete from t_apply_site where applyId = ?";
-		return super.update(sql, appId);
-	}
+    @Resource(name = "dynamicDataSource")
+    public void setDataSource(DataSource dataSource) {
+        super.setDataSourceReadOnly(dataSource);
+        super.setDataSourceWrite(dataSource);
+    }
+
+    @Override
+    protected String getPKColumn() {
+        return "id";
+    }
+
+    public List<ApplySite> selectBySiteId(Integer siteId) {
+        QueryRule queryRule = QueryRule.getInstance();
+        queryRule.andEqual("siteId", siteId);
+        return super.find(queryRule);
+    }
+
+    public List<ApplySite> selectList(Integer siteId, List<Long> roleIds) {
+        QueryRule queryRule = QueryRule.getInstance();
+        queryRule.andEqual("siteId", siteId);
+        queryRule.andIn("roleId", roleIds);
+        return super.find(queryRule);
+    }
+
+    public int deleteByAppId(Long appId) {
+        //内置的root的应用不能被删除
+        String sql = "delete from t_apply_site where applyId = ? and roleId != 1";
+        return super.update(sql, appId);
+    }
 
 }

+ 60 - 56
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/service/IApplyService.java

@@ -1,70 +1,74 @@
 package cn.vbdsm.manage.service;
 
-import java.util.List;
+import cn.vbdsm.model.Apply;
 
 import javax.core.common.ResultMsg;
-
-
-
-
-
-import cn.vbdsm.model.Apply;
+import java.util.List;
 
 
 /**
  * 应用管理
- * @author tanpeng
  *
+ * @author tanpeng
  */
 public interface IApplyService {
-	/**
-	 * 获取全部应用
-	 */
-	public ResultMsg<?> getAll(String local,int isRoot,List<Long> roleIds,Integer siteId);
-	
-	
-	/**
-	 * @param local
-	 * @param categoryId
-	 * @return
-	 * @throws Exception
-	 */
-	public ResultMsg<?> getList(String local,Long categoryId,Integer type,int isRoot,List<Long> roleIds,Integer siteId);
-	
-	/**
-	 * 添加应用
-	 * @param apply
-	 * @return
-	 */
-	public ResultMsg<?> add(String local,Apply apply);
-	
-	
-	/**
-	 * 根据应用id删除应用
-	 * @param id
-	 * @return
-	 */
-	public ResultMsg<?> realDel(String local,Long id);
-	
-	
-	/**
-	 * 修改应用
-	 * @param apply
-	 * @return
-	 */
-	public ResultMsg<?> modify(String local,Apply apply);
-	
-	/**
-	 * 根据id修改应用状态(伪删除)
-	 */
-	public ResultMsg<?> remove(String local,Long id) ;
+    /**
+     * 获取全部应用
+     */
+    ResultMsg<?> getAll(String local, int isRoot, List<Long> roleIds, Integer siteId);
+
+    /**
+     * 获取全部应用
+     */
+    ResultMsg<?> getAll(String local, int isRoot, List<Long> roleIds, Integer siteId, boolean isDesk);
+
+
+    /**
+     * @param local
+     * @param categoryId
+     * @return
+     * @throws Exception
+     */
+    ResultMsg<?> getList(String local, Long categoryId, Integer type, int isRoot, List<Long> roleIds, Integer siteId);
+
+    /**
+     * 添加应用
+     *
+     * @param apply
+     * @return
+     */
+    ResultMsg<?> add(String local, Apply apply);
+
+
+    /**
+     * 根据应用id删除应用
+     *
+     * @param id
+     * @return
+     */
+    ResultMsg<?> realDel(String local, Long id);
+
+
+    /**
+     * 修改应用
+     *
+     * @param apply
+     * @return
+     */
+    ResultMsg<?> modify(String local, Apply apply);
+
+    /**
+     * 根据id修改应用状态(伪删除)
+     */
+    ResultMsg<?> remove(String local, Long id);
 
 
-	/**
-	 * 根据应用类型查询
-	 * @param local
-	 * @param type
-	 * @return
-	 */
-	public ResultMsg<?> getListByType(String local, Integer type,int isRoot,List<Long> roleIds,Integer siteId);
+    /**
+     * 根据应用类型查询
+     *
+     * @param local
+     * @param type
+     * @return
+     */
+    ResultMsg<?> getListByType(String local, Integer type, int isRoot, List<Long> roleIds, Integer siteId);
 }

+ 14 - 4
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/service/impl/ApplyService.java

@@ -31,10 +31,16 @@ public class ApplyService implements IApplyService {
     @Autowired
     private ApplySiteDao applySiteDao;
 
+    public ResultMsg<?> getAll(String local, int isRoot, List<Long> roleIds, Integer siteId) {
+
+        return getAll(local, isRoot, roleIds, siteId, true);
+    }
+
     /**
      * 获取全部应用
+     * 根据 isDesk 返回对应图标
      */
-    public ResultMsg<?> getAll(String local, int isRoot, List<Long> roleIds, Integer siteId) {
+    public ResultMsg<?> getAll(String local, int isRoot, List<Long> roleIds, Integer siteId, boolean isDesk) {
         Page<Apply> page = new Page<Apply>();
         try {
             List<Apply> list = null;
@@ -78,10 +84,14 @@ public class ApplyService implements IApplyService {
             for (Apply apply : list) {
                 String icon = apply.getIcon();
                 String[] iconArr = icon.split("@");
-                if (iconArr.length > 1) {
-                    apply.setIcon(iconArr[1]);
+                if (isDesk) {
+                    if (iconArr.length > 1) {
+                        apply.setIcon(iconArr[1]);
+                    } else {
+                        apply.setIcon("bigScreen.png");
+                    }
                 } else {
-                    apply.setIcon("bigScreen.png");
+                    apply.setIcon(iconArr[0]);
                 }
             }
             page = new Page<Apply>(0, list.size(), list.size(), list);

+ 2 - 4
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/service/impl/ExplorerService.java

@@ -124,7 +124,7 @@ public class ExplorerService implements IExplorerService {
         //获取全部分类
         ResultMsg<?> applyCategoryResult = applyCategoryService.getAll(local);
         //获取应用
-        ResultMsg<?> applyResult = applyService.getAll(local, isRoot, roleIds, siteId);
+        ResultMsg<?> applyResult = applyService.getAll(local, isRoot, roleIds, siteId, false);
         //获取菜单
         ResultMsg<Page<TreeMenu>> treemenuResult = treemenuService.getAll(local, condition, cid, uid);
 
@@ -150,9 +150,7 @@ public class ExplorerService implements IExplorerService {
                 String[] menuIds = content.split(",");
                 //menuIds大于1的时候,不需要图标,二级菜单为sub-icon
                 // 修改icon
-                String icon = apply.getIcon();
-                String[] iconArr = icon.split("@");
-                applyVo.setIcon(iconArr[0]);
+                applyVo.setIcon(apply.getIcon());
                 //}
                 List<TreeMenuNewVo> treeMenus = new ArrayList<TreeMenuNewVo>();
                 for (String s : menuIds) {