Ver Fonte

新增调拨记录对于调拨申请信息以及调拨设备信息的组合分页查询

lingpeng.li há 1 mês atrás
pai
commit
16ad1a0405

+ 25 - 0
zgzt-sbsmzq/jeecg-module-lifecycle/src/main/java/org/jeecg/modules/equipmentDisposal/deviceTransfer/controller/DeviceTransferController.java

@@ -17,12 +17,14 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.RedisUtil;
 import org.jeecg.common.util.TokenUtils;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.equipmentDisposal.deviceTransfer.dto.DeviceTransferItemQuery;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.DeviceTransfer;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.TransferAttachments;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.TransferItem;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.service.IDeviceTransferService;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.service.ITransferAttachmentsService;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.service.ITransferItemService;
+import org.jeecg.modules.equipmentDisposal.deviceTransfer.vo.DeviceTransferItemVO;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.vo.DeviceTransferPage;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@@ -338,4 +340,27 @@ public class DeviceTransferController {
         IPage<TransferItem> pageList = transferItemService.page(page, queryWrapper);
         return Result.OK(pageList);
     }
+
+    @ApiOperation(value = "设备调拨记录-调拨列表信息与设备信息组合查询", notes = "设备调拨记录-调拨列表信息与设备信息组合查询")
+    @GetMapping("/listTransferItems")
+    public Result<IPage<DeviceTransferItemVO>> listTransferItems(
+            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+            DeviceTransferItemQuery query) {
+
+        // 禁用自动 searchCount
+        Page<DeviceTransferItemVO> page = new Page<>(pageNo, pageSize, false); // false 表示不自动 count
+
+        // 查询当前页数据
+        IPage<DeviceTransferItemVO> pagedTransferItems = deviceTransferService.getPagedTransferItems(page, query);
+
+        // 手动查询总数
+        long total = deviceTransferService.getTransferItemsCount(query);
+
+        // 设置数据与总数
+        page.setRecords(pagedTransferItems.getRecords());
+        page.setTotal(total);
+
+        return Result.OK(page);
+    }
 }

+ 13 - 0
zgzt-sbsmzq/jeecg-module-lifecycle/src/main/java/org/jeecg/modules/equipmentDisposal/deviceTransfer/dto/DeviceTransferItemQuery.java

@@ -0,0 +1,13 @@
+package org.jeecg.modules.equipmentDisposal.deviceTransfer.dto;
+
+import lombok.Data;
+
+@Data
+public class DeviceTransferItemQuery {
+
+    private String transferNumber;
+    private String transferType;
+    private String outCompany;
+    private String applicant;
+    private String deviceCode;
+}

+ 10 - 2
zgzt-sbsmzq/jeecg-module-lifecycle/src/main/java/org/jeecg/modules/equipmentDisposal/deviceTransfer/mapper/DeviceTransferMapper.java

@@ -1,14 +1,22 @@
 package org.jeecg.modules.equipmentDisposal.deviceTransfer.mapper;
 
-import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.DeviceTransfer;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.equipmentDisposal.deviceTransfer.dto.DeviceTransferItemQuery;
+import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.DeviceTransfer;
+import org.jeecg.modules.equipmentDisposal.deviceTransfer.vo.DeviceTransferItemVO;
 
 /**
  * @Description: 设备调拨转移
  * @Author: jeecg-boot
- * @Date:   2025-04-15
+ * @Date: 2025-04-15
  * @Version: V1.0
  */
 public interface DeviceTransferMapper extends BaseMapper<DeviceTransfer> {
 
+    IPage<DeviceTransferItemVO> queryTransferItemsPage(Page<DeviceTransferItemVO> page, @Param("query") DeviceTransferItemQuery query);
+
+    Long countTransferItems(@Param("query") DeviceTransferItemQuery query);
 }

+ 71 - 0
zgzt-sbsmzq/jeecg-module-lifecycle/src/main/java/org/jeecg/modules/equipmentDisposal/deviceTransfer/mapper/xml/DeviceTransferMapper.xml

@@ -2,4 +2,75 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.equipmentDisposal.deviceTransfer.mapper.DeviceTransferMapper">
 
