diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaMachine.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaMachine.java index 3a59e2e9..0e5b16dd 100644 --- a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaMachine.java +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaMachine.java @@ -47,6 +47,11 @@ public class MaMachine extends BaseEntity { */ @ApiModelProperty(value = "机具状态(数据字典)") private String maStatus; + /** + * 机具状态(数据字典) + */ + @ApiModelProperty(value = "机具状态(数据字典)名称") + private String maStatusName; /** * 二维码 */ @@ -354,4 +359,12 @@ public class MaMachine extends BaseEntity { public void setSpecificationType(String specificationType) { this.specificationType = specificationType; } + + public String getMaStatusName() { + return maStatusName; + } + + public void setMaStatusName(String maStatusName) { + this.maStatusName = maStatusName; + } } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaTypeController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaTypeController.java index e6420235..97452c15 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaTypeController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaTypeController.java @@ -53,6 +53,20 @@ public class MaTypeController extends BaseController { return AjaxResult.success(maTypeList); } + /** + * 根据左列表类型id查询右表格 + * @param typeId + * @return + */ + + @ApiOperation(value = "工器具类型") + @GetMapping("/equipmentType") + public AjaxResult equipmentType(@RequestParam(required = false) Long typeId, + @RequestParam(required = false) String typeName){ + List listByMaType = iTypeService.getEquipmentType(typeId,typeName); + return success(listByMaType); + } + /** * 获取规格层级为3的设备列表 * @return 结果 @@ -150,6 +164,19 @@ public class MaTypeController extends BaseController { */ @ApiOperation(value = "根据左列表类型id查询右表格") @GetMapping("/getListByMaType") + public AjaxResult getListByMaType(@RequestParam(required = false) Long typeId, + @RequestParam(required = false) String typeName){ + List listByMaType = iTypeService.getListByParentId(typeId,typeName); + return success(listByMaType); + } + +/* *//** + * 根据左列表类型id查询右表格 + * @param typeId + * @return + *//* + @ApiOperation(value = "根据左列表类型id查询右表格") + @GetMapping("/getListByMaType") public TableDataInfo getListByMaType(@RequestParam(required = false) Long typeId, @RequestParam(required = false) String typeName, @RequestParam(required = false) Integer pageSize, @@ -161,12 +188,12 @@ public class MaTypeController extends BaseController { TableDataInfo rspData = new TableDataInfo(); rspData.setTotal(listByMaType.size()); rspData.setCode(HttpStatus.SUCCESS); - listByMaType = listByMaType.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); +// listByMaType = listByMaType.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); rspData.setRows(listByMaType); rspData.setMsg("查询成功"); return rspData; - } + }*/ /** * 获取机具类型管理ma_type详细信息 @@ -206,8 +233,7 @@ public class MaTypeController extends BaseController { @ApiOperation(value = "删除机具类型管理ma_type") @Log(title = "机具类型管理ma_type", businessType = BusinessType.DELETE) @DeleteMapping("/{typeId}") - public AjaxResult remove(@PathVariable Long typeId) - { + public AjaxResult remove(@PathVariable Long typeId) throws Exception { return toAjax(iTypeService.deleteMaTypeByTypeId(typeId)); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/ITypeService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/ITypeService.java index 2e476f2b..70ac1638 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/ITypeService.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/ITypeService.java @@ -45,7 +45,7 @@ public interface ITypeService { * @param typeId 机具类型管理ma_type主键 * @return 结果 */ - public int deleteMaTypeByTypeId(Long typeId); + public int deleteMaTypeByTypeId(Long typeId) throws Exception; /** * 构建前端所需要树结构 diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaMachineServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaMachineServiceImpl.java index d1322b2d..b52d6306 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaMachineServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaMachineServiceImpl.java @@ -22,12 +22,7 @@ public class MaMachineServiceImpl implements MaMachineService { @Override public List getMaMachine(MaMachine maMachine) { - List maMachineList = maMachineMapper.getMaMachine(maMachine); - for (MaMachine machine : maMachineList) { - // 添加查询物品种类,设备类型,规格型号 - getType(machine); - } - return maMachineList; + return maMachineMapper.getMaMachine(maMachine); } /** diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java index 4ca3042d..143e7df7 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java @@ -48,23 +48,31 @@ public class MaTypeServiceImpl implements ITypeService { @Override @Transactional public int insertMaType(MaType maType) { + Long parentId = maType.getParentId(); + MaType maType1 = maTypeMapper.selectMaTypeByTypeId(parentId); + String level = maType1.getLevel(); + maType.setLevel(String.valueOf(Integer.parseInt(level) + 1)); maType.setCreateTime(DateUtils.getNowDate()); int i = maTypeMapper.insertType(maType); Long typeId = maType.getTypeId(); // 图片路径保存 - MaTypeFile typeFile = new MaTypeFile(); - typeFile.setTypeId(typeId); - typeFile.setFileName(maType.getPhotoName()); - typeFile.setFileUrl(maType.getPhotoUrl()); - typeFile.setFileType(""); - typeFileMapper.insertMaTypeFile(typeFile); + if (StringUtils.isNotEmpty(maType.getPhotoName()) && StringUtils.isNotEmpty(maType.getPhotoUrl())) { + MaTypeFile typeFile = new MaTypeFile(); + typeFile.setTypeId(typeId); + typeFile.setFileName(maType.getPhotoName()); + typeFile.setFileUrl(maType.getPhotoUrl()); + typeFile.setFileType(""); + typeFileMapper.insertMaTypeFile(typeFile); + } // 文档路径保存 - MaTypeFile typeFile1 = new MaTypeFile(); - typeFile1.setTypeId(typeId); - typeFile1.setFileName(maType.getDocumentName()); - typeFile1.setFileUrl(maType.getDocumentUrl()); - typeFile1.setFileType(""); - typeFileMapper.insertMaTypeFile(typeFile1); + if (StringUtils.isNotEmpty(maType.getDocumentName()) && StringUtils.isNotEmpty(maType.getDocumentUrl())) { + MaTypeFile typeFile1 = new MaTypeFile(); + typeFile1.setTypeId(typeId); + typeFile1.setFileName(maType.getDocumentName()); + typeFile1.setFileUrl(maType.getDocumentUrl()); + typeFile1.setFileType(""); + typeFileMapper.insertMaTypeFile(typeFile1); + } // 库管员配置 MaTypeKeeper typeKeeper = new MaTypeKeeper(); typeKeeper.setUserId(maType.getKeeperUserId()); @@ -145,7 +153,11 @@ public class MaTypeServiceImpl implements ITypeService { * @return 结果 */ @Override - public int deleteMaTypeByTypeId(Long typeId) { + public int deleteMaTypeByTypeId(Long typeId) throws Exception { + List listByParentId = maTypeMapper.getListByParentId(typeId, ""); + if (listByParentId.size() > 0) { + throw new Exception("子级类型不为空!!!"); + } return maTypeMapper.deleteTypeById(typeId); } diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineMapper.xml index 8372e64b..3d49ec35 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineMapper.xml @@ -37,11 +37,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -276,7 +215,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml index ab00fb8b..7933b2f8 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml @@ -289,9 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time, m.remark, m.company_id from ma_type m - - level != 4 and m.status = '0' - + where level != 4 and m.status = '0' and del_flag = '0' - and supplier = #{supplier} + and supplier like concat('%',#{supplier},'%') and address = #{address} and legal_person = #{legalPerson} and primary_contact = #{primaryContact}