配件类型管理
This commit is contained in:
parent
39ee20b818
commit
e2e7dbd72d
|
|
@ -1,8 +1,10 @@
|
|||
package com.bonus.common.biz.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -30,11 +32,15 @@ public class TreeNode {
|
|||
|
||||
private String code;
|
||||
|
||||
private float num;
|
||||
/** 原值 */
|
||||
@ApiModelProperty(value = "原值")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
private String modelCode;
|
||||
/** 实时库存 */
|
||||
@ApiModelProperty(value = "实时库存")
|
||||
private Long storageNum;
|
||||
|
||||
private String manageType;
|
||||
private String remark;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<TreeNode> children = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -44,11 +44,16 @@ public class PartTypeController extends BaseController
|
|||
@ApiOperation(value = "查询配件类型管理列表")
|
||||
@RequiresPermissions("ma:type:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(PartType partType)
|
||||
public AjaxResult list(PartType partType)
|
||||
{
|
||||
startPage();
|
||||
List<PartType> list = partTypeService.selectPartTypeList(partType);
|
||||
return getDataTable(list);
|
||||
return partTypeService.selectPartTypeList(partType);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "配件类型所属上级树")
|
||||
@RequiresPermissions("ma:type:query")
|
||||
@GetMapping("/getPartTree")
|
||||
public AjaxResult getPartTree(PartType dto){
|
||||
return partTypeService.getPartTree(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -61,7 +66,7 @@ public class PartTypeController extends BaseController
|
|||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PartType partType)
|
||||
{
|
||||
List<PartType> list = partTypeService.selectPartTypeList(partType);
|
||||
List<PartType> list = partTypeService.getTypeList(partType);
|
||||
ExcelUtil<PartType> util = new ExcelUtil<PartType>(PartType.class);
|
||||
util.exportExcel(response, list, "配件类型管理数据");
|
||||
}
|
||||
|
|
@ -111,8 +116,8 @@ public class PartTypeController extends BaseController
|
|||
@RequiresPermissions("ma:type:remove")
|
||||
@SysLog(title = "配件类型管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除配件类型管理")
|
||||
@DeleteMapping("/{paIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] paIds)
|
||||
public AjaxResult remove(@PathVariable Long paId)
|
||||
{
|
||||
return toAjax(partTypeService.deletePartTypeByPaIds(paIds));
|
||||
return partTypeService.deletePartTypeByPaId(paId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,24 +13,23 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
* @author xsheng
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class PartType extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer isExport;
|
||||
|
||||
/** 类型ID */
|
||||
private Long paId;
|
||||
|
||||
/** 类型名称 */
|
||||
@Excel(name = "类型名称")
|
||||
@Excel(name = "名称")
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String paName;
|
||||
|
||||
/** 上级ID */
|
||||
@Excel(name = "上级ID")
|
||||
@ApiModelProperty(value = "上级ID")
|
||||
private Long parentId;
|
||||
|
||||
|
|
@ -38,28 +37,30 @@ public class PartType extends BaseEntity
|
|||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 实时库存 */
|
||||
@Excel(name = "实时库存")
|
||||
@ApiModelProperty(value = "实时库存")
|
||||
private Long storageNum;
|
||||
|
||||
/** 计量单位ID */
|
||||
@Excel(name = "计量单位ID")
|
||||
@ApiModelProperty(value = "计量单位ID")
|
||||
private String unitId;
|
||||
|
||||
/** 计量单位名称 */
|
||||
@Excel(name = "计量单位")
|
||||
@ApiModelProperty(value = "计量单位名称")
|
||||
private String unitName;
|
||||
|
||||
/** 原值 */
|
||||
@Excel(name = "原值")
|
||||
@Excel(name = "购置价格(元)")
|
||||
@ApiModelProperty(value = "原值")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
/** 实时库存 */
|
||||
@Excel(name = "数量")
|
||||
@ApiModelProperty(value = "实时库存")
|
||||
private Long storageNum;
|
||||
|
||||
/** 层级 */
|
||||
@Excel(name = "层级")
|
||||
@ApiModelProperty(value = "层级")
|
||||
private String level;
|
||||
|
||||
/** 库存预警数量 */
|
||||
@Excel(name = "库存预警数量")
|
||||
@ApiModelProperty(value = "库存预警数量")
|
||||
private Long warnNum;
|
||||
|
||||
|
|
@ -67,14 +68,14 @@ public class PartType extends BaseEntity
|
|||
private String delFlag;
|
||||
|
||||
/** 数据所属组织 */
|
||||
@Excel(name = "数据所属组织")
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private String companyId;
|
||||
|
||||
/** 框架年份 */
|
||||
@Excel(name = "框架年份")
|
||||
@ApiModelProperty(value = "框架年份")
|
||||
private String year;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.material.ma.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.biz.domain.TreeNode;
|
||||
import com.bonus.material.ma.domain.PartType;
|
||||
|
||||
/**
|
||||
|
|
@ -25,7 +27,7 @@ public interface PartTypeMapper
|
|||
* @param partType 配件类型管理
|
||||
* @return 配件类型管理集合
|
||||
*/
|
||||
public List<PartType> selectPartTypeList(PartType partType);
|
||||
public List<TreeNode> selectPartTypeList(PartType partType);
|
||||
|
||||
/**
|
||||
* 新增配件类型管理
|
||||
|
|
@ -57,5 +59,19 @@ public interface PartTypeMapper
|
|||
* @param paIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePartTypeByPaIds(Long[] paIds);
|
||||
public int deletePartTypeByPaIds(Long paIds);
|
||||
|
||||
/**
|
||||
* 获取配件类型树
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<TreeNode> getPartTree(PartType dto);
|
||||
|
||||
/**
|
||||
* 获取配件类型列表
|
||||
* @param partType
|
||||
* @return
|
||||
*/
|
||||
List<PartType> getTypeList(PartType partType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.material.ma.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.ma.domain.PartType;
|
||||
|
||||
/**
|
||||
|
|
@ -25,7 +27,7 @@ public interface IPartTypeService
|
|||
* @param partType 配件类型管理
|
||||
* @return 配件类型管理集合
|
||||
*/
|
||||
public List<PartType> selectPartTypeList(PartType partType);
|
||||
public AjaxResult selectPartTypeList(PartType partType);
|
||||
|
||||
/**
|
||||
* 新增配件类型管理
|
||||
|
|
@ -49,7 +51,7 @@ public interface IPartTypeService
|
|||
* @param paIds 需要删除的配件类型管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePartTypeByPaIds(Long[] paIds);
|
||||
public int deletePartTypeByPaIds(Long paIds);
|
||||
|
||||
/**
|
||||
* 删除配件类型管理信息
|
||||
|
|
@ -57,5 +59,19 @@ public interface IPartTypeService
|
|||
* @param paId 配件类型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePartTypeByPaId(Long paId);
|
||||
public AjaxResult deletePartTypeByPaId(Long paId);
|
||||
|
||||
/**
|
||||
* 获取配件类型树
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getPartTree(PartType dto);
|
||||
|
||||
/**
|
||||
* 导出结果集
|
||||
* @param partType
|
||||
* @return
|
||||
*/
|
||||
List<PartType> getTypeList(PartType partType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,15 @@
|
|||
package com.bonus.material.ma.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.biz.domain.TreeBuild;
|
||||
import com.bonus.common.biz.domain.TreeNode;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.ma.mapper.PartTypeMapper;
|
||||
|
|
@ -15,6 +23,7 @@ import com.bonus.material.ma.service.IPartTypeService;
|
|||
* @date 2024-09-27
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PartTypeServiceImpl implements IPartTypeService
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -39,9 +48,22 @@ public class PartTypeServiceImpl implements IPartTypeService
|
|||
* @return 配件类型管理
|
||||
*/
|
||||
@Override
|
||||
public List<PartType> selectPartTypeList(PartType partType)
|
||||
public AjaxResult selectPartTypeList(PartType partType)
|
||||
{
|
||||
return partTypeMapper.selectPartTypeList(partType);
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = partTypeMapper.selectPartTypeList(partType);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("配件类型树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -73,13 +95,13 @@ public class PartTypeServiceImpl implements IPartTypeService
|
|||
/**
|
||||
* 批量删除配件类型管理
|
||||
*
|
||||
* @param paIds 需要删除的配件类型管理主键
|
||||
* @param paId 需要删除的配件类型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePartTypeByPaIds(Long[] paIds)
|
||||
public int deletePartTypeByPaIds(Long paId)
|
||||
{
|
||||
return partTypeMapper.deletePartTypeByPaIds(paIds);
|
||||
return partTypeMapper.deletePartTypeByPaIds(paId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -89,8 +111,47 @@ public class PartTypeServiceImpl implements IPartTypeService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePartTypeByPaId(Long paId)
|
||||
public AjaxResult deletePartTypeByPaId(Long paId)
|
||||
{
|
||||
return partTypeMapper.deletePartTypeByPaId(paId);
|
||||
int result = partTypeMapper.deletePartTypeByPaId(paId);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配件类型树
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getPartTree(PartType dto) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = partTypeMapper.getPartTree(dto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("配件所属上级树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配件类型列表
|
||||
* @param partType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PartType> getTypeList(PartType partType) {
|
||||
return partTypeMapper.getTypeList(partType);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,27 +27,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectPartTypeList" parameterType="com.bonus.material.ma.domain.PartType" resultMap="PartTypeResult">
|
||||
<include refid="selectPartTypeVo"/>
|
||||
<where>
|
||||
<if test="paName != null and paName != ''"> and pa_name like concat('%', #{paName}, '%')</if>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="storageNum != null "> and storage_num = #{storageNum}</if>
|
||||
<if test="unitId != null and unitId != ''"> and unit_id = #{unitId}</if>
|
||||
<if test="buyPrice != null "> and buy_price = #{buyPrice}</if>
|
||||
<if test="level != null and level != ''"> and level = #{level}</if>
|
||||
<if test="warnNum != null "> and warn_num = #{warnNum}</if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
|
||||
<if test="year != null and year != ''"> and year = #{year}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPartTypeByPaId" parameterType="Long" resultMap="PartTypeResult">
|
||||
<include refid="selectPartTypeVo"/>
|
||||
where pa_id = #{paId}
|
||||
</select>
|
||||
|
||||
<select id="getPartTree" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||
SELECT pa_id AS id,
|
||||
pa_name AS label,
|
||||
parent_id AS parentId,
|
||||
level
|
||||
FROM ma_part_type
|
||||
WHERE del_flag = '0' and level != '3'
|
||||
ORDER BY create_time
|
||||
</select>
|
||||
|
||||
<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
|
||||
where
|
||||
<if test="paName != null and paName != ''">
|
||||
AND pa_name like concat('%', #{paName}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<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
|
||||
where
|
||||
<if test="paName != null and paName != ''">
|
||||
AND pa_name like concat('%', #{paName}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insertPartType" parameterType="com.bonus.material.ma.domain.PartType" useGeneratedKeys="true" keyProperty="paId">
|
||||
insert into ma_part_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -112,11 +122,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deletePartTypeByPaId" parameterType="Long">
|
||||
delete from ma_part_type where pa_id = #{paId}
|
||||
update ma_part_type set del_flag = '2' where pa_id = #{paId}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePartTypeByPaIds" parameterType="String">
|
||||
delete from ma_part_type where pa_id in
|
||||
update ma_part_type set del_flag = '2' where pa_id in
|
||||
<foreach item="paId" collection="array" open="(" separator="," close=")">
|
||||
#{paId}
|
||||
</foreach>
|
||||
|
|
|
|||
Loading…
Reference in New Issue