+    <select id="queryTransferItemsPage" resultType="org.jeecg.modules.equipmentDisposal.deviceTransfer.vo.DeviceTransferItemVO">
+        SELECT
+        dt.id AS transferId,
+        dt.transfer_number,
+        dt.application_time,
+        dt.transfer_type,
+        dt.out_company,
+        dt.applicant,
+        dt.application_reason,
+        dt.current_node,
+        dt.approval_status,
+        dt.approval_end_time,
+        ti.id AS itemId,
+        ti.device_code,
+        ti.device_name,
+        ti.asset_code,
+        ti.serial_number,
+        ti.spec,
+        ti.transfer_out_dept,
+        ti.transfer_out_location,
+        ti.original_responsible,
+        ti.transfer_in_dept,
+        ti.transfer_in_location,
+        ti.new_responsible,
+        ti.remark
+        FROM device_transfer dt
+        LEFT JOIN sbsmzq_transfer_item ti
+        ON dt.id COLLATE utf8mb4_general_ci = ti.transfer_id COLLATE utf8mb4_general_ci
+        <where>
+            <if test="query.transferNumber != null and query.transferNumber != ''">
+                AND dt.transfer_number LIKE CONCAT('%', #{query.transferNumber}, '%')
+            </if>
+            <if test="query.transferType != null and query.transferType != ''">
+                AND dt.transfer_type = #{query.transferType}
+            </if>
+            <if test="query.outCompany != null and query.outCompany != ''">
+                AND dt.out_company LIKE CONCAT('%', #{query.outCompany}, '%')
+            </if>
+            <if test="query.applicant != null and query.applicant != ''">
+                AND dt.applicant LIKE CONCAT('%', #{query.applicant}, '%')
+            </if>
+            <if test="query.deviceCode != null and query.deviceCode != ''">
+                AND ti.device_code LIKE CONCAT('%', #{query.deviceCode}, '%')
+            </if>
+        </where>
+    </select>
+
+    <select id="countTransferItems" resultType="java.lang.Long">
+        SELECT COUNT(1)
+        FROM device_transfer dt
+        LEFT JOIN sbsmzq_transfer_item ti
+        ON dt.id COLLATE utf8mb4_general_ci = ti.transfer_id COLLATE utf8mb4_general_ci
+        <where>
+            <if test="query.transferNumber != null and query.transferNumber != ''">
+                AND dt.transfer_number LIKE CONCAT('%', #{query.transferNumber}, '%')
+            </if>
+            <if test="query.transferType != null and query.transferType != ''">
+                AND dt.transfer_type = #{query.transferType}
+            </if>
+            <if test="query.outCompany != null and query.outCompany != ''">
+                AND dt.out_company LIKE CONCAT('%', #{query.outCompany}, '%')
+            </if>
+            <if test="query.applicant != null and query.applicant != ''">
+                AND dt.applicant LIKE CONCAT('%', #{query.applicant}, '%')
+            </if>
+            <if test="query.deviceCode != null and query.deviceCode != ''">
+                AND ti.device_code LIKE CONCAT('%', #{query.deviceCode}, '%')
+            </if>
+        </where>
+    </select>
+
 </mapper>

+ 9 - 0
zgzt-sbsmzq/jeecg-module-lifecycle/src/main/java/org/jeecg/modules/equipmentDisposal/deviceTransfer/service/IDeviceTransferService.java

@@ -1,9 +1,14 @@
 package org.jeecg.modules.equipmentDisposal.deviceTransfer.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.modules.equipmentDisposal.deviceTransfer.dto.DeviceTransferItemQuery;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.TransferAttachments;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.TransferItem;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.DeviceTransfer;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.equipmentDisposal.deviceTransfer.vo.DeviceTransferItemVO;
+
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.List;
@@ -47,5 +52,9 @@ public interface IDeviceTransferService extends IService<DeviceTransfer> {
 	 * @param idList
 	 */
 	public void delBatchMain (Collection<? extends Serializable> idList);
+
+	IPage<DeviceTransferItemVO> getPagedTransferItems(Page<DeviceTransferItemVO> page, DeviceTransferItemQuery query);
+
+	long getTransferItemsCount(DeviceTransferItemQuery query);
 	
 }

+ 14 - 1
zgzt-sbsmzq/jeecg-module-lifecycle/src/main/java/org/jeecg/modules/equipmentDisposal/deviceTransfer/service/impl/DeviceTransferServiceImpl.java

@@ -1,5 +1,8 @@
 package org.jeecg.modules.equipmentDisposal.deviceTransfer.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.modules.equipmentDisposal.deviceTransfer.dto.DeviceTransferItemQuery;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.DeviceTransfer;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.TransferAttachments;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.entity.TransferItem;
@@ -7,6 +10,7 @@ import org.jeecg.modules.equipmentDisposal.deviceTransfer.mapper.TransferAttachm
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.mapper.TransferItemMapper;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.mapper.DeviceTransferMapper;
 import org.jeecg.modules.equipmentDisposal.deviceTransfer.service.IDeviceTransferService;
+import org.jeecg.modules.equipmentDisposal.deviceTransfer.vo.DeviceTransferItemVO;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -94,5 +98,14 @@ public class DeviceTransferServiceImpl extends ServiceImpl<DeviceTransferMapper,
 			deviceTransferMapper.deleteById(id);
 		}
 	}
-	
+
+	public IPage<DeviceTransferItemVO> getPagedTransferItems(Page<DeviceTransferItemVO> page, DeviceTransferItemQuery query) {
+		return baseMapper.queryTransferItemsPage(page, query);
+	}
+
+	@Override
+	public long getTransferItemsCount(DeviceTransferItemQuery query) {
+		return baseMapper.countTransferItems(query);
+	}
+
 }

+ 36 - 0
zgzt-sbsmzq/jeecg-module-lifecycle/src/main/java/org/jeecg/modules/equipmentDisposal/deviceTransfer/vo/DeviceTransferItemVO.java

@@ -0,0 +1,36 @@
+package org.jeecg.modules.equipmentDisposal.deviceTransfer.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class DeviceTransferItemVO {
+
+    // DeviceTransfer 字段
+    private String transferId; // deviceTransfer.id
+    private String transferNumber;
+    private Date applicationTime;
+    private String transferType;
+    private String outCompany;
+    private String applicant;
+    private String applicationReason;
+    private String currentNode;
+    private String approvalStatus;
+    private Date approvalEndTime;
+
+    // TransferItem 字段
+    private String itemId;
+    private String deviceCode;
+    private String deviceName;
+    private String assetCode;
+    private String serialNumber;
+    private String spec;
+    private String transferOutDept;
+    private String transferOutLocation;
+    private String originalResponsible;
+    private String transferInDept;
+    private String transferInLocation;
+    private String newResponsible;
+    private String remark;
+}