From ab6ed92b27dab771202620a6e44779660570748d Mon Sep 17 00:00:00 2001 From: hyingbo <1363390067@qq.com> Date: 星期五, 25 七月 2025 10:59:58 +0800 Subject: [PATCH] 安灯管理列表添加当前登陆人的数据筛选逻辑 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IAndonOrderService.java | 4 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/AndonOrderMapper.java | 3 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/AndonOrderServiceImpl.java | 12 ++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/AndonOrderController.java | 13 +++++- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/AndonOrderMapper.xml | 38 +++++++++++++++++++ 5 files changed, 67 insertions(+), 3 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/AndonOrderController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/AndonOrderController.java index 2b678bc..a889d23 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/AndonOrderController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/AndonOrderController.java @@ -6,12 +6,16 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.entity.AndonOrder; import org.jeecg.modules.mdc.service.IAndonOrderService; +import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -48,9 +52,12 @@ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { - QueryWrapper<AndonOrder> queryWrapper = QueryGenerator.initQueryWrapper(andonOrder, req.getParameterMap()); - Page<AndonOrder> page = new Page<AndonOrder>(pageNo, pageSize); - IPage<AndonOrder> pageList = andonOrderService.page(page, queryWrapper); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + IPage<AndonOrder> pageList= new Page<>(); + if (StringUtils.isNotBlank(userId)) { + pageList = andonOrderService.pageList(userId, andonOrder, pageNo, pageSize, req); + } return Result.OK(pageList); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/AndonOrderMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/AndonOrderMapper.java index a7d8d2b..159b5b6 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/AndonOrderMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/AndonOrderMapper.java @@ -1,6 +1,7 @@ package org.jeecg.modules.mdc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.AndonOrder; @@ -17,4 +18,6 @@ List<AndonOrder> equAndonList(@Param("equipmentIdList") List<String> equipmentIdList); List<AndonOrder> untreatedAndonList(); + + IPage<AndonOrder> pageList(IPage<AndonOrder> pageData, @Param("andonOrder") AndonOrder andonOrder, @Param("userId") String userId); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/AndonOrderMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/AndonOrderMapper.xml index 9c4dad1..2d6a91c 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/AndonOrderMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/AndonOrderMapper.xml @@ -35,4 +35,42 @@ ORDER BY ao.create_time </select> + <select id="pageList" resultType="org.jeecg.modules.mdc.entity.AndonOrder"> + SELECT + id, + equipment_id, + andon_type, + operator, + operate_time, + responder, + response_time, + processor, + process_time, + order_status, + problem_descreption, + resolution_descreption, + image_files, + del_flag, + create_by, + create_time, + update_by, + update_time, + call_reason, + plant_name + FROM + andon_order + WHERE + del_flag = 0 + AND (operator = #{userId} OR responder = #{userId} OR processor = #{userId}) + <if test="andonOrder.equipmentId != null and andonOrder.equipmentId != '' "> + AND equipment_id LIKE CONCAT(CONCAT('%',#{andonOrder.equipmentId}),'%') + </if> + <if test="andonOrder.andonType != null and andonOrder.andonType != '' "> + AND andon_type = #{andonOrder.andonType} + </if> + <if test="andonOrder.orderStatus != null and andonOrder.orderStatus != '' "> + AND order_status = #{andonOrder.orderStatus} + </if> + + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IAndonOrderService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IAndonOrderService.java index b315837..99be3d3 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IAndonOrderService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IAndonOrderService.java @@ -1,10 +1,12 @@ package org.jeecg.modules.mdc.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.board.vo.EquAndon; import org.jeecg.modules.mdc.entity.AndonOrder; import org.jeecg.modules.mdc.vo.AndonOrderWebSocketVo; +import javax.servlet.http.HttpServletRequest; import java.util.List; /** @@ -24,4 +26,6 @@ void responseData(List<String> ids); void dealWith(AndonOrder andonOrder); + + IPage<AndonOrder> pageList(String userId, AndonOrder andonOrder, Integer pageNo, Integer pageSize, HttpServletRequest req); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/AndonOrderServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/AndonOrderServiceImpl.java index 630a9af..2834fa9 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/AndonOrderServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/AndonOrderServiceImpl.java @@ -2,11 +2,15 @@ import cn.hutool.core.date.DatePattern; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.shiro.SecurityUtils; import org.jeecg.common.constant.WebsocketConst; import org.jeecg.common.exception.JeecgBootException; @@ -20,6 +24,7 @@ import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.AndonOrderWebSocketVo; +import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; import org.jeecg.modules.message.websocket.WebSocket; import org.jeecg.modules.system.service.ISysDictService; import org.jeecg.modules.system.service.ISysUserService; @@ -27,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.util.*; import java.util.stream.Collectors; @@ -221,4 +227,10 @@ this.updateById(andonOrder); } + + @Override + public IPage<AndonOrder> pageList(String userId, AndonOrder andonOrder, Integer pageNo, Integer pageSize, HttpServletRequest req) { + IPage<AndonOrder> pageData = new Page<>(pageNo, pageSize); + return this.baseMapper.pageList(pageData, andonOrder, userId); + } } -- Gitblit v1.9.3