Commit c8c9c327 by 袁伟铭

完成所有表的cru

parent dbdacb56
...@@ -9,10 +9,9 @@ import com.zq.resource.vo.DataDictFindVo; ...@@ -9,10 +9,9 @@ import com.zq.resource.vo.DataDictFindVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import java.util.List;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @author wilmiam * @author wilmiam
...@@ -32,6 +31,12 @@ public class DictController { ...@@ -32,6 +31,12 @@ public class DictController {
return ResultVo.success(dictService.getDictList(vo)); return ResultVo.success(dictService.getDictList(vo));
} }
@ApiOperation("获取字典列表")
@GetMapping(value = "/getDictList/{type}")
public ResultVo<List<DataDict>> getDictListByCode(@PathVariable String type) {
return ResultVo.success(dictService.getDictListByType(type));
}
@ApiOperation("添加字典") @ApiOperation("添加字典")
@PostMapping(value = "/addDict") @PostMapping(value = "/addDict")
public ResultVo addDict(@RequestBody DataDict vo) { public ResultVo addDict(@RequestBody DataDict vo) {
......
...@@ -13,10 +13,9 @@ import com.zq.resource.vo.StandardDataMappingFindVo; ...@@ -13,10 +13,9 @@ import com.zq.resource.vo.StandardDataMappingFindVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import java.util.List;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @author wilmiam * @author wilmiam
...@@ -47,7 +46,6 @@ public class StandardDataController { ...@@ -47,7 +46,6 @@ public class StandardDataController {
AssertUtils.hasText(vo.getLabel(), "缺少编目名称"); AssertUtils.hasText(vo.getLabel(), "缺少编目名称");
AssertUtils.hasText(vo.getCategoryNum(), "缺少所属领域编码"); AssertUtils.hasText(vo.getCategoryNum(), "缺少所属领域编码");
standardDataService.addStandardData(vo); standardDataService.addStandardData(vo);
return ResultVo.success(); return ResultVo.success();
} }
...@@ -67,6 +65,18 @@ public class StandardDataController { ...@@ -67,6 +65,18 @@ public class StandardDataController {
return ResultVo.success(standardDataService.getStandardDataList(vo)); return ResultVo.success(standardDataService.getStandardDataList(vo));
} }
@ApiOperation("获取数据元列表")
@PostMapping(value = "/getAllStandardDataList")
public ResultVo<List<StandardData>> getAllStandardDataList(@RequestBody StandardDataFindVo vo) {
return ResultVo.success(standardDataService.getAllStandardDataList(vo));
}
@ApiOperation("获取数据元信息")
@GetMapping(value = "/getStandardDataInfo/{standardDataId}")
public ResultVo<StandardData> getStandardDataInfo(@PathVariable String standardDataId) {
return ResultVo.success(standardDataService.getStandardDataInfo(standardDataId));
}
@ApiOperation("添加数据元映射") @ApiOperation("添加数据元映射")
@PostMapping(value = "/addStandardDataMapping") @PostMapping(value = "/addStandardDataMapping")
public ResultVo addStandardDataMapping(@RequestBody StandardDataMapping vo) { public ResultVo addStandardDataMapping(@RequestBody StandardDataMapping vo) {
...@@ -77,7 +87,7 @@ public class StandardDataController { ...@@ -77,7 +87,7 @@ public class StandardDataController {
AssertUtils.hasText(vo.getFieldName(), "缺少列名"); AssertUtils.hasText(vo.getFieldName(), "缺少列名");
AssertUtils.hasText(vo.getFieldType(), "缺少列类型"); AssertUtils.hasText(vo.getFieldType(), "缺少列类型");
AssertUtils.notNull(vo.getLength(), "缺少列长度"); AssertUtils.notNull(vo.getLength(), "缺少列长度");
AssertUtils.notNull(vo.getPrecision(), "缺少列精度"); AssertUtils.notNull(vo.getFieldPrecision(), "缺少列精度");
AssertUtils.notNull(vo.getIsPk(), "确实是否主键"); AssertUtils.notNull(vo.getIsPk(), "确实是否主键");
AssertUtils.hasText(vo.getStandardNum(), "缺少数据标准编目"); AssertUtils.hasText(vo.getStandardNum(), "缺少数据标准编目");
AssertUtils.hasText(vo.getConnecttionName(), "缺少数据源名称"); AssertUtils.hasText(vo.getConnecttionName(), "缺少数据源名称");
...@@ -100,14 +110,20 @@ public class StandardDataController { ...@@ -100,14 +110,20 @@ public class StandardDataController {
@ApiOperation("获取数据元映射列表") @ApiOperation("获取数据元映射列表")
@PostMapping(value = "/getStandardDataMappingList") @PostMapping(value = "/getStandardDataMappingList")
public ResultVo<PageVo<StandardDataMapping>> getCategoryInterfaceAttachList(@RequestBody StandardDataMappingFindVo vo) { public ResultVo<PageVo<StandardDataMapping>> getStandardDataMappingList(@RequestBody StandardDataMappingFindVo vo) {
return ResultVo.success(standardDataService.getCategoryInterfaceAttachList(vo)); return ResultVo.success(standardDataService.getStandardDataMappingList(vo));
}
@ApiOperation("获取数据元映射信息")
@GetMapping(value = "/getStandardDataMappingInfo/{standardMappingDataId}")
public ResultVo<StandardDataMapping> getStandardDataMappingInfo(@PathVariable String standardMappingDataId) {
return ResultVo.success(standardDataService.getStandardDataMappingInfo(standardMappingDataId));
} }
@ApiOperation("添加数据元所属领域") @ApiOperation("添加数据元所属领域")
@PostMapping(value = "/addStandardCategoryName") @PostMapping(value = "/addStandardCategoryName")
public ResultVo addStandardCategoryName(@RequestBody StandardCategoryName vo) { public ResultVo addStandardCategoryName(@RequestBody StandardCategoryName vo) {
AssertUtils.hasText(vo.getStandardName(), "缺少领域名称"); AssertUtils.hasText(vo.getCategoryName(), "缺少领域名称");
AssertUtils.hasText(vo.getLabel(), "缺少编目名称"); AssertUtils.hasText(vo.getLabel(), "缺少编目名称");
AssertUtils.notNull(vo.getIsGeneral(), "缺少是否通用"); AssertUtils.notNull(vo.getIsGeneral(), "缺少是否通用");
AssertUtils.notNull(vo.getStandardLevel(), "缺少编目标签"); AssertUtils.notNull(vo.getStandardLevel(), "缺少编目标签");
...@@ -116,7 +132,7 @@ public class StandardDataController { ...@@ -116,7 +132,7 @@ public class StandardDataController {
return ResultVo.success(); return ResultVo.success();
} }
@ApiOperation("修改数据元映射") @ApiOperation("修改数据元所属领域")
@PostMapping(value = "/modifyStandardCategoryName") @PostMapping(value = "/modifyStandardCategoryName")
public ResultVo modifyCategoryInterfaceAttach(@RequestBody StandardCategoryName vo) { public ResultVo modifyCategoryInterfaceAttach(@RequestBody StandardCategoryName vo) {
AssertUtils.hasText(vo.getId(), "ID不能为空"); AssertUtils.hasText(vo.getId(), "ID不能为空");
...@@ -125,10 +141,22 @@ public class StandardDataController { ...@@ -125,10 +141,22 @@ public class StandardDataController {
return ResultVo.success(); return ResultVo.success();
} }
@ApiOperation("获取数据元映射列表") @ApiOperation("获取数据元所属领域列表")
@PostMapping(value = "/getStandardCategoryNameList") @PostMapping(value = "/getStandardCategoryNameList")
public ResultVo<PageVo<StandardCategoryName>> getStandardCategoryNameList(@RequestBody StandardCategoryNameFindVo vo) { public ResultVo<PageVo<StandardCategoryName>> getStandardCategoryNameList(@RequestBody StandardCategoryNameFindVo vo) {
return ResultVo.success(standardDataService.getStandardCategoryNameList(vo)); return ResultVo.success(standardDataService.getStandardCategoryNameList(vo));
} }
@ApiOperation("获取数据元所属领域信息")
@GetMapping(value = "/getStandardCategoryNameInfo/{id}")
public ResultVo<StandardCategoryName> getStandardCategoryNameInfo(@PathVariable String id) {
return ResultVo.success(standardDataService.getStandardCategoryNameInfo(id));
}
@ApiOperation("获取数据元所属领域树")
@GetMapping(value = "/getStandardCategoryNameTree")
public ResultVo getStandardCategoryNameTree() {
return ResultVo.success(standardDataService.getStandardCategoryNameTree());
}
} }
...@@ -35,7 +35,7 @@ public class StandardCategoryName { ...@@ -35,7 +35,7 @@ public class StandardCategoryName {
* 所属领域 * 所属领域
*/ */
@ApiModelProperty("所属领域") @ApiModelProperty("所属领域")
private String standardName; private String categoryName;
/** /**
* 编目名称 * 编目名称
......
...@@ -77,7 +77,7 @@ public class StandardDataMapping { ...@@ -77,7 +77,7 @@ public class StandardDataMapping {
* 列精度 * 列精度
*/ */
@ApiModelProperty("列精度") @ApiModelProperty("列精度")
private Integer precision; private Integer fieldPrecision;
/** /**
* 是否主键 * 是否主键
......
...@@ -13,6 +13,8 @@ import lombok.RequiredArgsConstructor; ...@@ -13,6 +13,8 @@ import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author wilmiam * @author wilmiam
* @since 2021/8/20 9:30 * @since 2021/8/20 9:30
...@@ -62,4 +64,8 @@ public class DictService { ...@@ -62,4 +64,8 @@ public class DictService {
dataDictDao.updateById(dataDict); dataDictDao.updateById(dataDict);
} }
public List<DataDict> getDictListByType(String type) {
return dataDictDao.selectList(Wrappers.lambdaQuery(DataDict.builder().type(type).build()));
}
} }
package com.zq.resource.service; package com.zq.resource.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
...@@ -12,6 +13,8 @@ import com.zq.resource.dao.StandardDataMappingDao; ...@@ -12,6 +13,8 @@ import com.zq.resource.dao.StandardDataMappingDao;
import com.zq.resource.entity.StandardCategoryName; import com.zq.resource.entity.StandardCategoryName;
import com.zq.resource.entity.StandardData; import com.zq.resource.entity.StandardData;
import com.zq.resource.entity.StandardDataMapping; import com.zq.resource.entity.StandardDataMapping;
import com.zq.resource.utils.TreeUtils;
import com.zq.resource.vo.DataTreeVo;
import com.zq.resource.vo.StandardCategoryNameFindVo; import com.zq.resource.vo.StandardCategoryNameFindVo;
import com.zq.resource.vo.StandardDataFindVo; import com.zq.resource.vo.StandardDataFindVo;
import com.zq.resource.vo.StandardDataMappingFindVo; import com.zq.resource.vo.StandardDataMappingFindVo;
...@@ -19,6 +22,9 @@ import lombok.RequiredArgsConstructor; ...@@ -19,6 +22,9 @@ import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author wilmiam * @author wilmiam
* @since 2021/9/7 11:17 * @since 2021/9/7 11:17
...@@ -83,6 +89,36 @@ public class StandardDataService { ...@@ -83,6 +89,36 @@ public class StandardDataService {
return PagingUtils.paging(vo, standardDataDao, StandardData.class, lambdaQuery); return PagingUtils.paging(vo, standardDataDao, StandardData.class, lambdaQuery);
} }
public List<StandardData> getAllStandardDataList(StandardDataFindVo vo) {
LambdaQueryWrapper<StandardData> lambdaQuery = Wrappers.lambdaQuery(StandardData.class);
if (StringUtils.isNotBlank(vo.getStandardName())) {
lambdaQuery.like(StandardData::getStandardName, vo.getStandardName());
vo.setStandardName(null);
}
if (StringUtils.isNotBlank(vo.getEnglishName())) {
lambdaQuery.like(StandardData::getEnglishName, vo.getEnglishName());
vo.setEnglishName(null);
}
if (StringUtils.isNotBlank(vo.getIdentification())) {
lambdaQuery.like(StandardData::getIdentification, vo.getIdentification());
vo.setIdentification(null);
}
if (StringUtils.isNotBlank(vo.getLabel())) {
lambdaQuery.like(StandardData::getLabel, vo.getLabel());
vo.setLabel(null);
}
StandardData standardData = BeanUtil.copyProperties(vo, StandardData.class);
lambdaQuery.setEntity(standardData);
return standardDataDao.selectList(lambdaQuery);
}
public StandardData getStandardDataInfo(String standardDataId) {
return standardDataDao.selectById(standardDataId);
}
public void addStandardDataMapping(StandardDataMapping vo) { public void addStandardDataMapping(StandardDataMapping vo) {
vo.setCreateTime(DateUtil.date()); vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date()); vo.setUpdateTime(DateUtil.date());
...@@ -101,7 +137,7 @@ public class StandardDataService { ...@@ -101,7 +137,7 @@ public class StandardDataService {
standardDataMapping.setFieldName(vo.getFieldName()); standardDataMapping.setFieldName(vo.getFieldName());
standardDataMapping.setFieldType(vo.getFieldType()); standardDataMapping.setFieldType(vo.getFieldType());
standardDataMapping.setLength(vo.getLength()); standardDataMapping.setLength(vo.getLength());
standardDataMapping.setPrecision(vo.getPrecision()); standardDataMapping.setFieldPrecision(vo.getFieldPrecision());
standardDataMapping.setIsPk(vo.getIsPk()); standardDataMapping.setIsPk(vo.getIsPk());
standardDataMapping.setStandardNum(vo.getStandardNum()); standardDataMapping.setStandardNum(vo.getStandardNum());
standardDataMapping.setConnecttionName(vo.getConnecttionName()); standardDataMapping.setConnecttionName(vo.getConnecttionName());
...@@ -113,7 +149,7 @@ public class StandardDataService { ...@@ -113,7 +149,7 @@ public class StandardDataService {
standardDataMappingDao.updateById(standardDataMapping); standardDataMappingDao.updateById(standardDataMapping);
} }
public PageVo<StandardDataMapping> getCategoryInterfaceAttachList(StandardDataMappingFindVo vo) { public PageVo<StandardDataMapping> getStandardDataMappingList(StandardDataMappingFindVo vo) {
LambdaQueryWrapper<StandardDataMapping> lambdaQuery = Wrappers.lambdaQuery(StandardDataMapping.class); LambdaQueryWrapper<StandardDataMapping> lambdaQuery = Wrappers.lambdaQuery(StandardDataMapping.class);
if (StringUtils.isNotBlank(vo.getTableName())) { if (StringUtils.isNotBlank(vo.getTableName())) {
...@@ -136,6 +172,10 @@ public class StandardDataService { ...@@ -136,6 +172,10 @@ public class StandardDataService {
return PagingUtils.paging(vo, standardDataMappingDao, StandardDataMapping.class, lambdaQuery); return PagingUtils.paging(vo, standardDataMappingDao, StandardDataMapping.class, lambdaQuery);
} }
public StandardDataMapping getStandardDataMappingInfo(String standardMappingDataId) {
return standardDataMappingDao.selectById(standardMappingDataId);
}
public void addStandardCategoryName(StandardCategoryName vo) { public void addStandardCategoryName(StandardCategoryName vo) {
vo.setCreateTime(DateUtil.date()); vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date()); vo.setUpdateTime(DateUtil.date());
...@@ -147,7 +187,7 @@ public class StandardDataService { ...@@ -147,7 +187,7 @@ public class StandardDataService {
StandardCategoryName standardCategoryName = standardCategoryNameDao.selectById(vo.getId()); StandardCategoryName standardCategoryName = standardCategoryNameDao.selectById(vo.getId());
AssertUtils.notNull(standardCategoryName, "无此领域"); AssertUtils.notNull(standardCategoryName, "无此领域");
standardCategoryName.setStandardName(vo.getStandardName()); standardCategoryName.setCategoryName(vo.getCategoryName());
standardCategoryName.setLabel(vo.getLabel()); standardCategoryName.setLabel(vo.getLabel());
standardCategoryName.setParentCategoryNum(vo.getParentCategoryNum()); standardCategoryName.setParentCategoryNum(vo.getParentCategoryNum());
standardCategoryName.setIsGeneral(vo.getIsGeneral()); standardCategoryName.setIsGeneral(vo.getIsGeneral());
...@@ -162,7 +202,7 @@ public class StandardDataService { ...@@ -162,7 +202,7 @@ public class StandardDataService {
LambdaQueryWrapper<StandardCategoryName> lambdaQuery = Wrappers.lambdaQuery(StandardCategoryName.class); LambdaQueryWrapper<StandardCategoryName> lambdaQuery = Wrappers.lambdaQuery(StandardCategoryName.class);
if (StringUtils.isNotBlank(vo.getStandardName())) { if (StringUtils.isNotBlank(vo.getStandardName())) {
lambdaQuery.like(StandardCategoryName::getStandardName, vo.getStandardName()); lambdaQuery.like(StandardCategoryName::getCategoryName, vo.getStandardName());
vo.setStandardName(null); vo.setStandardName(null);
} }
if (StringUtils.isNotBlank(vo.getLabel())) { if (StringUtils.isNotBlank(vo.getLabel())) {
...@@ -172,4 +212,18 @@ public class StandardDataService { ...@@ -172,4 +212,18 @@ public class StandardDataService {
return PagingUtils.paging(vo, standardCategoryNameDao, StandardCategoryName.class, lambdaQuery); return PagingUtils.paging(vo, standardCategoryNameDao, StandardCategoryName.class, lambdaQuery);
} }
public StandardCategoryName getStandardCategoryNameInfo(String id) {
return standardCategoryNameDao.selectById(id);
}
public Object getStandardCategoryNameTree() {
List<StandardCategoryName> standardCategoryNameList = standardCategoryNameDao.selectList(null);
List<DataTreeVo> collect = standardCategoryNameList.stream().map(item -> DataTreeVo.builder()
.value(item.getId())
.parentId(item.getParentCategoryNum())
.label(item.getCategoryName())
.build()).collect(Collectors.toList());
return TreeUtils.buildTree(collect, "");
}
} }
...@@ -73,7 +73,7 @@ public class StandardDataMappingFindVo extends PageReqVo { ...@@ -73,7 +73,7 @@ public class StandardDataMappingFindVo extends PageReqVo {
* 列精度 * 列精度
*/ */
@ApiModelProperty("列精度") @ApiModelProperty("列精度")
private Integer precision; private Integer fieldPrecision;
/** /**
* 是否主键 * 是否主键
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment