设备信息 模板页面及接口信息导入

设备信息 模板页面及接口信息导入
pull/3/head
siontion 9 months ago
parent 6b82aa61d7
commit 6049fbbde9

@ -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, "车间不存在");

@ -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<Long> createEquip(@Valid @RequestBody EquipSaveReqVO createReqVO) {
return success(equipService.createEquip(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新设备信息")
@PreAuthorize("@ss.hasPermission('heli:equip:update')")
public CommonResult<Boolean> 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<Boolean> 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<EquipRespVO> 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<PageResult<EquipRespVO>> getEquipPage(@Valid EquipPageReqVO pageReqVO) {
PageResult<EquipDO> 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<EquipDO> list = equipService.getEquipPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "设备信息.xls", "数据", EquipRespVO.class,
BeanUtils.toBean(list, EquipRespVO.class));
}
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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<Long> createMouldType(@Valid @RequestBody MouldTypeSaveReqVO createReqVO) {
return success(mouldTypeService.createMouldType(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新模具类型")
@PreAuthorize("@ss.hasPermission('heli:mould-type:update')")
public CommonResult<Boolean> 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<Boolean> 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<MouldTypeRespVO> 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<PageResult<MouldTypeRespVO>> getMouldTypePage(@Valid MouldTypePageReqVO pageReqVO) {
PageResult<MouldTypeDO> 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<MouldTypeDO> list = mouldTypeService.getMouldTypePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "模具类型.xls", "数据", MouldTypeRespVO.class,
BeanUtils.toBean(list, MouldTypeRespVO.class));
}
}
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<Long> createMouldType(@Valid @RequestBody MouldTypeSaveReqVO createReqVO) {
return success(mouldTypeService.createMouldType(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新模具类型")
@PreAuthorize("@ss.hasPermission('heli:mould-type:update')")
public CommonResult<Boolean> 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<Boolean> 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<MouldTypeRespVO> 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<PageResult<MouldTypeRespVO>> getMouldTypePage(@Valid MouldTypePageReqVO pageReqVO) {
PageResult<MouldTypeDO> 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<MouldTypeDO> 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<List<Map<String, Object>> > getSimpleList() {
List<Map<String, Object>> list = mouldTypeService.getMouldTypeSimpleList();
// 拼接数据
return success(list);
}
}

@ -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;
/**
* ,121
*/
private Integer status;
}

@ -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<EquipDO> {
default PageResult<EquipDO> selectPage(EquipPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<EquipDO>()
.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));
}
}

@ -34,7 +34,7 @@ public interface MaterialMapper extends BaseMapperX<MaterialDO> {
.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<MaterialDO> {
default List<Map<String, Object>> selectSimpleList() {
return selectMaps(new QueryWrapper<MaterialDO>().select("id", "name","short_name","code","material_type","spec","unit","brand").eq("virtual_part", YesOrNoEnum.Y.name()).lambda());
return selectMaps(new QueryWrapper<MaterialDO>().select("id", "name","short_name","code","material_type","spec","unit","brand").eq("virtual_part", YesOrNoEnum.N.name()).lambda());
}
}

@ -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<MouldTypeDO> {
.betweenIfPresent(MouldTypeDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MouldTypeDO::getId));
}
default List<Map<String, Object>> selectSimpleList() {
return selectMaps(new QueryWrapper<MouldTypeDO>().select("id", "name","mould_type_id").lambda());
}
}

@ -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<EquipDO> getEquipPage(EquipPageReqVO pageReqVO);
}

@ -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<EquipDO> getEquipPage(EquipPageReqVO pageReqVO) {
return equipMapper.selectPage(pageReqVO);
}
}

@ -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<MouldTypeDO> getMouldTypePage(MouldTypePageReqVO pageReqVO);
}
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<MouldTypeDO> getMouldTypePage(MouldTypePageReqVO pageReqVO);
List<Map<String, Object>> getMouldTypeSimpleList();
}

