GoodsOrderItemMapper.xml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
  4. <mapper namespace="com.ym.mec.biz.dal.dao.GoodsOrderItemDao">
  5. <resultMap type="com.ym.mec.biz.dal.entity.GoodsOrderItem"
  6. id="GoodsOrderItem">
  7. <result column="id_" property="id" />
  8. <result column="goods_order_id_" property="goodsOrderId" />
  9. <result column="goods_id_" property="goodsId" />
  10. <result column="market_price_" property="marketPrice" />
  11. <result column="discount_price_" property="discountPrice" />
  12. <result column="goods_quantity_" property="goodsQuantity" />
  13. <result column="create_time_" property="createTime" />
  14. <result column="update_time_" property="updateTime" />
  15. <result column="tenant_id_" property="tenantId"/>
  16. </resultMap>
  17. <!-- 根据主键查询一条记录 -->
  18. <select id="get" resultMap="GoodsOrderItem">
  19. SELECT * FROM
  20. goods_order_item WHERE id_ = #{id}
  21. </select>
  22. <!-- 全查询 -->
  23. <select id="findAll" resultMap="GoodsOrderItem">
  24. SELECT * FROM goods_order_item where tenant_id_ = #{tenantId}
  25. ORDER BY id_
  26. </select>
  27. <!-- 向数据库增加一条记录 -->
  28. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.GoodsOrderItem"
  29. useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  30. INSERT INTO goods_order_item
  31. (id_,goods_order_id_,goods_id_,market_price_,discount_price_,goods_quantity_,create_time_,update_time_,tenant_id_)
  32. VALUES(#{id},#{goodsOrderId},#{goodsId},#{marketPrice},#{discountPrice},#{goodsQuantity},now(),now(),#{tenantId})
  33. </insert>
  34. <!-- 根据主键查询一条记录 -->
  35. <update id="update" parameterType="com.ym.mec.biz.dal.entity.GoodsOrderItem">
  36. UPDATE goods_order_item
  37. <set>
  38. <if test="goodsQuantity != null">
  39. goods_quantity_ = #{goodsQuantity},
  40. </if>
  41. <if test="id != null">
  42. id_ = #{id},
  43. </if>
  44. <if test="updateTime != null">
  45. update_time_ = NOW(),
  46. </if>
  47. <if test="marketPrice != null">
  48. market_price_ = #{marketPrice},
  49. </if>
  50. <if test="discountPrice != null">
  51. discount_price_ = #{discountPrice},
  52. </if>
  53. <if test="goodsOrderId != null">
  54. goods_order_id_ = #{goodsOrderId},
  55. </if>
  56. <if test="goodsId != null">
  57. goods_id_ = #{goodsId},
  58. </if>
  59. <if test="createTime != null">
  60. create_time_ = #{createTime},
  61. </if>
  62. </set>
  63. WHERE id_ = #{id} and tenant_id_ = #{tenantId}
  64. </update>
  65. <!-- 根据主键删除一条记录 -->
  66. <delete id="delete">
  67. DELETE FROM goods_order_item WHERE id_ =
  68. #{id}
  69. </delete>
  70. <!-- 分页查询 -->
  71. <select id="queryPage" resultMap="GoodsOrderItem" parameterType="map">
  72. SELECT * FROM goods_order_item where tenant_id_ = #{tenantId} ORDER BY id_
  73. <include refid="global.limit" />
  74. </select>
  75. <!-- 查询当前表的总记录数 -->
  76. <select id="queryCount" resultType="int">
  77. SELECT COUNT(*) FROM
  78. goods_order_item where tenant_id_ = #{tenantId}
  79. </select>
  80. </mapper>