配件管理
This commit is contained in:
parent
20db0026a7
commit
7376ca7421
|
|
@ -1,107 +0,0 @@
|
||||||
package com.bonus.common.biz.domain;
|
|
||||||
|
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class MaType extends BaseEntity implements Serializable {
|
|
||||||
private static final long serialVersionUID = 135108051525707131L;
|
|
||||||
|
|
||||||
private Integer isExport;
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
private String id;
|
|
||||||
/**
|
|
||||||
* 上级id
|
|
||||||
*/
|
|
||||||
private String parentId;
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 父级名称
|
|
||||||
*/
|
|
||||||
private String parentName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编码
|
|
||||||
*/
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 层级
|
|
||||||
*/
|
|
||||||
private String level;
|
|
||||||
/**
|
|
||||||
* 库存
|
|
||||||
*/
|
|
||||||
private Integer storageNum;
|
|
||||||
/**
|
|
||||||
* 计量单位id
|
|
||||||
*/
|
|
||||||
private String unitId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 计量单位名称
|
|
||||||
*/
|
|
||||||
private String unitName;
|
|
||||||
/**
|
|
||||||
* 采购单价
|
|
||||||
*/
|
|
||||||
private Integer buyPrice;
|
|
||||||
/**
|
|
||||||
* 租赁单价
|
|
||||||
*/
|
|
||||||
private Integer leasePrice;
|
|
||||||
/**
|
|
||||||
* 管理类型(0是编码 1数量)
|
|
||||||
*/
|
|
||||||
private String manageType;
|
|
||||||
/**
|
|
||||||
* 是否启用
|
|
||||||
*/
|
|
||||||
private String isActive;
|
|
||||||
/**
|
|
||||||
* 额定载荷
|
|
||||||
*/
|
|
||||||
private String rateLoad;
|
|
||||||
/**
|
|
||||||
* 试验载荷
|
|
||||||
*/
|
|
||||||
private String testLoad;
|
|
||||||
/**
|
|
||||||
* 持荷时间 (分钟)
|
|
||||||
*/
|
|
||||||
private String holdTime;
|
|
||||||
/**
|
|
||||||
* 文件路径
|
|
||||||
*/
|
|
||||||
private String fileUrl;
|
|
||||||
/**
|
|
||||||
* 数据所属
|
|
||||||
*/
|
|
||||||
private String companyId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否试验(0 否 1是)
|
|
||||||
*/
|
|
||||||
private String isTest;
|
|
||||||
|
|
||||||
/** 子节点 */
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
|
||||||
private List<MaType> children = new ArrayList<>();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
package com.bonus.common.biz.domain;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门表(SysDept)实体类
|
|
||||||
*
|
|
||||||
* @author makejava
|
|
||||||
* @since 2024-08-15 13:44:56
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class SysDeptTree implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 991828482042492876L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级树标识 1代表查询二级树
|
|
||||||
*/
|
|
||||||
private Integer isTree;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
private Date updateTime;
|
|
||||||
/**
|
|
||||||
* 更新者
|
|
||||||
*/
|
|
||||||
private String updateBy;
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
|
||||||
/**
|
|
||||||
* 创建者
|
|
||||||
*/
|
|
||||||
private String createBy;
|
|
||||||
/**
|
|
||||||
* 删除标志(0代表存在 2代表删除)
|
|
||||||
*/
|
|
||||||
private String delFlag;
|
|
||||||
/**
|
|
||||||
* 部门状态(0正常 1停用)
|
|
||||||
*/
|
|
||||||
private String status;
|
|
||||||
/**
|
|
||||||
* 邮箱
|
|
||||||
*/
|
|
||||||
private String email;
|
|
||||||
/**
|
|
||||||
* 联系电话
|
|
||||||
*/
|
|
||||||
private String phone;
|
|
||||||
/**
|
|
||||||
* 负责人
|
|
||||||
*/
|
|
||||||
private String leader;
|
|
||||||
/**
|
|
||||||
* 显示顺序
|
|
||||||
*/
|
|
||||||
private Integer orderNum;
|
|
||||||
/**
|
|
||||||
* 部门名称
|
|
||||||
*/
|
|
||||||
private String deptName;
|
|
||||||
/**
|
|
||||||
* 祖级列表
|
|
||||||
*/
|
|
||||||
private String ancestors;
|
|
||||||
/**
|
|
||||||
* 父部门id
|
|
||||||
*/
|
|
||||||
private String parentId;
|
|
||||||
/**
|
|
||||||
* 部门id
|
|
||||||
*/
|
|
||||||
private String deptId;
|
|
||||||
|
|
||||||
/** 子节点 */
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
|
||||||
private List<SysDeptTree> children = new ArrayList<>();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
package com.bonus.material.basic.controller;
|
package com.bonus.material.basic.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||||
|
import com.bonus.common.biz.domain.TreeSelect;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
|
import com.bonus.system.api.RemoteUserService;
|
||||||
|
import com.bonus.system.api.domain.SysDept;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -20,6 +24,10 @@ import com.bonus.material.basic.service.IBmUnitPersonService;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 往来单位管理Controller
|
* 往来单位管理Controller
|
||||||
*
|
*
|
||||||
|
|
@ -34,13 +42,35 @@ public class BmUnitPersonController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBmUnitPersonService bmUnitPersonService;
|
private IBmUnitPersonService bmUnitPersonService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门用户下拉树
|
* 查询部门下拉树
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "查询部门用户下拉树")
|
@ApiOperation(value = "查询部门下拉树")
|
||||||
@GetMapping("/getDeptUserTree")
|
@GetMapping("/getDeptUserTree")
|
||||||
public AjaxResult selectDeptTree(BmUnitPerson unitPerson) {
|
public AjaxResult selectDeptTree(SysDept dept) {
|
||||||
return bmUnitPersonService.selectDeptTree(unitPerson);
|
AjaxResult ajaxResult = remoteUserService.deptTree(dept, null);
|
||||||
|
List<TreeSelect> data = (List<TreeSelect>) ajaxResult.get("data");
|
||||||
|
if (CollectionUtils.isEmpty(data)) {
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
List<TreeSelect> branches = getBranches(data);
|
||||||
|
return AjaxResult.success(branches);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<TreeSelect> getBranches(List<TreeSelect> data) {
|
||||||
|
List<TreeSelect> branches = new ArrayList<>();
|
||||||
|
for (TreeSelect company : data) {
|
||||||
|
if (company.getChildren() != null) {
|
||||||
|
for (TreeSelect child : company.getChildren()) {
|
||||||
|
// 添加分公司
|
||||||
|
branches.add(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return branches;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.bonus.material.basic.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.bonus.common.biz.domain.SysDeptTree;
|
|
||||||
import com.bonus.common.biz.domain.TreeNode;
|
import com.bonus.common.biz.domain.TreeNode;
|
||||||
import com.bonus.material.basic.domain.BmUnitPerson;
|
import com.bonus.material.basic.domain.BmUnitPerson;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,10 @@ public class PartTypeController extends BaseController
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取配件类型管理详细信息")
|
@ApiOperation(value = "获取配件类型管理详细信息")
|
||||||
@RequiresPermissions("ma:type:query")
|
@RequiresPermissions("ma:type:query")
|
||||||
@GetMapping(value = "/{paId}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("paId") Long paId)
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
return success(partTypeService.selectPartTypeByPaId(paId));
|
return AjaxResult.success(partTypeService.selectPartTypeByPaId(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -92,7 +92,7 @@ public class PartTypeController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody PartType partType)
|
public AjaxResult add(@RequestBody PartType partType)
|
||||||
{
|
{
|
||||||
return toAjax(partTypeService.insertPartType(partType));
|
return partTypeService.insertPartType(partType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -105,7 +105,7 @@ public class PartTypeController extends BaseController
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody PartType partType)
|
public AjaxResult edit(@RequestBody PartType partType)
|
||||||
{
|
{
|
||||||
return toAjax(partTypeService.updatePartType(partType));
|
return partTypeService.updatePartType(partType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -115,9 +115,9 @@ public class PartTypeController extends BaseController
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("ma:type:remove")
|
@RequiresPermissions("ma:type:remove")
|
||||||
@SysLog(title = "配件类型管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除配件类型管理")
|
@SysLog(title = "配件类型管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除配件类型管理")
|
||||||
@DeleteMapping("/{paIds}")
|
@DeleteMapping("/{id}")
|
||||||
public AjaxResult remove(@PathVariable Long paId)
|
public AjaxResult remove(@PathVariable Long id)
|
||||||
{
|
{
|
||||||
return partTypeService.deletePartTypeByPaId(paId);
|
return partTypeService.deletePartTypeByPaId(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public class PartType extends BaseEntity
|
||||||
private Integer isExport;
|
private Integer isExport;
|
||||||
|
|
||||||
/** 类型ID */
|
/** 类型ID */
|
||||||
private Long paId;
|
private Long id;
|
||||||
|
|
||||||
/** 类型名称 */
|
/** 类型名称 */
|
||||||
@Excel(name = "名称")
|
@Excel(name = "名称")
|
||||||
|
|
@ -78,4 +78,7 @@ public class PartType extends BaseEntity
|
||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关键字")
|
||||||
|
private String keyWord;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ public interface PartTypeMapper
|
||||||
/**
|
/**
|
||||||
* 查询配件类型管理
|
* 查询配件类型管理
|
||||||
*
|
*
|
||||||
* @param paId 配件类型管理主键
|
* @param id 配件类型管理主键
|
||||||
* @return 配件类型管理
|
* @return 配件类型管理
|
||||||
*/
|
*/
|
||||||
public PartType selectPartTypeByPaId(Long paId);
|
public PartType selectPartTypeByPaId(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询配件类型管理列表
|
* 查询配件类型管理列表
|
||||||
|
|
@ -48,18 +48,10 @@ public interface PartTypeMapper
|
||||||
/**
|
/**
|
||||||
* 删除配件类型管理
|
* 删除配件类型管理
|
||||||
*
|
*
|
||||||
* @param paId 配件类型管理主键
|
* @param id 配件类型管理主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deletePartTypeByPaId(Long paId);
|
public int deletePartTypeByPaId(Long id);
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除配件类型管理
|
|
||||||
*
|
|
||||||
* @param paIds 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deletePartTypeByPaIds(Long paIds);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取配件类型树
|
* 获取配件类型树
|
||||||
|
|
@ -74,4 +66,25 @@ public interface PartTypeMapper
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PartType> getTypeList(PartType partType);
|
List<PartType> getTypeList(PartType partType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据名称查询
|
||||||
|
* @param partType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PartType selectByName(PartType partType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int selectById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配件是否在用
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int selectPart(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ public interface IPartTypeService
|
||||||
/**
|
/**
|
||||||
* 查询配件类型管理
|
* 查询配件类型管理
|
||||||
*
|
*
|
||||||
* @param paId 配件类型管理主键
|
* @param id 配件类型管理主键
|
||||||
* @return 配件类型管理
|
* @return 配件类型管理
|
||||||
*/
|
*/
|
||||||
public PartType selectPartTypeByPaId(Long paId);
|
public PartType selectPartTypeByPaId(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询配件类型管理列表
|
* 查询配件类型管理列表
|
||||||
|
|
@ -35,7 +35,7 @@ public interface IPartTypeService
|
||||||
* @param partType 配件类型管理
|
* @param partType 配件类型管理
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertPartType(PartType partType);
|
public AjaxResult insertPartType(PartType partType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改配件类型管理
|
* 修改配件类型管理
|
||||||
|
|
@ -43,23 +43,15 @@ public interface IPartTypeService
|
||||||
* @param partType 配件类型管理
|
* @param partType 配件类型管理
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updatePartType(PartType partType);
|
public AjaxResult updatePartType(PartType partType);
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除配件类型管理
|
|
||||||
*
|
|
||||||
* @param paIds 需要删除的配件类型管理主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deletePartTypeByPaIds(Long paIds);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除配件类型管理信息
|
* 删除配件类型管理信息
|
||||||
*
|
*
|
||||||
* @param paId 配件类型管理主键
|
* @param id 配件类型管理主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public AjaxResult deletePartTypeByPaId(Long paId);
|
public AjaxResult deletePartTypeByPaId(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取配件类型树
|
* 获取配件类型树
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,14 @@ package com.bonus.material.ma.service.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.bonus.common.biz.domain.TreeBuild;
|
import com.bonus.common.biz.domain.TreeBuild;
|
||||||
import com.bonus.common.biz.domain.TreeNode;
|
import com.bonus.common.biz.domain.TreeNode;
|
||||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -32,13 +34,13 @@ public class PartTypeServiceImpl implements IPartTypeService
|
||||||
/**
|
/**
|
||||||
* 查询配件类型管理
|
* 查询配件类型管理
|
||||||
*
|
*
|
||||||
* @param paId 配件类型管理主键
|
* @param id 配件类型管理主键
|
||||||
* @return 配件类型管理
|
* @return 配件类型管理
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PartType selectPartTypeByPaId(Long paId)
|
public PartType selectPartTypeByPaId(Long id)
|
||||||
{
|
{
|
||||||
return partTypeMapper.selectPartTypeByPaId(paId);
|
return partTypeMapper.selectPartTypeByPaId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -73,10 +75,25 @@ public class PartTypeServiceImpl implements IPartTypeService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertPartType(PartType partType)
|
public AjaxResult insertPartType(PartType partType)
|
||||||
{
|
{
|
||||||
|
if (partType == null || partType.getPaName() == null) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||||
|
}
|
||||||
|
//新增判重,二级和三级不同类型下面可以重复,一级不能重复
|
||||||
|
PartType type = partTypeMapper.selectByName(partType);
|
||||||
|
if (type != null) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||||
|
}
|
||||||
partType.setCreateTime(DateUtils.getNowDate());
|
partType.setCreateTime(DateUtils.getNowDate());
|
||||||
return partTypeMapper.insertPartType(partType);
|
partType.setCreateBy(SecurityUtils.getUserId().toString());
|
||||||
|
partType.setParentId(partType.getId() != null ? partType.getId() : 0L);
|
||||||
|
partType.setLevel(partType.getLevel() != null ? String.valueOf(Integer.valueOf(partType.getLevel()) + 1) : "1");
|
||||||
|
int result = partTypeMapper.insertPartType(partType);
|
||||||
|
if (result > 0) {
|
||||||
|
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||||
|
}
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -86,34 +103,47 @@ public class PartTypeServiceImpl implements IPartTypeService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updatePartType(PartType partType)
|
public AjaxResult updatePartType(PartType partType)
|
||||||
{
|
{
|
||||||
|
if (partType == null || partType.getPaName() == null || partType.getParentId() == null || partType.getId() == null) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||||
|
}
|
||||||
|
//修改判重,二级和三级不同类型下面可以重复,一级不能重复
|
||||||
|
PartType type = partTypeMapper.selectByName(partType);
|
||||||
|
if (type != null) {
|
||||||
|
if (!Objects.equals(type.getId(), partType.getId())) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
partType.setUpdateTime(DateUtils.getNowDate());
|
partType.setUpdateTime(DateUtils.getNowDate());
|
||||||
return partTypeMapper.updatePartType(partType);
|
partType.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||||
}
|
int result = partTypeMapper.updatePartType(partType);
|
||||||
|
if (result > 0) {
|
||||||
/**
|
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||||
* 批量删除配件类型管理
|
}
|
||||||
*
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||||
* @param paId 需要删除的配件类型管理主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deletePartTypeByPaIds(Long paId)
|
|
||||||
{
|
|
||||||
return partTypeMapper.deletePartTypeByPaIds(paId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除配件类型管理信息
|
* 删除配件类型管理信息
|
||||||
*
|
*
|
||||||
* @param paId 配件类型管理主键
|
* @param id 配件类型管理主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult deletePartTypeByPaId(Long paId)
|
public AjaxResult deletePartTypeByPaId(Long id)
|
||||||
{
|
{
|
||||||
int result = partTypeMapper.deletePartTypeByPaId(paId);
|
//判断配件类型下是否有下级配件
|
||||||
|
int count = partTypeMapper.selectById(id);
|
||||||
|
if (count > 0) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该类型下有下级配件,不允许删除");
|
||||||
|
}
|
||||||
|
//判断配件是否在用,在用则不能删除
|
||||||
|
int i = partTypeMapper.selectPart(id);
|
||||||
|
if (i > 0) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该配件类型处于在用状态,不允许删除");
|
||||||
|
}
|
||||||
|
int result = partTypeMapper.deletePartTypeByPaId(id);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||||
}
|
}
|
||||||
|
|
@ -153,5 +183,4 @@ public class PartTypeServiceImpl implements IPartTypeService
|
||||||
return partTypeMapper.getTypeList(partType);
|
return partTypeMapper.getTypeList(partType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
<result property="storageNum" column="storage_num" />
|
<result property="storageNum" column="storage_num" />
|
||||||
<result property="unitId" column="unit_id" />
|
<result property="unitId" column="unit_id" />
|
||||||
|
<result property="unitName" column="unit_name" />
|
||||||
<result property="buyPrice" column="buy_price" />
|
<result property="buyPrice" column="buy_price" />
|
||||||
<result property="level" column="level" />
|
<result property="level" column="level" />
|
||||||
<result property="warnNum" column="warn_num" />
|
<result property="warnNum" column="warn_num" />
|
||||||
|
|
@ -24,12 +25,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectPartTypeVo">
|
<sql id="selectPartTypeVo">
|
||||||
select pa_id, pa_name, parent_id, status, storage_num, unit_id, buy_price, level, warn_num, del_flag, create_by, update_by, create_time, update_time, remark, company_id, year from ma_part_type
|
select pa_id, pa_name, parent_id, status, storage_num, unit_id, unit_name, buy_price, level, warn_num, del_flag, create_by, update_by, create_time, update_time, remark, company_id, year from ma_part_type
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectPartTypeByPaId" parameterType="Long" resultMap="PartTypeResult">
|
<select id="selectPartTypeByPaId" parameterType="Long" resultMap="PartTypeResult">
|
||||||
<include refid="selectPartTypeVo"/>
|
<include refid="selectPartTypeVo"/>
|
||||||
where pa_id = #{paId}
|
where pa_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPartTree" resultType="com.bonus.common.biz.domain.TreeNode">
|
<select id="getPartTree" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||||
|
|
@ -44,18 +45,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="selectPartTypeList" resultType="com.bonus.common.biz.domain.TreeNode">
|
<select id="selectPartTypeList" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||||
select pa_id as id, pa_name as label, parent_id as parentId, storage_num as storageNum, unit_name as unitName, buy_price as buyPrice, level as level, remark as remark from ma_part_type
|
select pa_id as id, pa_name as label, parent_id as parentId, storage_num as storageNum, unit_name as unitName, buy_price as buyPrice, level as level, remark as remark from ma_part_type
|
||||||
where
|
where del_flag = '0'
|
||||||
<if test="paName != null and paName != ''">
|
<if test="keyWord != null and keyWord != ''">
|
||||||
AND pa_name like concat('%', #{paName}, '%')
|
and (
|
||||||
</if>
|
pa_name like concat('%', #{keyWord}, '%')
|
||||||
|
or storage_num like concat('%', #{keyWord}, '%')
|
||||||
|
or unit_name = #{keyWord},
|
||||||
|
or buy_price like concat('%', #{keyWord}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getTypeList" resultType="com.bonus.material.ma.domain.PartType">
|
<select id="getTypeList" resultType="com.bonus.material.ma.domain.PartType">
|
||||||
select pa_id as paId, pa_name as paName, parent_id as parentId, storage_num as storageNum, unit_name as unitName, buy_price as buyPrice, level as level, remark as remark from ma_part_type
|
select pa_id as id, pa_name as paName, parent_id as parentId, storage_num as storageNum, unit_name as unitName, buy_price as buyPrice, level as level, remark as remark from ma_part_type
|
||||||
where
|
where del_flag = '0'
|
||||||
<if test="paName != null and paName != ''">
|
<if test="keyWord != null and keyWord != ''">
|
||||||
AND pa_name like concat('%', #{paName}, '%')
|
and (
|
||||||
</if>
|
pa_name like concat('%', #{keyWord}, '%')
|
||||||
|
or storage_num like concat('%', #{keyWord}, '%')
|
||||||
|
or unit_name = #{keyWord},
|
||||||
|
or buy_price like concat('%', #{keyWord}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByName" resultType="com.bonus.material.ma.domain.PartType">
|
||||||
|
select pa_id as id, pa_name as paName, parent_id as parentId, storage_num as storageNum, unit_name as unitName, buy_price as buyPrice, level as level, remark as remark from ma_part_type
|
||||||
|
where del_flag = '0'
|
||||||
|
<if test="paName != null and paName != ''">
|
||||||
|
AND pa_name = #{paName}
|
||||||
|
</if>
|
||||||
|
<if test="parentId != null">
|
||||||
|
AND parent_id = #{parentId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectById" resultType="java.lang.Integer">
|
||||||
|
select count(*) from ma_part_type where parent_id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPart" resultType="java.lang.Integer">
|
||||||
|
select count(*) from repair_apply_record where part_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertPartType" parameterType="com.bonus.material.ma.domain.PartType" useGeneratedKeys="true" keyProperty="paId">
|
<insert id="insertPartType" parameterType="com.bonus.material.ma.domain.PartType" useGeneratedKeys="true" keyProperty="paId">
|
||||||
|
|
@ -66,10 +96,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
<if test="storageNum != null">storage_num,</if>
|
<if test="storageNum != null">storage_num,</if>
|
||||||
<if test="unitId != null">unit_id,</if>
|
<if test="unitId != null">unit_id,</if>
|
||||||
|
<if test="unitName != null">unit_name,</if>
|
||||||
<if test="buyPrice != null">buy_price,</if>
|
<if test="buyPrice != null">buy_price,</if>
|
||||||
<if test="level != null">level,</if>
|
<if test="level != null">level,</if>
|
||||||
<if test="warnNum != null">warn_num,</if>
|
<if test="warnNum != null">warn_num,</if>
|
||||||
<if test="delFlag != null">del_flag,</if>
|
del_flag,
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
|
|
@ -84,10 +115,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
<if test="storageNum != null">#{storageNum},</if>
|
<if test="storageNum != null">#{storageNum},</if>
|
||||||
<if test="unitId != null">#{unitId},</if>
|
<if test="unitId != null">#{unitId},</if>
|
||||||
|
<if test="unitName != null">#{unitName},</if>
|
||||||
<if test="buyPrice != null">#{buyPrice},</if>
|
<if test="buyPrice != null">#{buyPrice},</if>
|
||||||
<if test="level != null">#{level},</if>
|
<if test="level != null">#{level},</if>
|
||||||
<if test="warnNum != null">#{warnNum},</if>
|
<if test="warnNum != null">#{warnNum},</if>
|
||||||
<if test="delFlag != null">#{delFlag},</if>
|
0,
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
|
@ -106,29 +138,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
<if test="storageNum != null">storage_num = #{storageNum},</if>
|
<if test="storageNum != null">storage_num = #{storageNum},</if>
|
||||||
<if test="unitId != null">unit_id = #{unitId},</if>
|
<if test="unitId != null">unit_id = #{unitId},</if>
|
||||||
|
<if test="unitName != null">unit_name = #{unitName},</if>
|
||||||
<if test="buyPrice != null">buy_price = #{buyPrice},</if>
|
<if test="buyPrice != null">buy_price = #{buyPrice},</if>
|
||||||
<if test="level != null">level = #{level},</if>
|
<if test="level != null">level = #{level},</if>
|
||||||
<if test="warnNum != null">warn_num = #{warnNum},</if>
|
<if test="warnNum != null">warn_num = #{warnNum},</if>
|
||||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="companyId != null">company_id = #{companyId},</if>
|
<if test="companyId != null">company_id = #{companyId},</if>
|
||||||
<if test="year != null">year = #{year},</if>
|
<if test="year != null">year = #{year},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where pa_id = #{paId}
|
where pa_id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deletePartTypeByPaId" parameterType="Long">
|
<delete id="deletePartTypeByPaId" parameterType="Long">
|
||||||
update ma_part_type set del_flag = '2' where pa_id = #{paId}
|
update ma_part_type set del_flag = '2' where pa_id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deletePartTypeByPaIds" parameterType="String">
|
|
||||||
update ma_part_type set del_flag = '2' where pa_id in
|
|
||||||
<foreach item="paId" collection="array" open="(" separator="," close=")">
|
|
||||||
#{paId}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue