diff --git a/imt-server/imt-module-system/imt-module-system-api/src/main/java/com/inspur/module/system/enums/ErrorCodeConstants.java b/imt-server/imt-module-system/imt-module-system-api/src/main/java/com/inspur/module/system/enums/ErrorCodeConstants.java index 84a1a9e..757d11c 100644 --- a/imt-server/imt-module-system/imt-module-system-api/src/main/java/com/inspur/module/system/enums/ErrorCodeConstants.java +++ b/imt-server/imt-module-system/imt-module-system-api/src/main/java/com/inspur/module/system/enums/ErrorCodeConstants.java @@ -165,5 +165,6 @@ public interface ErrorCodeConstants { // ========== 基础信息模块 ========== ErrorCode MODEL_INFO_NOT_EXISTS = new ErrorCode(1_002_028_000, "未获取到机床型号信息"); ErrorCode CUSTOMER_INFO_NOT_EXISTS = new ErrorCode(1_002_028_000, "未获取到机床客户信息"); + ErrorCode EQUIP_INFO_NOT_EXISTS = new ErrorCode(1_002_028_000, "未获取到机床信息"); } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/CustomerInfoController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/CustomerInfoController.java index 2c5b307..77ce430 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/CustomerInfoController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/CustomerInfoController.java @@ -6,6 +6,7 @@ import com.inspur.framework.ip.core.utils.AreaUtils; import com.inspur.module.system.controller.baseData.vo.CustomerInfoPageReqVO; import com.inspur.module.system.controller.baseData.vo.CustomerInfoRespVO; import com.inspur.module.system.controller.baseData.vo.CustomerInfoSaveReqVO; +import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO; import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO; import com.inspur.module.system.service.baseData.CustomerInfoService; import org.springframework.web.bind.annotation.*; @@ -125,4 +126,11 @@ public class CustomerInfoController { ExcelUtils.write(response, "机床客户信息.xls", "数据", CustomerInfoRespVO.class, bean); } + @Operation(summary = "机床客户信息下拉") + @PreAuthorize("@ss.hasPermission('imt:customer-info:query')") + @GetMapping("/selection") + public List selection() { + return customerInfoService.selection(false); + } + } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/ModelInfoController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/ModelInfoController.java index 9fecf8a..ee57635 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/ModelInfoController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/ModelInfoController.java @@ -3,6 +3,7 @@ package com.inspur.module.system.controller.baseData; import com.inspur.module.system.controller.baseData.vo.ModelInfoPageReqVO; import com.inspur.module.system.controller.baseData.vo.ModelInfoRespVO; import com.inspur.module.system.controller.baseData.vo.ModelInfoSaveReqVO; +import com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO; import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO; import com.inspur.module.system.service.baseData.ModelInfoService; import org.springframework.web.bind.annotation.*; @@ -95,4 +96,11 @@ public class ModelInfoController { ExcelUtils.write(response, "机床型号信息.xls", "数据", ModelInfoRespVO.class, BeanUtils.toBean(list, ModelInfoRespVO.class)); } + @Operation(summary = "机床型号下拉") + @GetMapping("/selection") + @PreAuthorize("@ss.hasPermission('imt:model-info:query')") + public List selection(){ + return modelInfoService.selection(false); + } + } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/vo/CustomerInfoSelectionVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/vo/CustomerInfoSelectionVO.java new file mode 100644 index 0000000..eddd36d --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/vo/CustomerInfoSelectionVO.java @@ -0,0 +1,18 @@ +package com.inspur.module.system.controller.baseData.vo; + +import lombok.Data; + +/** + * 客户信息下拉 + * + * @Author xusd + * @Date 2024/8/28 17:33 + **/ +@Data +public class CustomerInfoSelectionVO { + + private String customerId; + + private String customerName; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/vo/ModelInfoSelectionVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/vo/ModelInfoSelectionVO.java new file mode 100644 index 0000000..4267474 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/vo/ModelInfoSelectionVO.java @@ -0,0 +1,21 @@ +package com.inspur.module.system.controller.baseData.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 机床型号下拉 + * + * @Author xusd + * @Date 2024/8/28 17:21 + **/ +@Data +public class ModelInfoSelectionVO { + + @Schema(description = "机床型号id", requiredMode = Schema.RequiredMode.REQUIRED) + private String modelId; + + @Schema(description = "机床型号名称", requiredMode = Schema.RequiredMode.REQUIRED) + private String modelName; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/EquipInfoController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/EquipInfoController.java new file mode 100644 index 0000000..0898242 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/EquipInfoController.java @@ -0,0 +1,134 @@ +package com.inspur.module.system.controller.equip; + +import cn.hutool.core.collection.CollUtil; +import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO; +import com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO; +import com.inspur.module.system.controller.equip.vo.EquipInfoPageReqVO; +import com.inspur.module.system.controller.equip.vo.EquipInfoRespVO; +import com.inspur.module.system.controller.equip.vo.EquipInfoSaveReqVO; +import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; +import com.inspur.module.system.service.baseData.CustomerInfoService; +import com.inspur.module.system.service.baseData.ModelInfoService; +import com.inspur.module.system.service.equip.EquipInfoService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; +import java.util.stream.Collectors; + +import com.inspur.framework.common.pojo.PageParam; +import com.inspur.framework.common.pojo.PageResult; +import com.inspur.framework.common.pojo.CommonResult; +import com.inspur.framework.common.util.object.BeanUtils; + +import static com.inspur.framework.common.pojo.CommonResult.success; + +import com.inspur.framework.excel.core.util.ExcelUtils; + +import com.inspur.framework.apilog.core.annotation.ApiAccessLog; + +import static com.inspur.framework.apilog.core.enums.OperateTypeEnum.*; + +@Tag(name = "管理后台 - 机床信息") +@RestController +@RequestMapping("/admin-api/equip/equipInfo") +@Validated +public class EquipInfoController { + + @Resource + private EquipInfoService equipInfoService; + + @Resource + private ModelInfoService modelInfoService; + + @Resource + private CustomerInfoService customerInfoService; + + @PostMapping("/create") + @Operation(summary = "创建机床信息") + @PreAuthorize("@ss.hasPermission('imt:equip-info:create')") + public CommonResult createEquipInfo(@Valid @RequestBody EquipInfoSaveReqVO createReqVO) { + return success(equipInfoService.createEquipInfo(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新机床信息") + @PreAuthorize("@ss.hasPermission('imt:equip-info:update')") + public CommonResult updateEquipInfo(@Valid @RequestBody EquipInfoSaveReqVO updateReqVO) { + equipInfoService.updateEquipInfo(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除机床信息") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('imt:equip-info:delete')") + public CommonResult deleteEquipInfo(@RequestParam("id") String id) { + equipInfoService.deleteEquipInfo(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得机床信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('imt:equip-info:query')") + public CommonResult getEquipInfo(@RequestParam("id") String id) { + EquipInfoDO equipInfo = equipInfoService.getEquipInfo(id); + return success(BeanUtils.toBean(equipInfo, EquipInfoRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得机床信息分页") + @PreAuthorize("@ss.hasPermission('imt:equip-info:query')") + public CommonResult> getEquipInfoPage(@Valid EquipInfoPageReqVO pageReqVO) { + PageResult pageResult = equipInfoService.getEquipInfoPage(pageReqVO); + PageResult result = BeanUtils.toBean(pageResult, EquipInfoRespVO.class); + List list = result.getList(); + if (CollUtil.isNotEmpty(list)) { + List modelList = modelInfoService.selection(true); + Map modelMap = modelList.stream().collect(Collectors.toMap(ModelInfoSelectionVO::getModelId, ModelInfoSelectionVO::getModelName)); + List customerList = customerInfoService.selection(true); + Map customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName)); + list.forEach(item -> { + item.setModelName(modelMap.get(item.getModelId())); + item.setCustomerName(customerMap.get(item.getCustomerId())); + }); + } + return success(result); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出机床信息 Excel") + @PreAuthorize("@ss.hasPermission('imt:equip-info:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportEquipInfoExcel(@Valid EquipInfoPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = equipInfoService.getEquipInfoPage(pageReqVO).getList(); + List voList = BeanUtils.toBean(list, EquipInfoRespVO.class); + if (CollUtil.isNotEmpty(voList)) { + List modelList = modelInfoService.selection(true); + Map modelMap = modelList.stream().collect(Collectors.toMap(ModelInfoSelectionVO::getModelId, ModelInfoSelectionVO::getModelName)); + List customerList = customerInfoService.selection(true); + Map customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName)); + voList.forEach(item -> { + item.setModelName(modelMap.get(item.getModelId())); + item.setCustomerName(customerMap.get(item.getCustomerId())); + }); + } + // 导出 Excel + ExcelUtils.write(response, "机床信息.xls", "数据", EquipInfoRespVO.class, voList); + } + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipInfoPageReqVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipInfoPageReqVO.java new file mode 100644 index 0000000..920998b --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipInfoPageReqVO.java @@ -0,0 +1,25 @@ +package com.inspur.module.system.controller.equip.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.inspur.framework.common.pojo.PageParam; + +@Schema(description = "管理后台 - 机床信息分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class EquipInfoPageReqVO extends PageParam { + + @Schema(description = "机床型号id") + private String modelId; + + @Schema(description = "客户信息id") + private String customerId; + + @Schema(description = "机床设备编号") + private String equipNo; + + @Schema(description = "机床状态") + private Integer status; + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipInfoRespVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipInfoRespVO.java new file mode 100644 index 0000000..7c83d1a --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipInfoRespVO.java @@ -0,0 +1,70 @@ +package com.inspur.module.system.controller.equip.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import com.inspur.framework.excel.core.annotations.DictFormat; +import com.inspur.framework.excel.core.convert.DictConvert; + +import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +import static com.inspur.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; + +@Schema(description = "管理后台 - 机床信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class EquipInfoRespVO { + + @Schema(description = "机床信息id", requiredMode = Schema.RequiredMode.REQUIRED) + private String equipId; + + @Schema(description = "机床型号id", requiredMode = Schema.RequiredMode.REQUIRED) + private String modelId; + + @ExcelProperty("机床型号") + private String modelName; + + @Schema(description = "客户信息id", requiredMode = Schema.RequiredMode.REQUIRED) + private String customerId; + + @ExcelProperty("客户信息名称") + private String customerName; + + @Schema(description = "机床设备编号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("机床设备编号") + private String equipNo; + + @Schema(description = "生产日期") + @ExcelProperty("生产日期") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date productDate; + + @Schema(description = "出厂日期/购买日期") + @ExcelProperty("出厂日期/购买日期") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date purchaseDate; + + @Schema(description = "保修到期日期") + @ExcelProperty("保修到期日期") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date expireDate; + + @Schema(description = "机床状态") + @ExcelProperty(value = "机床状态", converter = DictConvert.class) + @DictFormat("equip_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer status; + + @Schema(description = "二维码图片路径") + private String qrcodePicPath; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipInfoSaveReqVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipInfoSaveReqVO.java new file mode 100644 index 0000000..2d0cdc4 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipInfoSaveReqVO.java @@ -0,0 +1,56 @@ +package com.inspur.module.system.controller.equip.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +import static com.inspur.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; + +@Schema(description = "管理后台 - 机床信息新增/修改 Request VO") +@Data +public class EquipInfoSaveReqVO { + + @Schema(description = "机床信息id", requiredMode = Schema.RequiredMode.REQUIRED) + private String equipId; + + @Schema(description = "机床型号id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "机床型号id不能为空") + private String modelId; + + @Schema(description = "客户信息id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "客户信息id不能为空") + private String customerId; + + @Schema(description = "机床设备编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "机床设备编号不能为空") + @Size(message = "机床设备编号最大不允许超过30个字符", max = 30) + private String equipNo; + + @Schema(description = "生产日期") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date productDate; + + @Schema(description = "出厂日期/购买日期") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date purchaseDate; + + @Schema(description = "保修到期日期") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date expireDate; + + @Schema(description = "机床状态") + private Integer status; + + @Schema(description = "二维码图片路径") + private String qrcodePicPath; + + @Schema(description = "备注") + @Size(message = "备注最大不允许超过500个字符", max = 500) + private String remark; + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/equip/EquipInfoDO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/equip/EquipInfoDO.java new file mode 100644 index 0000000..b54647f --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/equip/EquipInfoDO.java @@ -0,0 +1,71 @@ +package com.inspur.module.system.dal.dataobject.equip; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.inspur.framework.mybatis.core.dataobject.BaseDO; + +/** + * 机床信息 DO + * + * @author 芋道源码 + */ +@TableName("imt_equip_info") +@KeySequence("imt_equip_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class EquipInfoDO extends BaseDO { + + /** + * 机床信息id + */ + @TableId(type = IdType.ASSIGN_UUID) + private String equipId; + /** + * 机床型号id + */ + private String modelId; + /** + * 客户信息id + */ + private String customerId; + /** + * 机床设备编号 + */ + private String equipNo; + /** + * 生产日期 + */ + private Date productDate; + /** + * 出厂日期/购买日期 + */ + private Date purchaseDate; + /** + * 保修到期日期 + */ + private Date expireDate; + /** + * 机床状态 + * + */ + private Integer status; + /** + * 二维码图片路径 + */ + private String qrcodePicPath; + /** + * 备注 + */ + private String remark; + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/baseData/CustomerInfoMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/baseData/CustomerInfoMapper.java index 0749a9a..45db274 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/baseData/CustomerInfoMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/baseData/CustomerInfoMapper.java @@ -1,12 +1,17 @@ package com.inspur.module.system.dal.mysql.baseData; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.inspur.framework.common.pojo.PageResult; +import com.inspur.framework.common.util.object.BeanUtils; import com.inspur.framework.mybatis.core.mapper.BaseMapperX; import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX; import com.inspur.module.system.controller.baseData.vo.CustomerInfoPageReqVO; +import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO; import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 机床客户信息 Mapper * @@ -19,7 +24,15 @@ public interface CustomerInfoMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(CustomerInfoDO::getCustomerName, reqVO.getCustomerName()) .eqIfPresent(CustomerInfoDO::getIndustryType, reqVO.getIndustryType()) - .orderByDesc(CustomerInfoDO::getCustomerId)); + .orderByDesc(CustomerInfoDO::getCreateTime)); } + default List selection(boolean showAllData){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (!showAllData){ + queryWrapper.eq(CustomerInfoDO::getStatus,"0"); + } + List modelInfoList = selectList(queryWrapper); + return BeanUtils.toBean(modelInfoList, CustomerInfoSelectionVO.class); + } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/baseData/ModelInfoMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/baseData/ModelInfoMapper.java index a1730e9..58e4891 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/baseData/ModelInfoMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/baseData/ModelInfoMapper.java @@ -1,12 +1,17 @@ package com.inspur.module.system.dal.mysql.baseData; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.inspur.framework.common.pojo.PageResult; +import com.inspur.framework.common.util.object.BeanUtils; import com.inspur.framework.mybatis.core.mapper.BaseMapperX; import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX; import com.inspur.module.system.controller.baseData.vo.ModelInfoPageReqVO; +import com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO; import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 机床型号信息 Mapper * @@ -19,7 +24,15 @@ public interface ModelInfoMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(ModelInfoDO::getModelName, reqVO.getModelName()) .eqIfPresent(ModelInfoDO::getMachineType, reqVO.getMachineType()) - .orderByDesc(ModelInfoDO::getModelId)); + .orderByDesc(ModelInfoDO::getCreateTime)); } + default List selection(boolean showAllData){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (!showAllData){ + queryWrapper.eq(ModelInfoDO::getStatus,"0"); + } + List modelInfoList = selectList(queryWrapper); + return BeanUtils.toBean(modelInfoList,ModelInfoSelectionVO.class); + } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/equip/EquipInfoMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/equip/EquipInfoMapper.java new file mode 100644 index 0000000..3bbe9e2 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/equip/EquipInfoMapper.java @@ -0,0 +1,27 @@ +package com.inspur.module.system.dal.mysql.equip; + +import com.inspur.framework.common.pojo.PageResult; +import com.inspur.framework.mybatis.core.mapper.BaseMapperX; +import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.inspur.module.system.controller.equip.vo.EquipInfoPageReqVO; +import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 机床信息 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface EquipInfoMapper extends BaseMapperX { + + default PageResult selectPage(EquipInfoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(EquipInfoDO::getModelId, reqVO.getModelId()) + .eqIfPresent(EquipInfoDO::getCustomerId, reqVO.getCustomerId()) + .likeIfPresent(EquipInfoDO::getEquipNo, reqVO.getEquipNo()) + .eqIfPresent(EquipInfoDO::getStatus, reqVO.getStatus()) + .orderByDesc(EquipInfoDO::getCreateTime)); + } + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/CustomerInfoService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/CustomerInfoService.java index 3b1a0ae..92d6520 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/CustomerInfoService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/CustomerInfoService.java @@ -3,9 +3,11 @@ package com.inspur.module.system.service.baseData; import com.inspur.framework.common.pojo.PageResult; import com.inspur.module.system.controller.baseData.vo.CustomerInfoPageReqVO; import com.inspur.module.system.controller.baseData.vo.CustomerInfoSaveReqVO; +import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO; import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO; import javax.validation.*; +import java.util.List; /** * 机床客户信息 Service 接口 @@ -52,4 +54,13 @@ public interface CustomerInfoService { */ PageResult getCustomerInfoPage(CustomerInfoPageReqVO pageReqVO); + /** + * 机床客户信息下拉 + * + * @Author xusd + * @Date 16:32 2024/8/29 + * @param showAllData 是否显示所有数据,true:显示;false:不显示停用 + * @return java.util.List + */ + List selection(boolean showAllData); } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/CustomerInfoServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/CustomerInfoServiceImpl.java index dec03de..cfb4748 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/CustomerInfoServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/CustomerInfoServiceImpl.java @@ -3,6 +3,7 @@ package com.inspur.module.system.service.baseData; import com.inspur.framework.common.pojo.PageResult; import com.inspur.module.system.controller.baseData.vo.CustomerInfoPageReqVO; import com.inspur.module.system.controller.baseData.vo.CustomerInfoSaveReqVO; +import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO; import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO; import com.inspur.module.system.dal.mysql.baseData.CustomerInfoMapper; import org.springframework.stereotype.Service; @@ -10,6 +11,9 @@ import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; import com.inspur.framework.common.util.object.BeanUtils; +import java.util.Collections; +import java.util.List; + import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.inspur.module.system.enums.ErrorCodeConstants.CUSTOMER_INFO_NOT_EXISTS; @@ -67,4 +71,8 @@ public class CustomerInfoServiceImpl implements CustomerInfoService { return customerInfoMapper.selectPage(pageReqVO); } + @Override + public List selection(boolean showAllData) { + return customerInfoMapper.selection(showAllData); + } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/ModelInfoService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/ModelInfoService.java index 04fca13..00a1ec0 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/ModelInfoService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/ModelInfoService.java @@ -3,9 +3,11 @@ package com.inspur.module.system.service.baseData; import com.inspur.framework.common.pojo.PageResult; import com.inspur.module.system.controller.baseData.vo.ModelInfoPageReqVO; import com.inspur.module.system.controller.baseData.vo.ModelInfoSaveReqVO; +import com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO; import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO; import javax.validation.*; +import java.util.List; /** * 机床型号信息 Service 接口 @@ -52,4 +54,13 @@ public interface ModelInfoService { */ PageResult getModelInfoPage(ModelInfoPageReqVO pageReqVO); + /** + * 机床型号下拉 + * + * @Author xusd + * @Date 16:30 2024/8/29 + * @param showAllData 是否显示所有数据,true:显示;false:不显示停用 + * @return java.util.List + */ + List selection(boolean showAllData); } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/ModelInfoServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/ModelInfoServiceImpl.java index a988649..3fdbbcc 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/ModelInfoServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/baseData/ModelInfoServiceImpl.java @@ -3,6 +3,7 @@ package com.inspur.module.system.service.baseData; import com.inspur.framework.common.pojo.PageResult; import com.inspur.module.system.controller.baseData.vo.ModelInfoPageReqVO; import com.inspur.module.system.controller.baseData.vo.ModelInfoSaveReqVO; +import com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO; import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO; import com.inspur.module.system.dal.mysql.baseData.ModelInfoMapper; import com.inspur.module.system.enums.ErrorCodeConstants; @@ -11,6 +12,9 @@ import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; import com.inspur.framework.common.util.object.BeanUtils; +import java.util.Collections; +import java.util.List; + import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception; /** @@ -67,4 +71,8 @@ public class ModelInfoServiceImpl implements ModelInfoService { return modelInfoMapper.selectPage(pageReqVO); } + @Override + public List selection(boolean showAllData) { + return modelInfoMapper.selection(showAllData); + } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoService.java new file mode 100644 index 0000000..b72a697 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoService.java @@ -0,0 +1,55 @@ +package com.inspur.module.system.service.equip; + +import com.inspur.framework.common.pojo.PageResult; +import com.inspur.module.system.controller.equip.vo.EquipInfoPageReqVO; +import com.inspur.module.system.controller.equip.vo.EquipInfoSaveReqVO; +import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; + +import javax.validation.*; + +/** + * 机床信息 Service 接口 + * + * @author 芋道源码 + */ +public interface EquipInfoService { + + /** + * 创建机床信息 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + String createEquipInfo(@Valid EquipInfoSaveReqVO createReqVO); + + /** + * 更新机床信息 + * + * @param updateReqVO 更新信息 + */ + void updateEquipInfo(@Valid EquipInfoSaveReqVO updateReqVO); + + /** + * 删除机床信息 + * + * @param id 编号 + */ + void deleteEquipInfo(String id); + + /** + * 获得机床信息 + * + * @param id 编号 + * @return 机床信息 + */ + EquipInfoDO getEquipInfo(String id); + + /** + * 获得机床信息分页 + * + * @param pageReqVO 分页查询 + * @return 机床信息分页 + */ + PageResult getEquipInfoPage(EquipInfoPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoServiceImpl.java new file mode 100644 index 0000000..7c9c742 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoServiceImpl.java @@ -0,0 +1,70 @@ +package com.inspur.module.system.service.equip; + +import com.inspur.framework.common.pojo.PageResult; +import com.inspur.module.system.controller.equip.vo.EquipInfoPageReqVO; +import com.inspur.module.system.controller.equip.vo.EquipInfoSaveReqVO; +import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; +import com.inspur.module.system.dal.mysql.equip.EquipInfoMapper; +import com.inspur.module.system.enums.ErrorCodeConstants; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import com.inspur.framework.common.util.object.BeanUtils; + +import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception; + +/** + * 机床信息 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class EquipInfoServiceImpl implements EquipInfoService { + + @Resource + private EquipInfoMapper equipInfoMapper; + + @Override + public String createEquipInfo(EquipInfoSaveReqVO createReqVO) { + // 插入 + EquipInfoDO equipInfo = BeanUtils.toBean(createReqVO, EquipInfoDO.class); + equipInfoMapper.insert(equipInfo); + // 返回 + return equipInfo.getEquipId(); + } + + @Override + public void updateEquipInfo(EquipInfoSaveReqVO updateReqVO) { + // 校验存在 + validateEquipInfoExists(updateReqVO.getEquipId()); + // 更新 + EquipInfoDO updateObj = BeanUtils.toBean(updateReqVO, EquipInfoDO.class); + equipInfoMapper.updateById(updateObj); + } + + @Override + public void deleteEquipInfo(String id) { + // 校验存在 + validateEquipInfoExists(id); + // 删除 + equipInfoMapper.deleteById(id); + } + + private void validateEquipInfoExists(String id) { + if (equipInfoMapper.selectById(id) == null) { + throw exception(ErrorCodeConstants.EQUIP_INFO_NOT_EXISTS); + } + } + + @Override + public EquipInfoDO getEquipInfo(String id) { + return equipInfoMapper.selectById(id); + } + + @Override + public PageResult getEquipInfoPage(EquipInfoPageReqVO pageReqVO) { + return equipInfoMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/imt-ui/src/api/system/baseData/customerInfo.js b/imt-ui/src/api/system/baseData/customerInfo.js index 3e853b1..6bc1332 100644 --- a/imt-ui/src/api/system/baseData/customerInfo.js +++ b/imt-ui/src/api/system/baseData/customerInfo.js @@ -51,3 +51,11 @@ export function exportCustomerInfoExcel(params) { responseType: 'blob' }) } + +// 获得机床客户下拉 +export function getCustomerSelection() { + return request({ + url: '/baseData/customerInfo/selection', + method: 'get' + }) +} diff --git a/imt-ui/src/api/system/baseData/modelinfo.js b/imt-ui/src/api/system/baseData/modelinfo.js index 16f55a4..02d3104 100644 --- a/imt-ui/src/api/system/baseData/modelinfo.js +++ b/imt-ui/src/api/system/baseData/modelinfo.js @@ -51,3 +51,11 @@ export function exportModelInfoExcel(params) { responseType: 'blob' }) } + +// 获得机床型号下拉 +export function getModelSelection() { + return request({ + url: '/baseData/modelInfo/selection', + method: 'get' + }) +} diff --git a/imt-ui/src/api/system/equip/equipInfo.js b/imt-ui/src/api/system/equip/equipInfo.js new file mode 100644 index 0000000..e56ee55 --- /dev/null +++ b/imt-ui/src/api/system/equip/equipInfo.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 创建机床信息 +export function createEquipInfo(data) { + return request({ + url: '/equip/equipInfo/create', + method: 'post', + data: data + }) +} + +// 更新机床信息 +export function updateEquipInfo(data) { + return request({ + url: '/equip/equipInfo/update', + method: 'put', + data: data + }) +} + +// 删除机床信息 +export function deleteEquipInfo(id) { + return request({ + url: '/equip/equipInfo/delete?id=' + id, + method: 'delete' + }) +} + +// 获得机床信息 +export function getEquipInfo(id) { + return request({ + url: '/equip/equipInfo/get?id=' + id, + method: 'get' + }) +} + +// 获得机床信息分页 +export function getEquipInfoPage(params) { + return request({ + url: '/equip/equipInfo/page', + method: 'get', + params + }) +} +// 导出机床信息 Excel +export function exportEquipInfoExcel(params) { + return request({ + url: '/equip/equipInfo/export-excel', + method: 'get', + params, + responseType: 'blob' + }) +} diff --git a/imt-ui/src/utils/dict.js b/imt-ui/src/utils/dict.js index c1e1429..21c7122 100644 --- a/imt-ui/src/utils/dict.js +++ b/imt-ui/src/utils/dict.js @@ -13,6 +13,7 @@ export const DICT_TYPE = { //========== imt 模块 ========== MACHINE_TYPE: 'machine_type', INDUSTRY_TYPE: 'industry_type', + EQUIP_STATUS: 'equip_status', // ========== SYSTEM 模块 ========== SYSTEM_USER_SEX: 'system_user_sex', diff --git a/imt-ui/src/views/system/equip/equipInfo/EquipInfoForm.vue b/imt-ui/src/views/system/equip/equipInfo/EquipInfoForm.vue new file mode 100644 index 0000000..aea047f --- /dev/null +++ b/imt-ui/src/views/system/equip/equipInfo/EquipInfoForm.vue @@ -0,0 +1,164 @@ + + + diff --git a/imt-ui/src/views/system/equip/equipInfo/index.vue b/imt-ui/src/views/system/equip/equipInfo/index.vue new file mode 100644 index 0000000..273c94e --- /dev/null +++ b/imt-ui/src/views/system/equip/equipInfo/index.vue @@ -0,0 +1,195 @@ + + +