diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java index e01c3872..5855cc11 100644 --- a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java @@ -31,6 +31,7 @@ public interface ErrorCodeConstants { ErrorCode SUPPLIER_NOT_EXISTS = new ErrorCode(1_001_005, "供应商不存在"); ErrorCode PROCEDURE_NOT_EXISTS = new ErrorCode(1_001_006, "工序不存在"); ErrorCode SERIAL_NUMBER_NOT_EXISTS = new ErrorCode(1_001_007, "序列号记录不存在"); + ErrorCode EQUIP_NOT_EXISTS = new ErrorCode(1_001_008, "设备信息不存在"); /*********组织架构************/ ErrorCode WORKSHOP_NOT_EXISTS = new ErrorCode(1_002_001, "车间不存在"); diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/EquipController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/EquipController.java new file mode 100644 index 00000000..9cfdcd19 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/EquipController.java @@ -0,0 +1,95 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.equip; + +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 com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; + +import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; + +import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; +import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; + +import com.chanko.yunxi.mes.module.heli.controller.admin.equip.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; +import com.chanko.yunxi.mes.module.heli.service.equip.EquipService; + +@Tag(name = "管理后台 - 设备信息") +@RestController +@RequestMapping("/heli/equip") +@Validated +public class EquipController { + + @Resource + private EquipService equipService; + + @PostMapping("/create") + @Operation(summary = "创建设备信息") + @PreAuthorize("@ss.hasPermission('heli:equip:create')") + public CommonResult createEquip(@Valid @RequestBody EquipSaveReqVO createReqVO) { + return success(equipService.createEquip(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新设备信息") + @PreAuthorize("@ss.hasPermission('heli:equip:update')") + public CommonResult updateEquip(@Valid @RequestBody EquipSaveReqVO updateReqVO) { + equipService.updateEquip(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除设备信息") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:equip:delete')") + public CommonResult deleteEquip(@RequestParam("id") Long id) { + equipService.deleteEquip(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得设备信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:equip:query')") + public CommonResult getEquip(@RequestParam("id") Long id) { + EquipDO equip = equipService.getEquip(id); + return success(BeanUtils.toBean(equip, EquipRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得设备信息分页") + @PreAuthorize("@ss.hasPermission('heli:equip:query')") + public CommonResult> getEquipPage(@Valid EquipPageReqVO pageReqVO) { + PageResult pageResult = equipService.getEquipPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, EquipRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出设备信息 Excel") + @PreAuthorize("@ss.hasPermission('heli:equip:export')") + @OperateLog(type = EXPORT) + public void exportEquipExcel(@Valid EquipPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = equipService.getEquipPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "设备信息.xls", "数据", EquipRespVO.class, + BeanUtils.toBean(list, EquipRespVO.class)); + } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/vo/EquipPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/vo/EquipPageReqVO.java new file mode 100644 index 00000000..319f002e --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/vo/EquipPageReqVO.java @@ -0,0 +1,50 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.equip.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 设备信息分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class EquipPageReqVO extends PageParam { + + @Schema(description = "自增字段,唯一") + private Long id; + + @Schema(description = "设备名称 唯一") + private String name; + + @Schema(description = "模具类型id,对应 base_mould_type 表中的id") + private Long mouldTypeId; + + @Schema(description = "状态,1表示正常,2表示禁用,默认是1") + private Integer status; + + @Schema(description = "创建者") + private String creator; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "更新者") + private String updater; + + @Schema(description = "更新时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] updateTime; + + @Schema(description = "是否删除") + private Boolean deleted; + + @Schema(description = "租户编号") + private Long tenantId; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/vo/EquipRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/vo/EquipRespVO.java new file mode 100644 index 00000000..66ea928f --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/vo/EquipRespVO.java @@ -0,0 +1,30 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.equip.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 设备信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class EquipRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "设备名称 唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("设备名称 唯一") + private String name; + + @Schema(description = "模具类型id,对应 base_mould_type 表中的id", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("模具类型id,对应 base_mould_type 表中的id") + private Long mouldTypeId; + + @Schema(description = "状态,1表示正常,2表示禁用,默认是1") + @ExcelProperty("状态,1表示正常,2表示禁用,默认是1") + private Integer status; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/vo/EquipSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/vo/EquipSaveReqVO.java new file mode 100644 index 00000000..cbbced14 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/vo/EquipSaveReqVO.java @@ -0,0 +1,27 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.equip.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; + +@Schema(description = "管理后台 - 设备信息新增/修改 Request VO") +@Data +public class EquipSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + + @Schema(description = "设备名称 唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "设备名称 唯一不能为空") + private String name; + + @Schema(description = "模具类型id,对应 base_mould_type 表中的id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "模具类型id,对应 base_mould_type 表中的id不能为空") + private Long mouldTypeId; + + @Schema(description = "状态,1表示正常,2表示禁用,默认是1") + private Integer status; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/mouldtype/MouldTypeController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/mouldtype/MouldTypeController.java index 6d117f02..f98d86a7 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/mouldtype/MouldTypeController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/mouldtype/MouldTypeController.java @@ -1,95 +1,102 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.mouldtype; - -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 com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; -import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; -import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; - -import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; - -import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; -import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; - -import com.chanko.yunxi.mes.module.heli.controller.admin.mouldtype.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.mouldtype.MouldTypeDO; -import com.chanko.yunxi.mes.module.heli.service.mouldtype.MouldTypeService; - -@Tag(name = "管理后台 - 模具类型") -@RestController -@RequestMapping("/heli/mould-type") -@Validated -public class MouldTypeController { - - @Resource - private MouldTypeService mouldTypeService; - - @PostMapping("/create") - @Operation(summary = "创建模具类型") - @PreAuthorize("@ss.hasPermission('heli:mould-type:create')") - public CommonResult createMouldType(@Valid @RequestBody MouldTypeSaveReqVO createReqVO) { - return success(mouldTypeService.createMouldType(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新模具类型") - @PreAuthorize("@ss.hasPermission('heli:mould-type:update')") - public CommonResult updateMouldType(@Valid @RequestBody MouldTypeSaveReqVO updateReqVO) { - mouldTypeService.updateMouldType(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除模具类型") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('heli:mould-type:delete')") - public CommonResult deleteMouldType(@RequestParam("id") Long id) { - mouldTypeService.deleteMouldType(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得模具类型") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('heli:mould-type:query')") - public CommonResult getMouldType(@RequestParam("id") Long id) { - MouldTypeDO mouldType = mouldTypeService.getMouldType(id); - return success(BeanUtils.toBean(mouldType, MouldTypeRespVO.class)); - } - - @GetMapping("/page") - @Operation(summary = "获得模具类型分页") - @PreAuthorize("@ss.hasPermission('heli:mould-type:query')") - public CommonResult> getMouldTypePage(@Valid MouldTypePageReqVO pageReqVO) { - PageResult pageResult = mouldTypeService.getMouldTypePage(pageReqVO); - return success(BeanUtils.toBean(pageResult, MouldTypeRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出模具类型 Excel") - @PreAuthorize("@ss.hasPermission('heli:mould-type:export')") - @OperateLog(type = EXPORT) - public void exportMouldTypeExcel(@Valid MouldTypePageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = mouldTypeService.getMouldTypePage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "模具类型.xls", "数据", MouldTypeRespVO.class, - BeanUtils.toBean(list, MouldTypeRespVO.class)); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.mouldtype; + +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 com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; + +import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; + +import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; +import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; + +import com.chanko.yunxi.mes.module.heli.controller.admin.mouldtype.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.mouldtype.MouldTypeDO; +import com.chanko.yunxi.mes.module.heli.service.mouldtype.MouldTypeService; + +@Tag(name = "管理后台 - 模具类型") +@RestController +@RequestMapping("/heli/mould-type") +@Validated +public class MouldTypeController { + + @Resource + private MouldTypeService mouldTypeService; + + @PostMapping("/create") + @Operation(summary = "创建模具类型") + @PreAuthorize("@ss.hasPermission('heli:mould-type:create')") + public CommonResult createMouldType(@Valid @RequestBody MouldTypeSaveReqVO createReqVO) { + return success(mouldTypeService.createMouldType(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新模具类型") + @PreAuthorize("@ss.hasPermission('heli:mould-type:update')") + public CommonResult updateMouldType(@Valid @RequestBody MouldTypeSaveReqVO updateReqVO) { + mouldTypeService.updateMouldType(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除模具类型") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:mould-type:delete')") + public CommonResult deleteMouldType(@RequestParam("id") Long id) { + mouldTypeService.deleteMouldType(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得模具类型") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:mould-type:query')") + public CommonResult getMouldType(@RequestParam("id") Long id) { + MouldTypeDO mouldType = mouldTypeService.getMouldType(id); + return success(BeanUtils.toBean(mouldType, MouldTypeRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得模具类型分页") + @PreAuthorize("@ss.hasPermission('heli:mould-type:query')") + public CommonResult> getMouldTypePage(@Valid MouldTypePageReqVO pageReqVO) { + PageResult pageResult = mouldTypeService.getMouldTypePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, MouldTypeRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出模具类型 Excel") + @PreAuthorize("@ss.hasPermission('heli:mould-type:export')") + @OperateLog(type = EXPORT) + public void exportMouldTypeExcel(@Valid MouldTypePageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = mouldTypeService.getMouldTypePage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "模具类型.xls", "数据", MouldTypeRespVO.class, + BeanUtils.toBean(list, MouldTypeRespVO.class)); + } + + @GetMapping({"/all-simples"}) + @Operation(summary = "TODO:获取模块类型信息列表", description = "只包含被开启的模块类型,主要用于前端的下拉选项") + public CommonResult> > getSimpleList() { + List> list = mouldTypeService.getMouldTypeSimpleList(); + // 拼接数据 + return success(list); + } +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/equip/EquipDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/equip/EquipDO.java new file mode 100644 index 00000000..56200047 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/equip/EquipDO.java @@ -0,0 +1,43 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.equip; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 设备信息 DO + * + * @author 管理员 + */ +@TableName("base_equip") +@KeySequence("base_equip_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class EquipDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 设备名称 唯一 + */ + private String name; + /** + * 模具类型id,对应 base_mould_type 表中的id + */ + private Long mouldTypeId; + /** + * 状态,1表示正常,2表示禁用,默认是1 + */ + private Integer status; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/equip/EquipMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/equip/EquipMapper.java new file mode 100644 index 00000000..46e6c017 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/equip/EquipMapper.java @@ -0,0 +1,34 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.equip; + +import java.util.*; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.equip.vo.*; + +/** + * 设备信息 Mapper + * + * @author 管理员 + */ +@Mapper +public interface EquipMapper extends BaseMapperX { + + default PageResult selectPage(EquipPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(EquipDO::getId, reqVO.getId()) + .likeIfPresent(EquipDO::getName, reqVO.getName()) + .eqIfPresent(EquipDO::getMouldTypeId, reqVO.getMouldTypeId()) + .eqIfPresent(EquipDO::getStatus, reqVO.getStatus()) + .eqIfPresent(EquipDO::getCreator, reqVO.getCreator()) + .betweenIfPresent(EquipDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(EquipDO::getUpdater, reqVO.getUpdater()) + .betweenIfPresent(EquipDO::getUpdateTime, reqVO.getUpdateTime()) + .eqIfPresent(EquipDO::getDeleted, reqVO.getDeleted()) + .orderByDesc(EquipDO::getId)); + } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java index 49e5c813..6928b940 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java @@ -34,7 +34,7 @@ public interface MaterialMapper extends BaseMapperX { .like(!StringUtils.isEmpty(reqVO.getCode()), MaterialDO::getCode, reqVO.getCode()) .eq(!StringUtils.isEmpty(reqVO.getMaterialType()), MaterialDO::getMaterialType, reqVO.getMaterialType()) .eq(reqVO.getStatus() != null, MaterialDO::getStatus, reqVO.getStatus()) - .eq(true,MaterialDO::getVirtualPart, YesOrNoEnum.Y.name()) + .eq(true,MaterialDO::getVirtualPart, YesOrNoEnum.N.name()) .eq(!StringUtils.isEmpty(reqVO.getVirtualPart()), MaterialDO::getVirtualPart, reqVO.getVirtualPart()); return selectPage(reqVO, query); @@ -42,7 +42,7 @@ public interface MaterialMapper extends BaseMapperX { default List> selectSimpleList() { - return selectMaps(new QueryWrapper().select("id", "name","short_name","code","material_type","spec","unit","brand").eq("virtual_part", YesOrNoEnum.Y.name()).lambda()); + return selectMaps(new QueryWrapper().select("id", "name","short_name","code","material_type","spec","unit","brand").eq("virtual_part", YesOrNoEnum.N.name()).lambda()); } } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/mouldtype/MouldTypeMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/mouldtype/MouldTypeMapper.java index fc395427..fa8d597a 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/mouldtype/MouldTypeMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/mouldtype/MouldTypeMapper.java @@ -2,10 +2,12 @@ package com.chanko.yunxi.mes.module.heli.dal.mysql.mouldtype; import java.util.*; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; import com.chanko.yunxi.mes.module.heli.dal.dataobject.mouldtype.MouldTypeDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.pn.PnDO; import org.apache.ibatis.annotations.Mapper; import com.chanko.yunxi.mes.module.heli.controller.admin.mouldtype.vo.*; @@ -24,5 +26,9 @@ public interface MouldTypeMapper extends BaseMapperX { .betweenIfPresent(MouldTypeDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(MouldTypeDO::getId)); } + default List> selectSimpleList() { + return selectMaps(new QueryWrapper().select("id", "name","mould_type_id").lambda()); + + } } \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipService.java new file mode 100644 index 00000000..9247a3d0 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipService.java @@ -0,0 +1,55 @@ +package com.chanko.yunxi.mes.module.heli.service.equip; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.equip.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 设备信息 Service 接口 + * + * @author 管理员 + */ +public interface EquipService { + + /** + * 创建设备信息 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createEquip(@Valid EquipSaveReqVO createReqVO); + + /** + * 更新设备信息 + * + * @param updateReqVO 更新信息 + */ + void updateEquip(@Valid EquipSaveReqVO updateReqVO); + + /** + * 删除设备信息 + * + * @param id 编号 + */ + void deleteEquip(Long id); + + /** + * 获得设备信息 + * + * @param id 编号 + * @return 设备信息 + */ + EquipDO getEquip(Long id); + + /** + * 获得设备信息分页 + * + * @param pageReqVO 分页查询 + * @return 设备信息分页 + */ + PageResult getEquipPage(EquipPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipServiceImpl.java new file mode 100644 index 00000000..8eec3f8b --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipServiceImpl.java @@ -0,0 +1,74 @@ +package com.chanko.yunxi.mes.module.heli.service.equip; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.equip.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; + +import com.chanko.yunxi.mes.module.heli.dal.mysql.equip.EquipMapper; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; + +/** + * 设备信息 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class EquipServiceImpl implements EquipService { + + @Resource + private EquipMapper equipMapper; + + @Override + public Long createEquip(EquipSaveReqVO createReqVO) { + // 插入 + EquipDO equip = BeanUtils.toBean(createReqVO, EquipDO.class); + equipMapper.insert(equip); + // 返回 + return equip.getId(); + } + + @Override + public void updateEquip(EquipSaveReqVO updateReqVO) { + // 校验存在 + validateEquipExists(updateReqVO.getId()); + // 更新 + EquipDO updateObj = BeanUtils.toBean(updateReqVO, EquipDO.class); + equipMapper.updateById(updateObj); + } + + @Override + public void deleteEquip(Long id) { + // 校验存在 + validateEquipExists(id); + // 删除 + equipMapper.deleteById(id); + } + + private void validateEquipExists(Long id) { + if (equipMapper.selectById(id) == null) { + throw exception(EQUIP_NOT_EXISTS); + } + } + + @Override + public EquipDO getEquip(Long id) { + return equipMapper.selectById(id); + } + + @Override + public PageResult getEquipPage(EquipPageReqVO pageReqVO) { + return equipMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeService.java index b07354b0..892c3c55 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeService.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeService.java @@ -1,55 +1,57 @@ -package com.chanko.yunxi.mes.module.heli.service.mouldtype; - -import java.util.*; -import javax.validation.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.mouldtype.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.mouldtype.MouldTypeDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; - -/** - * 模具类型 Service 接口 - * - * @author 管理员 - */ -public interface MouldTypeService { - - /** - * 创建模具类型 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createMouldType(@Valid MouldTypeSaveReqVO createReqVO); - - /** - * 更新模具类型 - * - * @param updateReqVO 更新信息 - */ - void updateMouldType(@Valid MouldTypeSaveReqVO updateReqVO); - - /** - * 删除模具类型 - * - * @param id 编号 - */ - void deleteMouldType(Long id); - - /** - * 获得模具类型 - * - * @param id 编号 - * @return 模具类型 - */ - MouldTypeDO getMouldType(Long id); - - /** - * 获得模具类型分页 - * - * @param pageReqVO 分页查询 - * @return 模具类型分页 - */ - PageResult getMouldTypePage(MouldTypePageReqVO pageReqVO); - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.mouldtype; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.mouldtype.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.mouldtype.MouldTypeDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 模具类型 Service 接口 + * + * @author 管理员 + */ +public interface MouldTypeService { + + /** + * 创建模具类型 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createMouldType(@Valid MouldTypeSaveReqVO createReqVO); + + /** + * 更新模具类型 + * + * @param updateReqVO 更新信息 + */ + void updateMouldType(@Valid MouldTypeSaveReqVO updateReqVO); + + /** + * 删除模具类型 + * + * @param id 编号 + */ + void deleteMouldType(Long id); + + /** + * 获得模具类型 + * + * @param id 编号 + * @return 模具类型 + */ + MouldTypeDO getMouldType(Long id); + + /** + * 获得模具类型分页 + * + * @param pageReqVO 分页查询 + * @return 模具类型分页 + */ + PageResult getMouldTypePage(MouldTypePageReqVO pageReqVO); + + List> getMouldTypeSimpleList(); + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeServiceImpl.java index 89514cdf..d561d29a 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeServiceImpl.java @@ -1,74 +1,78 @@ -package com.chanko.yunxi.mes.module.heli.service.mouldtype; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.mouldtype.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.mouldtype.MouldTypeDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; - -import com.chanko.yunxi.mes.module.heli.dal.mysql.mouldtype.MouldTypeMapper; - -import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; - -/** - * 模具类型 Service 实现类 - * - * @author 管理员 - */ -@Service -@Validated -public class MouldTypeServiceImpl implements MouldTypeService { - - @Resource - private MouldTypeMapper mouldTypeMapper; - - @Override - public Long createMouldType(MouldTypeSaveReqVO createReqVO) { - // 插入 - MouldTypeDO mouldType = BeanUtils.toBean(createReqVO, MouldTypeDO.class); - mouldTypeMapper.insert(mouldType); - // 返回 - return mouldType.getId(); - } - - @Override - public void updateMouldType(MouldTypeSaveReqVO updateReqVO) { - // 校验存在 - validateMouldTypeExists(updateReqVO.getId()); - // 更新 - MouldTypeDO updateObj = BeanUtils.toBean(updateReqVO, MouldTypeDO.class); - mouldTypeMapper.updateById(updateObj); - } - - @Override - public void deleteMouldType(Long id) { - // 校验存在 - validateMouldTypeExists(id); - // 删除 - mouldTypeMapper.deleteById(id); - } - - private void validateMouldTypeExists(Long id) { - if (mouldTypeMapper.selectById(id) == null) { - throw exception(MOULD_TYPE_NOT_EXISTS); - } - } - - @Override - public MouldTypeDO getMouldType(Long id) { - return mouldTypeMapper.selectById(id); - } - - @Override - public PageResult getMouldTypePage(MouldTypePageReqVO pageReqVO) { - return mouldTypeMapper.selectPage(pageReqVO); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.mouldtype; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.mouldtype.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.mouldtype.MouldTypeDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; + +import com.chanko.yunxi.mes.module.heli.dal.mysql.mouldtype.MouldTypeMapper; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; + +/** + * 模具类型 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class MouldTypeServiceImpl implements MouldTypeService { + + @Resource + private MouldTypeMapper mouldTypeMapper; + + @Override + public Long createMouldType(MouldTypeSaveReqVO createReqVO) { + // 插入 + MouldTypeDO mouldType = BeanUtils.toBean(createReqVO, MouldTypeDO.class); + mouldTypeMapper.insert(mouldType); + // 返回 + return mouldType.getId(); + } + + @Override + public void updateMouldType(MouldTypeSaveReqVO updateReqVO) { + // 校验存在 + validateMouldTypeExists(updateReqVO.getId()); + // 更新 + MouldTypeDO updateObj = BeanUtils.toBean(updateReqVO, MouldTypeDO.class); + mouldTypeMapper.updateById(updateObj); + } + + @Override + public void deleteMouldType(Long id) { + // 校验存在 + validateMouldTypeExists(id); + // 删除 + mouldTypeMapper.deleteById(id); + } + + private void validateMouldTypeExists(Long id) { + if (mouldTypeMapper.selectById(id) == null) { + throw exception(MOULD_TYPE_NOT_EXISTS); + } + } + + @Override + public MouldTypeDO getMouldType(Long id) { + return mouldTypeMapper.selectById(id); + } + + @Override + public PageResult getMouldTypePage(MouldTypePageReqVO pageReqVO) { + return mouldTypeMapper.selectPage(pageReqVO); + } + + @Override + public List> getMouldTypeSimpleList(){ + return mouldTypeMapper.selectSimpleList(); + } +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/equip/EquipMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/equip/EquipMapper.xml new file mode 100644 index 00000000..6a50e306 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/equip/EquipMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/equip/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/equip/index.ts new file mode 100644 index 00000000..cd96b3ae --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/equip/index.ts @@ -0,0 +1,38 @@ +import request from '@/config/axios' + +export interface EquipVO { + id: number + name: string + mouldTypeId: number + status: number +} + +// 查询设备信息分页 +export const getEquipPage = async (params) => { + return await request.get({ url: `/heli/equip/page`, params }) +} + +// 查询设备信息详情 +export const getEquip = async (id: number) => { + return await request.get({ url: `/heli/equip/get?id=` + id }) +} + +// 新增设备信息 +export const createEquip = async (data: EquipVO) => { + return await request.post({ url: `/heli/equip/create`, data }) +} + +// 修改设备信息 +export const updateEquip = async (data: EquipVO) => { + return await request.put({ url: `/heli/equip/update`, data }) +} + +// 删除设备信息 +export const deleteEquip = async (id: number) => { + return await request.delete({ url: `/heli/equip/delete?id=` + id }) +} + +// 导出设备信息 Excel +export const exportEquip = async (params) => { + return await request.download({ url: `/heli/equip/export-excel`, params }) +} \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/equip/EquipForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/equip/EquipForm.vue new file mode 100644 index 00000000..a841becb --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/equip/EquipForm.vue @@ -0,0 +1,102 @@ + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/equip/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/equip/index.vue new file mode 100644 index 00000000..01b70468 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/equip/index.vue @@ -0,0 +1,264 @@ + + + \ No newline at end of file