<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.huaheng.project.task.task.mapper.TaskMapper"> <select id="getTaskByLocationCode" resultType="com.huaheng.project.task.task.domain.Task"> SELECT * from task where Status != 40 and (sourceLocation = #{location, jdbcType=VARCHAR} or destinationLocation = #{warehouse, jdbcType=VARCHAR} ) limit 1; </select> <select id="getContainerMaterial" resultType="java.util.HashMap"> SELECT rch.locationCode, rcd.id, rd.receiptId, m.barcode, m.name, rd.qty FROM receipt_container_header rch INNER JOIN receipt_container_detail rcd ON rcd.headerId = rch.id AND rch.receiptContainerCode = #{containerCode,jdbcType=VARCHAR} INNER JOIN receipt_detail rd ON rd.id = rcd.receiptDetailId INNER JOIN material m ON rd.materialId = m.id AND m.deleted = FALSE </select> <select id="getTaskReceipt" resultType="java.util.HashMap"> SELECT rh.warehouseId, rh.warehouseCode, rch.locationCode, rh.sourceCode, rd.sourceLine, rh.companyId, rh.companyCode, rd.materialId, rd.materialCode, rh.id receiptId, rh.code, rd.id receiptDetailId, rd.batch, rd.lot, rd.project, rd.manufactureDate, rd.expirationDate, rd.inventoryStatus, rcd.qty, rd.price, td.id taskDetailId, td.status, td.materialCode, td.materialName FROM task_detail td INNER JOIN receipt_container_detail rcd ON rcd.id = td.allocationId AND td.taskId = #{taskId,jdbcType=INTEGER} INNER JOIN receipt_container_header rch ON rch.id = rcd.headerId INNER JOIN receipt_detail rd ON rd.id = rcd.receiptDetailId INNER JOIN receipt_header rh ON rh.id = rd.receiptId </select> <select id="getTasks" resultType="com.huaheng.project.task.task.domain.Task"> SELECT id, warehouseId, warehouseCode, companyId, priority, type, station, containerId, containerCode, sourceLocation, destinationLocation, status, createdBy, beginTime, endTime, lastUpdated, lastUpdatedBy, userDef1, userDef2, userDef3 FROM task <where> <if test="id != null"> AND id = #{id} </if> <if test="warehouseId != null"> AND warehouseId = #{warehouseId} </if> <if test="warehouseCode != null"> AND warehouseCode = #{warehouseCode} </if> <if test="companyId != null"> AND companyId = #{companyId} </if> <if test="priority != null"> AND priority = #{priority} </if> <if test="type != null"> AND type = #{type} </if> <if test="station != null"> AND station = #{station} </if> <if test="containerId != null"> AND containerId = #{containerId} </if> <if test="containerCode != null"> AND containerCode = #{containerCode} </if> <if test="sourceLocation != null"> AND sourceLocation = #{sourceLocation} </if> <if test="destinationLocation != null"> AND destinationLocation = #{destinationLocation} </if> <if test="status != null"> AND status = #{status} </if> <if test="createdBy != null"> AND createdBy = #{createdBy} </if> <if test="beginTime != null"> AND beginTime = #{beginTime} </if> <if test="endTime != null"> AND endTime = #{endTime} </if> <if test="lastUpdated != null"> AND lastUpdated = #{lastUpdated} </if> <if test="lastUpdatedBy != null"> AND lastUpdatedBy = #{lastUpdatedBy} </if> <if test="userDef1 != null"> AND userDef1 = #{userDef1} </if> <if test="userDef2 != null"> AND userDef2 = #{userDef2} </if> <if test="userDef3 != null"> AND userDef3 = #{userDef3} </if> <if test="sectionStartTime != null"> AND created >= #{sectionStartTime} </if> <if test="sectionEndTime != null"> AND created <= #{sectionEndTime} </if> </where> </select> </mapper>