BdglFoodKindMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.BdglFoodKindMapper">
  6. <resultMap type="BdglFoodKind" id="BdglFoodKindResult">
  7. <result property="id" column="id" />
  8. <result property="distinctions" column="distinctions" />
  9. <result property="name" column="name" />
  10. <result property="weight" column="weight" />
  11. <result property="unitPrice" column="unit_price" />
  12. <result property="money" column="money" />
  13. <result property="types" column="types" />
  14. <result property="remark" column="remark" />
  15. <result property="foodId" column="food_id" />
  16. <result property="time" column="time" />
  17. <result property="createtime" column="createtime" />
  18. <result property="updatetime" column="updatetime" />
  19. </resultMap>
  20. <sql id="selectBdglFoodKindVo">
  21. select id, distinctions, name, weight, unit_price, money, types, remark, food_id, time, createtime, updatetime from bdgl_food_kind
  22. </sql>
  23. <select id="selectBdglFoodKindList" parameterType="BdglFoodKind" resultMap="BdglFoodKindResult">
  24. <include refid="selectBdglFoodKindVo"/>
  25. <where>
  26. <if test="distinctions != null and distinctions != ''"> and distinctions = #{distinctions}</if>
  27. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  28. <if test="weight != null "> and weight = #{weight}</if>
  29. <if test="unitPrice != null "> and unit_price = #{unitPrice}</if>
  30. <if test="money != null "> and money = #{money}</if>
  31. <if test="types != null and types != ''"> and types = #{types}</if>
  32. <if test="foodId != null "> and food_id = #{foodId}</if>
  33. <if test="time != null "> and time = #{time}</if>
  34. <if test="createtime != null "> and createtime = #{createtime}</if>
  35. <if test="updatetime != null "> and updatetime = #{updatetime}</if>
  36. </where>
  37. </select>
  38. <select id="selectBdglFoodKindById" parameterType="Integer" resultMap="BdglFoodKindResult">
  39. <include refid="selectBdglFoodKindVo"/>
  40. where id = #{id}
  41. </select>
  42. <select id="selectBdglFoodKindLists" parameterType="BdglFoodKind" resultMap="BdglFoodKindResult">
  43. SELECT id,IFNULL( distinctions, "" ) AS distinctions,NAME,IFNULL( weight, "" ) AS weight,IFNULL( unit_price, "" ) AS unit_price,
  44. IFNULL( money, "" ) AS money,IFNULL( types, "" ) AS types,IFNULL( remark, "" ) AS remark,IFNULL( food_id, "" ) AS food_id,time,
  45. createtime,updatetime FROM bdgl_food_kind
  46. <where>
  47. <if test="distinctions != null and distinctions != ''"> and distinctions = #{distinctions}</if>
  48. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  49. <if test="weight != null "> and weight = #{weight}</if>
  50. <if test="unitPrice != null "> and unit_price = #{unitPrice}</if>
  51. <if test="money != null "> and money = #{money}</if>
  52. <if test="types != null and types != ''"> and types = #{types}</if>
  53. <if test="foodId != null "> and food_id = #{foodId}</if>
  54. <if test="time != null "> and time = #{time}</if>
  55. <if test="createtime != null "> and createtime = #{createtime}</if>
  56. <if test="updatetime != null "> and updatetime = #{updatetime}</if>
  57. </where>
  58. </select>
  59. <insert id="insertBdglFoodKind" parameterType="BdglFoodKind" useGeneratedKeys="true" keyProperty="id">
  60. insert into bdgl_food_kind
  61. <trim prefix="(" suffix=")" suffixOverrides=",">
  62. <if test="distinctions != null">distinctions,</if>
  63. <if test="name != null">name,</if>
  64. <if test="weight != null">weight,</if>
  65. <if test="unitPrice != null">unit_price,</if>
  66. <if test="money != null">money,</if>
  67. <if test="types != null">types,</if>
  68. <if test="remark != null">remark,</if>
  69. <if test="foodId != null">food_id,</if>
  70. <if test="time != null">time,</if>
  71. <if test="createtime != null">createtime,</if>
  72. <if test="updatetime != null">updatetime,</if>
  73. </trim>
  74. <trim prefix="values (" suffix=")" suffixOverrides=",">
  75. <if test="distinctions != null">#{distinctions},</if>
  76. <if test="name != null">#{name},</if>
  77. <if test="weight != null">#{weight},</if>
  78. <if test="unitPrice != null">#{unitPrice},</if>
  79. <if test="money != null">#{money},</if>
  80. <if test="types != null">#{types},</if>
  81. <if test="remark != null">#{remark},</if>
  82. <if test="foodId != null">#{foodId},</if>
  83. <if test="time != null">#{time},</if>
  84. <if test="createtime != null">#{createtime},</if>
  85. <if test="updatetime != null">#{updatetime},</if>
  86. </trim>
  87. </insert>
  88. <update id="updateBdglFoodKind" parameterType="BdglFoodKind">
  89. update bdgl_food_kind
  90. <trim prefix="SET" suffixOverrides=",">
  91. <if test="distinctions != null">distinctions = #{distinctions},</if>
  92. <if test="name != null">name = #{name},</if>
  93. <if test="weight != null">weight = #{weight},</if>
  94. <if test="unitPrice != null">unit_price = #{unitPrice},</if>
  95. <if test="money != null">money = #{money},</if>
  96. <if test="types != null">types = #{types},</if>
  97. <if test="remark != null">remark = #{remark},</if>
  98. <if test="foodId != null">food_id = #{foodId},</if>
  99. <if test="time != null">time = #{time},</if>
  100. <if test="createtime != null">createtime = #{createtime},</if>
  101. <if test="updatetime != null">updatetime = #{updatetime},</if>
  102. </trim>
  103. where id = #{id}
  104. </update>
  105. <delete id="deleteBdglFoodKindById" parameterType="Integer">
  106. delete from bdgl_food_kind where id = #{id}
  107. </delete>
  108. <delete id="deleteBdglFoodKindByIds" parameterType="String">
  109. delete from bdgl_food_kind where id in
  110. <foreach item="id" collection="array" open="(" separator="," close=")">
  111. #{id}
  112. </foreach>
  113. </delete>
  114. <delete id="deleteBdglFoodKind">
  115. delete from bdgl_food_kind where food_id = #{id}
  116. </delete>
  117. </mapper>