CartGoodsDOMapper.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. <mapper namespace="com.cdu.lys.graduation.repository.dao.CartGoodsDOMapper" >
  4. <resultMap id="BaseResultMap" type="com.cdu.lys.graduation.repository.entity.CartGoodsDO" >
  5. <constructor >
  6. <idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  7. <arg column="goods_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  8. <arg column="cart_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  9. <arg column="add_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  10. </constructor>
  11. </resultMap>
  12. <sql id="Base_Column_List" >
  13. id, goods_id, cart_id, add_time
  14. </sql>
  15. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  16. select
  17. <include refid="Base_Column_List" />
  18. from tb_cart_goods
  19. where id = #{id,jdbcType=INTEGER}
  20. </select>
  21. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  22. delete from tb_cart_goods
  23. where id = #{id,jdbcType=INTEGER}
  24. </delete>
  25. <insert id="insert" parameterType="com.cdu.lys.graduation.repository.entity.CartGoodsDO" >
  26. insert into tb_cart_goods (id, goods_id, cart_id,
  27. add_time)
  28. values (#{id,jdbcType=INTEGER}, #{goodsId,jdbcType=INTEGER}, #{cartId,jdbcType=INTEGER},
  29. #{addTime,jdbcType=TIMESTAMP})
  30. </insert>
  31. <insert id="insertSelective" parameterType="com.cdu.lys.graduation.repository.entity.CartGoodsDO" >
  32. insert into tb_cart_goods
  33. <trim prefix="(" suffix=")" suffixOverrides="," >
  34. <if test="id != null" >
  35. id,
  36. </if>
  37. <if test="goodsId != null" >
  38. goods_id,
  39. </if>
  40. <if test="cartId != null" >
  41. cart_id,
  42. </if>
  43. <if test="addTime != null" >
  44. add_time,
  45. </if>
  46. </trim>
  47. <trim prefix="values (" suffix=")" suffixOverrides="," >
  48. <if test="id != null" >
  49. #{id,jdbcType=INTEGER},
  50. </if>
  51. <if test="goodsId != null" >
  52. #{goodsId,jdbcType=INTEGER},
  53. </if>
  54. <if test="cartId != null" >
  55. #{cartId,jdbcType=INTEGER},
  56. </if>
  57. <if test="addTime != null" >
  58. #{addTime,jdbcType=TIMESTAMP},
  59. </if>
  60. </trim>
  61. </insert>
  62. <update id="updateByPrimaryKeySelective" parameterType="com.cdu.lys.graduation.repository.entity.CartGoodsDO" >
  63. update tb_cart_goods
  64. <set >
  65. <if test="goodsId != null" >
  66. goods_id = #{goodsId,jdbcType=INTEGER},
  67. </if>
  68. <if test="cartId != null" >
  69. cart_id = #{cartId,jdbcType=INTEGER},
  70. </if>
  71. <if test="addTime != null" >
  72. add_time = #{addTime,jdbcType=TIMESTAMP},
  73. </if>
  74. </set>
  75. where id = #{id,jdbcType=INTEGER}
  76. </update>
  77. <update id="updateByPrimaryKey" parameterType="com.cdu.lys.graduation.repository.entity.CartGoodsDO" >
  78. update tb_cart_goods
  79. set goods_id = #{goodsId,jdbcType=INTEGER},
  80. cart_id = #{cartId,jdbcType=INTEGER},
  81. add_time = #{addTime,jdbcType=TIMESTAMP}
  82. where id = #{id,jdbcType=INTEGER}
  83. </update>
  84. </mapper>