Compare commits
5 Commits
e91fb07dff
...
2ea2a156ca
| Author | SHA1 | Date |
|---|---|---|
|
|
2ea2a156ca | |
|
|
b578b91b0d | |
|
|
d44de8d924 | |
|
|
b8142c5ff2 | |
|
|
965831ae6b |
|
|
@ -76,5 +76,12 @@ public class EdTagLibraryController {
|
|||
public ElectromagneticResult<?> listTagTree() {
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.listTagTree());
|
||||
}
|
||||
|
||||
// 查看所有标签
|
||||
@GetMapping ("/listAllTags")
|
||||
@UserOperation(value="查看了所有标签", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> listAllTags() {
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.listAllTags());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.FileFormat;
|
||||
import com.electromagnetic.industry.software.manage.service.serviceimpl.FileFormatService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/format")
|
||||
public class FileFormatController {
|
||||
|
||||
@Resource
|
||||
private FileFormatService fileFormatService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@UserOperation(value = "新增文件格式", modelName = UserOperationModuleEnum.DATABASE)
|
||||
public ElectromagneticResult<?> addFileFormat(@RequestBody FileFormat fileFormat) {
|
||||
return ElectromagneticResultUtil.success(fileFormatService.addFileFormat(fileFormat));
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
@UserOperation(value = "删除文件格式", modelName = UserOperationModuleEnum.DATABASE)
|
||||
public ElectromagneticResult<?> deleteFileFormat(@PathVariable Long id) {
|
||||
return ElectromagneticResultUtil.success(fileFormatService.deleteFileFormat(id));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@UserOperation(value = "查询文件格式列表", modelName = UserOperationModuleEnum.DATABASE)
|
||||
public ElectromagneticResult<?> list() {
|
||||
return ElectromagneticResultUtil.success(fileFormatService.getList());
|
||||
}
|
||||
|
||||
@PostMapping("/edit")
|
||||
@UserOperation(value = "修改文件格式", modelName = UserOperationModuleEnum.DATABASE)
|
||||
public ElectromagneticResult<?> editFileFormat(@RequestBody FileFormat fileFormat) {
|
||||
return ElectromagneticResultUtil.success(fileFormatService.updateFileFormat(fileFormat));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.FileFormat;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
@Mapper
|
||||
public interface FileFormatMapper extends BaseMapper<FileFormat> {
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("ed_file_format")
|
||||
public class FileFormat {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String fileSuffix;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createdTime;
|
||||
|
||||
private String createdBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updatedTime;
|
||||
|
||||
private String updatedBy;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FileFormatVO {
|
||||
private Long id;
|
||||
|
||||
private String fileSuffix;
|
||||
|
||||
private String systemNumber;
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import com.electromagnetic.industry.software.common.pojo.TreeNode;
|
|||
import com.electromagnetic.industry.software.manage.pojo.models.EdTagLibrary;
|
||||
import com.electromagnetic.industry.software.manage.pojo.resp.TagListVO;
|
||||
|
||||
import javax.swing.text.html.HTML;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -63,4 +64,10 @@ public interface EdTagLibraryService extends IService<EdTagLibrary> {
|
|||
* @return
|
||||
*/
|
||||
List<TreeNode> listTagTree();
|
||||
|
||||
/**
|
||||
* 获取所有标签
|
||||
* @return
|
||||
*/
|
||||
List<EdTagLibrary> listAllTags();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,5 +300,17 @@ public class EdTagLibraryServiceImpl extends ServiceImpl<EdTagLibraryMapper, EdT
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有标签
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<EdTagLibrary> listAllTags() {
|
||||
LambdaQueryWrapper<EdTagLibrary> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(EdTagLibrary::getIsPublished, PublishEnum.PUBLISHED.getCode())
|
||||
.eq(EdTagLibrary::getType, TagTypeEnum.TAG.getCode());
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.FileFormat;
|
||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileFormatVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FileFormatService extends IService<FileFormat> {
|
||||
|
||||
/**
|
||||
* 创建文件格式
|
||||
* @param fileFormat
|
||||
* @return
|
||||
*/
|
||||
boolean addFileFormat(FileFormat fileFormat);
|
||||
|
||||
/**
|
||||
* 删除文件格式
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean deleteFileFormat(Long id);
|
||||
|
||||
/**
|
||||
* 查询文件格式列表
|
||||
* @return
|
||||
*/
|
||||
List<FileFormatVO> getList();
|
||||
|
||||
/**
|
||||
* 更新文件格式
|
||||
* @param fileFormat
|
||||
* @return
|
||||
*/
|
||||
boolean updateFileFormat(FileFormat fileFormat);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.text.StrFormatter;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.mapper.FileFormatMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.FileFormat;
|
||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileFormatVO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FileFormatServiceImpl extends ServiceImpl<FileFormatMapper, FileFormat> implements FileFormatService {
|
||||
|
||||
/**
|
||||
* 创建文件格式
|
||||
* @param fileFormat
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean addFileFormat(FileFormat fileFormat) {
|
||||
fileFormat.setCreatedBy(UserThreadLocal.getUserId());
|
||||
Assert.notNull(fileFormat.getFileSuffix(), "文件格式不能为空");
|
||||
boolean isSaved = this.save(fileFormat);
|
||||
if (isSaved) {
|
||||
UserThreadLocal.setSuccessInfo("","", StrFormatter.format("添加了文件格式 {} ", fileFormat.getFileSuffix()));
|
||||
}
|
||||
return isSaved;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件格式
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteFileFormat(Long id) {
|
||||
FileFormat fileFormat = getById(id);
|
||||
UserThreadLocal.setSuccessInfo("","", StrFormatter.format("删除了文件格式 {} ", fileFormat.getFileSuffix()));
|
||||
return removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询了文件格式列表
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public List<FileFormatVO> getList() {
|
||||
List<FileFormat> list = this.list();
|
||||
List<FileFormatVO> result = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
FileFormat fileFormat = list.get(i);
|
||||
FileFormatVO fileFormatVO = new FileFormatVO();
|
||||
BeanUtils.copyProperties(fileFormat, fileFormatVO);
|
||||
// 生成系统编号
|
||||
fileFormatVO.setSystemNumber(String.format("%02d", i + 1));
|
||||
result.add(fileFormatVO);
|
||||
}
|
||||
UserThreadLocal.setSuccessInfo("","", "查询了文件格式列表");
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新文件格式
|
||||
* @param fileFormat
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean updateFileFormat(FileFormat fileFormat) {
|
||||
fileFormat.setUpdatedBy(UserThreadLocal.getUserId());
|
||||
Assert.notNull(fileFormat.getId(), "文件格式ID不能为空");
|
||||
Assert.notEmpty(fileFormat.getFileSuffix(), "文件格式不能为空");
|
||||
boolean isUpdated = updateById(fileFormat);
|
||||
if (isUpdated) {
|
||||
UserThreadLocal.setSuccessInfo("","", StrFormatter.format("修改了文件格式 {} ", fileFormat.getFileSuffix()));
|
||||
}
|
||||
return isUpdated;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue