附属属性相关接口修改

This commit is contained in:
huguanghan 2024-12-25 17:08:24 +08:00
parent b45f7d6c4f
commit 85fde3f2ac
3 changed files with 35 additions and 12 deletions

View File

@ -10,6 +10,7 @@ import com.das.modules.equipment.domain.dto.SysEquipmentDto;
import com.das.modules.equipment.domain.dto.SysGenExtPropsDto;
import com.das.modules.equipment.domain.vo.EquipmentTypeVo;
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
import com.das.modules.equipment.domain.vo.SysGenExtPropsVo;
import com.das.modules.equipment.entity.SysEquipmentDocs;
import com.das.modules.equipment.entity.SysGenExtProps;
import com.das.modules.equipment.service.SysEquipmentService;
@ -148,7 +149,7 @@ public class EquipmentController {
* @return 所有附属属性
*/
@PostMapping("/extProps/add")
public R<SysGenExtProps> addSysEquipmentExtProps(@RequestBody SysGenExtPropsDto sysGenExtPropsDto) {
public R<SysGenExtPropsVo> addSysEquipmentExtProps(@RequestBody SysGenExtPropsDto sysGenExtPropsDto) {
//判断是否有权限
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
if(!hasPermission){
@ -162,7 +163,7 @@ public class EquipmentController {
* @return 所有附属属性
*/
@PostMapping("/extProps/update")
public R<SysGenExtProps> updateSysEquipmentExtProps(@RequestBody SysGenExtPropsDto sysGenExtPropsDto) {
public R<SysGenExtPropsVo> updateSysEquipmentExtProps(@RequestBody SysGenExtPropsDto sysGenExtPropsDto) {
//判断是否有权限
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
if(!hasPermission){
@ -176,7 +177,7 @@ public class EquipmentController {
* @return 所有附属属性
*/
@PostMapping("/extProps/query")
public R<SysGenExtProps> querySysEquipmentExtProps(@RequestBody SysGenExtPropsDto sysGenExtPropsDto) {
public R<SysGenExtPropsVo> querySysEquipmentExtProps(@RequestBody SysGenExtPropsDto sysGenExtPropsDto) {
//判断是否有权限
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
if(!hasPermission){

View File

@ -4,6 +4,7 @@ import com.das.common.utils.PageDataInfo;
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
import com.das.modules.equipment.domain.dto.SysGenExtPropsDto;
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
import com.das.modules.equipment.domain.vo.SysGenExtPropsVo;
import com.das.modules.equipment.entity.SysEquipmentDocs;
import com.das.modules.equipment.entity.SysGenExtProps;
import jakarta.servlet.http.HttpServletRequest;
@ -32,13 +33,13 @@ public interface SysEquipmentService {
void importSysEquipment(String parentEquipmentId,MultipartFile file) throws IOException, ParseException;
SysGenExtProps creatSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto);
SysGenExtPropsVo creatSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto);
SysGenExtProps updateSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto);
SysGenExtPropsVo updateSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto);
void deleteSysEquipmentExtProps(Long id);
SysGenExtProps querySysEquipmentExtProps(Long id);
SysGenExtPropsVo querySysEquipmentExtProps(Long id);
List<SysEquipmentDocs> upload(String folderName, List<MultipartFile> fileList);

View File

@ -29,6 +29,7 @@ import com.das.modules.equipment.domain.dto.SysEquipmentDto;
import com.das.modules.equipment.domain.dto.SysGenExtPropsDto;
import com.das.modules.equipment.domain.excel.SysEquipmentExcel;
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
import com.das.modules.equipment.domain.vo.SysGenExtPropsVo;
import com.das.modules.equipment.entity.SysEquipment;
import com.das.modules.equipment.entity.SysEquipmentDocs;
import com.das.modules.equipment.entity.SysGenExtProps;
@ -47,6 +48,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -398,7 +400,7 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
}
@Override
public SysGenExtProps creatSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto) {
public SysGenExtPropsVo creatSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto) {
if (sysGenExtPropsDto.getId() == null) {
throw new ServiceException("设备id不能为空");
}
@ -413,11 +415,17 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
sysEquipmentDocsMapper.insert(item);
}
}
return sysEquipmentExtProps;
QueryWrapper<SysEquipmentDocs> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("deviceid",sysGenExtPropsDto.getId());
List<SysEquipmentDocs> resultList = sysEquipmentDocsMapper.selectList(queryWrapper);
SysGenExtPropsVo sysGenExtPropsVo = new SysGenExtPropsVo();
BeanCopyUtils.copy(sysEquipmentExtProps,sysGenExtPropsVo);
sysGenExtPropsVo.setSysEquipmentDocsList(resultList);
return sysGenExtPropsVo;
}
@Override
public SysGenExtProps updateSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto) {
public SysGenExtPropsVo updateSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto) {
if (sysGenExtPropsDto.getId() == null) {
throw new ServiceException("设备id不能为空");
}
@ -446,7 +454,13 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
sysEquipmentDocsMapper.insert(item);
}
}
return sysEquipmentExtProps;
QueryWrapper<SysEquipmentDocs> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("deviceid",sysGenExtPropsDto.getId());
List<SysEquipmentDocs> resultList = sysEquipmentDocsMapper.selectList(queryWrapper);
SysGenExtPropsVo sysGenExtPropsVo = new SysGenExtPropsVo();
BeanCopyUtils.copy(sysEquipmentExtProps,sysGenExtPropsVo);
sysGenExtPropsVo.setSysEquipmentDocsList(resultList);
return sysGenExtPropsVo;
}
@Override
@ -472,8 +486,15 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
}
@Override
public SysGenExtProps querySysEquipmentExtProps(Long id) {
return sysGenExtPropsMapper.selectById(id);
public SysGenExtPropsVo querySysEquipmentExtProps(Long id) {
SysGenExtProps sysGenExtProps = sysGenExtPropsMapper.selectById(id);
QueryWrapper<SysEquipmentDocs> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("deviceid",id);
List<SysEquipmentDocs> resultList = sysEquipmentDocsMapper.selectList(queryWrapper);
SysGenExtPropsVo sysGenExtPropsVo = new SysGenExtPropsVo();
BeanCopyUtils.copy(sysGenExtProps,sysGenExtPropsVo);
sysGenExtPropsVo.setSysEquipmentDocsList(resultList);
return sysGenExtPropsVo;
}
@Override