xuhy
2025-09-02 5d2d6fdff67f8f9a7e65abdbb4b87dba07dcb32b
ruoyi-system/src/main/resources/mapper/system/TSamplingRecordMapper.xml
@@ -20,5 +20,51 @@
    <sql id="Base_Column_List">
        id, dispatch_id, sampling_code, remark, status, create_time, update_time, create_by, update_by, disabled
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.vo.TSamplingRecordVO">
        select
            tsr.id, tsr.dispatch_id, tsr.sampling_code, tsr.remark, tsr.status, tsr.create_time, tsr.update_time,
            tsr.create_by, tsr.update_by, tsr.disabled, ted.experiment_code AS experimentCode,ted.experiment_name AS experimentName,
            tpp.project_name AS projectName
        from t_sampling_record tsr
        left join t_experiment_dispatch ted on ted.id = tsr.dispatch_id
        left join t_project_proposal tpp on ted.proposal_id = tpp.id
        <where>
            <if test="query.projectName != null and query.projectName != ''">
                and tpp.project_name like concat('%', #{query.projectName}, '%')
            </if>
            <if test="query.experimentName != null and query.experimentName != ''">
                and ted.experiment_name like concat('%', #{query.experimentName}, '%')
            </if>
            <if test="query.experimentCode != null and query.experimentCode !=''">
                and ted.experiment_code like concat('%', #{query.experimentCode}, '%')
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tsr.create_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.status != null">
                and tsr.status = #{query.status}
            </if>
            <if test="query.createBy != null and query.createBy !=''">
                and tsr.create_by like concat('%', #{query.createBy}, '%')
            </if>
            <if test="query.dispatchIds != null and query.dispatchIds.size() > 0">
                and tsr.dispatch_id in
                <foreach item="item" collection="query.dispatchIds" separator="," close=")" index="index" open="(">
                    #{item}
                </foreach>
            </if>
            <if test="query.roleType != null and (query.roleType == 3 or query.roleType == 4 or query.roleType == 5)">
                AND tsr.status != 3
            </if>
            <if test="query.roleType != null and (query.roleType == 5 or query.roleType == 4)">
                AND tsr.status != 4
            </if>
            <if test="query.status == null">
                and tsr.status != -1
            </if>
            AND tsr.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tsr.create_time DESC
    </select>
</mapper>