ZDeviceSampleMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.robot.remote.smartrobotremote.mapper.ZDeviceSampleMapper">
  6. <resultMap type="ZDeviceSample" id="ZDeviceSampleResult">
  7. <result property="sampleId" column="sample_id" />
  8. <result property="deviceNo" column="device_no" />
  9. <result property="assayType" column="assay_type" />
  10. <result property="itemName" column="item_name" />
  11. <result property="createBy" column="create_by" />
  12. <result property="createTime" column="create_time" />
  13. <result property="updateBy" column="update_by" />
  14. <result property="updateTime" column="update_time" />
  15. </resultMap>
  16. <sql id="selectZDeviceSampleVo">
  17. select sample_id, device_no, assay_type, item_name, create_by, create_time, update_by, update_time from z_device_sample
  18. </sql>
  19. <select id="selectZDeviceSampleList" parameterType="ZDeviceSample" resultMap="ZDeviceSampleResult">
  20. <include refid="selectZDeviceSampleVo"/>
  21. <where>
  22. <if test="deviceNo != null and deviceNo != ''"> and device_no = #{deviceNo}</if>
  23. <if test="assayType != null and assayType != ''"> and assay_type = #{assayType}</if>
  24. <if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
  25. </where>
  26. </select>
  27. <select id="selectZDeviceSampleBySampleId" parameterType="Long" resultMap="ZDeviceSampleResult">
  28. <include refid="selectZDeviceSampleVo"/>
  29. where sample_id = #{sampleId}
  30. </select>
  31. <insert id="insertZDeviceSample" parameterType="ZDeviceSample">
  32. insert into z_device_sample
  33. <trim prefix="(" suffix=")" suffixOverrides=",">
  34. <if test="sampleId != null">sample_id,</if>
  35. <if test="deviceNo != null">device_no,</if>
  36. <if test="assayType != null">assay_type,</if>
  37. <if test="itemName != null">item_name,</if>
  38. <if test="createBy != null">create_by,</if>
  39. <if test="createTime != null">create_time,</if>
  40. <if test="updateBy != null">update_by,</if>
  41. <if test="updateTime != null">update_time,</if>
  42. </trim>
  43. <trim prefix="values (" suffix=")" suffixOverrides=",">
  44. <if test="sampleId != null">#{sampleId},</if>
  45. <if test="deviceNo != null">#{deviceNo},</if>
  46. <if test="assayType != null">#{assayType},</if>
  47. <if test="itemName != null">#{itemName},</if>
  48. <if test="createBy != null">#{createBy},</if>
  49. <if test="createTime != null">#{createTime},</if>
  50. <if test="updateBy != null">#{updateBy},</if>
  51. <if test="updateTime != null">#{updateTime},</if>
  52. </trim>
  53. </insert>
  54. <update id="updateZDeviceSample" parameterType="ZDeviceSample">
  55. update z_device_sample
  56. <trim prefix="SET" suffixOverrides=",">
  57. <if test="deviceNo != null">device_no = #{deviceNo},</if>
  58. <if test="assayType != null">assay_type = #{assayType},</if>
  59. <if test="itemName != null">item_name = #{itemName},</if>
  60. <if test="createBy != null">create_by = #{createBy},</if>
  61. <if test="createTime != null">create_time = #{createTime},</if>
  62. <if test="updateBy != null">update_by = #{updateBy},</if>
  63. <if test="updateTime != null">update_time = #{updateTime},</if>
  64. </trim>
  65. where sample_id = #{sampleId}
  66. </update>
  67. <delete id="deleteZDeviceSampleBySampleId" parameterType="Long">
  68. delete from z_device_sample where sample_id = #{sampleId}
  69. </delete>
  70. <delete id="deleteZDeviceSampleBySampleIds" parameterType="String">
  71. delete from z_device_sample where sample_id in
  72. <foreach item="sampleId" collection="array" open="(" separator="," close=")">
  73. #{sampleId}
  74. </foreach>
  75. </delete>
  76. </mapper>