From 3174142b61d0b82fd10d37b19847a6f0ede8ac04 Mon Sep 17 00:00:00 2001 From: zangch Date: Thu, 26 Sep 2024 10:52:27 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E5=A2=9E=E6=B7=BB=E4=BF=9D?= =?UTF-8?q?=E5=85=BB=E9=A1=B9=E7=9B=AE=E9=A1=B5=E9=9D=A2=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E5=85=BB=E9=83=A8=E4=BD=8D=E9=A1=B5=E9=9D=A2=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=88=96=E4=BF=AE=E6=94=B9=E5=AF=B9=E8=AF=9D=E6=A1=86=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E4=BF=9D=E5=85=BB=E9=A1=B9=E7=9B=AE=E7=9A=84=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=A4=8D=E9=80=89=E6=A1=86=E5=8F=8A=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DmsBaseMaintProjectController.java | 127 ++++++++ .../DmsBaseStationProjectController.java | 115 ++++++++ .../hw/dms/domain/DmsBaseMaintProject.java | 81 +++++ .../hw/dms/domain/DmsBaseMaintStation.java | 14 + .../hw/dms/domain/DmsBaseStationProject.java | 99 +++++++ .../dms/mapper/DmsBaseMaintProjectMapper.java | 63 ++++ .../mapper/DmsBaseStationProjectMapper.java | 66 +++++ .../service/IDmsBaseMaintProjectService.java | 63 ++++ .../IDmsBaseStationProjectService.java | 67 +++++ .../impl/DmsBaseMaintProjectServiceImpl.java | 123 ++++++++ .../impl/DmsBaseMaintStationServiceImpl.java | 90 +++++- .../DmsBaseStationProjectServiceImpl.java | 131 +++++++++ .../mapper/dms/DmsBaseMaintProjectMapper.xml | 108 +++++++ .../dms/DmsBaseStationProjectMapper.xml | 103 +++++++ hw-ui/src/api/dms/baseStationProject.js | 52 ++++ hw-ui/src/api/dms/dmsBaseMaintProject.js | 61 ++++ .../views/dms/dmsBaseMaintProject/index.vue | 278 ++++++++++++++++++ hw-ui/src/views/dms/station/index.vue | 94 +++++- 18 files changed, 1722 insertions(+), 13 deletions(-) create mode 100644 hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBaseMaintProjectController.java create mode 100644 hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBaseStationProjectController.java create mode 100644 hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseMaintProject.java create mode 100644 hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseStationProject.java create mode 100644 hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBaseMaintProjectMapper.java create mode 100644 hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBaseStationProjectMapper.java create mode 100644 hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBaseMaintProjectService.java create mode 100644 hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBaseStationProjectService.java create mode 100644 hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseMaintProjectServiceImpl.java create mode 100644 hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseStationProjectServiceImpl.java create mode 100644 hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBaseMaintProjectMapper.xml create mode 100644 hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBaseStationProjectMapper.xml create mode 100644 hw-ui/src/api/dms/baseStationProject.js create mode 100644 hw-ui/src/api/dms/dmsBaseMaintProject.js create mode 100644 hw-ui/src/views/dms/dmsBaseMaintProject/index.vue diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBaseMaintProjectController.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBaseMaintProjectController.java new file mode 100644 index 0000000..53239e9 --- /dev/null +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBaseMaintProjectController.java @@ -0,0 +1,127 @@ +package com.hw.dms.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +import com.hw.dms.domain.DmsBaseStationProject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.hw.common.log.annotation.Log; +import com.hw.common.log.enums.BusinessType; +import com.hw.common.security.annotation.RequiresPermissions; +import com.hw.dms.domain.DmsBaseMaintProject; +import com.hw.dms.service.IDmsBaseMaintProjectService; +import com.hw.common.core.web.controller.BaseController; +import com.hw.common.core.web.domain.AjaxResult; +import com.hw.common.core.utils.poi.ExcelUtil; +import com.hw.common.core.web.page.TableDataInfo; + +/** + * 保养项目信息Controller + * + * @author zangch + * @date 2024-09-23 + */ +@RestController +@RequestMapping("/dmsBaseMaintProject") +public class DmsBaseMaintProjectController extends BaseController +{ + @Autowired + private IDmsBaseMaintProjectService dmsBaseMaintProjectService; + + /** + * 查询保养项目信息列表 + */ + @RequiresPermissions("dms:dmsBaseMaintProject:list") + @GetMapping("/list") + public TableDataInfo list(DmsBaseMaintProject dmsBaseMaintProject) + { + startPage(); + List list = dmsBaseMaintProjectService.selectDmsBaseMaintProjectList(dmsBaseMaintProject); + return getDataTable(list); + } + + /** + * 导出保养项目信息列表 + */ + @RequiresPermissions("dms:dmsBaseMaintProject:export") + @Log(title = "保养项目信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DmsBaseMaintProject dmsBaseMaintProject) + { + List list = dmsBaseMaintProjectService.selectDmsBaseMaintProjectList(dmsBaseMaintProject); + ExcelUtil util = new ExcelUtil(DmsBaseMaintProject.class); + util.exportExcel(response, list, "保养项目信息数据"); + } + + /** + * 获取保养项目信息详细信息 + */ + @RequiresPermissions("dms:dmsBaseMaintProject:query") + @GetMapping(value = "/{maintProjectId}") + public AjaxResult getInfo(@PathVariable("maintProjectId") Long maintProjectId) + { + return success(dmsBaseMaintProjectService.selectDmsBaseMaintProjectByMaintProjectId(maintProjectId)); + } + + /** + * 新增保养项目信息 + */ + @RequiresPermissions("dms:dmsBaseMaintProject:add") + @Log(title = "保养项目信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DmsBaseMaintProject dmsBaseMaintProject) + { + return toAjax(dmsBaseMaintProjectService.insertDmsBaseMaintProject(dmsBaseMaintProject)); + } + + /** + * 修改保养项目信息 + */ + @RequiresPermissions("dms:dmsBaseMaintProject:edit") + @Log(title = "保养项目信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DmsBaseMaintProject dmsBaseMaintProject) + { + return toAjax(dmsBaseMaintProjectService.updateDmsBaseMaintProject(dmsBaseMaintProject)); + } + + /** + * 删除保养项目信息 + */ + @RequiresPermissions("dms:dmsBaseMaintProject:remove") + @Log(title = "保养项目信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{maintProjectIds}") + public AjaxResult remove(@PathVariable Long[] maintProjectIds) + { + return toAjax(dmsBaseMaintProjectService.deleteDmsBaseMaintProjectByMaintProjectIds(maintProjectIds)); + } + + @GetMapping("/projectMenu") +//TODO 未完成 + public AjaxResult projectMenu(DmsBaseMaintProject dmsBaseMaintProject) + { + List projectMenu = dmsBaseMaintProjectService.selectDmsBaseMaintProjectList(dmsBaseMaintProject); + return success(projectMenu); + } + + + @GetMapping("/projectMenuByStaion/{maintStationId}") + public AjaxResult projectMenuByStaion(@PathVariable("maintStationId") Long maintStationId) + { + List projectMenu = dmsBaseMaintProjectService.selectProjectMenuByStationId(maintStationId); + return success(projectMenu); + } +} + + + + diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBaseStationProjectController.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBaseStationProjectController.java new file mode 100644 index 0000000..f2ce76a --- /dev/null +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBaseStationProjectController.java @@ -0,0 +1,115 @@ +package com.hw.dms.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +import com.hw.common.security.utils.SecurityUtils; +import com.sun.xml.bind.v2.TODO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.hw.common.log.annotation.Log; +import com.hw.common.log.enums.BusinessType; +import com.hw.common.security.annotation.RequiresPermissions; +import com.hw.dms.domain.DmsBaseStationProject; +import com.hw.dms.service.IDmsBaseStationProjectService; +import com.hw.common.core.web.controller.BaseController; +import com.hw.common.core.web.domain.AjaxResult; +import com.hw.common.core.utils.poi.ExcelUtil; +import com.hw.common.core.web.page.TableDataInfo; + +/** + * 保养部位关联项目信息Controller + * + * @author zangch + * @date 2024-09-23 + */ +@RestController +@RequestMapping("/baseStationProject") +public class DmsBaseStationProjectController extends BaseController +{ + @Autowired + private IDmsBaseStationProjectService dmsBaseStationProjectService; + + /** + * 查询保养部位关联项目信息列表 + */ +/* @RequiresPermissions("dms:baseStationProject:list")*/ + @GetMapping("/list") + public TableDataInfo list(DmsBaseStationProject dmsBaseStationProject) + { + startPage(); + List list = dmsBaseStationProjectService.selectDmsBaseStationProjectList(dmsBaseStationProject); + return getDataTable(list); + } + + /** + * 导出保养部位关联项目信息列表 + */ +/* @RequiresPermissions("dms:baseStationProject:export")*/ + @Log(title = "保养部位关联项目信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DmsBaseStationProject dmsBaseStationProject) + { + List list = dmsBaseStationProjectService.selectDmsBaseStationProjectList(dmsBaseStationProject); + ExcelUtil util = new ExcelUtil(DmsBaseStationProject.class); + util.exportExcel(response, list, "保养部位关联项目信息数据"); + } + + /** + * 获取保养部位关联项目信息详细信息 + */ +/* @RequiresPermissions("dms:baseStationProject:query")*/ + @GetMapping(value = "/{maintStationId}") + public AjaxResult getInfo(@PathVariable("maintStationId") Long maintStationId) + { + return success(dmsBaseStationProjectService.selectDmsBaseStationProjectByMaintStationId(maintStationId)); + } + + /** + * 新增保养部位关联项目信息 + */ +/* @RequiresPermissions("dms:baseStationProject:add")*/ + @Log(title = "保养部位关联项目信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DmsBaseStationProject dmsBaseStationProject) + { + return toAjax(dmsBaseStationProjectService.insertDmsBaseStationProject(dmsBaseStationProject)); + } + + /** + * 修改保养部位关联项目信息 + */ +/* @RequiresPermissions("dms:baseStationProject:edit")*/ + @Log(title = "保养部位关联项目信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DmsBaseStationProject dmsBaseStationProject) + { + return toAjax(dmsBaseStationProjectService.updateDmsBaseStationProject(dmsBaseStationProject)); + } + + /** + * 删除保养部位关联项目信息 + */ +/* @RequiresPermissions("dms:baseStationProject:remove")*/ + @Log(title = "保养部位关联项目信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{maintStationIds}") + public AjaxResult remove(@PathVariable Long[] maintStationIds) + { + return toAjax(dmsBaseStationProjectService.deleteDmsBaseStationProjectByMaintStationIds(maintStationIds)); + } + +/* @GetMapping("/treeselect") + public AjaxResult stationProjectTreeselect(DmsBaseStationProject dmsBaseStationProject) + { + List dmsBaseStationProjects = dmsBaseStationProjectService.selectDmsBaseStationProjectList(dmsBaseStationProject); + return success(dmsBaseStationProjects); + }*/ +} diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseMaintProject.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseMaintProject.java new file mode 100644 index 0000000..df84643 --- /dev/null +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseMaintProject.java @@ -0,0 +1,81 @@ +package com.hw.dms.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.hw.common.core.annotation.Excel; +import com.hw.common.core.web.domain.BaseEntity; + +/** + * 保养项目信息对象 dms_base_maint_project + * + * @author zangch + * @date 2024-09-23 + */ +public class DmsBaseMaintProject extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键标识 */ + private Long maintProjectId; + + /** 项目名称 */ + @Excel(name = "项目名称") + private String maintProjectName; + + /** 项目描述 */ + @Excel(name = "项目描述") + private String maintProjectDesc; + + private Long maintStationId; + + public Long getMaintStationId() { + return maintStationId; + } + + public void setMaintStationId(Long maintStationId) { + this.maintStationId = maintStationId; + } + + public void setMaintProjectId(Long maintProjectId) + { + this.maintProjectId = maintProjectId; + } + + public Long getMaintProjectId() + { + return maintProjectId; + } + public void setMaintProjectName(String maintProjectName) + { + this.maintProjectName = maintProjectName; + } + + public String getMaintProjectName() + { + return maintProjectName; + } + public void setMaintProjectDesc(String maintProjectDesc) + { + this.maintProjectDesc = maintProjectDesc; + } + + public String getMaintProjectDesc() + { + return maintProjectDesc; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("maintProjectId", getMaintProjectId()) + .append("maintProjectName", getMaintProjectName()) + .append("maintProjectDesc", getMaintProjectDesc()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("maintStationId", getMaintStationId()) + .toString(); + } +} diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseMaintStation.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseMaintStation.java index 8666b5a..8c9c09f 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseMaintStation.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseMaintStation.java @@ -40,6 +40,11 @@ public class DmsBaseMaintStation extends BaseEntity private String TypeName; + /** 绑定保养项目 */ + private Long[] productIds; + + + public String getTypeName() { return TypeName; } @@ -103,6 +108,14 @@ public class DmsBaseMaintStation extends BaseEntity return isFlag; } + public Long[] getProductIds() { + return productIds; + } + + public void setProductIds(Long[] productIds) { + this.productIds = productIds; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -116,6 +129,7 @@ public class DmsBaseMaintStation extends BaseEntity .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) + .append("productIds", getProductIds()) .toString(); } } diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseStationProject.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseStationProject.java new file mode 100644 index 0000000..ee9844b --- /dev/null +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsBaseStationProject.java @@ -0,0 +1,99 @@ +package com.hw.dms.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.hw.common.core.annotation.Excel; +import com.hw.common.core.web.domain.BaseEntity; + +/** + * 保养部位关联项目信息对象 dms_base_station_project + * + * @author zangch + * @date 2024-09-23 + */ +public class DmsBaseStationProject extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 保养部位ID */ + @Excel(name = "保养部位ID") + private Long maintStationId; + + /** 保养项目ID */ + @Excel(name = "保养项目ID") + private Long maintProjectId; + + private String maintProjectName; + private String maintStationCode; + private String maintStationName; + + + /** 保养项目编号 */ + private Long[] productIds; + + public Long[] getProductIds() { + return productIds; + } + + public void setProductIds(Long[] productIds) { + this.productIds = productIds; + } + + + public String getMaintProjectName() { + return maintProjectName; + } + + public void setMaintProjectName(String maintProjectName) { + this.maintProjectName = maintProjectName; + } + + public String getMaintStationCode() { + return maintStationCode; + } + + public void setMaintStationCode(String maintStationCode) { + this.maintStationCode = maintStationCode; + } + + public String getMaintStationName() { + return maintStationName; + } + + public void setMaintStationName(String maintStationName) { + this.maintStationName = maintStationName; + } + + public void setMaintStationId(Long maintStationId) + { + this.maintStationId = maintStationId; + } + + public Long getMaintStationId() + { + return maintStationId; + } + public void setMaintProjectId(Long maintProjectId) + { + this.maintProjectId = maintProjectId; + } + + public Long getMaintProjectId() + { + return maintProjectId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("maintStationId", getMaintStationId()) + .append("maintProjectId", getMaintProjectId()) + + .append("maintProjectName",getMaintProjectName()) + .append("maintStationCode",getMaintStationName()) + .append("maintStationName",getMaintStationName()) + .append("productIds",getProductIds()) + .toString(); + } + +} diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBaseMaintProjectMapper.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBaseMaintProjectMapper.java new file mode 100644 index 0000000..a37d075 --- /dev/null +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBaseMaintProjectMapper.java @@ -0,0 +1,63 @@ +package com.hw.dms.mapper; + +import java.util.List; +import com.hw.dms.domain.DmsBaseMaintProject; + +/** + * 保养项目信息Mapper接口 + * + * @author zangch + * @date 2024-09-23 + */ +public interface DmsBaseMaintProjectMapper +{ + /** + * 查询保养项目信息 + * + * @param maintProjectId 保养项目信息主键 + * @return 保养项目信息 + */ + public DmsBaseMaintProject selectDmsBaseMaintProjectByMaintProjectId(Long maintProjectId); + + /** + * 查询保养项目信息列表 + * + * @param dmsBaseMaintProject 保养项目信息 + * @return 保养项目信息集合 + */ + public List selectDmsBaseMaintProjectList(DmsBaseMaintProject dmsBaseMaintProject); + + /** + * 新增保养项目信息 + * + * @param dmsBaseMaintProject 保养项目信息 + * @return 结果 + */ + public int insertDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject); + + /** + * 修改保养项目信息 + * + * @param dmsBaseMaintProject 保养项目信息 + * @return 结果 + */ + public int updateDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject); + + /** + * 删除保养项目信息 + * + * @param maintProjectId 保养项目信息主键 + * @return 结果 + */ + public int deleteDmsBaseMaintProjectByMaintProjectId(Long maintProjectId); + + /** + * 批量删除保养项目信息 + * + * @param maintProjectIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDmsBaseMaintProjectByMaintProjectIds(Long[] maintProjectIds); + + public List selectProjectMenuByStationId(Long maintStationId); +} diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBaseStationProjectMapper.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBaseStationProjectMapper.java new file mode 100644 index 0000000..a293eb9 --- /dev/null +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBaseStationProjectMapper.java @@ -0,0 +1,66 @@ +package com.hw.dms.mapper; + +import java.util.List; +import com.hw.dms.domain.DmsBaseStationProject; + +/** + * 保养部位关联项目信息Mapper接口 + * + * @author zangch + * @date 2024-09-23 + */ +public interface DmsBaseStationProjectMapper +{ + /** + * 查询保养部位关联项目信息 + * + * @param maintStationId 保养部位关联项目信息主键 + * @return 保养部位关联项目信息 + */ + public DmsBaseStationProject selectDmsBaseStationProjectByMaintStationId(Long maintStationId); + + /** + * 查询保养部位关联项目信息列表 + * + * @param dmsBaseStationProject 保养部位关联项目信息 + * @return 保养部位关联项目信息集合 + */ + public List selectDmsBaseStationProjectList(DmsBaseStationProject dmsBaseStationProject); + + /** + * 新增保养部位关联项目信息 + * + * @param dmsBaseStationProject 保养部位关联项目信息 + * @return 结果 + */ + public int insertDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject); + + /** + * 修改保养部位关联项目信息 + * + * @param dmsBaseStationProject 保养部位关联项目信息 + * @return 结果 + */ + public int updateDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject); + + /** + * 删除保养部位关联项目信息 + * + * @param maintStationId 保养部位关联项目信息主键 + * @return 结果 + */ + public int deleteDmsBaseStationProjectByMaintStationId(Long maintStationId); + + /** + * 批量删除保养部位关联项目信息 + * + * @param maintStationIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDmsBaseStationProjectByMaintStationIds(Long[] maintStationIds); + + public int batchUpdateDmsBaseStationProject(List dmsBaseStationProjectList); + public int batchInsertDmsBaseStationProject(List dmsBaseStationProjectList); + + public DmsBaseStationProject selectDmsBaseStationProjectBymaintProjectId(Long maintProjectId); +} diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBaseMaintProjectService.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBaseMaintProjectService.java new file mode 100644 index 0000000..ab3198f --- /dev/null +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBaseMaintProjectService.java @@ -0,0 +1,63 @@ +package com.hw.dms.service; + +import java.util.List; +import com.hw.dms.domain.DmsBaseMaintProject; + +/** + * 保养项目信息Service接口 + * + * @author zangch + * @date 2024-09-23 + */ +public interface IDmsBaseMaintProjectService +{ + /** + * 查询保养项目信息 + * + * @param maintProjectId 保养项目信息主键 + * @return 保养项目信息 + */ + public DmsBaseMaintProject selectDmsBaseMaintProjectByMaintProjectId(Long maintProjectId); + + /** + * 查询保养项目信息列表 + * + * @param dmsBaseMaintProject 保养项目信息 + * @return 保养项目信息集合 + */ + public List selectDmsBaseMaintProjectList(DmsBaseMaintProject dmsBaseMaintProject); + + /** + * 新增保养项目信息 + * + * @param dmsBaseMaintProject 保养项目信息 + * @return 结果 + */ + public int insertDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject); + + /** + * 修改保养项目信息 + * + * @param dmsBaseMaintProject 保养项目信息 + * @return 结果 + */ + public int updateDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject); + + /** + * 批量删除保养项目信息 + * + * @param maintProjectIds 需要删除的保养项目信息主键集合 + * @return 结果 + */ + public int deleteDmsBaseMaintProjectByMaintProjectIds(Long[] maintProjectIds); + + /** + * 删除保养项目信息信息 + * + * @param maintProjectId 保养项目信息主键 + * @return 结果 + */ + public int deleteDmsBaseMaintProjectByMaintProjectId(Long maintProjectId); + + public List selectProjectMenuByStationId(Long maintStationId); +} diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBaseStationProjectService.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBaseStationProjectService.java new file mode 100644 index 0000000..dd2cdc4 --- /dev/null +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBaseStationProjectService.java @@ -0,0 +1,67 @@ +package com.hw.dms.service; + +import java.util.List; +import com.hw.dms.domain.DmsBaseStationProject; + +/** + * 保养部位关联项目信息Service接口 + * + * @author zangch + * @date 2024-09-23 + */ +public interface IDmsBaseStationProjectService +{ + /** + * 查询保养部位关联项目信息 + * + * @param maintStationId 保养部位关联项目信息主键 + * @return 保养部位关联项目信息 + */ + public DmsBaseStationProject selectDmsBaseStationProjectByMaintStationId(Long maintStationId); + + /** + * 查询保养部位关联项目信息列表 + * + * @param dmsBaseStationProject 保养部位关联项目信息 + * @return 保养部位关联项目信息集合 + */ + public List selectDmsBaseStationProjectList(DmsBaseStationProject dmsBaseStationProject); + + /** + * 新增保养部位关联项目信息 + * + * @param dmsBaseStationProject 保养部位关联项目信息 + * @return 结果 + */ + public int insertDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject); + + /** + * 修改保养部位关联项目信息 + * + * @param dmsBaseStationProject 保养部位关联项目信息 + * @return 结果 + */ + public int updateDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject); + + /** + * 批量删除保养部位关联项目信息 + * + * @param maintStationIds 需要删除的保养部位关联项目信息主键集合 + * @return 结果 + */ + public int deleteDmsBaseStationProjectByMaintStationIds(Long[] maintStationIds); + + /** + * 删除保养部位关联项目信息信息 + * + * @param maintStationId 保养部位关联项目信息主键 + * @return 结果 + */ + public int deleteDmsBaseStationProjectByMaintStationIds(Long maintStationId); + + + public int batchUpdateDmsBaseStationProject(List dmsBaseStationProjectList); + public int batchInsertDmsBaseStationProject(List dmsBaseStationProjectList); + + public DmsBaseStationProject selectDmsBaseStationProjectBymaintProjectId(Long maintProjectId); +} diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseMaintProjectServiceImpl.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseMaintProjectServiceImpl.java new file mode 100644 index 0000000..13856ae --- /dev/null +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseMaintProjectServiceImpl.java @@ -0,0 +1,123 @@ +package com.hw.dms.service.impl; + +import java.util.List; + +import com.hw.common.core.exception.ServiceException; +import com.hw.common.core.utils.DateUtils; +import com.hw.dms.domain.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.hw.dms.mapper.*; +import com.hw.dms.service.*; + +/** + * 保养项目信息Service业务层处理 + * + * @author zangch + * @date 2024-09-23 + */ +@Service +public class DmsBaseMaintProjectServiceImpl implements IDmsBaseMaintProjectService +{ + @Autowired + private DmsBaseMaintProjectMapper dmsBaseMaintProjectMapper; + @Autowired + private DmsBaseStationProjectServiceImpl dmsBaseStationProjectServiceImpl; + + /** + * 查询保养项目信息 + * + * @param maintProjectId 保养项目信息主键 + * @return 保养项目信息 + */ + @Override + public DmsBaseMaintProject selectDmsBaseMaintProjectByMaintProjectId(Long maintProjectId) + { + return dmsBaseMaintProjectMapper.selectDmsBaseMaintProjectByMaintProjectId(maintProjectId); + } + + /** + * 查询保养项目信息列表 + * + * @param dmsBaseMaintProject 保养项目信息 + * @return 保养项目信息 + */ + @Override + public List selectDmsBaseMaintProjectList(DmsBaseMaintProject dmsBaseMaintProject) + { + return dmsBaseMaintProjectMapper.selectDmsBaseMaintProjectList(dmsBaseMaintProject); + } + + /** + * 新增保养项目信息 + * + * @param dmsBaseMaintProject 保养项目信息 + * @return 结果 + */ + @Override + public int insertDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject) + { + dmsBaseMaintProject.setCreateTime(DateUtils.getNowDate()); + return dmsBaseMaintProjectMapper.insertDmsBaseMaintProject(dmsBaseMaintProject); + } + + /** + * 修改保养项目信息 + * + * @param dmsBaseMaintProject 保养项目信息 + * @return 结果 + */ + @Override + public int updateDmsBaseMaintProject(DmsBaseMaintProject dmsBaseMaintProject) + { + dmsBaseMaintProject.setUpdateTime(DateUtils.getNowDate()); + return dmsBaseMaintProjectMapper.updateDmsBaseMaintProject(dmsBaseMaintProject); + } + + /** + * 批量删除保养项目信息 + * + * @param maintProjectIds 需要删除的保养项目信息主键 + * @return 结果 + */ + @Override + public int deleteDmsBaseMaintProjectByMaintProjectIds(Long[] maintProjectIds) + { + //删除前先根据maintProjectId监测stationproject表中是否存在数据,若存在就抛出异常不能删除 + for(Long maintProjectId : maintProjectIds){ + DmsBaseStationProject dmsBaseStationProject = new DmsBaseStationProject(); + dmsBaseStationProject.setMaintProjectId(maintProjectId); + List dmsBaseStationProjectList = dmsBaseStationProjectServiceImpl + .selectDmsBaseStationProjectList(dmsBaseStationProject); + if(dmsBaseStationProjectList.size() > 0){ + throw new ServiceException("其中的保养项目信息已绑定到保养部位,不能删除"); + } + } + return dmsBaseMaintProjectMapper.deleteDmsBaseMaintProjectByMaintProjectIds(maintProjectIds); + } + + /** + * 删除保养项目信息信息 + * + * @param maintProjectId 保养项目信息主键 + * @return 结果 + */ + @Override + public int deleteDmsBaseMaintProjectByMaintProjectId(Long maintProjectId) + { + + //删除前先根据maintProjectId监测stationproject表中是否存在数据,若存在就抛出异常不能删除 + DmsBaseStationProject dmsBaseStationProject = dmsBaseStationProjectServiceImpl + .selectDmsBaseStationProjectBymaintProjectId(maintProjectId); + if(dmsBaseStationProject != null){ + throw new ServiceException("该保养项目信息已绑定到保养部位,不能删除"); + } + + return dmsBaseMaintProjectMapper.deleteDmsBaseMaintProjectByMaintProjectId(maintProjectId); + } + + public List selectProjectMenuByStationId(Long maintStationId) + { + return dmsBaseMaintProjectMapper.selectProjectMenuByStationId(maintStationId); + } +} diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseMaintStationServiceImpl.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseMaintStationServiceImpl.java index 1899cb1..ec77fc3 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseMaintStationServiceImpl.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseMaintStationServiceImpl.java @@ -1,6 +1,8 @@ package com.hw.dms.service.impl; +import java.util.ArrayList; import java.util.List; + import com.hw.common.core.exception.ServiceException; import com.hw.common.core.utils.DateUtils; import com.hw.common.security.utils.SecurityUtils; @@ -8,8 +10,9 @@ import com.hw.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hw.dms.mapper.DmsBaseMaintStationMapper; -import com.hw.dms.domain.DmsBaseMaintStation; -import com.hw.dms.service.IDmsBaseMaintStationService; +import com.hw.dms.domain.*; +import com.hw.dms.service.*; +import org.springframework.transaction.annotation.Transactional; /** * 保养部位信息Service业务层处理 @@ -23,6 +26,9 @@ public class DmsBaseMaintStationServiceImpl implements IDmsBaseMaintStationServi @Autowired private DmsBaseMaintStationMapper dmsBaseMaintStationMapper; + @Autowired + private IDmsBaseStationProjectService dmsBaseStationProjectService; + /** * 查询保养部位信息 * @@ -54,18 +60,42 @@ public class DmsBaseMaintStationServiceImpl implements IDmsBaseMaintStationServi * @return 结果 */ @Override - public int insertDmsBaseMaintStation(DmsBaseMaintStation dmsBaseMaintStation) - { + @Transactional + public int insertDmsBaseMaintStation(DmsBaseMaintStation dmsBaseMaintStation) { DmsBaseMaintStation MaintStation = new DmsBaseMaintStation(); MaintStation.setMaintStationCode(dmsBaseMaintStation.getMaintStationCode()); List dmsBaseMaintStationlist = dmsBaseMaintStationMapper .selectDmsBaseMaintStationList(MaintStation); - if (dmsBaseMaintStationlist.size() > 0){throw new ServiceException("保养部位信息编码已存在");} + if (dmsBaseMaintStationlist.size() > 0) { + throw new ServiceException("保养部位信息编码已存在"); + } LoginUser user = SecurityUtils.getLoginUser(); dmsBaseMaintStation.setIsFlag(1l); dmsBaseMaintStation.setCreateBy(user.getUsername()); dmsBaseMaintStation.setCreateTime(DateUtils.getNowDate()); - return dmsBaseMaintStationMapper.insertDmsBaseMaintStation(dmsBaseMaintStation); + +/*因为MaintStationId在前端不可见不可编辑,是数据库自增主键, +所以新增保养部位以及相关的保养项目时,前端传来的实体类没有MaintStationId,所以需要先插入保养部位,再获取自增主键MaintStationId,再赋值给dmsBaseMaintStation +方法添加了事务@Transactional保证原子性*/ + //先新增保养部位 + int i = dmsBaseMaintStationMapper.insertDmsBaseMaintStation(dmsBaseMaintStation);//先插入保养部位信息,数据库自增主键maint_station_id + //查询出来MaintStationId,再赋值给dmsBaseMaintStation + List dmsBaseMaintStationsNew = dmsBaseMaintStationMapper. + selectDmsBaseMaintStationList(dmsBaseMaintStation); + dmsBaseMaintStation.setMaintStationId(dmsBaseMaintStationsNew.get(0).getMaintStationId()); + //若Long[] ProductIds不为空,则分批添加 + if (dmsBaseMaintStation.getProductIds().length > 0) { + List dmsBaseStationProjectList = new ArrayList<>(); + for (Long productId : dmsBaseMaintStation.getProductIds()) { + DmsBaseStationProject dmsBaseStationProject = new DmsBaseStationProject(); + dmsBaseStationProject.setMaintStationId(dmsBaseMaintStation.getMaintStationId()); + dmsBaseStationProject.setMaintProjectId(productId); + dmsBaseStationProjectList.add(dmsBaseStationProject); + } + dmsBaseStationProjectService.batchInsertDmsBaseStationProject(dmsBaseStationProjectList); + } + + return i; } /** @@ -75,18 +105,54 @@ public class DmsBaseMaintStationServiceImpl implements IDmsBaseMaintStationServi * @return 结果 */ @Override - public int updateDmsBaseMaintStation(DmsBaseMaintStation dmsBaseMaintStation) - { + @Transactional + public int updateDmsBaseMaintStation(DmsBaseMaintStation dmsBaseMaintStation) { DmsBaseMaintStation MaintStation = new DmsBaseMaintStation(); MaintStation.setMaintStationCode(dmsBaseMaintStation.getMaintStationCode()); List dmsBaseMaintStationlist = dmsBaseMaintStationMapper .selectDmsBaseMaintStationList(MaintStation); if (dmsBaseMaintStationlist.size() > 0 && !dmsBaseMaintStationlist.get(0).getMaintStationId() - .equals(dmsBaseMaintStation.getMaintStationId())){ - throw new ServiceException("保养部位信息编码已存在");} + .equals(dmsBaseMaintStation.getMaintStationId())) { + throw new ServiceException("保养部位信息编码已存在"); + } LoginUser user = SecurityUtils.getLoginUser(); dmsBaseMaintStation.setUpdateBy(user.getUsername()); dmsBaseMaintStation.setUpdateTime(DateUtils.getNowDate()); + + //若Long[] ProductIds不为空 + if (dmsBaseMaintStation.getProductIds().length > 0) { + //根据部位id先去若StaionProject表中查询是否已有数据 + DmsBaseStationProject dmsBaseStationProjectSearch = new DmsBaseStationProject(); + dmsBaseStationProjectSearch.setMaintStationId(dmsBaseMaintStation.getMaintStationId()); + List dmsBaseStationProjectSerchList = dmsBaseStationProjectService + .selectDmsBaseStationProjectList(dmsBaseStationProjectSearch); + //list存储每个实体 + List dmsBaseStationProjectList = new ArrayList<>(); + //若StaionProject表中有数据,则更新(先根据部位id删除,再分批添加) + if (dmsBaseStationProjectSerchList.size() > 0) { + //list存储每个实体,每个实体设置属性 + for (Long productId : dmsBaseMaintStation.getProductIds()) { + DmsBaseStationProject dmsBaseStationProject = new DmsBaseStationProject(); + dmsBaseStationProject.setMaintStationId(dmsBaseMaintStation.getMaintStationId()); + dmsBaseStationProject.setMaintProjectId(productId); + dmsBaseStationProjectList.add(dmsBaseStationProject); + } + dmsBaseStationProjectService.batchUpdateDmsBaseStationProject(dmsBaseStationProjectList); + } else { + //若StaionProject无数据,则添加 + for (Long productId : dmsBaseMaintStation.getProductIds()) { + DmsBaseStationProject dmsBaseStationProject = new DmsBaseStationProject(); + dmsBaseStationProject.setMaintStationId(dmsBaseMaintStation.getMaintStationId()); + dmsBaseStationProject.setMaintProjectId(productId); + dmsBaseStationProjectList.add(dmsBaseStationProject); + } + dmsBaseStationProjectService.batchInsertDmsBaseStationProject(dmsBaseStationProjectList); + } + } else { + //若ProductIds为空,则根据maintStationId删除相关 + dmsBaseStationProjectService.deleteDmsBaseStationProjectByMaintStationIds(dmsBaseMaintStation.getMaintStationId()); + } + return dmsBaseMaintStationMapper.updateDmsBaseMaintStation(dmsBaseMaintStation); } @@ -97,8 +163,10 @@ public class DmsBaseMaintStationServiceImpl implements IDmsBaseMaintStationServi * @return 结果 */ @Override + @Transactional public int deleteDmsBaseMaintStationByMaintStationIds(Long[] maintStationIds) { + dmsBaseStationProjectService.deleteDmsBaseStationProjectByMaintStationIds(maintStationIds); return dmsBaseMaintStationMapper.deleteDmsBaseMaintStationByMaintStationIds(maintStationIds); } @@ -109,8 +177,10 @@ public class DmsBaseMaintStationServiceImpl implements IDmsBaseMaintStationServi * @return 结果 */ @Override + @Transactional public int deleteDmsBaseMaintStationByMaintStationId(Long maintStationId) { + dmsBaseStationProjectService.deleteDmsBaseStationProjectByMaintStationIds(maintStationId); return dmsBaseMaintStationMapper.deleteDmsBaseMaintStationByMaintStationId(maintStationId); } } diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseStationProjectServiceImpl.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseStationProjectServiceImpl.java new file mode 100644 index 0000000..9afedd0 --- /dev/null +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBaseStationProjectServiceImpl.java @@ -0,0 +1,131 @@ +package com.hw.dms.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.hw.dms.mapper.DmsBaseStationProjectMapper; +import com.hw.dms.domain.DmsBaseStationProject; +import com.hw.dms.service.IDmsBaseStationProjectService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 保养部位关联项目信息Service业务层处理 + * + * @author zangch + * @date 2024-09-23 + */ +@Service +public class DmsBaseStationProjectServiceImpl implements IDmsBaseStationProjectService +{ + @Autowired + private DmsBaseStationProjectMapper dmsBaseStationProjectMapper; + + /** + * 查询保养部位关联项目信息 + * + * @param maintStationId 保养部位关联项目信息主键 + * @return 保养部位关联项目信息 + */ + @Override + public DmsBaseStationProject selectDmsBaseStationProjectByMaintStationId(Long maintStationId) + { + return dmsBaseStationProjectMapper.selectDmsBaseStationProjectByMaintStationId(maintStationId); + } + + /** + * 查询保养部位关联项目信息列表 + * + * @param dmsBaseStationProject 保养部位关联项目信息 + * @return 保养部位关联项目信息 + */ + @Override + public List selectDmsBaseStationProjectList(DmsBaseStationProject dmsBaseStationProject) + { + return dmsBaseStationProjectMapper.selectDmsBaseStationProjectList(dmsBaseStationProject); + } + + /** + * 新增保养部位关联项目信息 + * + * @param dmsBaseStationProject 保养部位关联项目信息 + * @return 结果 + */ + @Override + public int insertDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject) + { + return dmsBaseStationProjectMapper.insertDmsBaseStationProject(dmsBaseStationProject); + } + + /** + * 修改保养部位关联项目信息 + * + * @param dmsBaseStationProject 保养部位关联项目信息 + * @return 结果 + */ + @Override + public int updateDmsBaseStationProject(DmsBaseStationProject dmsBaseStationProject) + { + return dmsBaseStationProjectMapper.updateDmsBaseStationProject(dmsBaseStationProject); + } + + /** + * 批量删除保养部位关联项目信息 + * + * @param maintStationIds 需要删除的保养部位关联项目信息主键 + * @return 结果 + */ + @Override + public int deleteDmsBaseStationProjectByMaintStationIds(Long[] maintStationIds) + { + return dmsBaseStationProjectMapper.deleteDmsBaseStationProjectByMaintStationIds(maintStationIds); + } + + /** + * 更新保养部位关联项目信息信息 + * + * @param maintStationId 保养部位关联项目信息 + * @return 结果 + */ + @Override + public int deleteDmsBaseStationProjectByMaintStationIds(Long maintStationId) + { + return dmsBaseStationProjectMapper.deleteDmsBaseStationProjectByMaintStationId(maintStationId); + } + + /** + * 删除保养部位关联项目信息信息 + * + * @param dmsBaseStationProjectList 保养部位关联项目信息主键 + * @return 结果 + */ + @Override + @Transactional + public int batchUpdateDmsBaseStationProject(List dmsBaseStationProjectList){ + //复选框,先根据MaintStationId删除表中数据,再批量添加 + for( DmsBaseStationProject dmsBaseStationProject:dmsBaseStationProjectList){ + dmsBaseStationProjectMapper.deleteDmsBaseStationProjectByMaintStationId(dmsBaseStationProject.getMaintStationId()); + } + return dmsBaseStationProjectMapper.batchInsertDmsBaseStationProject(dmsBaseStationProjectList); + } + + /** + * 批量保养部位关联项目信息信息 + * + * @param dmsBaseStationProjectList 保养部位关联项目信息 + * @return 结果 + */ + @Override + public int batchInsertDmsBaseStationProject(List dmsBaseStationProjectList){ + return dmsBaseStationProjectMapper.batchInsertDmsBaseStationProject(dmsBaseStationProjectList); + } + + /** + * 查询保养部位关联项目信息信息 + * + * @param maintProjectId 保养部位关联项目信息 + * @return 结果 + */ + public DmsBaseStationProject selectDmsBaseStationProjectBymaintProjectId(Long maintProjectId){ + return dmsBaseStationProjectMapper.selectDmsBaseStationProjectBymaintProjectId(maintProjectId); + } +} diff --git a/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBaseMaintProjectMapper.xml b/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBaseMaintProjectMapper.xml new file mode 100644 index 0000000..06d7035 --- /dev/null +++ b/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBaseMaintProjectMapper.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + select dbmp.maint_project_id, + dbmp.maint_project_name, + dbmp.maint_project_desc, + dbmp.remark, dbmp.create_by, dbmp.create_time, dbmp.update_by, dbmp.update_time + from dms_base_maint_project dbmp + + + + select dbmp.maint_project_id, + dbmp.maint_project_name, + dbmp.maint_project_desc, + dbmp.remark, dbmp.create_by, dbmp.create_time, dbmp.update_by, dbmp.update_time, + dbsp.maint_station_id + from dms_base_maint_project dbmp + left join dms_base_station_project dbsp on dbmp.maint_project_id = dbsp.maint_project_id + + + + + + + + + + + + + insert into dms_base_maint_project + + maint_project_name, + maint_project_desc, + remark, + create_by, + create_time, + update_by, + update_time, + + + #{maintProjectName}, + #{maintProjectDesc}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update dms_base_maint_project + + maint_project_name = #{maintProjectName}, + maint_project_desc = #{maintProjectDesc}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where maint_project_id = #{maintProjectId} + + + + delete from dms_base_maint_project where maint_project_id = #{maintProjectId} + + + + delete from dms_base_maint_project where maint_project_id in + + #{maintProjectId} + + + + + \ No newline at end of file diff --git a/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBaseStationProjectMapper.xml b/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBaseStationProjectMapper.xml new file mode 100644 index 0000000..a63d3a7 --- /dev/null +++ b/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBaseStationProjectMapper.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + select dbsp.maint_station_id, + dbsp.maint_project_id, + dbmp.maint_project_name, + dbms.maint_station_name, + dbms.maint_station_code + from dms_base_station_project dbsp + left join dms_base_maint_project dbmp on dbsp.maint_project_id = dbmp.maint_project_id + left join dms_base_maint_station dbms on dbsp.maint_station_id = dbms.maint_station_id + + + + + + + + + + + + insert into dms_base_station_project + + maint_station_id, + maint_project_id, + + + #{maintStationId}, + #{maintProjectId}, + + + + + update dms_base_station_project + + maint_project_id = #{maintProjectId}, + maint_project_name = #{maintProjectName}, + + where maint_station_id = #{maintStationId} + + + + delete from dms_base_station_project where maint_station_id = #{maintStationId} + + + + delete from dms_base_station_project where maint_station_id in + + #{maintStationId} + + + + + + + + update dms_base_station_project + + maint_project_id = #{item.maintProjectId} + + where maint_station_id = #{item.maintStationId} + + + + + insert into dms_base_station_project(maint_station_id,maint_project_id) + values + + (#{item.maintStationId},#{item.maintProjectId}) + + + + \ No newline at end of file diff --git a/hw-ui/src/api/dms/baseStationProject.js b/hw-ui/src/api/dms/baseStationProject.js new file mode 100644 index 0000000..310dd67 --- /dev/null +++ b/hw-ui/src/api/dms/baseStationProject.js @@ -0,0 +1,52 @@ +import request from '@/utils/request' + +// 查询保养部位关联项目信息列表 +export function listBaseStationProject(query) { + return request({ + url: '/dms/baseStationProject/list', + method: 'get', + params: query + }) +} + +// 查询保养部位关联项目信息详细 +export function getBaseStationProject(maintStationId) { + return request({ + url: '/dms/baseStationProject/' + maintStationId, + method: 'get' + }) +} + +// 新增保养部位关联项目信息 +export function addBaseStationProject(data) { + return request({ + url: '/dms/baseStationProject', + method: 'post', + data: data + }) +} + +// 修改保养部位关联项目信息 +export function updateBaseStationProject(data) { + return request({ + url: '/dms/baseStationProject', + method: 'put', + data: data + }) +} + +// 删除保养部位关联项目信息 +export function delBaseStationProject(maintStationId) { + return request({ + url: '/dms/baseStationProject/' + maintStationId, + method: 'delete' + }) +} + +/*// 查询菜单下拉树结构 +export function stationProjectTreeselect(query) { + return request({ + url: '/dms/baseStationProject/treeselect', + method: 'get' + }) +}*/ diff --git a/hw-ui/src/api/dms/dmsBaseMaintProject.js b/hw-ui/src/api/dms/dmsBaseMaintProject.js new file mode 100644 index 0000000..e6c3350 --- /dev/null +++ b/hw-ui/src/api/dms/dmsBaseMaintProject.js @@ -0,0 +1,61 @@ +import request from '@/utils/request' + +// 查询保养项目信息列表 +export function listDmsBaseMaintProject(query) { + return request({ + url: '/dms/dmsBaseMaintProject/list', + method: 'get', + params: query + }) +} + +// 查询保养项目信息详细 +export function getDmsBaseMaintProject(maintProjectId) { + return request({ + url: '/dms/dmsBaseMaintProject/' + maintProjectId, + method: 'get' + }) +} + +// 新增保养项目信息 +export function addDmsBaseMaintProject(data) { + return request({ + url: '/dms/dmsBaseMaintProject', + method: 'post', + data: data + }) +} + +// 修改保养项目信息 +export function updateDmsBaseMaintProject(data) { + return request({ + url: '/dms/dmsBaseMaintProject', + method: 'put', + data: data + }) +} +// 删除保养项目信息 +export function delDmsBaseMaintProject(maintProjectId) { + return request({ + url: '/dms/dmsBaseMaintProject/' + maintProjectId, + method: 'delete' + }) + +} + + +// 查询菜单 +export function projectMenu(query) { + return request({ + url: '/dms/dmsBaseMaintProject/projectMenu', + method: 'get' + }) +} + +// 根据部位ID查询菜单结构 +export function projectMenuByStaion(maintStationId) { + return request({ + url:'/dms/dmsBaseMaintProject/projectMenuByStaion/'+ maintStationId, + method: 'get' + }) +} diff --git a/hw-ui/src/views/dms/dmsBaseMaintProject/index.vue b/hw-ui/src/views/dms/dmsBaseMaintProject/index.vue new file mode 100644 index 0000000..ac06a03 --- /dev/null +++ b/hw-ui/src/views/dms/dmsBaseMaintProject/index.vue @@ -0,0 +1,278 @@ + + + diff --git a/hw-ui/src/views/dms/station/index.vue b/hw-ui/src/views/dms/station/index.vue index bba9207..c6d5a0a 100644 --- a/hw-ui/src/views/dms/station/index.vue +++ b/hw-ui/src/views/dms/station/index.vue @@ -199,6 +199,20 @@ + + 全选/全不选 +
+ +
+
@@ -218,6 +232,7 @@ import { listStation, getStation, delStation, addStation, updateStation } from "@/api/dms/station"; import { listDevicetype } from '@/api/dms/devicetype' import {getMaintStandardlist} from '@/api/dms/standard' +import {projectMenu, projectMenuByStaion} from "@/api/dms/dmsBaseMaintProject"; export default { name: "Station", @@ -266,13 +281,16 @@ export default { // isFlag: [ // { required: true, message: "是否标识:1-是;2-否不能为空", trigger: "blur" } // ], - } + }, + menuNodeAll: false, + baseStationProjectList: [], }; }, created() { this.getList(); this.getDeviceTypeList(); this.getStandard(); +/* this.getStaionProjetList();*/ }, methods: { /** 查询保养标准信息列表 */ @@ -305,6 +323,10 @@ export default { }, // 表单重置 reset() { + if (this.$refs.menu != undefined) { + this.$refs.menu.setCheckedKeys([]); + } + this.menuNodeAll = false, this.form = { maintStationId: null, deviceTypeId: null, @@ -318,7 +340,8 @@ export default { createBy: null, createTime: null, updateBy: null, - updateTime: null + updateTime: null, + baseStationProjectList: [], }; this.resetForm("form"); }, @@ -342,15 +365,29 @@ export default { handleAdd() { this.reset(); this.open = true; + this.getStaionProjetList() ; this.title = "添加保养部位信息"; }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); const maintStationId = row.maintStationId || this.ids + this.getStaionProjetList(); getStation(maintStationId).then(response => { +/* this.getStaionProjetList();*/ this.form = response.data; this.open = true; + this.$nextTick(() => { + projectMenuByStaion(maintStationId).then(res => { + let checkedKeys = res.data + checkedKeys.forEach((v) => { + console.log('v',v) + this.$nextTick(()=>{ + this.$refs.menu.setChecked(v.maintProjectId, true ,false); + }) + }) + }); + }); this.title = "修改保养部位信息"; }); }, @@ -359,12 +396,14 @@ export default { this.$refs["form"].validate(valid => { if (valid) { if (this.form.maintStationId != null) { + this.form.productIds = this.getMenuAllCheckedKeys(); updateStation(this.form).then(response => { this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { + this.form.productIds = this.getMenuAllCheckedKeys(); addStation(this.form).then(response => { this.$modal.msgSuccess("新增成功"); this.open = false; @@ -390,7 +429,56 @@ export default { this.download('dms/station/export', { ...this.queryParams }, `station_${new Date().getTime()}.xlsx`) - } + }, + + // 树权限(全选/全不选) + handleCheckedTreeNodeAll(value, type) { + if (type == 'menu') { + this.$refs.menu.setCheckedNodes(value ? this.baseStationProjectList: []); + } + }, + /** 查询保养部位关联项目信息列表 */ + getStaionProjetList() { + projectMenu({}).then(response => { + this.baseStationProjectList = response.data; + console.log(this.baseStationProjectList) + }); + }, + + /** 根据部位id查询菜单 */ + getStaionProjetListByStionId(maintStationId) { + return projectMenuByStaion(maintStationId).then(response => { + this.baseStationProjectList = response.data; + console.log(this.baseStationProjectList) + }); + }, + // 所有菜单节点数据 + getMenuAllCheckedKeys() { + // 目前被选中的菜单节点 + let checkedKeys = this.$refs.menu.getCheckedKeys(); + return checkedKeys; + }, + // 所有部门节点数据 + getDeptAllCheckedKeys() { + // 目前被选中的部门节点 + let checkedKeys = this.$refs.dept.getCheckedKeys(); + // 半选中的部门节点 + let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys(); + checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys); + return checkedKeys; + }, + } }; + + +