自动化立体仓库 - WCS系统
*
lsh
2025-04-10 fe98cf73031f9736b13c70f4c877d680e0ae3ecb
*
5个文件已修改
103 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/DeviceErrorController.java 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/DeviceErrorMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/DeviceErrorService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/DeviceErrorServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/DeviceErrorMapper.xml 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/DeviceErrorController.java
@@ -1,6 +1,5 @@
package com.zy.asrs.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
@@ -30,6 +29,20 @@
        return R.ok(deviceErrorService.selectById(String.valueOf(id)));
    }
//    @RequestMapping(value = "/deviceError/list/auth")
//    @ManagerAuth
//    public R list(@RequestParam(defaultValue = "1")Integer curr,
//                  @RequestParam(defaultValue = "10")Integer limit,
//                  @RequestParam(required = false)String orderByField,
//                  @RequestParam(required = false)String orderByType,
//                  @RequestParam Map<String, Object> param){
//        EntityWrapper<DeviceError> wrapper = new EntityWrapper<>();
//        excludeTrash(param);
//        convert(param, wrapper);
//        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
//        return R.ok(deviceErrorService.selectPage(new Page<>(curr, limit), wrapper));
//    }
    @RequestMapping(value = "/deviceError/list/auth")
    @ManagerAuth
    public R list(@RequestParam(defaultValue = "1")Integer curr,
@@ -37,11 +50,30 @@
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<DeviceError> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(deviceErrorService.selectPage(new Page<>(curr, limit), wrapper));
        try {
            long id = 0;
            String device = null;
            Integer deviceId = null;
            for (Map.Entry<String, Object> entry : param.entrySet()) {
                String val = String.valueOf(entry.getValue());
                if (Cools.isEmpty(val)) {
                    continue;
                }
                if (entry.getKey().equals("id")) {
                    id = Long.getLong(val);
                } else if (entry.getKey().equals("device")) {
                    device = val;
                } else if (entry.getKey().equals("deviceId")) {
                    deviceId = Integer.valueOf(val);
                }
            }
            List<DeviceError> deviceErrorList = deviceErrorService.selectDeviceErrorList(id,device,deviceId, curr, limit);
            Page<DeviceError> page1 = new Page<DeviceError>(curr, limit).setRecords(deviceErrorList);
            page1.setTotal(deviceErrorService.selectDeviceErrorListTotal(id,device,deviceId));
            return R.ok(page1);
        } catch (Exception e) {
            return R.error("异常" + e);
        }
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
src/main/java/com/zy/asrs/mapper/DeviceErrorMapper.java
@@ -3,7 +3,10 @@
import com.zy.asrs.entity.DeviceError;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
@@ -13,4 +16,18 @@
    Integer deleteByDeviceAndDeviceId(String device, Integer deviceId);
    List<DeviceError> selectDeviceErrorList(
            @Param("id")Long id,
            @Param("device")String device,
            @Param("deviceId")Integer deviceId,
            @Param("pageNumber")Integer curr,
            @Param("pageSize")Integer limit
    ) ;
    Long selectDeviceErrorListTotal(
            @Param("id")Long id,
            @Param("device")String device,
            @Param("deviceId")Integer deviceId
    ) ;
}
src/main/java/com/zy/asrs/service/DeviceErrorService.java
@@ -3,6 +3,8 @@
import com.zy.asrs.entity.DeviceError;
import com.baomidou.mybatisplus.service.IService;
import java.util.List;
public interface DeviceErrorService extends IService<DeviceError> {
    DeviceError selectByDeviceAndDeviceId(String device, Integer deviceId);
@@ -11,4 +13,7 @@
    Integer deleteDeviceError(String device, Integer deviceId);
    List<DeviceError> selectDeviceErrorList(Long id, String device, Integer deviceId, Integer curr, Integer limit) ;
    Long selectDeviceErrorListTotal(Long id,String device, Integer deviceId) ;
}
src/main/java/com/zy/asrs/service/impl/DeviceErrorServiceImpl.java
@@ -9,6 +9,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service("deviceErrorService")
public class DeviceErrorServiceImpl extends ServiceImpl<DeviceErrorMapper, DeviceError> implements DeviceErrorService {
@@ -37,4 +38,14 @@
    public Integer deleteDeviceError(String device, Integer deviceId) {
        return this.baseMapper.deleteByDeviceAndDeviceId(device, deviceId);
    }
    @Override
    public List<DeviceError> selectDeviceErrorList(Long id, String device, Integer deviceId, Integer curr, Integer limit) {
        return this.baseMapper.selectDeviceErrorList(id,device, deviceId,curr,limit);
    }
    @Override
    public Long selectDeviceErrorListTotal(Long id,String device, Integer deviceId) {
        return this.baseMapper.selectDeviceErrorListTotal(id,device, deviceId);
    }
}
src/main/resources/mapper/DeviceErrorMapper.xml
@@ -11,6 +11,18 @@
        <result column="CREATE_TIME" property="createTime" />
    </resultMap>
    <sql id="batchSeq">
        <if test="id != null and id != 0">
            and a.ID = #{id}
        </if>
        <if test="device != null and device != ''">
            and a.DEVICE = #{device}
        </if>
        <if test="deviceId != null and deviceId != 0">
            and a.DEVICE_ID = #{deviceId}
        </if>
    </sql>
    <select id="selectByDeviceAndDeviceId" resultMap="BaseResultMap">
        select top 1 * from "SOURCE"."wcs_device_error"
        where "DEVICE" = #{device}
@@ -23,4 +35,18 @@
        and "DEVICE_ID" = #{deviceId}
    </delete>
    <select id="selectDeviceErrorList" resultMap="BaseResultMap">
        SELECT * FROM "SOURCE"."wcs_device_error"
        WHERE 1=1
        <include refid="batchSeq"></include>
        ORDER BY CREATE_TIME DESC
        LIMIT #{pageSize} OFFSET ((#{pageNumber} - 1) * #{pageSize});
    </select>
    <select id="selectDeviceErrorListTotal" resultType="Long">
        SELECT count(1) FROM "SOURCE"."wcs_device_error"
        WHERE 1=1
        <include refid="batchSeq"></include>
    </select>
</mapper>