企业端设备树形结构列表,新增和修改

企业端岗位树形结构列表,新增和修改
This commit is contained in:
79493 2022-10-19 17:37:21 +08:00
parent 05ce271bb9
commit 7139270269
8 changed files with 308 additions and 0 deletions

View File

@ -25,4 +25,8 @@ public interface EntDeviceTypeMapper extends BaseMapper<EntDeviceType> {
* */
List<EntDeviceType>selectEntEquipmentTypeList(@Param("enterpriseId") String enterpriseId);
int updateEntEquipment(@Param("entDeviceType") EntDeviceType entDeviceType);
int addEntEquipment(@Param("entDeviceType") EntDeviceType entDeviceType);
}

View File

@ -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<EntPost> {
* */
List<EntPost> 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);
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -33,4 +33,16 @@
order by post_level asc
</select>
<update id="updateEntPost">
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}
</update>
<insert id="insertEntPost">
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})
</insert>
</mapper>

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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;
}
}