装备,工具租赁价批量修改

This commit is contained in:
mashuai 2025-12-11 20:00:52 +08:00
parent d5125993c0
commit 9d61cb163b
12 changed files with 110 additions and 32 deletions

View File

@ -216,8 +216,9 @@ public class MaTypeController extends BaseController {
@ApiOperation(value = "根据左列表类型id查询右表格")
@GetMapping("/getList")
public AjaxResult getList(@RequestParam(required = false) String typeName, Integer level, @RequestParam(value = "typeId", required = false) Integer parentId) {
List<MaType> listByMaType = iTypeService.getList(typeName,level,parentId);
public AjaxResult getList(@RequestParam(required = false) String typeName, Integer level, @RequestParam(value = "typeId", required = false) Integer parentId,
@RequestParam(value = "keyWord", required = false) String keyWord) {
List<MaType> listByMaType = iTypeService.getList(typeName,level,parentId, keyWord);
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, listByMaType));

View File

@ -96,7 +96,7 @@ public interface MaTypeMapper {
int insertMaTypePropertyNames(@Param("typeId") Long typeId, @Param("list") List<MaTypeProperty> properties);
List<MaType> getList(@Param("typeName") String typeName, @Param("level") Integer level, @Param("parentId") Integer parentId);
List<MaType> getList(@Param("typeName") String typeName, @Param("level") Integer level, @Param("parentId") Integer parentId, @Param("keyWord") String keyWord);
List<MaType> selectMaTypeTreeBy5Level(Integer type);

View File

@ -76,5 +76,5 @@ public interface ITypeService {
AjaxResult updateProperties(MaType maType);
List<MaType> getList(String typeName,Integer level, Integer parentId);
List<MaType> getList(String typeName,Integer level, Integer parentId, String keyWord);
}

View File

@ -474,8 +474,8 @@ public class MaTypeServiceImpl implements ITypeService {
}
@Override
public List<MaType> getList(String typeName, Integer level, Integer parentId) {
List<MaType> list = maTypeMapper.getList(typeName, level, parentId);
public List<MaType> getList(String typeName, Integer level, Integer parentId, String keyWord) {
List<MaType> list = maTypeMapper.getList(typeName, level, parentId, keyWord);
return fillProperties(list);
}

View File

@ -310,4 +310,7 @@ public class MaType extends BaseEntity {
private String mainProcedure;
private String subProcedure;
@ApiModelProperty(value = "装备类目")
private String equipCategory;
}

View File

@ -120,4 +120,21 @@ public class ToolController extends BaseController {
ExcelUtil<ToolEntity> util = new ExcelUtil<ToolEntity>(ToolEntity.class);
util.exportExcel(response, list, "工具类型配置数据");
}
@ApiOperation(value = "工具租赁价(批量)修改")
@PostMapping("/updateLeasePrice")
public AjaxResult updateLeasePrice(@RequestBody ToolEntity info) {
if (info.getTypeIds().isEmpty()) {
return AjaxResult.error("请选择要修改的机具");
}
if (info.getLeasePrice() == null) {
return AjaxResult.error("请输入价格");
}
Integer i = toolService.updateLeasePrice(info);
if (i > 0) {
return AjaxResult.success("修改成功");
} else {
return AjaxResult.error("修改失败");
}
}
}

View File

@ -1,11 +1,13 @@
package com.bonus.material.tool.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ -96,4 +98,12 @@ public class ToolEntity implements Serializable {
// 子节点列表非数据库字段用于构建树形结构
private List<ToolEntity> children = new ArrayList<>();
private List<Integer> typeIds;
@ApiModelProperty(value = "租赁单价")
private BigDecimal leasePrice;
@ApiModelProperty(value = "关键字")
private String keyWord;
}

View File

@ -5,6 +5,7 @@ import com.bonus.material.tool.domain.ToolEntity;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@ -97,4 +98,11 @@ public interface ToolMapper {
@MapKey("id")
List<Map<String, Object>> getSelect(ToolEntity query);
/**
* 工具租赁价批量修改
* @param typeIds
* @param leasePrice
* @return
*/
Integer updateLeasePrice(@Param("typeIds") List<Integer> typeIds, @Param("leasePrice") BigDecimal leasePrice);
}

View File

@ -291,6 +291,16 @@ public class ToolServiceImpl implements ToolService {
}
}
/**
* 工具租赁价批量修改
* @param info
* @return
*/
@Override
public Integer updateLeasePrice(ToolEntity info) {
return toolMapper.updateLeasePrice(info.getTypeIds(), info.getLeasePrice());
}
/**
* 递归为父节点添加子节点

View File

@ -55,4 +55,11 @@ public interface ToolService {
* @return 集合
*/
AjaxResult getSelect(ToolEntity query);
/**
* 工具租赁价批量修改
* @param info
* @return
*/
Integer updateLeasePrice(ToolEntity info);
}

