工器具
This commit is contained in:
parent
9fe8cc3ff4
commit
625ae85773
|
|
@ -6,7 +6,6 @@ import com.bonus.common.core.controller.BaseController;
|
|||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.common.domain.mainDatabase.dto.TechnicalDto;
|
||||
import com.bonus.common.domain.mainDatabase.vo.EnterpriseVo;
|
||||
import com.bonus.common.domain.mainDatabase.vo.TechnicalVo;
|
||||
import com.bonus.common.enums.OperaType;
|
||||
import com.bonus.web.service.enterprise.TechnicalService;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package com.bonus.web.controller.enterprise;
|
||||
|
||||
import com.bonus.common.annotation.RequiresPermissions;
|
||||
import com.bonus.common.annotation.SysLog;
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.common.domain.mainDatabase.dto.ToolDto;
|
||||
import com.bonus.common.domain.mainDatabase.vo.ToolVo;
|
||||
import com.bonus.common.enums.OperaType;
|
||||
import com.bonus.web.service.enterprise.ToolService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:ToolController
|
||||
* @author:cwchen
|
||||
* @date:2025-10-30-13:20
|
||||
* @version:1.0
|
||||
* @description:工器具库-web层
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mainDatabase/tool")
|
||||
public class ToolController extends BaseController {
|
||||
|
||||
@Resource(name = "ToolService")
|
||||
private ToolService toolService;
|
||||
|
||||
@ApiOperation(value = "工器具库", notes = "查询数据列表")
|
||||
@GetMapping("getList")
|
||||
@SysLog(title = "工器具库", module = "企业知识库->工器具库->查询数据列表", businessType = OperaType.QUERY, details = "查询数据列表", logType = 1)
|
||||
@RequiresPermissions("enterpriseLibrary:technical:list")
|
||||
public TableDataInfo getList(ToolDto dto) {
|
||||
startPage();
|
||||
List<ToolVo> list = toolService.getList(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "工器具库", notes = "新增工器具库")
|
||||
@PostMapping("addData")
|
||||
@SysLog(title = "工器具库", module = "企业知识库->工器具库->新增工器具库", businessType = OperaType.INSERT, details = "新增工器具", logType = 1)
|
||||
@RequiresPermissions("enterpriseLibrary:tool:add")
|
||||
public AjaxResult addData(@RequestBody ToolDto dto) {
|
||||
return toolService.addData(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "工器具库", notes = "修改工器具")
|
||||
@PostMapping("editData")
|
||||
@SysLog(title = "工器具库", module = "企业知识库->工器具库->修改工器具库", businessType = OperaType.UPDATE, details = "修改工器具", logType = 1)
|
||||
@RequiresPermissions("enterpriseLibrary:tool:edit")
|
||||
public AjaxResult editData(@RequestBody ToolDto dto) {
|
||||
return toolService.editData(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "工器具库", notes = "删除工器具")
|
||||
@PostMapping("delData")
|
||||
@SysLog(title = "工器具库", module = "企业知识库->工器具库->删除工器具库", businessType = OperaType.DELETE, details = "删除工器具", logType = 1)
|
||||
@RequiresPermissions("enterpriseLibrary:tool:del")
|
||||
public AjaxResult delData(@RequestBody ToolDto dto) {
|
||||
return toolService.delData(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "工器具库", notes = "工器具详情")
|
||||
@PostMapping("detailData")
|
||||
@SysLog(title = "工器具库", module = "企业知识库->工器具库->工器具详情", businessType = OperaType.QUERY, details = "工器具详情", logType = 1)
|
||||
@RequiresPermissions("enterpriseLibrary:tool:detail")
|
||||
public AjaxResult detailData(@RequestBody ToolDto dto) {
|
||||
return toolService.detailData(dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ import com.bonus.common.constant.TableConstants;
|
|||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.domain.file.po.ResourceFilePo;
|
||||
import com.bonus.common.domain.file.vo.ResourceFileVo;
|
||||
import com.bonus.common.domain.file.vo.SysFile;
|
||||
import com.bonus.common.domain.mainDatabase.dto.TechnicalDto;
|
||||
import com.bonus.common.domain.mainDatabase.vo.TechnicalVo;
|
||||
import com.bonus.common.utils.ValidatorsUtils;
|
||||
|
|
@ -12,7 +11,6 @@ import com.bonus.file.service.FileUploadService;
|
|||
import com.bonus.file.service.SourceFileService;
|
||||
import com.bonus.mainDataBase.service.IMDTechnicalService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -22,7 +20,6 @@ import javax.annotation.Resource;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @className:TechnicalService
|
||||
|
|
@ -229,6 +226,8 @@ public class TechnicalService {
|
|||
try {
|
||||
// 删除技术方案库数据
|
||||
imdTechnicalService.operData(Collections.singletonList(dto), 3);
|
||||
// 删除技术方案库相关资源文件
|
||||
sourceFileService.delResourceFileByTable(dto.getTechnicalSolutionId(),TableConstants.TB_ENTERPRISE_TECHNICAL_SOLUTION);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,179 @@
|
|||
package com.bonus.web.service.enterprise;
|
||||
|
||||
import com.bonus.common.constant.TableConstants;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.domain.file.po.ResourceFilePo;
|
||||
import com.bonus.common.domain.file.vo.ResourceFileVo;
|
||||
import com.bonus.common.domain.mainDatabase.dto.TechnicalDto;
|
||||
import com.bonus.common.domain.mainDatabase.dto.ToolDto;
|
||||
import com.bonus.common.domain.mainDatabase.vo.TechnicalVo;
|
||||
import com.bonus.common.domain.mainDatabase.vo.ToolVo;
|
||||
import com.bonus.common.utils.ValidatorsUtils;
|
||||
import com.bonus.file.service.FileUploadService;
|
||||
import com.bonus.file.service.SourceFileService;
|
||||
import com.bonus.mainDataBase.service.IMDToolService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:ToolService
|
||||
* @author:cwchen
|
||||
* @date:2025-10-30-13:33
|
||||
* @version:1.0
|
||||
* @description:工器具业务层
|
||||
*/
|
||||
@Service(value = "ToolService")
|
||||
@Slf4j
|
||||
public class ToolService {
|
||||
|
||||
@Resource(name = "IMDToolService")
|
||||
private IMDToolService imdToolService;
|
||||
|
||||
@Resource(name = "SourceFileService")
|
||||
private SourceFileService sourceFileService;
|
||||
|
||||
|
||||
@Resource(name = "FileUploadService")
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
@Resource(name = "ValidatorsUtils")
|
||||
private ValidatorsUtils validatorsUtils;
|
||||
|
||||
/**
|
||||
* 企业知识库->工器具库->查询数据列表
|
||||
* @param dto
|
||||
* @return List<Technical>
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 13:46
|
||||
*/
|
||||
public List<ToolVo> getList(ToolDto dto) {
|
||||
return imdToolService.getList(dto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 企业知识库->工器具库->新增工器具数据
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 13:47
|
||||
*/
|
||||
public AjaxResult addData(ToolDto dto) {
|
||||
// 校验数据是否合法
|
||||
String validResult = validatorsUtils.valid(dto, TechnicalDto.TechnicalDataDto.ADD.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
try {
|
||||
// 1.校验工器具名称是否重复
|
||||
int result = imdToolService.isRepeat(dto);
|
||||
if(result > 0){
|
||||
return AjaxResult.error("工器具名称重复");
|
||||
}
|
||||
// 2.添加工器具数据
|
||||
imdToolService.operData(dto, 1);
|
||||
// 3.添加文件
|
||||
for (ResourceFilePo file : dto.getFiles()) {
|
||||
file.setBusinessId(dto.getToolId()); // 业务id
|
||||
file.setSourceTable(TableConstants.TB_ENTERPRISE_TOOL); // 来源表
|
||||
}
|
||||
sourceFileService.saveResourceFile(dto.getFiles());
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业知识库->工器具库->修改工器具数据
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 13:47
|
||||
*/
|
||||
public AjaxResult editData(ToolDto dto) {
|
||||
// 1.校验数据是否合法
|
||||
String validResult = validatorsUtils.valid(dto, ToolDto.UPDATE.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
try {
|
||||
// 1.校验工器具名称是否重复
|
||||
int result = imdToolService.isRepeat(dto);
|
||||
if(result > 0){
|
||||
return AjaxResult.error("工器具名称重复");
|
||||
}
|
||||
// 2.修改主体库数据
|
||||
imdToolService.operData(dto, 2);
|
||||
// 3.如果存在新增文件则添加文件
|
||||
if (CollectionUtils.isNotEmpty(dto.getFiles())) {
|
||||
for (ResourceFilePo file : dto.getFiles()) {
|
||||
file.setBusinessId(dto.getToolId()); // 业务id
|
||||
file.setSourceTable(TableConstants.TB_ENTERPRISE_TOOL); // 来源表
|
||||
}
|
||||
sourceFileService.saveResourceFile(dto.getFiles());
|
||||
}
|
||||
// 4.如果存在删除的文件则删除系统资源文件
|
||||
if (CollectionUtils.isNotEmpty(dto.getDelFiles())) {
|
||||
sourceFileService.delResourceFile(dto.getDelFiles(), TableConstants.TB_ENTERPRISE_TOOL);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业知识库->工器具库->删除工器具数据
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 13:47
|
||||
*/
|
||||
public AjaxResult delData(ToolDto dto) {
|
||||
// 校验数据是否合法
|
||||
String validResult = validatorsUtils.valid(dto, ToolDto.DELETE.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
try {
|
||||
// 删除工器具数据
|
||||
imdToolService.operData(dto, 3);
|
||||
// 删除工器具相关资源文件
|
||||
sourceFileService.delResourceFileByTable(dto.getToolId(),TableConstants.TB_ENTERPRISE_TOOL);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业知识库->工器具库->工器具详情
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 14:17
|
||||
*/
|
||||
public AjaxResult detailData(ToolDto dto) {
|
||||
ToolVo vo = new ToolVo();
|
||||
// 1.查询关联资源文件
|
||||
List<ResourceFileVo> fileVoList = sourceFileService.getFilesByTable(dto.getToolId(),TableConstants.TB_ENTERPRISE_TOOL);
|
||||
// 2.取minio中的文件访问路径
|
||||
List<ResourceFileVo> resourceFileVos = fileUploadService.setFile(fileVoList);
|
||||
vo.setResourceFileVoList(resourceFileVos);
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,4 +20,7 @@ public class TableConstants {
|
|||
|
||||
/**技术方案库*/
|
||||
public static final String TB_ENTERPRISE_TECHNICAL_SOLUTION = "tb_enterprise_technical_solution";
|
||||
|
||||
/**工器具库*/
|
||||
public static final String TB_ENTERPRISE_TOOL = "tb_enterprise_tool";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import javax.validation.constraints.NotBlank;
|
|||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
@ -42,8 +41,8 @@ public class TechnicalDto {
|
|||
/**
|
||||
* 技术方案名称
|
||||
*/
|
||||
@NotBlank(message = "技术方案名称不能为空", groups = {EnterpriseDto.ADD.class, EnterpriseDto.UPDATE.class})
|
||||
@Length(max = 64, message = "技术方案名称字符长度不能超过64", groups = {EnterpriseDto.ADD.class, EnterpriseDto.UPDATE.class})
|
||||
@NotBlank(message = "技术方案名称不能为空", groups = {ADD.class, UPDATE.class})
|
||||
@Length(max = 64, message = "技术方案名称字符长度不能超过64", groups = {ADD.class, UPDATE.class})
|
||||
private String technicalSolutionName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,138 @@
|
|||
package com.bonus.common.domain.mainDatabase.dto;
|
||||
|
||||
import com.bonus.common.core.domain.model.LoginUser;
|
||||
import com.bonus.common.domain.file.po.ResourceFilePo;
|
||||
import com.bonus.common.utils.SecurityUtils;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @className:ToolDto
|
||||
* @author:cwchen
|
||||
* @date:2025-10-30-13:23
|
||||
* @version:1.0
|
||||
* @description:工器具-dto
|
||||
*/
|
||||
@Data
|
||||
public class ToolDto {
|
||||
|
||||
/**
|
||||
* 工器具id
|
||||
*/
|
||||
@NotNull(message = "工器具id不能为空", groups = {UPDATE.class,DELETE.class, QUERY.class})
|
||||
private Long toolId;
|
||||
|
||||
/**
|
||||
* 企业id
|
||||
*/
|
||||
@NotNull(message = "企业id不能为空", groups = {UPDATE.class,DELETE.class, QUERY.class})
|
||||
private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 工器具名称
|
||||
*/
|
||||
@NotBlank(message = "工器具名称不能为空", groups = {ADD.class, UPDATE.class})
|
||||
@Length(max = 64, message = "工器具名称字符长度不能超过64", groups = {ADD.class, UPDATE.class})
|
||||
private String toolName;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@NotBlank(message = "规格型号不能为空", groups = {ADD.class, UPDATE.class})
|
||||
@Length(max = 32, message = "规格型号字符长度不能超过32", groups = {ADD.class, UPDATE.class})
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@NotBlank(message = "单位不能为空", groups = {ADD.class, UPDATE.class})
|
||||
@Length(max = 32, message = "单位字符长度不能超过32", groups = {ADD.class, UPDATE.class})
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 技术参数
|
||||
*/
|
||||
@Length(max = 100, message = "技术参数字符长度不能超过100", groups = {ADD.class, UPDATE.class})
|
||||
private String technicalParameters;
|
||||
|
||||
/**
|
||||
* 主要作用
|
||||
*/
|
||||
@Length(max = 100, message = "主要作用字符长度不能超过100", groups = {ADD.class, UPDATE.class})
|
||||
private String mainFunction;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Length(max = 200, message = "备注字符长度不能超过200", groups = {ADD.class, UPDATE.class})
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUserId = Optional.ofNullable(SecurityUtils.getLoginUser())
|
||||
.map(LoginUser::getUserId)
|
||||
.orElse(null);
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String createUserName = Optional.ofNullable(SecurityUtils.getLoginUser())
|
||||
.map(LoginUser::getUsername)
|
||||
.orElse(null);
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long updateUserId = Optional.ofNullable(SecurityUtils.getLoginUser())
|
||||
.map(LoginUser::getUserId)
|
||||
.orElse(null);
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String updateUserName = Optional.ofNullable(SecurityUtils.getLoginUser())
|
||||
.map(LoginUser::getUsername)
|
||||
.orElse(null);
|
||||
|
||||
/**
|
||||
* 资源文件
|
||||
*/
|
||||
@NotEmpty(message = "文件不能为空", groups = {TechnicalDto.TechnicalDataDto.ADD.class})
|
||||
@Size(min = 1,message = "最少上传一个文件", groups = {TechnicalDto.TechnicalDataDto.ADD.class})
|
||||
private List<ResourceFilePo> files;
|
||||
|
||||
/**删除的文件*/
|
||||
private List<String> delFiles;
|
||||
|
||||
/**
|
||||
* 查询条件限制
|
||||
*/
|
||||
public interface QUERY {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增条件限制
|
||||
*/
|
||||
public interface ADD {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改条件限制
|
||||
*/
|
||||
public interface UPDATE {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除条件限制
|
||||
*/
|
||||
public interface DELETE {
|
||||
}
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ public class TechnicalVo {
|
|||
*/
|
||||
private String technicalSolutionState;
|
||||
|
||||
/**人员相关资源文件*/
|
||||
/**相关资源文件*/
|
||||
private List<ResourceFileVo> resourceFileVoList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
package com.bonus.common.domain.mainDatabase.vo;
|
||||
|
||||
import com.bonus.common.domain.file.vo.ResourceFileVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:ToolVo
|
||||
* @author:cwchen
|
||||
* @date:2025-10-30-13:23
|
||||
* @version:1.0
|
||||
* @description:工器具-vo
|
||||
*/
|
||||
@Data
|
||||
public class ToolVo {
|
||||
|
||||
/**
|
||||
* 工器具id
|
||||
*/
|
||||
private Long toolId;
|
||||
|
||||
/**
|
||||
* 企业id
|
||||
*/
|
||||
private Long enterpriseId;
|
||||
|
||||
/**
|
||||
* 工器具名称
|
||||
*/
|
||||
private String toolName;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 技术参数
|
||||
*/
|
||||
private String technicalParameters;
|
||||
|
||||
/**
|
||||
* 主要作用
|
||||
*/
|
||||
private String mainFunction;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**相关资源文件*/
|
||||
private List<ResourceFileVo> resourceFileVoList;
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.bonus.mainDataBase.mapper;
|
||||
|
||||
import com.bonus.common.domain.mainDatabase.dto.ToolDto;
|
||||
import com.bonus.common.domain.mainDatabase.vo.TechnicalVo;
|
||||
import com.bonus.common.domain.mainDatabase.vo.ToolVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:IMDToolMapper
|
||||
* @author:cwchen
|
||||
* @date:2025-10-30-13:42
|
||||
* @version:1.0
|
||||
* @description:工器具-数据层
|
||||
*/
|
||||
@Repository(value = "IMDToolMapper")
|
||||
public interface IMDToolMapper {
|
||||
/**
|
||||
* 企业知识库->工器具库->查询数据列表
|
||||
* @param dto
|
||||
* @return List<Technical>
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 13:49
|
||||
*/
|
||||
List<ToolVo> getList(ToolDto dto);
|
||||
|
||||
/**
|
||||
* 企业知识库->工器具库->查询工器具名称是否重复
|
||||
* @param dto
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 14:02
|
||||
*/
|
||||
int isRepeat(ToolDto dto);
|
||||
|
||||
/**
|
||||
* 企业知识库->工器具库->操作工器具数据
|
||||
* @param dto
|
||||
* @param type
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 14:02
|
||||
*/
|
||||
void operData(@Param("params") ToolDto dto, @Param("type")int type);
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.bonus.mainDataBase.service;
|
||||
|
||||
import com.bonus.common.domain.mainDatabase.dto.ToolDto;
|
||||
import com.bonus.common.domain.mainDatabase.vo.TechnicalVo;
|
||||
import com.bonus.common.domain.mainDatabase.vo.ToolVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:IMDToolService
|
||||
* @author:cwchen
|
||||
* @date:2025-10-30-13:41
|
||||
* @version:1.0
|
||||
* @description:工器具-具体业务层
|
||||
*/
|
||||
public interface IMDToolService {
|
||||
|
||||
/**
|
||||
* 企业知识库->工器具库->查询数据列表
|
||||
* @param dto
|
||||
* @return List<Technical>
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 13:48
|
||||
*/
|
||||
List<ToolVo> getList(ToolDto dto);
|
||||
|
||||
/**
|
||||
* 企业知识库->工器具库->操作工器具数据
|
||||
* @param dto
|
||||
* @param type
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 13:59
|
||||
*/
|
||||
void operData(ToolDto dto, int type);
|
||||
|
||||
/**
|
||||
* 企业知识库->工器具库->查询工器具名称是否重复
|
||||
* @param dto
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2025/10/30 14:00
|
||||
*/
|
||||
int isRepeat(ToolDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.mainDataBase.service.impl;
|
||||
|
||||
import com.bonus.common.domain.mainDatabase.dto.ToolDto;
|
||||
import com.bonus.common.domain.mainDatabase.vo.TechnicalVo;
|
||||
import com.bonus.common.domain.mainDatabase.vo.ToolVo;
|
||||
import com.bonus.mainDataBase.mapper.IMDToolMapper;
|
||||
import com.bonus.mainDataBase.service.IMDToolService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @className:MDToolService
|
||||
* @author:cwchen
|
||||
* @date:2025-10-30-13:41
|
||||
* @version:1.0
|
||||
* @description:工器具-具体业务逻辑层
|
||||
*/
|
||||
@Service(value = "IMDToolService")
|
||||
@Slf4j
|
||||
public class MDToolServiceImpl implements IMDToolService {
|
||||
|
||||
@Resource(name = "IMDToolMapper")
|
||||
private IMDToolMapper imdToolMapper;
|
||||
|
||||
@Override
|
||||
public List<ToolVo> getList(ToolDto dto) {
|
||||
try {
|
||||
return imdToolMapper.getList(dto);
|
||||
} catch (Exception e) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operData(ToolDto dto, int type) {
|
||||
imdToolMapper.operData(dto,type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isRepeat(ToolDto dto) {
|
||||
try {
|
||||
return Optional.ofNullable(imdToolMapper.isRepeat(dto)).orElse(0);
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.mainDataBase.mapper.IMDToolMapper">
|
||||
<!--企业知识库->工器具库->操作工器具数据-->
|
||||
<insert id="operData" useGeneratedKeys="true" keyProperty="params.toolId" keyColumn="tool_id">
|
||||
<if test="type == 1">
|
||||
INSERT INTO tb_enterprise_tool
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="params.enterpriseId != null">enterprise_id,</if>
|
||||
<if test="params.toolName != null and params.toolName!=''">tool_name,</if>
|
||||
<if test="params.model != null and params.model!=''">model,</if>
|
||||
<if test="params.unit != null and params.unit!=''">unit,</if>
|
||||
<if test="params.technicalParameters != null and params.technicalParameters!=''">technical_parameters,</if>
|
||||
<if test="params.mainFunction != null and params.mainFunction!=''">main_function,</if>
|
||||
<if test="params.remark != null and params.remark!=''">remark,</if>
|
||||
create_user_id,
|
||||
create_user_name,
|
||||
update_user_id,
|
||||
update_user_name
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="params.enterpriseId != null">#{params.enterpriseId},</if>
|
||||
<if test="params.toolName != null and params.toolName!=''">#{params.toolName},</if>
|
||||
<if test="params.model != null and params.model!=''">#{params.model},</if>
|
||||
<if test="params.unit != null and params.unit!=''">#{params.unit},</if>
|
||||
<if test="params.technicalParameters != null and params.technicalParameters!=''">#{params.technicalParameters},</if>
|
||||
<if test="params.mainFunction != null and params.mainFunction!=''">#{params.mainFunction},</if>
|
||||
<if test="params.remark != null and params.remark!=''">#{params.remark},</if>
|
||||
#{params.createUserId},
|
||||
#{params.createUserName},
|
||||
#{params.updateUserId},
|
||||
#{params.updateUserName},
|
||||
</trim>
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
UPDATE tb_enterprise_tool
|
||||
SET
|
||||
tool_name = #{params.toolName},
|
||||
model = #{params.model},
|
||||
unit = #{params.unit},
|
||||
technical_parameters = #{params.technicalParameters},
|
||||
main_function = #{params.mainFunction},
|
||||
remark = #{params.remark}
|
||||
WHERE tool_id = #{params.toolId};
|
||||
</if>
|
||||
<if test="type == 3">
|
||||
UPDATE tb_enterprise_tool SET del_flag = '1' WHERE tool_id = #{params.toolId}
|
||||
</if>
|
||||
</insert>
|
||||
<!--企业知识库->工器具库->查询数据列表-->
|
||||
<select id="getList" resultType="com.bonus.common.domain.mainDatabase.vo.ToolVo">
|
||||
SELECT tool_id AS toolId,
|
||||
enterprise_id AS enterpriseId,
|
||||
tool_name AS toolName,
|
||||
model,
|
||||
unit,
|
||||
technical_parameters AS technicalParameters,
|
||||
main_function AS mainFunction,
|
||||
remark
|
||||
FROM tb_enterprise_tool
|
||||
<where>
|
||||
<if test="toolName!=null and toolName!=''">
|
||||
AND INSTR(tool_name,#{toolName}) > 0
|
||||
</if>
|
||||
AND enterprise_id = #{enterpriseId}
|
||||
AND del_flag = '0'
|
||||
</where>
|
||||
</select>
|
||||
<!--企业知识库->工器具库->查询工器具名称是否重复-->
|
||||
<select id="isRepeat" resultType="java.lang.Integer">
|
||||
<if test="toolId == null">
|
||||
SELECT COUNT(*) FROM tb_enterprise_tool WHERE tool_name = #{toolName} AND del_flag = '0'
|
||||
</if>
|
||||
<if test="toolId!=null">
|
||||
SELECT COUNT(*) FROM tb_enterprise_tool WHERE tool_id !=#{toolId} AND tool_name = #{toolName} AND del_flag = '0'
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue