BdglFoodProcurementMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.supervision.grassrootsregistration.mapper.BdglFoodProcurementMapper">
  6. <resultMap type="BdglFoodProcurement" id="BdglFoodProcurementResult">
  7. <result property="id" column="id" />
  8. <result property="distinction" column="distinction" />
  9. <result property="time" column="time" />
  10. <result property="name" column="name" />
  11. <result property="amount" column="amount" />
  12. <result property="price" column="price" />
  13. <result property="consumption" column="consumption" />
  14. <result property="foodId" column="food_id" />
  15. <result property="creattime" column="creattime" />
  16. <result property="updatetime" column="updatetime" />
  17. </resultMap>
  18. <sql id="selectBdglFoodProcurementVo">
  19. select id, distinction, time, name, amount, price, consumption, food_id, creattime, updatetime from bdgl_food_procurement
  20. </sql>
  21. <select id="selectBdglFoodProcurementList" parameterType="BdglFoodProcurement" resultMap="BdglFoodProcurementResult">
  22. <include refid="selectBdglFoodProcurementVo"/>
  23. <where>
  24. <if test="distinction != null and distinction != ''"> and distinction = #{distinction}</if>
  25. <if test="time != null "> and time = #{time}</if>
  26. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  27. <if test="amount != null "> and amount = #{amount}</if>
  28. <if test="price != null "> and price = #{price}</if>
  29. <if test="consumption != null "> and consumption = #{consumption}</if>
  30. <if test="foodId != null "> and food_id = #{foodId}</if>
  31. <if test="creattime != null "> and creattime = #{creattime}</if>
  32. <if test="updatetime != null "> and updatetime = #{updatetime}</if>
  33. </where>
  34. </select>
  35. <select id="selectBdglFoodProcurementById" parameterType="Integer" resultMap="BdglFoodProcurementResult">
  36. <include refid="selectBdglFoodProcurementVo"/>
  37. where id = #{id}
  38. </select>
  39. <insert id="insertBdglFoodProcurement" parameterType="BdglFoodProcurement" useGeneratedKeys="true" keyProperty="id">
  40. insert into bdgl_food_procurement
  41. <trim prefix="(" suffix=")" suffixOverrides=",">
  42. <if test="distinction != null">distinction,</if>
  43. <if test="time != null">time,</if>
  44. <if test="name != null">name,</if>
  45. <if test="amount != null">amount,</if>
  46. <if test="price != null">price,</if>
  47. <if test="consumption != null">consumption,</if>
  48. <if test="foodId != null">food_id,</if>
  49. <if test="creattime != null">creattime,</if>
  50. <if test="updatetime != null">updatetime,</if>
  51. </trim>
  52. <trim prefix="values (" suffix=")" suffixOverrides=",">
  53. <if test="distinction != null">#{distinction},</if>
  54. <if test="time != null">#{time},</if>
  55. <if test="name != null">#{name},</if>
  56. <if test="amount != null">#{amount},</if>
  57. <if test="price != null">#{price},</if>
  58. <if test="consumption != null">#{consumption},</if>
  59. <if test="foodId != null">#{foodId},</if>
  60. <if test="creattime != null">#{creattime},</if>
  61. <if test="updatetime != null">#{updatetime},</if>
  62. </trim>
  63. </insert>
  64. <update id="updateBdglFoodProcurement" parameterType="BdglFoodProcurement">
  65. update bdgl_food_procurement
  66. <trim prefix="SET" suffixOverrides=",">
  67. <if test="distinction != null">distinction = #{distinction},</if>
  68. <if test="time != null">time = #{time},</if>
  69. <if test="name != null">name = #{name},</if>
  70. <if test="amount != null">amount = #{amount},</if>
  71. <if test="price != null">price = #{price},</if>
  72. <if test="consumption != null">consumption = #{consumption},</if>
  73. <if test="foodId != null">food_id = #{foodId},</if>
  74. <if test="creattime != null">creattime = #{creattime},</if>
  75. <if test="updatetime != null">updatetime = #{updatetime},</if>
  76. </trim>
  77. where id = #{id}
  78. </update>
  79. <delete id="deleteBdglFoodProcurementById" parameterType="Integer">
  80. delete from bdgl_food_procurement where id = #{id}
  81. </delete>
  82. <delete id="deleteBdglFoodProcurementByIds" parameterType="String">
  83. delete from bdgl_food_procurement where id in
  84. <foreach item="id" collection="array" open="(" separator="," close=")">
  85. #{id}
  86. </foreach>
  87. </delete>
  88. <delete id="deleteBdglFoodProcurement">
  89. delete from bdgl_food_procurement where food_id = #{id}
  90. </delete>
  91. </mapper>