@ -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<MouldTypeDO> getMouldTypePage(MouldTypePageReqVO pageReqVO) {
return mouldTypeMapper.selectPage(pageReqVO);
}
}
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<MouldTypeDO> getMouldTypePage(MouldTypePageReqVO pageReqVO) {
return mouldTypeMapper.selectPage(pageReqVO);
}
@Override
public List<Map<String, Object>> getMouldTypeSimpleList(){
return mouldTypeMapper.selectSimpleList();
}
}

@ -0,0 +1,12 @@
<?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.chanko.yunxi.mes.module.heli.dal.mysql.equip.EquipMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -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 })
}

@ -0,0 +1,102 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="设备名称 唯一" prop="name">
<el-input v-model="formData.name" placeholder="请输入设备名称 唯一" />
</el-form-item>
<el-form-item label="模具类型id对应 base_mould_type 表中的id" prop="mouldTypeId">
<el-input v-model="formData.mouldTypeId" placeholder="请输入模具类型id对应 base_mould_type 表中的id" />
</el-form-item>
<el-form-item label="状态,1表示正常2表示禁用默认是1" prop="status">
<el-radio-group v-model="formData.status">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import * as EquipApi from '@/api/heli/equip'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
name: undefined,
mouldTypeId: undefined,
status: undefined,
})
const formRules = reactive({
name: [{ required: true, message: '设备名称 唯一不能为空', trigger: 'blur' }],
mouldTypeId: [{ required: true, message: '模具类型id对应 base_mould_type 表中的id不能为空', trigger: 'blur' }],
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await EquipApi.getEquip(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as EquipApi.EquipVO
if (formType.value === 'create') {
await EquipApi.createEquip(data)
message.success(t('common.createSuccess'))
} else {
await EquipApi.updateEquip(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
name: undefined,
mouldTypeId: undefined,
status: undefined,
}
formRef.value?.resetFields()
}
</script>

@ -0,0 +1,264 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="自增字段,唯一" prop="id">
<el-input
v-model="queryParams.id"
placeholder="请输入自增字段,唯一"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="设备名称 唯一" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入设备名称 唯一"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="模具类型id对应 base_mould_type 表中的id" prop="mouldTypeId">
<el-input
v-model="queryParams.mouldTypeId"
placeholder="请输入模具类型id对应 base_mould_type 表中的id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="状态,1表示正常2表示禁用默认是1" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择状态,1表示正常2表示禁用默认是1"
clearable
class="!w-240px"
>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="创建者" prop="creator">
<el-input
v-model="queryParams.creator"
placeholder="请输入创建者"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="更新者" prop="updater">
<el-input
v-model="queryParams.updater"
placeholder="请输入更新者"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="更新时间" prop="updateTime">
<el-date-picker
v-model="queryParams.updateTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="是否删除" prop="deleted">
<el-select
v-model="queryParams.deleted"
placeholder="请选择是否删除"
clearable
class="!w-240px"
>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="租户编号" prop="tenantId">
<el-input
v-model="queryParams.tenantId"
placeholder="请输入租户编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['heli:equip:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['heli:equip:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="自增字段,唯一" align="center" prop="id" />
<el-table-column label="设备名称 唯一" align="center" prop="name" />
<el-table-column label="模具类型id对应 base_mould_type 表中的id" align="center" prop="mouldTypeId" />
<el-table-column label="状态,1表示正常2表示禁用默认是1" align="center" prop="status" />
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['heli:equip:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['heli:equip:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<EquipForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import * as EquipApi from '@/api/heli/equip'
import EquipForm from './EquipForm.vue'
defineOptions({ name: 'Equip' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
id: undefined,
name: undefined,
mouldTypeId: undefined,
status: undefined,
creator: undefined,
createTime: [],
updater: undefined,
updateTime: [],
deleted: undefined,
tenantId: undefined,
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await EquipApi.getEquipPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await EquipApi.deleteEquip(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await EquipApi.exportEquip(queryParams)
download.excel(data, '设备信息.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>
Loading…
Cancel
Save