<?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.ruoyi.report.mapper.SampleRecordMapper">
|
|
<!-- 分页查询领样记录 -->
|
<select id="pageSampleRecord" resultType="com.ruoyi.report.vo.SampleRecordVo">
|
SELECT
|
h.id AS id,
|
s.id AS sampleId,
|
s.sample_code AS sampleCode,
|
s.sample_name AS sampleName,
|
o.custom AS custom,
|
h.operate_type AS operateType,
|
u.name AS operateUser,
|
h.operate_time AS operateTime,
|
h.from_cell AS fromCell,
|
h.to_cell AS toCell,
|
h.remark AS remark
|
FROM warehouse_history h
|
LEFT JOIN ins_sample s ON h.sample_id = s.id
|
LEFT JOIN ins_order o ON s.ins_order_id = o.id
|
LEFT JOIN user u ON h.operate_user_id = u.id
|
WHERE 1=1
|
<if test="dto.sampleCode != null and dto.sampleCode != ''">
|
AND s.sample_code LIKE CONCAT('%', #{dto.sampleCode}, '%')
|
</if>
|
<if test="dto.sampleName != null and dto.sampleName != ''">
|
AND s.sample_name LIKE CONCAT('%', #{dto.sampleName}, '%')
|
</if>
|
<if test="dto.custom != null and dto.custom != ''">
|
AND o.custom LIKE CONCAT('%', #{dto.custom}, '%')
|
</if>
|
<if test="dto.receiveUser != null and dto.receiveUser != ''">
|
AND u.name LIKE CONCAT('%', #{dto.receiveUser}, '%')
|
</if>
|
<if test="dto.startTime != null and dto.startTime != ''">
|
AND h.operate_time >= #{dto.startTime}
|
</if>
|
<if test="dto.endTime != null and dto.endTime != ''">
|
AND h.operate_time <= #{dto.endTime}
|
</if>
|
ORDER BY h.operate_time DESC
|
</select>
|
|
<!-- 查询样品流转记录 -->
|
<select id="getFlowRecord" resultType="com.ruoyi.report.vo.SampleRecordVo">
|
SELECT
|
h.id AS id,
|
s.id AS sampleId,
|
s.sample_code AS sampleCode,
|
s.sample_name AS sampleName,
|
o.custom AS custom,
|
h.operate_type AS operateType,
|
u.name AS operateUser,
|
h.operate_time AS operateTime,
|
h.from_cell AS fromCell,
|
h.to_cell AS toCell,
|
h.remark AS remark
|
FROM warehouse_history h
|
LEFT JOIN ins_sample s ON h.sample_id = s.id
|
LEFT JOIN ins_order o ON s.ins_order_id = o.id
|
LEFT JOIN user u ON h.operate_user_id = u.id
|
WHERE s.id = #{sampleId}
|
ORDER BY h.operate_time ASC
|
</select>
|
|
</mapper>
|