parent
8c5bbfd398
commit
5963701d23
@ -0,0 +1,95 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.composition;
|
||||
|
||||
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.composition.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.composition.CompositionDO;
|
||||
import com.chanko.yunxi.mes.module.heli.service.composition.CompositionService;
|
||||
|
||||
@Tag(name = "管理后台 - 材质")
|
||||
@RestController
|
||||
@RequestMapping("/heli/composition")
|
||||
@Validated
|
||||
public class CompositionController {
|
||||
|
||||
@Resource
|
||||
private CompositionService compositionService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建材质")
|
||||
@PreAuthorize("@ss.hasPermission('heli:composition:create')")
|
||||
public CommonResult<Long> createComposition(@Valid @RequestBody CompositionSaveReqVO createReqVO) {
|
||||
return success(compositionService.createComposition(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新材质")
|
||||
@PreAuthorize("@ss.hasPermission('heli:composition:update')")
|
||||
public CommonResult<Boolean> updateComposition(@Valid @RequestBody CompositionSaveReqVO updateReqVO) {
|
||||
compositionService.updateComposition(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除材质")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('heli:composition:delete')")
|
||||
public CommonResult<Boolean> deleteComposition(@RequestParam("id") Long id) {
|
||||
compositionService.deleteComposition(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得材质")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('heli:composition:query')")
|
||||
public CommonResult<CompositionRespVO> getComposition(@RequestParam("id") Long id) {
|
||||
CompositionDO composition = compositionService.getComposition(id);
|
||||
return success(BeanUtils.toBean(composition, CompositionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得材质分页")
|
||||
@PreAuthorize("@ss.hasPermission('heli:composition:query')")
|
||||
public CommonResult<PageResult<CompositionRespVO>> getCompositionPage(@Valid CompositionPageReqVO pageReqVO) {
|
||||
PageResult<CompositionDO> pageResult = compositionService.getCompositionPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CompositionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出材质 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('heli:composition:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportCompositionExcel(@Valid CompositionPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<CompositionDO> list = compositionService.getCompositionPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "材质.xls", "数据", CompositionRespVO.class,
|
||||
BeanUtils.toBean(list, CompositionRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.material;
|
||||
|
||||
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.material.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
|
||||
import com.chanko.yunxi.mes.module.heli.service.material.MaterialService;
|
||||
|
||||
@Tag(name = "管理后台 - 物料")
|
||||
@RestController
|
||||
@RequestMapping("/heli/material")
|
||||
@Validated
|
||||
public class MaterialController {
|
||||
|
||||
@Resource
|
||||
private MaterialService materialService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建物料")
|
||||
@PreAuthorize("@ss.hasPermission('heli:material:create')")
|
||||
public CommonResult<Long> createMaterial(@Valid @RequestBody MaterialSaveReqVO createReqVO) {
|
||||
return success(materialService.createMaterial(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新物料")
|
||||
@PreAuthorize("@ss.hasPermission('heli:material:update')")
|
||||
public CommonResult<Boolean> updateMaterial(@Valid @RequestBody MaterialSaveReqVO updateReqVO) {
|
||||
materialService.updateMaterial(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除物料")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('heli:material:delete')")
|
||||
public CommonResult<Boolean> deleteMaterial(@RequestParam("id") Long id) {
|
||||
materialService.deleteMaterial(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得物料")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('heli:material:query')")
|
||||
public CommonResult<MaterialRespVO> getMaterial(@RequestParam("id") Long id) {
|
||||
MaterialDO material = materialService.getMaterial(id);
|
||||
return success(BeanUtils.toBean(material, MaterialRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得物料分页")
|
||||
@PreAuthorize("@ss.hasPermission('heli:material:query')")
|
||||
public CommonResult<PageResult<MaterialRespVO>> getMaterialPage(@Valid MaterialPageReqVO pageReqVO) {
|
||||
PageResult<MaterialDO> pageResult = materialService.getMaterialPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, MaterialRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出物料 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('heli:material:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportMaterialExcel(@Valid MaterialPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<MaterialDO> list = materialService.getMaterialPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "物料.xls", "数据", MaterialRespVO.class,
|
||||
BeanUtils.toBean(list, MaterialRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.mysql.composition;
|
||||
|
||||
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.composition.CompositionDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.composition.vo.*;
|
||||
|
||||
/**
|
||||
* 材质 Mapper
|
||||
*
|
||||
* @author 开发者
|
||||
*/
|
||||
@Mapper
|
||||
public interface CompositionMapper extends BaseMapperX<CompositionDO> {
|
||||
|
||||
default PageResult<CompositionDO> selectPage(CompositionPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CompositionDO>()
|
||||
.likeIfPresent(CompositionDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CompositionDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(CompositionDO::getType, reqVO.getType())
|
||||
.eqIfPresent(CompositionDO::getDensity, reqVO.getDensity())
|
||||
.eqIfPresent(CompositionDO::getDensityUnit, reqVO.getDensityUnit())
|
||||
.eqIfPresent(CompositionDO::getDescription, reqVO.getDescription())
|
||||
.eqIfPresent(CompositionDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(CompositionDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(CompositionDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.mysql.material;
|
||||
|
||||
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.material.MaterialDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.material.vo.*;
|
||||
|
||||
/**
|
||||
* 物料 Mapper
|
||||
*
|
||||
* @author 开发者
|
||||
*/
|
||||
@Mapper
|
||||
public interface MaterialMapper extends BaseMapperX<MaterialDO> {
|
||||
|
||||
default PageResult<MaterialDO> selectPage(MaterialPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialDO>()
|
||||
.eqIfPresent(MaterialDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(MaterialDO::getName, reqVO.getName())
|
||||
.eqIfPresent(MaterialDO::getBrand, reqVO.getBrand())
|
||||
.eqIfPresent(MaterialDO::getSpec, reqVO.getSpec())
|
||||
.eqIfPresent(MaterialDO::getMaterialType, reqVO.getMaterialType())
|
||||
.eqIfPresent(MaterialDO::getUnit, reqVO.getUnit())
|
||||
.eqIfPresent(MaterialDO::getSizeInfo, reqVO.getSizeInfo())
|
||||
.eqIfPresent(MaterialDO::getCompositionId, reqVO.getCompositionId())
|
||||
.eqIfPresent(MaterialDO::getInvUpperLimit, reqVO.getInvUpperLimit())
|
||||
.eqIfPresent(MaterialDO::getInvLowerLimit, reqVO.getInvLowerLimit())
|
||||
.eqIfPresent(MaterialDO::getTraceType, reqVO.getTraceType())
|
||||
.eqIfPresent(MaterialDO::getVirsualPart, reqVO.getVirsualPart())
|
||||
.eqIfPresent(MaterialDO::getMainFrom, reqVO.getMainFrom())
|
||||
.eqIfPresent(MaterialDO::getDftStoreWh, reqVO.getDftStoreWh())
|
||||
.eqIfPresent(MaterialDO::getDftStoreRg, reqVO.getDftStoreRg())
|
||||
.eqIfPresent(MaterialDO::getDftStorePn, reqVO.getDftStorePn())
|
||||
.eqIfPresent(MaterialDO::getDftRoute, reqVO.getDftRoute())
|
||||
.eqIfPresent(MaterialDO::getDftPack, reqVO.getDftPack())
|
||||
.eqIfPresent(MaterialDO::getDescription, reqVO.getDescription())
|
||||
.betweenIfPresent(MaterialDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(MaterialDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(MaterialDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.composition;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.composition.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.composition.CompositionDO;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 材质 Service 接口
|
||||
*
|
||||
* @author 开发者
|
||||
*/
|
||||
public interface CompositionService {
|
||||
|
||||
/**
|
||||
* 创建材质
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createComposition(@Valid CompositionSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新材质
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateComposition(@Valid CompositionSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除材质
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteComposition(Long id);
|
||||
|
||||
/**
|
||||
* 获得材质
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 材质
|
||||
*/
|
||||
CompositionDO getComposition(Long id);
|
||||
|
||||
/**
|
||||
* 获得材质分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 材质分页
|
||||
*/
|
||||
PageResult<CompositionDO> getCompositionPage(CompositionPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.composition;
|
||||
|
||||
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.composition.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.composition.CompositionDO;
|
||||
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.composition.CompositionMapper;
|
||||
|
||||
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 CompositionServiceImpl implements CompositionService {
|
||||
|
||||
@Resource
|
||||
private CompositionMapper compositionMapper;
|
||||
|
||||
@Override
|
||||
public Long createComposition(CompositionSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
CompositionDO composition = BeanUtils.toBean(createReqVO, CompositionDO.class);
|
||||
compositionMapper.insert(composition);
|
||||
// 返回
|
||||
return composition.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateComposition(CompositionSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateCompositionExists(updateReqVO.getId());
|
||||
// 更新
|
||||
CompositionDO updateObj = BeanUtils.toBean(updateReqVO, CompositionDO.class);
|
||||
compositionMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteComposition(Long id) {
|
||||
// 校验存在
|
||||
validateCompositionExists(id);
|
||||
// 删除
|
||||
compositionMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateCompositionExists(Long id) {
|
||||
if (compositionMapper.selectById(id) == null) {
|
||||
throw exception(COMPOSITION_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompositionDO getComposition(Long id) {
|
||||
return compositionMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CompositionDO> getCompositionPage(CompositionPageReqVO pageReqVO) {
|
||||
return compositionMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.material;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.material.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 物料 Service 接口
|
||||
*
|
||||
* @author 开发者
|
||||
*/
|
||||
public interface MaterialService {
|
||||
|
||||
/**
|
||||
* 创建物料
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createMaterial(@Valid MaterialSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新物料
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateMaterial(@Valid MaterialSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除物料
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteMaterial(Long id);
|
||||
|
||||
/**
|
||||
* 获得物料
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 物料
|
||||
*/
|
||||
MaterialDO getMaterial(Long id);
|
||||
|
||||
/**
|
||||
* 获得物料分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 物料分页
|
||||
*/
|
||||
PageResult<MaterialDO> getMaterialPage(MaterialPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.material;
|
||||
|
||||
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.material.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
|
||||
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.material.MaterialMapper;
|
||||
|
||||
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 MaterialServiceImpl implements MaterialService {
|
||||
|
||||
@Resource
|
||||
private MaterialMapper materialMapper;
|
||||
|
||||
@Override
|
||||
public Long createMaterial(MaterialSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
MaterialDO material = BeanUtils.toBean(createReqVO, MaterialDO.class);
|
||||
materialMapper.insert(material);
|
||||
// 返回
|
||||
return material.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMaterial(MaterialSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateMaterialExists(updateReqVO.getId());
|
||||
// 更新
|
||||
MaterialDO updateObj = BeanUtils.toBean(updateReqVO, MaterialDO.class);
|
||||
materialMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMaterial(Long id) {
|
||||
// 校验存在
|
||||
validateMaterialExists(id);
|
||||
// 删除
|
||||
materialMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateMaterialExists(Long id) {
|
||||
if (materialMapper.selectById(id) == null) {
|
||||
throw exception(MATERIAL_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialDO getMaterial(Long id) {
|
||||
return materialMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MaterialDO> getMaterialPage(MaterialPageReqVO pageReqVO) {
|
||||
return materialMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface CompositionVO {
|
||||
id: number
|
||||
name: string
|
||||
code: string
|
||||
type: string
|
||||
density: number
|
||||
densityUnit: string
|
||||
description: string
|
||||
status: number
|
||||
}
|
||||
|
||||
// 查询材质分页
|
||||
export const getCompositionPage = async (params) => {
|
||||
return await request.get({ url: `/heli/composition/page`, params })
|
||||
}
|
||||
|
||||
// 查询材质详情
|
||||
export const getComposition = async (id: number) => {
|
||||
return await request.get({ url: `/heli/composition/get?id=` + id })
|
||||
}
|
||||
|
||||
// 新增材质
|
||||
export const createComposition = async (data: CompositionVO) => {
|
||||
return await request.post({ url: `/heli/composition/create`, data })
|
||||
}
|
||||
|
||||
// 修改材质
|
||||
export const updateComposition = async (data: CompositionVO) => {
|
||||
return await request.put({ url: `/heli/composition/update`, data })
|
||||
}
|
||||
|
||||
// 删除材质
|
||||
export const deleteComposition = async (id: number) => {
|
||||
return await request.delete({ url: `/heli/composition/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 导出材质 Excel
|
||||
export const exportComposition = async (params) => {
|
||||
return await request.download({ url: `/heli/composition/export-excel`, params })
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface MaterialVO {
|
||||
id: number
|
||||
code: string
|
||||
name: string
|
||||
brand: string
|
||||
spec: string
|
||||
materialType: string
|
||||
unit: string
|
||||
sizeInfo: string
|
||||
compositionId: number
|
||||
invUpperLimit: number
|
||||
invLowerLimit: number
|
||||
traceType: number
|
||||
virsualPart: string
|
||||
mainFrom: number
|
||||
dftStoreWh: number
|
||||
dftStoreRg: number
|
||||
dftStorePn: number
|
||||
dftRoute: number
|
||||
dftPack: number
|
||||
description: string
|
||||
status: number
|
||||
}
|
||||
|
||||
// 查询物料分页
|
||||
export const getMaterialPage = async (params) => {
|
||||
return await request.get({ url: `/heli/material/page`, params })
|
||||
}
|
||||
|
||||
// 查询物料详情
|
||||
export const getMaterial = async (id: number) => {
|
||||
return await request.get({ url: `/heli/material/get?id=` + id })
|
||||
}
|
||||
|
||||
// 新增物料
|
||||
export const createMaterial = async (data: MaterialVO) => {
|
||||
return await request.post({ url: `/heli/material/create`, data })
|
||||
}
|
||||
|
||||
// 修改物料
|
||||
export const updateMaterial = async (data: MaterialVO) => {
|
||||
return await request.put({ url: `/heli/material/update`, data })
|
||||
}
|
||||
|
||||
// 删除物料
|
||||
export const deleteMaterial = async (id: number) => {
|
||||
return await request.delete({ url: `/heli/material/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 导出物料 Excel
|
||||
export const exportMaterial = async (params) => {
|
||||
return await request.download({ url: `/heli/material/export-excel`, params })
|
||||
}
|
Loading…
Reference in new issue