NatureOwnershipMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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.goafanti.common.dao.NatureOwnershipMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.NatureOwnership" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="uid" property="uid" jdbcType="VARCHAR" />
  7. <result column="type" property="type" jdbcType="INTEGER" />
  8. <result column="name" property="name" jdbcType="VARCHAR" />
  9. <result column="id_number" property="idNumber" jdbcType="VARCHAR" />
  10. <result column="investment" property="investment" jdbcType="DECIMAL" />
  11. <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
  12. </resultMap>
  13. <sql id="Base_Column_List" >
  14. id, uid, type, name, id_number, investment, deleted_sign
  15. </sql>
  16. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  17. select
  18. <include refid="Base_Column_List" />
  19. from nature_ownership
  20. where id = #{id,jdbcType=VARCHAR}
  21. </select>
  22. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  23. delete from nature_ownership
  24. where id = #{id,jdbcType=VARCHAR}
  25. </delete>
  26. <insert id="insert" parameterType="com.goafanti.common.model.NatureOwnership" >
  27. insert into nature_ownership (id, uid, type,
  28. name, id_number, investment,
  29. deleted_sign)
  30. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
  31. #{name,jdbcType=VARCHAR}, #{idNumber,jdbcType=VARCHAR}, #{investment,jdbcType=DECIMAL},
  32. #{deletedSign,jdbcType=INTEGER})
  33. </insert>
  34. <insert id="insertSelective" parameterType="com.goafanti.common.model.NatureOwnership" >
  35. insert into nature_ownership
  36. <trim prefix="(" suffix=")" suffixOverrides="," >
  37. <if test="id != null" >
  38. id,
  39. </if>
  40. <if test="uid != null" >
  41. uid,
  42. </if>
  43. <if test="type != null" >
  44. type,
  45. </if>
  46. <if test="name != null" >
  47. name,
  48. </if>
  49. <if test="idNumber != null" >
  50. id_number,
  51. </if>
  52. <if test="investment != null" >
  53. investment,
  54. </if>
  55. <if test="deletedSign != null" >
  56. deleted_sign,
  57. </if>
  58. </trim>
  59. <trim prefix="values (" suffix=")" suffixOverrides="," >
  60. <if test="id != null" >
  61. #{id,jdbcType=VARCHAR},
  62. </if>
  63. <if test="uid != null" >
  64. #{uid,jdbcType=VARCHAR},
  65. </if>
  66. <if test="type != null" >
  67. #{type,jdbcType=INTEGER},
  68. </if>
  69. <if test="name != null" >
  70. #{name,jdbcType=VARCHAR},
  71. </if>
  72. <if test="idNumber != null" >
  73. #{idNumber,jdbcType=VARCHAR},
  74. </if>
  75. <if test="investment != null" >
  76. #{investment,jdbcType=DECIMAL},
  77. </if>
  78. <if test="deletedSign != null" >
  79. #{deletedSign,jdbcType=INTEGER},
  80. </if>
  81. </trim>
  82. </insert>
  83. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.NatureOwnership" >
  84. update nature_ownership
  85. <set >
  86. <if test="uid != null" >
  87. uid = #{uid,jdbcType=VARCHAR},
  88. </if>
  89. <if test="type != null" >
  90. type = #{type,jdbcType=INTEGER},
  91. </if>
  92. <if test="name != null" >
  93. name = #{name,jdbcType=VARCHAR},
  94. </if>
  95. <if test="idNumber != null" >
  96. id_number = #{idNumber,jdbcType=VARCHAR},
  97. </if>
  98. <if test="investment != null" >
  99. investment = #{investment,jdbcType=DECIMAL},
  100. </if>
  101. <if test="deletedSign != null" >
  102. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  103. </if>
  104. </set>
  105. where id = #{id,jdbcType=VARCHAR}
  106. </update>
  107. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.NatureOwnership" >
  108. update nature_ownership
  109. set uid = #{uid,jdbcType=VARCHAR},
  110. type = #{type,jdbcType=INTEGER},
  111. name = #{name,jdbcType=VARCHAR},
  112. id_number = #{idNumber,jdbcType=VARCHAR},
  113. investment = #{investment,jdbcType=DECIMAL},
  114. deleted_sign = #{deletedSign,jdbcType=INTEGER}
  115. where id = #{id,jdbcType=VARCHAR}
  116. </update>
  117. <select id="selectByUid" resultMap="BaseResultMap" parameterType="java.lang.String" >
  118. select
  119. <include refid="Base_Column_List" />
  120. from nature_ownership
  121. where uid = #{uid,jdbcType=VARCHAR} and deleted_sign = 0 order by investment desc
  122. </select>
  123. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  124. update nature_ownership set deleted_sign = 1
  125. where id in
  126. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  127. #{item}
  128. </foreach>
  129. </update>
  130. <insert id="batchInsert" parameterType="com.goafanti.common.model.NatureOwnership">
  131. insert into nature_ownership (id, uid, type, name, id_number, investment, deleted_sign)
  132. values
  133. <foreach item="item" index="index" collection="list" separator=",">
  134. (#{item.id,jdbcType=VARCHAR}, #{item.uid,jdbcType=VARCHAR}, #{item.type,jdbcType=INTEGER},
  135. #{item.name,jdbcType=VARCHAR}, #{item.idNumber,jdbcType=VARCHAR}, #{item.investment,jdbcType=DECIMAL},
  136. #{item.deletedSign,jdbcType=INTEGER})
  137. </foreach>
  138. ON DUPLICATE KEY UPDATE
  139. type = values(type),
  140. name = values(name),
  141. id_number = values(id_number),
  142. investment = values(investment),
  143. deleted_sign = values(deleted_sign)
  144. </insert>
  145. </mapper>