<?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.casic.missiles.mapper.customer.CustomerSampleMapper"> <select id="selectMaxSampleNo" resultType="Long"> SELECT IFNULL(MAX(RIGHT(sample_no, 12)), 0) FROM customer_sample_info </select> <select id="samplesByOderId" resultType="com.casic.missiles.model.customer.CustomerSampleInfo"> SELECT csi.* FROM customer_sample_info csi LEFT JOIN business_order_sample_relation sr ON sr.sample_id = csi.id WHERE csi.is_del =0 <if test="sampleNo != null and sampleNo !=''"> and csi.sample_no like concat('%', #{sampleNo}, '%') </if> <if test="sampleName != null and sampleName !=''"> and csi.sample_name like concat('%', #{sampleName}, '%') </if> <if test="orderId != null and orderId !=''"> and sr.order_id = #{orderId} </if> ORDER BY csi.create_time DESC </select> </mapper>