FsPrescribeDrugMapper.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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.fs.store.mapper.FsPrescribeDrugMapper">
  6. <resultMap type="FsPrescribeDrug" id="FsPrescribeDrugResult">
  7. <result property="drugId" column="drug_id" />
  8. <result property="prescribeId" column="prescribe_id" />
  9. <result property="drugCommonName" column="drug_common_name" />
  10. <result property="drugSpecification" column="drug_specification" />
  11. <result property="usageMethod" column="usage_method" />
  12. <result property="usageFrequencyUnit" column="usage_frequency_unit" />
  13. <result property="usagePerUseCount" column="usage_per_use_count" />
  14. <result property="usagePerUseUnit" column="usage_per_use_unit" />
  15. <result property="usageDays" column="usage_days" />
  16. <result property="saleAmount" column="sale_amount" />
  17. <result property="saleUnit" column="sale_unit" />
  18. <result property="instructions" column="instructions" />
  19. <result property="approvalNumber" column="approval_number" />
  20. <result property="productId" column="product_id" />
  21. </resultMap>
  22. <sql id="selectFsPrescribeDrugVo">
  23. select drug_id, prescribe_id, drug_common_name, drug_specification, usage_method, usage_frequency_unit, usage_per_use_count, usage_per_use_unit, usage_days, sale_amount, sale_unit, instructions, approval_number, product_id from fs_prescribe_drug
  24. </sql>
  25. <select id="selectFsPrescribeDrugList" parameterType="FsPrescribeDrug" resultMap="FsPrescribeDrugResult">
  26. <include refid="selectFsPrescribeDrugVo"/>
  27. <where>
  28. <if test="prescribeId != null "> and prescribe_id = #{prescribeId}</if>
  29. <if test="drugCommonName != null and drugCommonName != ''"> and drug_common_name like concat('%', #{drugCommonName}, '%')</if>
  30. <if test="drugSpecification != null and drugSpecification != ''"> and drug_specification = #{drugSpecification}</if>
  31. <if test="usageMethod != null and usageMethod != ''"> and usage_method = #{usageMethod}</if>
  32. <if test="usageFrequencyUnit != null and usageFrequencyUnit != ''"> and usage_frequency_unit = #{usageFrequencyUnit}</if>
  33. <if test="usagePerUseCount != null and usagePerUseCount != ''"> and usage_per_use_count = #{usagePerUseCount}</if>
  34. <if test="usagePerUseUnit != null and usagePerUseUnit != ''"> and usage_per_use_unit = #{usagePerUseUnit}</if>
  35. <if test="usageDays != null and usageDays != ''"> and usage_days = #{usageDays}</if>
  36. <if test="saleAmount != null and saleAmount != ''"> and sale_amount = #{saleAmount}</if>
  37. <if test="saleUnit != null and saleUnit != ''"> and sale_unit = #{saleUnit}</if>
  38. <if test="instructions != null and instructions != ''"> and instructions = #{instructions}</if>
  39. <if test="approvalNumber != null and approvalNumber != ''"> and approval_number = #{approvalNumber}</if>
  40. <if test="productId != null "> and product_id = #{productId}</if>
  41. </where>
  42. </select>
  43. <select id="selectFsPrescribeDrugById" parameterType="Long" resultMap="FsPrescribeDrugResult">
  44. <include refid="selectFsPrescribeDrugVo"/>
  45. where drug_id = #{drugId}
  46. </select>
  47. <insert id="insertFsPrescribeDrug" parameterType="FsPrescribeDrug" useGeneratedKeys="true" keyProperty="drugId">
  48. insert into fs_prescribe_drug
  49. <trim prefix="(" suffix=")" suffixOverrides=",">
  50. <if test="prescribeId != null">prescribe_id,</if>
  51. <if test="drugCommonName != null">drug_common_name,</if>
  52. <if test="drugSpecification != null">drug_specification,</if>
  53. <if test="usageMethod != null">usage_method,</if>
  54. <if test="usageFrequencyUnit != null">usage_frequency_unit,</if>
  55. <if test="usagePerUseCount != null">usage_per_use_count,</if>
  56. <if test="usagePerUseUnit != null">usage_per_use_unit,</if>
  57. <if test="usageDays != null">usage_days,</if>
  58. <if test="saleAmount != null">sale_amount,</if>
  59. <if test="saleUnit != null">sale_unit,</if>
  60. <if test="instructions != null">instructions,</if>
  61. <if test="approvalNumber != null">approval_number,</if>
  62. <if test="productId != null">product_id,</if>
  63. </trim>
  64. <trim prefix="values (" suffix=")" suffixOverrides=",">
  65. <if test="prescribeId != null">#{prescribeId},</if>
  66. <if test="drugCommonName != null">#{drugCommonName},</if>
  67. <if test="drugSpecification != null">#{drugSpecification},</if>
  68. <if test="usageMethod != null">#{usageMethod},</if>
  69. <if test="usageFrequencyUnit != null">#{usageFrequencyUnit},</if>
  70. <if test="usagePerUseCount != null">#{usagePerUseCount},</if>
  71. <if test="usagePerUseUnit != null">#{usagePerUseUnit},</if>
  72. <if test="usageDays != null">#{usageDays},</if>
  73. <if test="saleAmount != null">#{saleAmount},</if>
  74. <if test="saleUnit != null">#{saleUnit},</if>
  75. <if test="instructions != null">#{instructions},</if>
  76. <if test="approvalNumber != null">#{approvalNumber},</if>
  77. <if test="productId != null">#{productId},</if>
  78. </trim>
  79. </insert>
  80. <update id="updateFsPrescribeDrug" parameterType="FsPrescribeDrug">
  81. update fs_prescribe_drug
  82. <trim prefix="SET" suffixOverrides=",">
  83. <if test="prescribeId != null">prescribe_id = #{prescribeId},</if>
  84. <if test="drugCommonName != null">drug_common_name = #{drugCommonName},</if>
  85. <if test="drugSpecification != null">drug_specification = #{drugSpecification},</if>
  86. <if test="usageMethod != null">usage_method = #{usageMethod},</if>
  87. <if test="usageFrequencyUnit != null">usage_frequency_unit = #{usageFrequencyUnit},</if>
  88. <if test="usagePerUseCount != null">usage_per_use_count = #{usagePerUseCount},</if>
  89. <if test="usagePerUseUnit != null">usage_per_use_unit = #{usagePerUseUnit},</if>
  90. <if test="usageDays != null">usage_days = #{usageDays},</if>
  91. <if test="saleAmount != null">sale_amount = #{saleAmount},</if>
  92. <if test="saleUnit != null">sale_unit = #{saleUnit},</if>
  93. <if test="instructions != null">instructions = #{instructions},</if>
  94. <if test="approvalNumber != null">approval_number = #{approvalNumber},</if>
  95. <if test="productId != null">product_id = #{productId},</if>
  96. </trim>
  97. where drug_id = #{drugId}
  98. </update>
  99. <delete id="deleteFsPrescribeDrugById" parameterType="Long">
  100. delete from fs_prescribe_drug where drug_id = #{drugId}
  101. </delete>
  102. <delete id="deleteFsPrescribeDrugByIds" parameterType="String">
  103. delete from fs_prescribe_drug where drug_id in
  104. <foreach item="drugId" collection="array" open="(" separator="," close=")">
  105. #{drugId}
  106. </foreach>
  107. </delete>
  108. </mapper>