feat(): 资产结构树形结构

dev
chao 2024-04-22 19:04:15 +08:00
parent 9953c7c202
commit bd68e9030f
9 changed files with 252 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package com.etl.data.structure.domain.resp;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
*
*
* @author Chao
* @ClassName: AssetStructureResp
* @CreateTime: 2024/4/22 7:23
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class AssetStructureResp {
private List<AssetResp> assetRespList;
}

View File

@ -0,0 +1,38 @@
package com.etl.data.structure.controller;
import com.etl.common.core.domain.Result;
import com.etl.common.security.annotation.RequiresPermissions;
import com.etl.data.structure.domain.AssetStructure;
import com.etl.data.structure.service.IAssetStructureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* Controller
*
* @author Chao
* @ClassName: AssetStructureController Controller
* @CreateTime: 2024/4/22 10:09
*/
@RestController
@RequestMapping("/structure")
public class AssetStructureController {
@Autowired
private IAssetStructureService assetStructureService;
/**
*
*/
@RequiresPermissions("data:structure:list")
@PostMapping("/list")
public Result<List<AssetStructure>> list() {
return Result.success(assetStructureService.selectAssetSouructureList());
}
}

View File

@ -0,0 +1,40 @@
package com.etl.data.structure.controller;
import com.etl.common.core.domain.Result;
import com.etl.common.security.annotation.RequiresPermissions;
import com.etl.data.structure.domain.AssetStructureTable;
import com.etl.data.structure.service.IAssetStructureTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* Controller
*
* @author Chao
* @ClassName: AssetStructureTableController Controller
* @CreateTime: 2024/4/22 7:28
*/
@RestController
@RequestMapping("/structureTable")
public class AssetStructureTableController {
@Autowired
private IAssetStructureTableService assetStructureTableService;
/**
*
* @param assetStructureId
* @return
*/
@RequiresPermissions("data:structureTable:list")
@PostMapping("list/{assetStructureId}")
public Result<List<AssetStructureTable>> list(@PathVariable("assetStructureId") Long assetStructureId) {
return Result.success(assetStructureTableService.selectAssetSouructureTableList(assetStructureId));
}
}

View File

@ -0,0 +1,14 @@
package com.etl.data.structure.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etl.data.structure.domain.AssetStructure;
/**
* Mapper
*
* @author Chao
* @ClassName: AssetStructureMapper Mapper
* @CreateTime: 2024/4/22 2:12
*/
public interface AssetStructureMapper extends BaseMapper<AssetStructure> {
}

View File

@ -0,0 +1,14 @@
package com.etl.data.structure.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etl.data.structure.domain.AssetStructureTable;
/**
* Mapper
*
* @author Chao
* @ClassName: AssetStructureTableMapper Mapper
* @CreateTime: 2024/4/22 5:23
*/
public interface AssetStructureTableMapper extends BaseMapper<AssetStructureTable> {
}

View File

@ -0,0 +1,23 @@
package com.etl.data.structure.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.etl.data.structure.domain.AssetStructure;
import java.util.List;
/**
* Service
*
* @author Chao
* @ClassName: IAssetStructureService Service
* @CreateTime: 2024/4/22 2:08
*/
public interface IAssetStructureService extends IService<AssetStructure> {
/**
*
*
* @return
*/
List<AssetStructure> selectAssetSouructureList();
}

View File

@ -0,0 +1,23 @@
package com.etl.data.structure.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.etl.data.structure.domain.AssetStructureTable;
import java.util.List;
/**
* Service
*
* @author Chao
* @ClassName: IAssetStructureTableService Service
* @CreateTime: 2024/4/22 5:21
*/
public interface IAssetStructureTableService extends IService<AssetStructureTable> {
/**
*
* @param assetStructureId id
* @return
*/
List<AssetStructureTable> selectAssetSouructureTableList(Long assetStructureId );
}

View File

@ -0,0 +1,39 @@
package com.etl.data.structure.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.etl.data.structure.domain.AssetStructure;
import com.etl.data.structure.mapper.AssetStructureMapper;
import com.etl.data.structure.service.IAssetStructureService;
import com.etl.data.structure.service.IAssetStructureTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Chao
* @ClassName: AssetStructureServiceImpl Service
* @CreateTime: 2024/4/22 2:10
*/
@Service
public class AssetStructureServiceImpl extends ServiceImpl<AssetStructureMapper, AssetStructure> implements IAssetStructureService {
@Autowired
private IAssetStructureTableService assetStructureTableService;
/**
*
*
* @return
*/
@Override
public List<AssetStructure> selectAssetSouructureList() {
// 创建一个列表
List<AssetStructure> assetStructureList = this.list();
return assetStructureList;
}
}

View File

@ -0,0 +1,34 @@
package com.etl.data.structure.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.etl.data.structure.domain.AssetStructureTable;
import com.etl.data.structure.mapper.AssetStructureTableMapper;
import com.etl.data.structure.service.IAssetStructureTableService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Chao
* @ClassName: AssetStructureTableServiceImpl Service
* @CreateTime: 2024/4/22 5:22
*/
@Service
public class AssetStructureTableServiceImpl extends ServiceImpl<AssetStructureTableMapper, AssetStructureTable> implements IAssetStructureTableService {
/**
*
* @param assetStructureId id
* @return
*/
@Override
public List<AssetStructureTable> selectAssetSouructureTableList(Long assetStructureId) {
List<AssetStructureTable> list = this.list(
new LambdaQueryWrapper<AssetStructureTable>()
.eq(AssetStructureTable::getAssetStructureId, assetStructureId)
);
return list;
}
}