功能修改
This commit is contained in:
parent
7cb7484618
commit
06fda2ebf7
|
|
@ -48,7 +48,9 @@ public class MachineController extends BaseController {
|
|||
@GetMapping("/list")
|
||||
public TableDataInfo list(Machine machine)
|
||||
{
|
||||
startPage();
|
||||
if (machine.getPrefix()==null || machine.getPrefix()==null){
|
||||
startPage();
|
||||
}
|
||||
List<MachineVo> list = machineService.selectMachineList(machine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,4 +167,10 @@ public class Machine extends BaseEntity
|
|||
@ApiModelProperty("资产属性ID")
|
||||
private String assetsId;
|
||||
|
||||
@ApiModelProperty("前缀")
|
||||
private Integer prefix;
|
||||
|
||||
@ApiModelProperty("后缀")
|
||||
private Integer suffix;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.ma.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
|
|
@ -61,16 +62,21 @@ public class MachineServiceImpl implements IMachineService
|
|||
@Override
|
||||
public List<MachineVo> selectMachineList(Machine machine)
|
||||
{
|
||||
List<MachineVo> list = machineMapper.selectMachineList(machine);
|
||||
Map<String, String> machineStatus = remoteConfig.getDictValue("ma_machine_status");
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.forEach(machineVo -> {
|
||||
if (StringUtils.isNotBlank(machineVo.getMaStatus())) {
|
||||
machineVo.setStatusName(StringUtils.isBlank(machineStatus.get(machineVo.getMaStatus())) ? "" : machineStatus.get(machineVo.getMaStatus()));
|
||||
}
|
||||
});
|
||||
try {
|
||||
List<MachineVo> list = machineMapper.selectMachineList(machine);
|
||||
Map<String, String> machineStatus = remoteConfig.getDictValue("ma_machine_status");
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.forEach(machineVo -> {
|
||||
if (StringUtils.isNotBlank(machineVo.getMaStatus())) {
|
||||
machineVo.setStatusName(StringUtils.isBlank(machineStatus.get(machineVo.getMaStatus())) ? "" : machineStatus.get(machineVo.getMaStatus()));
|
||||
}
|
||||
});
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</sql>
|
||||
|
||||
<select id="selectMachineList" resultType="com.bonus.material.ma.domain.vo.MachineVo">
|
||||
select a.*
|
||||
from (
|
||||
SELECT
|
||||
ma.ma_id as maId,
|
||||
ma.type_id as typeId,
|
||||
|
|
@ -72,11 +74,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ma.update_time as updateTime,
|
||||
ma.inspect_man as inspectMan,
|
||||
ma.inspect_status as inspectStatus,
|
||||
ma.phone as phone
|
||||
ma.phone as phone,
|
||||
CASE
|
||||
WHEN RIGHT(ma.ma_code, 4) REGEXP '^[0-9]{4}$' THEN CAST(RIGHT(ma.ma_code, 4) AS UNSIGNED)
|
||||
WHEN RIGHT(ma.ma_code, 3) REGEXP '^[0-9]{3}$' THEN CAST(RIGHT(ma.ma_code, 3) AS UNSIGNED)
|
||||
WHEN RIGHT(ma.ma_code, 2) REGEXP '^[0-9]{2}$' THEN CAST(RIGHT(ma.ma_code, 2) AS UNSIGNED)
|
||||
WHEN RIGHT(ma.ma_code, 1) REGEXP '^[0-9]$' THEN CAST(RIGHT(ma.ma_code, 1) AS UNSIGNED)
|
||||
ELSE '0'
|
||||
END AS result
|
||||
FROM
|
||||
ma_machine ma
|
||||
LEFT JOIN ma_type mt ON ma.type_id = mt.type_id
|
||||
and mt.`level` = '4' and mt.del_flag = '0'
|
||||
and mt.`level` = '4' and mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
and mt2.`level` = '3' and mt2.del_flag = '0'
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
|
|
@ -87,13 +96,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where
|
||||
1 = 1
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
and (
|
||||
ma.ma_code like concat('%', #{keyWord}, '%')
|
||||
or ma.assets_code like concat('%', #{keyWord}, '%')
|
||||
or ma.pre_code like concat('%', #{keyWord}, '%')
|
||||
or ma.buy_task like concat('%', #{keyWord}, '%')
|
||||
or ma.own_house like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
and ma.type_id = #{typeId}
|
||||
|
|
@ -102,19 +111,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and ma.ma_status = #{maStatus}
|
||||
</if>
|
||||
<if test="maCode != null and maCode != ''">
|
||||
and ma.ma_code like concat('%', #{maCode}, '%')
|
||||
and ma.ma_code like concat('%', #{maCode}, '%')
|
||||
</if>
|
||||
<if test="qrCode != null and qrCode != ''">
|
||||
and ma.qr_code like concat('%', #{qrCode}, '%')
|
||||
</if>
|
||||
<if test="materialType != null and materialType != ''">
|
||||
and mt3.type_name like concat('%', #{materialType}, '%')
|
||||
and mt3.type_name like concat('%', #{materialType}, '%')
|
||||
</if>
|
||||
<if test="materialName != null and materialName != ''">
|
||||
and mt2.type_name like concat('%', #{materialName}, '%')
|
||||
and mt2.type_name like concat('%', #{materialName}, '%')
|
||||
</if>
|
||||
<if test="materialModel != null and materialModel != ''">
|
||||
and mt.type_name like concat('%', #{materialModel}, '%')
|
||||
and mt.type_name like concat('%', #{materialModel}, '%')
|
||||
</if>
|
||||
<if test="isAssets != null">
|
||||
<if test="isAssets == 0">
|
||||
|
|
@ -125,7 +134,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND (ma.assets_code IS NULL OR ma.assets_code = '')
|
||||
</if>
|
||||
</if>
|
||||
order by ma.create_time desc
|
||||
|
||||
) a
|
||||
where
|
||||
1=1
|
||||
<if test="prefix != null and suffix !=null">
|
||||
and a.result BETWEEN #{prefix} and #{suffix}
|
||||
</if>
|
||||
|
||||
order by a.createTime desc
|
||||
</select>
|
||||
|
||||
<select id="selectMachineByMaId" resultType="com.bonus.material.ma.domain.vo.MachineVo">
|
||||
|
|
|
|||
Loading…
Reference in New Issue