From 713927026966bc7c407a553d95c7a4e9ede76b4c Mon Sep 17 00:00:00 2001 From: 79493 <794930212@qq.com> Date: Wed, 19 Oct 2022 17:37:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=AB=AF=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=A0=91=E5=BD=A2=E7=BB=93=E6=9E=84=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=92=8C=E4=BF=AE=E6=94=B9=20=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E7=AB=AF=E5=B2=97=E4=BD=8D=E6=A0=91=E5=BD=A2=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E5=88=97=E8=A1=A8=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=92=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/rzyc/mapper/EntDeviceTypeMapper.java | 4 + .../com/rzyc/mapper/ent/EntPostMapper.java | 17 +++ .../model/dto/AddOrUpdateEntEquipmentDto.java | 106 ++++++++++++++++++ .../rzyc/model/dto/AddOrUpdateEntPostDto.java | 97 ++++++++++++++++ .../resources/mapper/ent/EntPostMapper.xml | 12 ++ .../EnterpriseEquipmentController.java | 16 +++ .../rzyc/controller/PersonalController.java | 16 +++ .../com/rzyc/service/PcBusinessService.java | 40 +++++++ 8 files changed, 308 insertions(+) create mode 100644 inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntEquipmentDto.java create mode 100644 inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntPostDto.java diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/EntDeviceTypeMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/EntDeviceTypeMapper.java index 2197358..077824b 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/EntDeviceTypeMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/EntDeviceTypeMapper.java @@ -25,4 +25,8 @@ public interface EntDeviceTypeMapper extends BaseMapper { * */ ListselectEntEquipmentTypeList(@Param("enterpriseId") String enterpriseId); + int updateEntEquipment(@Param("entDeviceType") EntDeviceType entDeviceType); + + int addEntEquipment(@Param("entDeviceType") EntDeviceType entDeviceType); + } diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntPostMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntPostMapper.java index d9b6182..8304986 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntPostMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntPostMapper.java @@ -1,5 +1,6 @@ package com.rzyc.mapper.ent; +import com.rzyc.model.dto.AddOrUpdateEntPostDto; import com.rzyc.model.ent.EntPost; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; @@ -26,4 +27,20 @@ public interface EntPostMapper extends BaseMapper { * */ List selectEntUserTree(@Param("enterpriseId") String enterpriseId, @Param("postId") String postId); + + /** + * 修改企业岗位 + * @param entPost 新增修改企业岗位对象 + * @return int + * */ + int updateEntPost(@Param("data") EntPost entPost); + + + /** + * 新增企业岗位 + * @param entPost 新增修改企业岗位对象 + * @return int + * */ + int insertEntPost(@Param("data") EntPost entPost); + } diff --git a/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntEquipmentDto.java b/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntEquipmentDto.java new file mode 100644 index 0000000..25751db --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntEquipmentDto.java @@ -0,0 +1,106 @@ +package com.rzyc.model.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; + +/** + * 企业岗位新增和修改Dto + * @author Xuwanxin + * @date 2022/10/19 + * */ +public class AddOrUpdateEntEquipmentDto { + + + @ApiModelProperty(value = "设备分类id") + private String typeId; + + @NotNull + @ApiModelProperty(value = "企业id") + private String enterpriseId; + + @NotNull + @ApiModelProperty(value = "分类名") + private String name; + + @ApiModelProperty(value = "分类logo") + private String logo; + + @ApiModelProperty(value = "父级分类") + private String parentId; + + @ApiModelProperty(value = "所有父级分类") + private String parentPath; + + @ApiModelProperty(value = "父级分类名") + private String parentName; + + @ApiModelProperty(value = "排序") + private Integer sortId; + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + public String getEnterpriseId() { + return enterpriseId; + } + + public void setEnterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLogo() { + return logo; + } + + public void setLogo(String logo) { + this.logo = logo; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public String getParentPath() { + return parentPath; + } + + public void setParentPath(String parentPath) { + this.parentPath = parentPath; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + public Integer getSortId() { + return sortId; + } + + public void setSortId(Integer sortId) { + this.sortId = sortId; + } +} diff --git a/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntPostDto.java b/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntPostDto.java new file mode 100644 index 0000000..a8d3d5a --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntPostDto.java @@ -0,0 +1,97 @@ +package com.rzyc.model.dto; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; + +/** + * 企业岗位新增和修改Dto + * @author Xuwanxin + * @date 2022/10/19 + * */ +public class AddOrUpdateEntPostDto { + + @ApiModelProperty(value = "企业岗位id") + private String postId; + + @NotNull + @ApiModelProperty(value = "企业id") + private String enterpriseId; + + @NotNull + @ApiModelProperty(value = "岗位名") + private String name; + + @ApiModelProperty(value = "父级岗位") + private String parentId; + + @ApiModelProperty(value = "岗位路径") + private String postPath; + + @ApiModelProperty(value = "父级岗位名") + private String parentName; + + @ApiModelProperty(value = "岗位层级") + private Integer postLevel; + + + public String getPostId() { + return postId; + } + + public void setPostId(String postId) { + this.postId = postId; + } + + public String getEnterpriseId() { + return enterpriseId; + } + + public void setEnterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public String getPostPath() { + return postPath; + } + + public void setPostPath(String postPath) { + this.postPath = postPath; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + public Integer getPostLevel() { + return postLevel; + } + + public void setPostLevel(Integer postLevel) { + this.postLevel = postLevel; + } + +} diff --git a/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml b/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml index 7b629f3..a3b6375 100644 --- a/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml +++ b/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml @@ -33,4 +33,16 @@ order by post_level asc + + update set name = #{data.name},parent_id = #{data.parentId},post_path = #{data.postPath},parent_name = #{data.parentName},post_level = #{postLevel}, + modify_time = #{modifyTime} , modify_by = #{modifyBy} + where post_id = #{postId},enterprise_id = #{enterpriseId} + + + + insert into ent_post (post_id,enterprise_id,name,parent_id,post_path,parent_name,post_level,completion_rate,subordinates,create_time,create_by) + values(#{data.postId},#{data.enterpriseId},#{data.name},#{data.parentId},#{data.postPath},#{data.parentName},#{data.postLevel},#{data.completionRate},#{data.subordinates}, + ,#{data.createTime},#{data.createBy}) + + diff --git a/inventory-ent/src/main/java/com/rzyc/controller/EnterpriseEquipmentController.java b/inventory-ent/src/main/java/com/rzyc/controller/EnterpriseEquipmentController.java index e91f974..22ebc63 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/EnterpriseEquipmentController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/EnterpriseEquipmentController.java @@ -5,6 +5,7 @@ import com.common.utils.model.SingleResult; import com.rzyc.config.MethodAnnotation; import com.rzyc.model.EntDevice; import com.rzyc.model.EntDeviceType; +import com.rzyc.model.dto.AddOrUpdateEntEquipmentDto; import com.rzyc.model.ent.EntUser; import com.rzyc.service.PcBusinessService; import io.swagger.annotations.Api; @@ -101,5 +102,20 @@ public class EnterpriseEquipmentController extends BaseController { return pcBusinessService.entEquipmentStatistic(enterpriseId,deviceId); } + /** + * 新增设备,修改设备 + * @return 新增设备,修改设备 + * @throws Exception + */ + @ApiOperation(value = "新增设备,修改设备", notes = "新增设备,修改设备") + @GetMapping(value = "/addOrUpdateEntEquipment") + @PreAuthorize("hasAnyAuthority('addOrUpdateEntEquipment')") + @MethodAnnotation(authorizations = {"addOrUpdateEntEquipment"},name = "新增设备,修改设备") + @ResponseBody + public SingleResult addOrUpdateEntEquipment(AddOrUpdateEntEquipmentDto addOrUpdateEntEquipmentDto)throws Exception{ + return pcBusinessService.addOrUpdateEntEquipment(addOrUpdateEntEquipmentDto); + } + + } diff --git a/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java b/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java index 43e4cdd..bd7834b 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java @@ -322,6 +322,22 @@ public class PersonalController extends BaseController{ } + /** + * 新增和修改公司岗位 + * @param addOrUpdateEntPostDto + * @return list + * @throws Exception + */ + @ApiOperation(value = "新增和修改公司岗位", notes = "新增和修改公司岗位") + @PostMapping(value = "/addOrUpdateEntPost") + @PreAuthorize("hasAnyAuthority('addOrUpdateEntPost:update')") + @MethodAnnotation(authorizations = {"addOrUpdateEntPost:update"},name = "新增和修改公司岗位") + @ResponseBody + @Transactional(rollbackFor = Exception.class) + public SingleResult addOrUpdateEntPost(@RequestBody AddOrUpdateEntPostDto addOrUpdateEntPostDto)throws Exception{ + return pcBusinessService.addOrUpdateEntPost(addOrUpdateEntPostDto); + } + diff --git a/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java b/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java index 5bd72ed..c214451 100644 --- a/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java +++ b/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java @@ -316,6 +316,46 @@ public class PcBusinessService extends BaseController { return singleResult; } + public SingleResult addOrUpdateEntPost(AddOrUpdateEntPostDto addOrUpdateEntPostDto) throws Exception { + SingleResult singleResult = new SingleResult(); + EntPost entPost = new EntPost(); + BeanUtils.copyProperties(addOrUpdateEntPostDto,entPost); + Integer result = 0; + if (null != addOrUpdateEntPostDto && null != addOrUpdateEntPostDto.getPostId()){ + entPost.setModifyBy(getUserId()); + entPost.setModifyTime(new Date()); + result = entPostMapper.updateEntPost(entPost); + }else { + entPost.setCreateBy(getUserId()); + entPost.setCreateTime(new Date()); + result = entPostMapper.insertEntPost(entPost); + } + if (result != 1 ){ + singleResult.setCode(Code.ERROR.getCode()); + singleResult.setMessage(Message.ERROR); + } + return singleResult; + } + + + + public SingleResult addOrUpdateEntEquipment(AddOrUpdateEntEquipmentDto addOrUpdateEntEquipmentDto) throws Exception { + SingleResult singleResult = new SingleResult(); + EntDeviceType entDeviceType = new EntDeviceType(); + BeanUtils.copyProperties(addOrUpdateEntEquipmentDto,entDeviceType); + Integer result = 0; + if (null != addOrUpdateEntEquipmentDto && null != addOrUpdateEntEquipmentDto.getTypeId()){ + result = entDeviceTypeMapper.updateEntEquipment(entDeviceType); + }else { + result = entDeviceTypeMapper.addEntEquipment(entDeviceType); + } + if (result != 1 ){ + singleResult.setCode(Code.ERROR.getCode()); + singleResult.setMessage(Message.ERROR); + } + return singleResult; + } + }