FsMedicatedFoodMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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.his.mapper.FsMedicatedFoodMapper">
  6. <resultMap type="FsMedicatedFood" id="FsMedicatedFoodResult">
  7. <result property="id" column="id" />
  8. <result property="foodName" column="food_name" />
  9. <result property="imgUrl" column="img_url" />
  10. <result property="sort" column="sort" />
  11. <result property="action" column="action" />
  12. <result property="food" column="food" />
  13. <result property="indications" column="indications" />
  14. <result property="descs" column="descs" />
  15. <result property="createTime" column="create_time" />
  16. <result property="status" column="status" />
  17. <result property="pinyin" column="pinyin" />
  18. <result property="actionTitle" column="action_title" />
  19. </resultMap>
  20. <sql id="selectFsMedicatedFoodVo">
  21. select id, food_name, img_url, action_title,pinyin,sort, action, food, indications, descs, create_time, status from fs_medicated_food
  22. </sql>
  23. <select id="selectFsMedicatedFoodList" parameterType="FsMedicatedFood" resultMap="FsMedicatedFoodResult">
  24. <include refid="selectFsMedicatedFoodVo"/>
  25. <where>
  26. <if test="foodName != null and foodName != ''"> and food_name like concat('%', #{foodName}, '%')</if>
  27. <if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
  28. <if test="sort != null "> and sort = #{sort}</if>
  29. <if test="action != null and action != ''"> and action = #{action}</if>
  30. <if test="food != null and food != ''"> and food = #{food}</if>
  31. <if test="indications != null and indications != ''"> and indications = #{indications}</if>
  32. <if test="descs != null and descs != ''"> and descs = #{descs}</if>
  33. <if test="createTime != null "> and create_time = #{createTime}</if>
  34. <if test="status != null "> and status = #{status}</if>
  35. </where>
  36. </select>
  37. <select id="selectFsMedicatedFoodById" parameterType="Long" resultMap="FsMedicatedFoodResult">
  38. <include refid="selectFsMedicatedFoodVo"/>
  39. where id = #{id}
  40. </select>
  41. <insert id="insertFsMedicatedFood" parameterType="FsMedicatedFood" useGeneratedKeys="true" keyProperty="id">
  42. insert into fs_medicated_food
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="foodName != null">food_name,</if>
  45. <if test="imgUrl != null">img_url,</if>
  46. <if test="sort != null">sort,</if>
  47. <if test="action != null">action,</if>
  48. <if test="food != null">food,</if>
  49. <if test="indications != null">indications,</if>
  50. <if test="descs != null">descs,</if>
  51. <if test="createTime != null">create_time,</if>
  52. <if test="status != null">status,</if>
  53. <if test="pinyin != null">pinyin,</if>
  54. <if test="actionTitle != null">action_title,</if>
  55. </trim>
  56. <trim prefix="values (" suffix=")" suffixOverrides=",">
  57. <if test="foodName != null">#{foodName},</if>
  58. <if test="imgUrl != null">#{imgUrl},</if>
  59. <if test="sort != null">#{sort},</if>
  60. <if test="action != null">#{action},</if>
  61. <if test="food != null">#{food},</if>
  62. <if test="indications != null">#{indications},</if>
  63. <if test="descs != null">#{descs},</if>
  64. <if test="createTime != null">#{createTime},</if>
  65. <if test="status != null">#{status},</if>
  66. <if test="pinyin != null">#{pinyin},</if>
  67. <if test="actionTitle != null">#{actionTitle},</if>
  68. </trim>
  69. </insert>
  70. <update id="updateFsMedicatedFood" parameterType="FsMedicatedFood">
  71. update fs_medicated_food
  72. <trim prefix="SET" suffixOverrides=",">
  73. <if test="foodName != null">food_name = #{foodName},</if>
  74. <if test="imgUrl != null">img_url = #{imgUrl},</if>
  75. <if test="sort != null">sort = #{sort},</if>
  76. <if test="action != null">action = #{action},</if>
  77. <if test="food != null">food = #{food},</if>
  78. <if test="indications != null">indications = #{indications},</if>
  79. <if test="descs != null">descs = #{descs},</if>
  80. <if test="createTime != null">create_time = #{createTime},</if>
  81. <if test="status != null">status = #{status},</if>
  82. <if test="pinyin != null">pinyin = #{pinyin},</if>
  83. <if test="actionTitle != null">action_title = #{actionTitle},</if>
  84. </trim>
  85. where id = #{id}
  86. </update>
  87. <delete id="deleteFsMedicatedFoodById" parameterType="Long">
  88. delete from fs_medicated_food where id = #{id}
  89. </delete>
  90. <delete id="deleteFsMedicatedFoodByIds" parameterType="String">
  91. delete from fs_medicated_food where id in
  92. <foreach item="id" collection="array" open="(" separator="," close=")">
  93. #{id}
  94. </foreach>
  95. </delete>
  96. </mapper>