|
@@ -15,10 +15,16 @@
|
|
|
*/
|
|
|
package me.zhengjie.modules.dm.system.rest;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import me.zhengjie.annotation.Log;
|
|
|
+import me.zhengjie.modules.dm.roomDevice.domain.DmRoomDevice;
|
|
|
import me.zhengjie.modules.dm.system.domain.DmSystem;
|
|
|
import me.zhengjie.modules.dm.system.service.DmSystemService;
|
|
|
+import me.zhengjie.modules.dm.system.service.dto.DmSystemDto;
|
|
|
import me.zhengjie.modules.dm.system.service.dto.DmSystemQueryCriteria;
|
|
|
+import me.zhengjie.modules.dm.user.domain.DmUser;
|
|
|
+import me.zhengjie.modules.dm.user.service.DmUserService;
|
|
|
+import me.zhengjie.modules.dm.user.service.dto.DmUserDto;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.http.HttpStatus;
|
|
@@ -28,6 +34,9 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import io.swagger.annotations.*;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
/**
|
|
@@ -42,6 +51,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
public class DmSystemController {
|
|
|
|
|
|
private final DmSystemService dmSystemService;
|
|
|
+ private final DmUserService dmUserService;
|
|
|
|
|
|
@Log("导出数据")
|
|
|
@ApiOperation("导出数据")
|
|
@@ -56,7 +66,17 @@ public class DmSystemController {
|
|
|
@ApiOperation("查询子系统")
|
|
|
@PreAuthorize("@el.check('dmSystem:list')")
|
|
|
public ResponseEntity<Object> query(DmSystemQueryCriteria criteria, Pageable pageable){
|
|
|
- return new ResponseEntity<>(dmSystemService.queryAll(criteria,pageable),HttpStatus.OK);
|
|
|
+
|
|
|
+ Map<String,Object> map = dmSystemService.queryAll(criteria,pageable);
|
|
|
+ List<DmSystemDto> array = JSONArray.parseArray(JSONArray.toJSONString(map.get("content")),DmSystemDto.class);
|
|
|
+ List<DmSystemDto> newArray = new ArrayList<>();
|
|
|
+ for(DmSystemDto dmSystemDto : array){
|
|
|
+ DmUserDto dmUser = dmUserService.findById(dmSystemDto.getUserId());
|
|
|
+ dmSystemDto.setDmUser(dmUser);
|
|
|
+ newArray.add(dmSystemDto);
|
|
|
+ }
|
|
|
+ map.put("content",newArray);
|
|
|
+ return new ResponseEntity<>(map,HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
@PostMapping
|
|
@@ -85,10 +105,16 @@ public class DmSystemController {
|
|
|
return new ResponseEntity<>(HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
- @Log("根据用户查询子系统")
|
|
|
- @ApiOperation("根据用户查询子系统")
|
|
|
- @GetMapping(value = "/queryByUserId")
|
|
|
- public ResponseEntity<Object> queryByUserId(String userId,Long isMenu){
|
|
|
- return new ResponseEntity<>(dmSystemService.findByUserId(userId,isMenu),HttpStatus.OK);
|
|
|
+ @Log("根据角色查询子系统")
|
|
|
+ @ApiOperation("根据角色查询子系统")
|
|
|
+ @PostMapping(value = "/queryByRoleId")
|
|
|
+ public ResponseEntity<Object> queryByRoleId(@RequestBody List<Long> roleIds,Long isMenu){
|
|
|
+ return new ResponseEntity<>(dmSystemService.findByRoleId(roleIds,isMenu),HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("返回全部的子系统")
|
|
|
+ @GetMapping(value = "/lazy")
|
|
|
+ public ResponseEntity<Object> query(){
|
|
|
+ return new ResponseEntity<>(dmSystemService.getSystems(),HttpStatus.OK);
|
|
|
}
|
|
|
}
|