chenw 6 лет назад
Родитель
Сommit
2ddca5dd87

+ 1 - 2
bi-server/src/main/java/com/usoftchina/bi/server/controller/user/UserPowerController.java

@@ -40,8 +40,7 @@ public class UserPowerController {
     @CheckToken
     @ApiOperation(value = "获取用户(组)报表权限", notes = "获取用户(组)报表权限", response = RepEntity.class)
     public RepEntity read(@RequestHeader String token, @PathVariable("type") int type, @PathVariable("id") int id) {
-        userPowerService.read(type, id);
-        return new RepEntity(RepCode.success);
+        return new RepEntity(RepCode.success, userPowerService.read(type, id));
     }
 
     @PostMapping("/delete")

+ 5 - 2
bi-server/src/main/java/com/usoftchina/bi/server/dao/user/UserPowerMapper.java

@@ -1,9 +1,12 @@
 package com.usoftchina.bi.server.dao.user;
 
 import com.usoftchina.bi.server.model.vo.configVo.UserPowerInfo;
+import com.usoftchina.bi.server.model.vo.dataVo.DashboardPowerDTO;
 import org.apache.ibatis.annotations.*;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * @Author chenwei
  * @Date 2019-05-13
@@ -42,7 +45,7 @@ public interface UserPowerMapper {
     void delete(UserPowerInfo userPowerInfo);
 
     @Select(  "<script>"
-            + "SELECT ID,BD_NAME,CASE NVL(BPU_ID, '1') WHEN 1 THEN 'false' ELSE 'true' END CHECKED "
+            + "SELECT ID id,BD_NAME dashboardName,CASE NVL(BPU_ID, '1') WHEN 1 THEN 0 ELSE 1 END checked "
             + "FROM BI_DASHBOARDS LEFT JOIN BI_POWER_USERS ON BPU_DASHBOARDID = ID WHERE CREATE_ID = #{userId, jdbcType=INTEGER} "
             + "<choose>"
             +   "<if test=\"type == 0\">"
@@ -53,6 +56,6 @@ public interface UserPowerMapper {
             +   "</otherwise>"
             + "</choose>"
             + "</script>")
-    void selectDashBoards(@Param("type") int type, @Param("id") int id, @Param("userId") int userId);
+    List<DashboardPowerDTO> selectDashBoards(@Param("type") int type, @Param("id") int id, @Param("userId") int userId);
 
 }

+ 38 - 0
bi-server/src/main/java/com/usoftchina/bi/server/model/vo/dataVo/DashboardPowerDTO.java

@@ -0,0 +1,38 @@
+package com.usoftchina.bi.server.model.vo.dataVo;
+
+import java.io.Serializable;
+
+/**
+ * @Author chenwei
+ * @Date 2019-05-16
+ */
+public class DashboardPowerDTO implements Serializable {
+
+    private int id;
+    private String dashboardName;
+    private boolean checked;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getDashboardName() {
+        return dashboardName;
+    }
+
+    public void setDashboardName(String dashboardName) {
+        this.dashboardName = dashboardName;
+    }
+
+    public boolean isChecked() {
+        return checked;
+    }
+
+    public void setChecked(boolean checked) {
+        this.checked = checked;
+    }
+}

+ 5 - 2
bi-server/src/main/java/com/usoftchina/bi/server/service/user/UserPowerService.java

@@ -3,9 +3,12 @@ package com.usoftchina.bi.server.service.user;
 import com.usoftchina.bi.core.base.BaseContextHolder;
 import com.usoftchina.bi.server.dao.user.UserPowerMapper;
 import com.usoftchina.bi.server.model.vo.configVo.UserPowerInfo;
+import com.usoftchina.bi.server.model.vo.dataVo.DashboardPowerDTO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @Author chenwei
  * @Date 2019-05-13
@@ -29,8 +32,8 @@ public class UserPowerService {
      * @param type
      * @param id
      */
-    public void read(int type, int id){
-        userPowerMapper.selectDashBoards(type, id, BaseContextHolder.getUserId());
+    public List<DashboardPowerDTO> read(int type, int id){
+        return userPowerMapper.selectDashBoards(type, id, BaseContextHolder.getUserId());
     }
 
     /**