mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 05:22:13 +08:00
feat: 数据集
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package io.dataease.controller.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetGroup;
|
||||
import io.dataease.dto.dataset.DataSetGroupDTO;
|
||||
import io.dataease.service.dataset.DataSetGroupService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/2/20 8:29 下午
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("dataset/group")
|
||||
public class DataSetGroupController {
|
||||
@Resource
|
||||
private DataSetGroupService dataSetGroupService;
|
||||
|
||||
@PostMapping("/save")
|
||||
public DataSetGroupDTO save(@RequestBody DatasetGroup datasetGroup) {
|
||||
return dataSetGroupService.save(datasetGroup);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.dataease.dto.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetGroup;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/2/20 8:17 下午
|
||||
*/
|
||||
@Data
|
||||
public class DataSetGroupDTO extends DatasetGroup {
|
||||
private String label;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.dataease.service.dataset;
|
||||
|
||||
import com.alibaba.nacos.common.util.UuidUtils;
|
||||
import io.dataease.base.domain.DatasetGroup;
|
||||
import io.dataease.base.mapper.DatasetGroupMapper;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.dto.dataset.DataSetGroupDTO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/2/20 8:10 下午
|
||||
*/
|
||||
@Service
|
||||
public class DataSetGroupService {
|
||||
@Resource
|
||||
private DatasetGroupMapper datasetGroupMapper;
|
||||
|
||||
public DataSetGroupDTO save(DatasetGroup datasetGroup) {
|
||||
if (StringUtils.isEmpty(datasetGroup.getId())) {
|
||||
datasetGroup.setId(UuidUtils.generateUuid());
|
||||
datasetGroup.setCreateTime(System.currentTimeMillis());
|
||||
datasetGroupMapper.insert(datasetGroup);
|
||||
} else {
|
||||
datasetGroupMapper.updateByPrimaryKey(datasetGroup);
|
||||
}
|
||||
DataSetGroupDTO dataSetGroupDTO = new DataSetGroupDTO();
|
||||
BeanUtils.copyBean(dataSetGroupDTO, datasetGroup);
|
||||
dataSetGroupDTO.setLabel(dataSetGroupDTO.getName());
|
||||
return dataSetGroupDTO;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user