View File

@ -394,15 +394,7 @@
m.unit_name,
m.manage_type,
m.lease_price,
m.is_state_grid,
m.eff_time,
m.rent_price,
m.buy_price,
m.pay_price,
m.level,
m.rated_load,
m.test_load,
m.holding_time,
m.warn_num,
m.del_flag,
m.create_by,
@ -410,7 +402,7 @@
m.remark,
m.maintenance_alarm_day
from ma_type m
where del_flag = '0'
where del_flag = '0' and level != 5
</select>
<select id="getMaTypeSelect" resultType="com.bonus.material.ma.vo.MaType">
@ -565,14 +557,7 @@
m.unit_name,
m.manage_type,
m.lease_price,
m.eff_time,
m.rent_price,
m.buy_price,
m.pay_price,
m.level,
m.rated_load,
m.test_load,
m.holding_time,
m.warn_num,
m.del_flag,
m.create_by,
@ -581,21 +566,41 @@
m.maintenance_alarm_day,
m6.type_name AS subProcedure,
m5.type_name AS mainProcedure,
m4.type_name AS major
m4.type_name AS major,
m3.type_name AS equipCategory
FROM ma_type m
LEFT JOIN ma_type m6 ON m6.type_id = m.parent_id
LEFT JOIN ma_type m5 ON m5.type_id = m6.parent_id
LEFT JOIN ma_type m4 ON m4.type_id = m5.parent_id
LEFT JOIN ma_type m3 ON m3.type_id = m4.parent_id
LEFT JOIN ma_type m2 ON m2.type_id = m3.parent_id
LEFT JOIN ma_type m1 ON m1.type_id = m2.parent_id
WHERE m.LEVEL = '7'
and m.del_flag = 0
and m.parent_id = #{parentId}
<if test="level == 6">
<if test="typeName != null and typeName != ''">
and m6.type_name = #{typeName}
</if>
WHERE
m.del_flag = 0
<if test="level != '' and level == 1">
and m.level = 5
</if>
<if test="level != '' and level == 5">
and m.type_id = #{parentId}
</if>
<if test="level != '' and level == 4">
and m.parent_id = #{parentId}
</if>
<if test="level != '' and level == 3">
and m6.parent_id = #{parentId}
</if>
<if test="level != '' and level == 2">
and m5.parent_id = #{parentId}
</if>
<if test="level != '' and level == 1 and parentId != null">
and m4.parent_id = #{parentId}
</if>
<if test="keyWord != '' and keyWord != null">
and (
locate(#{keyWord}, m6.type_name) > 0 or
locate(#{keyWord}, m5.type_name) > 0 or
locate(#{keyWord}, m4.type_name) > 0 or
locate(#{keyWord}, m3.type_name) > 0 or
locate(#{keyWord}, m.type_name) > 0
)
</if>
</select>
<select id="selectMaTypeTreeBy5Level" resultType="com.bonus.material.ma.vo.MaType">

View File

@ -91,6 +91,14 @@
AND del_flag = '0' <!-- 只删除未删除的节点 -->
</update>
<update id="updateLeasePrice">
update tool_type set lease_price = #{leasePrice} where type_id in
<foreach item="typeId" collection="typeIds" open="(" separator="," close=")">
#{typeId}
</foreach>
and del_flag = 0
</update>
<select id="getTreeSelect" resultType="com.bonus.material.tool.domain.ToolEntity">
SELECT type_id AS typeId,
type_name AS typeName,
@ -146,6 +154,15 @@
<if test="typeName != null and typeName != ''">
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
</if>
<if test="keyWord != '' and keyWord != null">
and (
locate(#{keyWord}, tt.type_name) > 0 or
locate(#{keyWord}, tt1.type_name) > 0 or
locate(#{keyWord}, tt2.type_name) > 0 or
locate(#{keyWord}, tt3.type_name) > 0 or
locate(#{keyWord}, tt4.type_name) > 0
)
</if>
ORDER BY
tt.create_time DESC
</select>