From 5eedbacdb58d6a99d2d7d97412da22d6ed4f7af1 Mon Sep 17 00:00:00 2001 From: dingjie Date: Tue, 12 Dec 2023 16:58:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=9C=8D=E5=8A=A1=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/controller/MaHouseController.java | 11 +- .../base/controller/MaHouseSetController.java | 9 + .../controller/MaHouseShelController.java | 56 ---- .../base/controller/MaMachineController.java | 5 + .../base/controller/MaTypeController.java | 86 +++++- .../com/bonus/sgzb/base/domain/MaHouse.java | 24 ++ .../com/bonus/sgzb/base/domain/MaMachine.java | 38 +++ .../com/bonus/sgzb/base/domain/MaType.java | 202 ++++++++++-- .../bonus/sgzb/base/domain/MaTypeKeeper.java | 31 ++ .../bonus/sgzb/base/domain/MaTypeRepair.java | 79 +++++ .../bonus/sgzb/base/domain/vo/TreeSelect.java | 8 + .../bonus/sgzb/base/mapper/MaHouseMapper.java | 2 + .../sgzb/base/mapper/MaHouseSetMapper.java | 2 + .../sgzb/base/mapper/MaHouseShelMapper.java | 18 -- .../sgzb/base/mapper/MaTypeFileMapper.java | 62 ++++ .../bonus/sgzb/base/mapper/MaTypeMapper.java | 52 +++- .../bonus/sgzb/base/service/ITypeService.java | 54 +++- .../sgzb/base/service/IhouseService.java | 8 + .../sgzb/base/service/MaHouseSetService.java | 2 + .../sgzb/base/service/MaHouseShelService.java | 18 -- .../base/service/impl/MaHouseServiceImpl.java | 14 + .../base/service/impl/MaHouseSetImpl.java | 12 + .../service/impl/MaHouseShelServiceImpl.java | 46 --- .../service/impl/MaMachineServiceImpl.java | 33 +- .../base/service/impl/MaTypeServiceImpl.java | 288 +++++++++++++++--- .../resources/mapper/base/MaHouseMapper.xml | 17 +- .../mapper/base/MaHouseSetMapper.xml | 5 + .../mapper/base/MaHouseShelMapper.xml | 36 --- .../mapper/base/MaMachineTypeMapper.xml | 255 +++++++++++++--- .../mapper/base/MaTypeFileMapper.xml | 92 ++++++ 30 files changed, 1266 insertions(+), 299 deletions(-) delete mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseShelController.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaTypeRepair.java delete mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseShelMapper.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeFileMapper.java delete mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/MaHouseShelService.java delete mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseShelServiceImpl.java delete mode 100644 sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseShelMapper.xml create mode 100644 sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaTypeFileMapper.xml diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseController.java index cc84fbad..95f3f0d1 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseController.java @@ -42,12 +42,21 @@ public class MaHouseController extends BaseController { * @return */ @ApiOperation(value = "查询仓库组织树列表") - @GetMapping("/houseTree") + @GetMapping("/tree") public AjaxResult tree(MaHouse house) { return success(houseService.getHouseTree(house)); } + /** + * 获取仓库管理ma_house_info详细信息 + */ + @GetMapping(value = "/{houseId}") + public AjaxResult getInfo(@PathVariable("houseId") Long houseId) + { + return success(houseService.selectMaHouseByHouseId(houseId)); + } + /** * 新增仓库货架 */ diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseSetController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseSetController.java index a56c7c94..18454adf 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseSetController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseSetController.java @@ -39,6 +39,15 @@ public class MaHouseSetController extends BaseController { return getDataTable(list); } + /** + * 获取仓库货架配置详细信息 + */ + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(maHouseSetService.selectMaHouseSetByHouseId(id)); + } + /** * 新增仓库货架配置 */ diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseShelController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseShelController.java deleted file mode 100644 index 69913c45..00000000 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaHouseShelController.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.bonus.sgzb.base.controller; - -import com.bonus.sgzb.base.domain.MaHouseShel; -import com.bonus.sgzb.base.service.MaHouseShelService; -import com.bonus.sgzb.common.core.web.controller.BaseController; -import com.bonus.sgzb.common.core.web.domain.AjaxResult; -import com.bonus.sgzb.common.core.web.page.TableDataInfo; -import com.bonus.sgzb.common.security.utils.SecurityUtils; -import io.swagger.annotations.Api; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - - -/** -* MaHouseShelController -* @Author dingjie -* @Date 2023-12-07 -**/ -@Api("仓库货架管理Controller") -@RestController -@RequestMapping("/houseShel") -public class MaHouseShelController extends BaseController { - - @Autowired - private MaHouseShelService houseShelService; - - - /** - * 查询仓库货架列表 - * @param houseShel 货架信息 - * @return - */ - @GetMapping("/list") - public TableDataInfo list(MaHouseShel houseShel) - { - startPage(); - List list = houseShelService.selectHouseShelList(houseShel); - return getDataTable(list); - } - - /** - * 新增仓库货架 - */ - @PostMapping - public AjaxResult add(@Validated @RequestBody MaHouseShel houseShel){ -// if (!houseShelService.checkHouseNameUnique(houseShel)) { -// return error("新增仓库货架名称'" + houseShel.getShelveName() + "'失败,仓库货架名称已存在"); -// } - houseShel.setCreateBy(SecurityUtils.getUsername()); - return toAjax(houseShelService.insertHouseShel(houseShel)); - } - -} \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaMachineController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaMachineController.java index 83991b62..4f59a101 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaMachineController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaMachineController.java @@ -5,6 +5,8 @@ import com.bonus.sgzb.base.service.MaMachineService; import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.page.TableDataInfo; +import com.bonus.sgzb.common.log.annotation.Log; +import com.bonus.sgzb.common.log.enums.BusinessType; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -39,6 +41,7 @@ public class MaMachineController extends BaseController { /** * 新增机具设备管理 */ + @Log(title = "新增机具设备管理", businessType = BusinessType.INSERT) @ApiOperation(value = "新增机具设备管理") @PostMapping public AjaxResult maMachineAdd(@Validated @RequestBody MaMachine maMachine) @@ -49,6 +52,7 @@ public class MaMachineController extends BaseController { /** * 删除机具设备管理 */ + @Log(title = "删除机具设备管理", businessType = BusinessType.DELETE) @ApiOperation(value = "删除机具设备管理") @DeleteMapping("/{maIds}") public AjaxResult remove(@PathVariable Long[] maIds) @@ -60,6 +64,7 @@ public class MaMachineController extends BaseController { /** * 修改机具设备管理 */ + @Log(title = "修改机具设备管理", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改机具设备管理") @PutMapping public AjaxResult edit(@Validated @RequestBody MaMachine maMachine) 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 844f6675..604f97db 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 @@ -1,33 +1,42 @@ package com.bonus.sgzb.base.controller; +import com.bonus.sgzb.base.domain.MaType; import com.bonus.sgzb.base.service.ITypeService; +import com.bonus.sgzb.common.core.constant.HttpStatus; import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.page.TableDataInfo; +import com.bonus.sgzb.common.log.annotation.Log; +import com.bonus.sgzb.common.log.enums.BusinessType; +import com.github.pagehelper.PageInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; /** * 工机具类型管理控制层 */ @RestController +@Api(value = "工机具类型管理控制层") @RequestMapping("/type") public class MaTypeController extends BaseController { - @Autowired private ITypeService iTypeService; + /** * 根据类型名称查询类型 - * @return + * @return 结果 */ + @ApiOperation(value = "根据类型名称查询类型") @GetMapping("/getMaTypeList") public AjaxResult getMaTypeList(String typeName){ - return AjaxResult.success(iTypeService.getMaTypeList(typeName)); } @@ -37,14 +46,67 @@ public class MaTypeController extends BaseController { * @param typeId * @return */ - @GetMapping("/getListByMaType/{typeId}/{typeName}") - public TableDataInfo getListByMaType(@PathVariable("typeId") Long typeId,@PathVariable("typeName") String typeName){ - + @ApiOperation(value = "根据左列表类型id查询右表格") + @GetMapping("/getListByMaType") + public TableDataInfo getListByMaType(@RequestParam(required = false) Long typeId, + @RequestParam(required = false) String typeName, + @RequestParam(required = false) Integer pageSize, + @RequestParam(required = false) Integer pageNum){ if(typeId==null){ return null; } - startPage(); - return getDataTable(iTypeService.getListByMaType(typeId,typeName)); + List listByMaType = iTypeService.getListByMaType(typeId, typeName); + 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()); + rspData.setRows(listByMaType); + rspData.setMsg("查询成功"); + + return rspData; + } + + /** + * 获取机具类型管理ma_type详细信息 + */ + @ApiOperation(value = "获取机具类型管理ma_type详细信息") + @GetMapping(value = "/{typeId}") + public AjaxResult getInfo(@PathVariable("typeId") Long typeId) + { + return success(iTypeService.selectMaTypeByTypeId(typeId)); + } + + /** + * 新增机具类型管理ma_type + */ + @ApiOperation(value = "新增机具类型管理ma_type") + @Log(title = "机具类型管理ma_type", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MaType maType) + { + return toAjax(iTypeService.insertMaType(maType)); + } + + /** + * 修改机具类型管理ma_type + */ + @ApiOperation(value = "修改机具类型管理ma_type") + @Log(title = "机具类型管理ma_type", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MaType maType) + { + return toAjax(iTypeService.updateMaType(maType)); + } + + /** + * 删除机具类型管理ma_type + */ + @ApiOperation(value = "删除机具类型管理ma_type") + @Log(title = "机具类型管理ma_type", businessType = BusinessType.DELETE) + @DeleteMapping("/{typeId}") + public AjaxResult remove(@PathVariable Long typeId) + { + return toAjax(iTypeService.deleteMaTypeByTypeId(typeId)); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaHouse.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaHouse.java index c37ef322..8a392e21 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaHouse.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaHouse.java @@ -60,6 +60,14 @@ public class MaHouse extends BaseEntity { @ApiModelProperty(value= "数据所属组织") private String companyId; + /** 联系人 */ + @ApiModelProperty(value= "联系人") + private String concat; + + /** 联系电话 */ + @ApiModelProperty(value= "联系电话") + private String phone; + /** 数据所属组织 */ @ApiModelProperty(value= "排序") private int sort; @@ -188,4 +196,20 @@ public class MaHouse extends BaseEntity { public void setChildren(List children) { this.children = children; } + + public String getConcat() { + return concat; + } + + public void setConcat(String concat) { + this.concat = concat; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaMachine.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaMachine.java index cea3e2f4..000c47a8 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaMachine.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaMachine.java @@ -17,6 +17,21 @@ public class MaMachine extends BaseEntity { */ @ApiModelProperty(value = "类型ID") private long typeId; + /** + * 物品种类 + */ + @ApiModelProperty(value = "物品种类") + private String itemType; + /** + * 设备类型 + */ + @ApiModelProperty(value = "设备类型") + private String deviceType; + /** + * 规格型号 + */ + @ApiModelProperty(value = "规格型号") + private String specificationType; /** * 机具编号 */ @@ -316,4 +331,27 @@ public class MaMachine extends BaseEntity { this.companyId = companyId; } + public String getItemType() { + return itemType; + } + + public void setItemType(String itemType) { + this.itemType = itemType; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getSpecificationType() { + return specificationType; + } + + public void setSpecificationType(String specificationType) { + this.specificationType = specificationType; + } } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaType.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaType.java index 5630dd60..cfccfc14 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaType.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaType.java @@ -2,8 +2,11 @@ package com.bonus.sgzb.base.domain; import com.bonus.sgzb.common.core.annotation.Excel; import com.bonus.sgzb.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; import java.util.Date; +import java.util.List; /** * 工机具类型管理实体类 @@ -13,93 +16,144 @@ public class MaType extends BaseEntity { private static final long serialVersionUID = 1L; /** 类型ID */ - @Excel(name = "类型ID") + @ApiModelProperty(value = "类型ID") private Long typeId; /** 类型名称 */ - @Excel(name = "类型名称") + @ApiModelProperty(value = "类型名称") private String typeName; /** 上级ID */ - @Excel(name = "上级ID") + @ApiModelProperty(value = "上级ID") private Long parentId; /** 帐号状态(0正常 1停用) */ - @Excel(name = "帐号状态(0正常 1停用)") + @ApiModelProperty(value = "帐号状态(0正常 1停用)") private String status; /** 实时库存 */ - @Excel(name = "实时库存") + @ApiModelProperty(value = "实时库存") private String num; /** 计量单位id */ - @Excel(name = "计量单位id") + @ApiModelProperty(value = "计量单位id") private String unitId; /** 管理方式 */ - @Excel(name = "管理方式") + @ApiModelProperty(value = "管理方式") private String manageType; /** 租赁单价 */ - @Excel(name = "租赁单价") + @ApiModelProperty(value = "租赁单价") private String leasePrice; /** 原价 */ - @Excel(name = "原价") + @ApiModelProperty(value = "原价") private String buyPrice; /** 丢失赔偿价 */ - @Excel(name = "丢失赔偿价") + @ApiModelProperty(value = "丢失赔偿价") private String payPrice; /** 层级 */ - @Excel(name = "层级") + @ApiModelProperty(value = "层级") private String level; /** 额定载荷 */ - @Excel(name = "额定载荷") + @ApiModelProperty(value = "额定载荷") private String ratedLoad; /** 试验载荷 */ - @Excel(name = "试验载荷") + @ApiModelProperty(value = "试验载荷") private String testLoad; /** 持荷时间 */ - @Excel(name = "持荷时间") + @ApiModelProperty(value = "持荷时间") private String holdingTime; /** 库存预警数量 */ - @Excel(name = "库存预警数量") + @ApiModelProperty(value = "库存预警数量") private String warnNum; + /** 库存预警数量 */ + @ApiModelProperty(value = "是否计划管理(0代表否 1代表是)") + private String isPlan; + + /** 库存预警数量 */ + @ApiModelProperty(value = "是否安措费机具(0代表否1代表是)") + private String isAncuo; + /** 删除标志(0代表存在 2代表删除) */ - @Excel(name = "删除标志(0代表存在 2代表删除)") + @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") private String delFlag; /** 创建者 */ - @Excel(name = "创建者") + @ApiModelProperty(value = "创建者") private String createBy; /** 创建时间 */ - @Excel(name = "创建时间") + @ApiModelProperty(value = "创建时间") private Date createTime; /** 更新者 */ - @Excel(name = "更新者") + @ApiModelProperty(value = "更新者") private String updateBy; /** 更新时间 */ - @Excel(name = "更新时间") + @ApiModelProperty(value = "更新时间") private Date updateTime; /** 备注 */ - @Excel(name = "备注") + @ApiModelProperty(value = "备注") private String remark; /** 数据所属组织 */ - @Excel(name = "数据所属组织") + @ApiModelProperty(value = "数据所属组织") private String companyId; + /** 图片名称 */ + @ApiModelProperty(value = "图片名称") + private String photoName; + + /** 图片路径 */ + @ApiModelProperty(value = "图片路径") + private String photoUrl; + + /** 文档名称 */ + @ApiModelProperty(value = "文档名称") + private String documentName; + + /** 文档路径 */ + @ApiModelProperty(value = "文档路径") + private String documentUrl; + + /** 库管员id */ + @ApiModelProperty(value = "库管员id") + private long keeperUserId; + + /** 库管员名称 */ + @ApiModelProperty(value = "库管员名称") + private String keeperUserName; + + /** 库管员id */ + @ApiModelProperty(value = "维修员id") + private long repairUserId; + + /** 维修员名称 */ + @ApiModelProperty(value = "维修员名称") + private String repairUserName; + + /** 资产属性id */ + @ApiModelProperty(value = "资产属性id") + private long propId; + + /** 资产属性名称 */ + @ApiModelProperty(value = "资产属性名称") + private String propName; + + private List children = new ArrayList<>(); + + public Long getTypeId() { return typeId; } @@ -285,4 +339,108 @@ public class MaType extends BaseEntity { public void setCompanyId(String companyId) { this.companyId = companyId; } + + public String getPhotoName() { + return photoName; + } + + public void setPhotoName(String photoName) { + this.photoName = photoName; + } + + public String getPhotoUrl() { + return photoUrl; + } + + public void setPhotoUrl(String photoUrl) { + this.photoUrl = photoUrl; + } + + public String getDocumentName() { + return documentName; + } + + public void setDocumentName(String documentName) { + this.documentName = documentName; + } + + public String getDocumentUrl() { + return documentUrl; + } + + public void setDocumentUrl(String documentUrl) { + this.documentUrl = documentUrl; + } + + public String getIsPlan() { + return isPlan; + } + + public void setIsPlan(String isPlan) { + this.isPlan = isPlan; + } + + public String getIsAncuo() { + return isAncuo; + } + + public void setIsAncuo(String isAncuo) { + this.isAncuo = isAncuo; + } + + public long getKeeperUserId() { + return keeperUserId; + } + + public void setKeeperUserId(long keeperUserId) { + this.keeperUserId = keeperUserId; + } + + public String getKeeperUserName() { + return keeperUserName; + } + + public void setKeeperUserName(String keeperUserName) { + this.keeperUserName = keeperUserName; + } + + public long getRepairUserId() { + return repairUserId; + } + + public void setRepairUserId(long repairUserId) { + this.repairUserId = repairUserId; + } + + public String getRepairUserName() { + return repairUserName; + } + + public void setRepairUserName(String repairUserName) { + this.repairUserName = repairUserName; + } + + public long getPropId() { + return propId; + } + + public void setPropId(long propId) { + this.propId = propId; + } + + public String getPropName() { + return propName; + } + + public void setPropName(String propName) { + this.propName = propName; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaTypeKeeper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaTypeKeeper.java index 695fdcb2..7c33cfca 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaTypeKeeper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaTypeKeeper.java @@ -30,5 +30,36 @@ public class MaTypeKeeper extends BaseEntity { @Excel(name = "数据所属组织") private String companyId; + public Long getTypeId() { + return typeId; + } + + public void setTypeId(Long typeId) { + this.typeId = typeId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaTypeRepair.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaTypeRepair.java new file mode 100644 index 00000000..c8919e05 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/MaTypeRepair.java @@ -0,0 +1,79 @@ +package com.bonus.sgzb.base.domain; + +import com.bonus.sgzb.common.core.annotation.Excel; +import com.bonus.sgzb.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 维修班机具配置ma_type_repair对象 ma_type_repair + * + * @author bonus + * @date 2023-12-11 + */ +public class MaTypeRepair extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 类型ID */ + private Long typeId; + + /** 用户 */ + @Excel(name = "用户") + private Long userId; + + /** 创建时间 */ + @Excel(name = "创建时间") + private String time; + + /** 数据所属组织 */ + @Excel(name = "数据所属组织") + private String companyId; + + public void setTypeId(Long typeId) + { + this.typeId = typeId; + } + + public Long getTypeId() + { + return typeId; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setTime(String time) + { + this.time = time; + } + + public String getTime() + { + return time; + } + public void setCompanyId(String companyId) + { + this.companyId = companyId; + } + + public String getCompanyId() + { + return companyId; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("typeId", getTypeId()) + .append("userId", getUserId()) + .append("time", getTime()) + .append("companyId", getCompanyId()) + .toString(); + } +} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/vo/TreeSelect.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/vo/TreeSelect.java index 7e3da8c5..eb7b46c0 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/vo/TreeSelect.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/domain/vo/TreeSelect.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.base.domain.vo; import com.bonus.sgzb.base.domain.MaHouse; +import com.bonus.sgzb.base.domain.MaType; import com.fasterxml.jackson.annotation.JsonInclude; import java.io.Serializable; @@ -38,6 +39,13 @@ public class TreeSelect implements Serializable this.children = maHouse.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); } + public TreeSelect(MaType maType) + { + this.id = maType.getTypeId(); + this.label = maType.getTypeName(); + this.children = maType.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } + public Long getId() { return id; diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseMapper.java index 9597e9d1..80cfc76d 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseMapper.java @@ -70,4 +70,6 @@ public interface MaHouseMapper { List selectHouse(); List selectHouseParent(@Param("parentId") long parentId); + + MaHouse selectMaHouseByHouseId(Long houseId); } \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseSetMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseSetMapper.java index 1801977f..d2def43f 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseSetMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseSetMapper.java @@ -12,4 +12,6 @@ public interface MaHouseSetMapper { public int deleteHouseSetById(Long id); public int updateHouseSet(MaHouseSet maHouseSet); + + MaHouseSet selectMaHouseSetByHouseId(Long id); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseShelMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseShelMapper.java deleted file mode 100644 index 8252b94d..00000000 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaHouseShelMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bonus.sgzb.base.mapper; - -import com.bonus.sgzb.base.domain.MaHouseShel; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** -* MaHouseShelMapper -* @Author dingjie -* @Date 2023-12-07 -**/ -@Mapper -public interface MaHouseShelMapper{ - - List selectHouseShelList(MaHouseShel houseShel); - -} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeFileMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeFileMapper.java new file mode 100644 index 00000000..0ffce978 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeFileMapper.java @@ -0,0 +1,62 @@ +package com.bonus.sgzb.base.mapper; + +import com.bonus.sgzb.base.domain.MaTypeFile; + +import java.util.List; + +/** + * 机具类型文件ma_type_fileMapper接口 + * + * @author bonus + * @date 2023-12-11 + */ +public interface MaTypeFileMapper +{ + /** + * 查询机具类型文件ma_type_file + * + * @param typeId 机具类型文件ma_type_file主键 + * @return 机具类型文件ma_type_file + */ + public MaTypeFile selectMaTypeFileByTypeId(Long typeId); + + /** + * 查询机具类型文件ma_type_file列表 + * + * @param maTypeFile 机具类型文件ma_type_file + * @return 机具类型文件ma_type_file集合 + */ + public List selectMaTypeFileList(MaTypeFile maTypeFile); + + /** + * 新增机具类型文件ma_type_file + * + * @param maTypeFile 机具类型文件ma_type_file + * @return 结果 + */ + public int insertMaTypeFile(MaTypeFile maTypeFile); + + /** + * 修改机具类型文件ma_type_file + * + * @param maTypeFile 机具类型文件ma_type_file + * @return 结果 + */ + public int updateMaTypeFile(MaTypeFile maTypeFile); + + /** + * 删除机具类型文件ma_type_file + * + * @param typeId 机具类型文件ma_type_file主键 + * @return 结果 + */ + public int deleteMaTypeFileByTypeId(Long typeId); + + /** + * 批量删除机具类型文件ma_type_file + * + * @param typeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMaTypeFileByTypeIds(Long[] typeIds); +} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java index eebd3d2c..d7be9917 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/mapper/MaTypeMapper.java @@ -1,6 +1,9 @@ package com.bonus.sgzb.base.mapper; +import com.bonus.sgzb.base.domain.MaPropSet; import com.bonus.sgzb.base.domain.MaType; +import com.bonus.sgzb.base.domain.MaTypeKeeper; +import com.bonus.sgzb.base.domain.MaTypeRepair; import java.util.List; @@ -13,5 +16,52 @@ public interface MaTypeMapper { - List selectMaTypeList(); + List selectMaTypeList(String typeName); + + /** + * 查询机具类型管理ma_type + * + * @param typeId 机具类型管理ma_type主键 + * @return 机具类型管理ma_type + */ + public MaType selectMaTypeByTypeId(Long typeId); + + + /** + * 新增机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + public int insertType(MaType maType); + + /** + * 修改机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + public int updateType(MaType maType); + + /** + * 删除机具类型管理ma_type + * + * @param typeId 机具类型管理ma_type主键 + * @return 结果 + */ + public int deleteTypeById(Long typeId); + + int insertKeeper(MaTypeKeeper typeKeeper); + + int insertRepair(MaTypeRepair typeRepair); + + int insertMaPropSet(MaPropSet propSet); + + int updateKeeperByTypeId(MaTypeKeeper typeKeeper); + + int updateRepairByTypeId(MaTypeRepair typeRepair); + + int updatePropSetByTypeId(MaPropSet propSet); + + MaType selectTypeByTypeId(long typeId); } \ No newline at end of file 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 23c7e57a..ac62fff9 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 @@ -1,6 +1,8 @@ package com.bonus.sgzb.base.service; +import com.bonus.sgzb.base.domain.MaHouse; import com.bonus.sgzb.base.domain.MaType; +import com.bonus.sgzb.base.domain.vo.TreeSelect; import java.util.List; @@ -9,8 +11,58 @@ import java.util.List; */ public interface ITypeService { - List getMaTypeList(String typeName); + List getMaTypeList(String typeName); List getListByMaType(Long typeId,String typeName); + /** + * 查询机具类型管理ma_type + * + * @param typeId 机具类型管理ma_type主键 + * @return 机具类型管理ma_type + */ + public MaType selectMaTypeByTypeId(Long typeId); + + + /** + * 新增机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + public int insertMaType(MaType maType); + + /** + * 修改机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + public int updateMaType(MaType maType); + + /** + * 删除机具类型管理ma_type信息 + * + * @param typeId 机具类型管理ma_type主键 + * @return 结果 + */ + public int deleteMaTypeByTypeId(Long typeId); + + /** + * 构建前端所需要树结构 + * + * @param maTypeList 状态列表 + * @return 树结构列表 + */ + public List buildDeptTree(List maTypeList); + + + /** + * 构建前端所需要下拉树结构 + * + * @param maTypeList 工机具列表 + * @return 下拉树结构列表 + */ + public List buildDeptTreeSelect(List maTypeList); + } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/IhouseService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/IhouseService.java index f7dbd685..9c0970ec 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/IhouseService.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/IhouseService.java @@ -74,4 +74,12 @@ public interface IhouseService { * @return 树结构列表 */ public List buildDeptTree(List maHouseList); + + /** + * 查询仓库管理ma_house_info + * + * @param houseId 仓库管理ma_house_info主键 + * @return 仓库管理ma_house_info + */ + public MaHouse selectMaHouseByHouseId(Long houseId); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/MaHouseSetService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/MaHouseSetService.java index 078f2ed5..3535e647 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/MaHouseSetService.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/MaHouseSetService.java @@ -13,4 +13,6 @@ public interface MaHouseSetService { public int deleteHouseSetById(Long id); public int updateHouseSet(MaHouseSet maHouseSet); + + MaHouseSet selectMaHouseSetByHouseId(Long id); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/MaHouseShelService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/MaHouseShelService.java deleted file mode 100644 index cdf73179..00000000 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/MaHouseShelService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bonus.sgzb.base.service; - - -import com.bonus.sgzb.base.domain.MaHouseShel; - -import java.util.List; - -/** -* MaHouseShelService -* @Author dingjie -* @Date 2023-12-07 -**/ -public interface MaHouseShelService{ - List selectHouseShelList(MaHouseShel houseShel); - - int insertHouseShel(MaHouseShel houseShel); - -} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseServiceImpl.java index 779a4896..028f82bc 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseServiceImpl.java @@ -25,6 +25,20 @@ public class MaHouseServiceImpl implements IhouseService { @Resource private MaHouseMapper houseMapper; + + /** + * 查询仓库管理ma_house_info + * + * @param houseId 仓库管理ma_house_info主键 + * @return 仓库管理ma_house_info + */ + @Override + public MaHouse selectMaHouseByHouseId(Long houseId) + { + return houseMapper.selectMaHouseByHouseId(houseId); + } + + /** * 校验工程项目名称 * diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseSetImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseSetImpl.java index 5f096dcd..c550df1b 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseSetImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseSetImpl.java @@ -33,4 +33,16 @@ public class MaHouseSetImpl implements MaHouseSetService { public int updateHouseSet(MaHouseSet maHouseSet) { return maHouseSetMapper.updateHouseSet(maHouseSet); } + + /** + * 查询仓库货架配置ma_house_set + * + * @param id 仓库货架配置ma_house_set主键 + * @return 仓库货架配置ma_house_set + */ + @Override + public MaHouseSet selectMaHouseSetByHouseId(Long id) + { + return maHouseSetMapper.selectMaHouseSetByHouseId(id); + } } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseShelServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseShelServiceImpl.java deleted file mode 100644 index 30b5ec14..00000000 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/service/impl/MaHouseShelServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bonus.sgzb.base.service.impl; - -import com.bonus.sgzb.base.domain.MaHouseShel; -import com.bonus.sgzb.base.mapper.MaHouseShelMapper; -import com.bonus.sgzb.base.service.MaHouseShelService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.List; - - -/** -* MaHouseShelServiceImpl -* @Author dingjie -* @Date 2023-12-07 -**/ -@Service -@Transactional(rollbackFor = Exception.class) -public class MaHouseShelServiceImpl implements MaHouseShelService { - - @Resource - private MaHouseShelMapper houseShelMapper; - - /** - * 根据查询条件筛选仓库货架 - * @param houseShel 仓库货架信息 - * @return 结果 - */ - @Override - public List selectHouseShelList(MaHouseShel houseShel) { - List houseShelList = houseShelMapper.selectHouseShelList(houseShel); - - return null; - } - - /** - * 新增仓库货架 - * @param houseShel 仓库货架信息 - * @return 结果 - */ - @Override - public int insertHouseShel(MaHouseShel houseShel) { - return 0; - } -} \ No newline at end of file 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 a165b490..d11e4c37 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 @@ -1,23 +1,52 @@ package com.bonus.sgzb.base.service.impl; import com.bonus.sgzb.base.domain.MaMachine; +import com.bonus.sgzb.base.domain.MaType; import com.bonus.sgzb.base.mapper.MaMachineMapper; +import com.bonus.sgzb.base.mapper.MaTypeMapper; import com.bonus.sgzb.base.service.MaMachineService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.List; @Service public class MaMachineServiceImpl implements MaMachineService { - @Autowired + @Resource private MaMachineMapper maMachineMapper; + @Resource + private MaTypeMapper typeMapper; + @Override public List getMaMachine(MaMachine maMachine) { - return maMachineMapper.getMaMachine(maMachine); + List maMachineList = maMachineMapper.getMaMachine(maMachine); + for (MaMachine machine : maMachineList) { + // 添加查询物品种类,设备类型,规格型号 + getType(machine); + } + return maMachineList; + } + + /** + * 添加查询物品种类,设备类型,规格型号 + * @param machine + * @return + */ + private void getType(MaMachine machine) { + long typeId = machine.getTypeId(); + // 规格型号 + MaType maType = typeMapper.selectTypeByTypeId(typeId); + // 设备类型 + machine.setSpecificationType(maType.getTypeName()); + MaType maType1 = typeMapper.selectTypeByTypeId(maType.getParentId()); + // 物品种类 + machine.setDeviceType(maType1.getTypeName()); + MaType maType2 = typeMapper.selectTypeByTypeId(maType1.getParentId()); + machine.setItemType(maType2.getTypeName()); } @Override 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 51f33b4c..9584b841 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 @@ -1,15 +1,18 @@ package com.bonus.sgzb.base.service.impl; -import com.bonus.sgzb.base.domain.MaType; +import com.bonus.sgzb.base.domain.*; +import com.bonus.sgzb.base.domain.vo.TreeSelect; +import com.bonus.sgzb.base.mapper.MaTypeFileMapper; import com.bonus.sgzb.base.mapper.MaTypeMapper; import com.bonus.sgzb.base.service.ITypeService; +import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.common.core.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import javax.annotation.Resource; +import java.util.*; import java.util.stream.Collectors; /** @@ -18,69 +21,176 @@ import java.util.stream.Collectors; @Service public class MaTypeServiceImpl implements ITypeService { - @Autowired + @Resource private MaTypeMapper maTypeMapper; + @Resource + private MaTypeFileMapper typeFileMapper; + + /** + * 查询机具类型管理ma_type + * + * @param typeId 机具类型管理ma_type主键 + * @return 机具类型管理ma_type + */ @Override - public List getMaTypeList(String typeName) { + public MaType selectMaTypeByTypeId(Long typeId) { + return maTypeMapper.selectMaTypeByTypeId(typeId); + } - List maTypes = maTypeMapper.selectMaTypeList(); - if(StringUtils.isNotNull(typeName)){ - //根据类型名称过滤集合 - List types = maTypes - .stream() - .filter(maType -> maType.getTypeName().contains(typeName)) - .collect(Collectors.toList()); - //如果没有查询到那么返回空 - if(types.size()==0){ - return null; - } - //递归获取树 - return getTypeListByMaType(Collections.singletonList(types.get(0)),maTypes,null); + /** + * 新增机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + @Override + @Transactional + public int insertMaType(MaType maType) { + 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); + // 文档路径保存 + 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()); + typeKeeper.setTypeId(typeId); + maTypeMapper.insertKeeper(typeKeeper); + + // 维修员配置 + MaTypeRepair typeRepair = new MaTypeRepair(); + typeRepair.setUserId(maType.getRepairUserId()); + typeRepair.setTypeId(typeId); + maTypeMapper.insertRepair(typeRepair); + // 资产属性配置 + MaPropSet propSet = new MaPropSet(); + propSet.setTypeId(typeId); + propSet.setPropId(maType.getPropId()); + maTypeMapper.insertMaPropSet(propSet); + return i; + } + + /** + * 修改机具类型管理ma_type + * + * @param maType 机具类型管理ma_type + * @return 结果 + */ + @Override + public int updateMaType(MaType maType) { + Long typeId = maType.getTypeId(); + maType.setUpdateTime(DateUtils.getNowDate()); + int i = maTypeMapper.updateType(maType); + // 图片路径保存 + 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("1"); + typeFileMapper.updateMaTypeFile(typeFile); } - return maTypes; + // 文档路径保存 + 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("2"); + typeFileMapper.updateMaTypeFile(typeFile1); + } + // 库管员配置 + if (maType.getKeeperUserId() >= 0L) { + MaTypeKeeper typeKeeper = new MaTypeKeeper(); + typeKeeper.setUserId(maType.getKeeperUserId()); + typeKeeper.setTypeId(typeId); + maTypeMapper.updateKeeperByTypeId(typeKeeper); + } + + // 维修员配置 + if (maType.getRepairUserId() >= 0L) { + MaTypeRepair typeRepair = new MaTypeRepair(); + typeRepair.setUserId(maType.getRepairUserId()); + typeRepair.setTypeId(typeId); + maTypeMapper.updateRepairByTypeId(typeRepair); + } + // 资产属性配置 + if (maType.getPropId() >= 0L) { + MaPropSet propSet = new MaPropSet(); + propSet.setTypeId(typeId); + propSet.setPropId(maType.getPropId()); + maTypeMapper.updatePropSetByTypeId(propSet); + } + return i; + } + + /** + * 删除机具类型管理ma_type信息 + * + * @param typeId 机具类型管理ma_type主键 + * @return 结果 + */ + @Override + public int deleteMaTypeByTypeId(Long typeId) { + return maTypeMapper.deleteTypeById(typeId); + } + + @Override + public List getMaTypeList(String typeName) { + List maTypes = maTypeMapper.selectMaTypeList(typeName); + //如果没有查询到那么返回空 + return buildDeptTreeSelect(maTypes); } /** * 根据左列表类型id查询右表格 + * * @param typeId * @return */ @Override public List getListByMaType(Long typeId, String typeName) { - - List maTypes = maTypeMapper.selectMaTypeList(); + List maTypes = maTypeMapper.selectMaTypeList(""); MaType maType = new MaType(); maType.setTypeId(typeId); List typeListByMaType = getTypeListByMaType(Collections.singletonList(maType), maTypes, new ArrayList<>()); - if(StringUtils.isNotNull(typeName)){ + if (StringUtils.isNotNull(typeName)) { //根据类型名称过滤集合 List types = typeListByMaType .stream() .filter(ma -> ma.getTypeName().contains(typeName)) .collect(Collectors.toList()); //如果没有查询到那么返回空 - if(types.size()==0){ - return null; - } - //递归获取树 - return getTypeListByMaType(Collections.singletonList(types.get(0)),maTypes,null); + return types; } return typeListByMaType; } /** * 根据父级类型递归获取树结构 + * * @param * @return */ - private List getTypeListByMaType(List parentTypes,List oldMaTypes,List newMaTypes) { - + private List getTypeListByMaType(List parentTypes, List oldMaTypes, List newMaTypes) { //初始化新容器 - if(newMaTypes==null){ + if (newMaTypes == null) { newMaTypes = new ArrayList<>(); //添加父级对象 左边需要添加因为需要显示 右边不需要添加因为不需要显示 newMaTypes.addAll(parentTypes); @@ -88,21 +198,125 @@ public class MaTypeServiceImpl implements ITypeService { //递归父级容器 List parentList = new ArrayList<>(); //过滤相同数据,减少循环,性能优化 - oldMaTypes = oldMaTypes.stream().filter(oldMaType->!parentTypes.contains(oldMaType)).collect(Collectors.toList()); + oldMaTypes = oldMaTypes.stream().filter(oldMaType -> !parentTypes.contains(oldMaType)).collect(Collectors.toList()); for (MaType maType : oldMaTypes) { for (MaType parentType : parentTypes) { - if(maType.getParentId().equals(parentType.getTypeId())){ + if (maType.getParentId().equals(parentType.getTypeId())) { + newMaTypes.add(maType); parentList.add(maType); } } } //如果还有父级递归查询 - if(parentList.size()>0){ - return getTypeListByMaType(parentList,oldMaTypes,newMaTypes); - }else{ + if (parentList.size() > 0) { + return getTypeListByMaType(parentList, oldMaTypes, newMaTypes); + } else { + List result = new ArrayList<>(); + for (MaType type : newMaTypes) { + boolean a = true; + Long typeId1 = type.getTypeId(); + for (MaType type1 : newMaTypes) { + Long pid = type1.getParentId(); + if (typeId1.equals(pid)) { + a = false; + } + } + if (a) { + result.add(type); + } + } //返回 - return newMaTypes; + return result; } } + + + + /** + * 构建前端所需要树结构 + * + * @param maTypeList 部门列表 + * @return 树结构列表 + */ + @Override + public List buildDeptTree(List maTypeList) + { + List returnList = new ArrayList(); + List tempList = maTypeList.stream().map(MaType::getTypeId).collect(Collectors.toList()); + for (MaType maType : maTypeList) + { + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(maType.getParentId())) + { + recursionFn(maTypeList, maType); + returnList.add(maType); + } + } + if (returnList.isEmpty()) + { + returnList = maTypeList; + } + return returnList; + } + + /** + * 构建前端所需要下拉树结构 + * + * @param depts 部门列表 + * @return 下拉树结构列表 + */ + @Override + public List buildDeptTreeSelect(List depts) + { + List deptTrees = buildDeptTree(depts); + return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + + /** + * 递归列表 + */ + private void recursionFn(List list, MaType t) + { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (MaType tChild : childList) + { + if (hasChild(list, tChild)) + { + recursionFn(list, tChild); + } + } + } + + + + /** + * 得到子节点列表 + */ + private List getChildList(List list, MaType t) + { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) + { + MaType n = (MaType) it.next(); + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getTypeId().longValue()) + { + tlist.add(n); + } + } + return tlist; + } + + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, MaType t) + { + return getChildList(list, t).size() > 0 ? true : false; + } } diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseMapper.xml index 3c1070ca..3fd243ef 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseMapper.xml @@ -18,10 +18,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, remark, company_id, sort + select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, remark, company_id,phone ,concat from ma_house_info @@ -36,6 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark, create_by, company_id, + concat, + phone, create_time )values( #{houseId}, @@ -47,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{remark}, #{createBy}, #{companyId}, + #{concat}, + #{phone}, sysdate() ) @@ -62,6 +68,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark = #{remark}, update_by = #{updateBy}, company_id = #{companyId}, + concat = #{concat}, + phone = #{phone}, update_time = sysdate() where house_id = #{houseId} @@ -73,7 +81,7 @@ 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/MaHouseSetMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseSetMapper.xml index 317e28ee..80123534 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseSetMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseSetMapper.xml @@ -26,6 +26,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from ma_house_set + + insert into ma_house_set( house_id, diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseShelMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseShelMapper.xml deleted file mode 100644 index 92b329fd..00000000 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaHouseShelMapper.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - shelve_id, shelve_name, parent_id, contact, sort, contact_phone, remark, status, del_flag, create_by, create_time, update_by, update_time, company_id - - - - 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 840bcf4d..fd069e7f 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 @@ -3,6 +3,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + + + + + + + + + + + + + + + + + + + + + + + + + select type_id, type_name, parent_id, status, num, unit_id, manage_type, lease_price, buy_price, pay_price, level, rated_load, test_load, holding_time, warn_num, del_flag, create_by, create_time, remark, company_id @@ -10,37 +36,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into ma_type( - type_id, - type_name, - parent_id, - status, - num, - unit_id, - manage_type, - lease_price, - buy_price, - pay_price, - remark, - create_by, - company_id, - create_time - )values( - #{typeId}, - #{typeName}, - #{parentId}, - #{status}, - #{num}, - #{unitId}, - #{manageType}, - #{leasePrice}, - #{buyPrice}, - #{payPrice}, - #{remark}, - #{createBy}, - #{companyId}, - sysdate() - ) + insert into ma_type + + type_name, + parent_id, + status, + num, + unit_id, + manage_type, + lease_price, + buy_price, + pay_price, + level, + rated_load, + test_load, + holding_time, + warn_num, + del_flag, + create_by, + create_time, + update_by, + update_time, + is_plan, + is_ancuo, + remark, + company_id, + + + #{typeName}, + #{parentId}, + #{status}, + #{num}, + #{unitId}, + #{manageType}, + #{leasePrice}, + #{buyPrice}, + #{payPrice}, + #{level}, + #{ratedLoad}, + #{testLoad}, + #{holdingTime}, + #{warnNum}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{isPlan}, + #{isAncuo}, + #{remark}, + #{companyId}, + @@ -69,21 +115,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update ma_type - + type_name = #{typeName}, - parent_id = #{parentId}, - status = #{status}, - num = #{num}, - unit_id = #{unitId}, - manage_type = #{manageType}, - lease_price = #{leasePrice}, - buy_price = #{buyPrice}, - pay_price = #{payPrice}, + parent_id = #{parentId}, + status = #{status}, + num = #{num}, + unit_id = #{unitId}, + manage_type = #{manageType}, + lease_price = #{leasePrice}, + buy_price = #{buyPrice}, + pay_price = #{payPrice}, + level = #{level}, + rated_load = #{ratedLoad}, + test_load = #{testLoad}, + holding_time = #{holdingTime}, + warn_num = #{warnNum}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + is_plan = #{isPlan}, + is_ancuo = #{isAncuo}, remark = #{remark}, - update_by = #{updateBy}, - company_id = #{companyId}, - update_time = sysdate() - + company_id = #{companyId}, + where type_id = #{typeId} @@ -91,14 +147,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update ma_type set del_flag = '2' where type_id = #{typeId} - + select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.manage_type, + m.lease_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, + m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl, + mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId, + su.user_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time, + m.remark, m.company_id from ma_type m left join ma_prop_set mps on m.type_id = mps.type_id left join ma_prop_info mpi on mps.prop_id = mpi.prop_id - left join ma_type_file mtf on m.type_id = mtf.type_id + left join (select * from ma_type_file where file_type = '1') mtf on m.type_id = mtf.type_id + left join (select * from ma_type_file where file_type = '2') mtf2 on m.type_id = mtf2.type_id left join ma_type_keeper mtk on mtf.type_id = mtk.type_id left join sys_user su on mtk.user_id = su.user_id + + + AND type_name like concat('%',#{typeName},'%') + + + + + insert into ma_type_keeper + + type_id, + user_id, + time, + company_id, + + + #{typeId}, + #{userId}, + #{time}, + #{companyId}, + + + + + insert into ma_type_repair + + type_id, + user_id, + time, + company_id, + + + #{typeId}, + #{userId}, + #{time}, + #{companyId}, + + + + + insert into ma_prop_set + + prop_id, + type_id, + status, + del_flag, + create_by, + create_time, + update_by, + update_time, + remark, + company_id, + + + #{propId}, + #{typeId}, + #{status}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + #{companyId}, + + + + + + + update ma_type_keeper set user_id = #{userId} where type_id = #{typeId} + + + + update ma_type_repair set user_id = #{userId} where type_id = #{typeId} + + + + update ma_prop_set set prop_id = #{propId} where type_id = #{typeId} + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaTypeFileMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaTypeFileMapper.xml new file mode 100644 index 00000000..74d530f6 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaTypeFileMapper.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + select type_id, ma_id, file_name, file_url, file_type, user_id, time, status, company_id from ma_type_file + + + + + + + + insert into ma_type_file + + type_id, + ma_id, + file_name, + file_url, + file_type, + user_id, + time, + status, + company_id, + + + #{typeId}, + #{maId}, + #{fileName}, + #{fileUrl}, + #{fileType}, + #{userId}, + #{time}, + #{status}, + #{companyId}, + + + + + update ma_type_file + + ma_id = #{maId}, + file_name = #{fileName}, + file_url = #{fileUrl}, + user_id = #{userId}, + time = #{time}, + status = #{status}, + company_id = #{companyId}, + + where type_id = #{typeId} and file_type = #{fileType} + + + + delete from ma_type_file where type_id = #{typeId} + + + + delete from ma_type_file where type_id in + + #{typeId} + + + \ No newline at end of file