PublicReleaseDetailsMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.PublicReleaseDetailsMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.PublicReleaseDetails">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="prid" jdbcType="INTEGER" property="prid" />
  7. <result column="uid" jdbcType="VARCHAR" property="uid" />
  8. <result column="ufid" jdbcType="VARCHAR" property="ufid" />
  9. <result column="new_user" jdbcType="INTEGER" property="newUser" />
  10. <result column="sign_sum" jdbcType="INTEGER" property="signSum" />
  11. </resultMap>
  12. <sql id="Base_Column_List">
  13. id, prid, `uid`, ufid, new_user, sign_sum
  14. </sql>
  15. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  16. select
  17. <include refid="Base_Column_List" />
  18. from public_release_details
  19. where id = #{id,jdbcType=INTEGER}
  20. </select>
  21. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  22. delete from public_release_details
  23. where id = #{id,jdbcType=INTEGER}
  24. </delete>
  25. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseDetails" useGeneratedKeys="true">
  26. insert into public_release_details (prid, `uid`, ufid,
  27. new_user, sign_sum)
  28. values (#{prid,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{ufid,jdbcType=VARCHAR},
  29. #{newUser,jdbcType=INTEGER}, #{signSum,jdbcType=INTEGER})
  30. </insert>
  31. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseDetails" useGeneratedKeys="true">
  32. insert into public_release_details
  33. <trim prefix="(" suffix=")" suffixOverrides=",">
  34. <if test="prid != null">
  35. prid,
  36. </if>
  37. <if test="uid != null">
  38. `uid`,
  39. </if>
  40. <if test="ufid != null">
  41. ufid,
  42. </if>
  43. <if test="newUser != null">
  44. new_user,
  45. </if>
  46. <if test="signSum != null">
  47. sign_sum,
  48. </if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="prid != null">
  52. #{prid,jdbcType=INTEGER},
  53. </if>
  54. <if test="uid != null">
  55. #{uid,jdbcType=VARCHAR},
  56. </if>
  57. <if test="ufid != null">
  58. #{ufid,jdbcType=VARCHAR},
  59. </if>
  60. <if test="newUser != null">
  61. #{newUser,jdbcType=INTEGER},
  62. </if>
  63. <if test="signSum != null">
  64. #{signSum,jdbcType=INTEGER},
  65. </if>
  66. </trim>
  67. </insert>
  68. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicReleaseDetails">
  69. update public_release_details
  70. <set>
  71. <if test="prid != null">
  72. prid = #{prid,jdbcType=INTEGER},
  73. </if>
  74. <if test="uid != null">
  75. `uid` = #{uid,jdbcType=VARCHAR},
  76. </if>
  77. <if test="ufid != null">
  78. ufid = #{ufid,jdbcType=VARCHAR},
  79. </if>
  80. <if test="newUser != null">
  81. new_user = #{newUser,jdbcType=INTEGER},
  82. </if>
  83. <if test="signSum != null">
  84. sign_sum = #{signSum,jdbcType=INTEGER},
  85. </if>
  86. </set>
  87. where id = #{id,jdbcType=INTEGER}
  88. </update>
  89. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PublicReleaseDetails">
  90. update public_release_details
  91. set prid = #{prid,jdbcType=INTEGER},
  92. `uid` = #{uid,jdbcType=VARCHAR},
  93. ufid = #{ufid,jdbcType=VARCHAR},
  94. new_user = #{newUser,jdbcType=INTEGER},
  95. sign_sum = #{signSum,jdbcType=INTEGER}
  96. where id = #{id,jdbcType=INTEGER}
  97. </update>
  98. <select id="selectByPCid" resultType="com.goafanti.common.model.PublicReleaseDetails">
  99. select
  100. id,prid, `uid`, ufid, new_user newUser, sign_sum signSum
  101. from public_release_details
  102. where prid = #{id,jdbcType=INTEGER}
  103. </select>
  104. <insert id="insertBatch">
  105. insert into public_release_details (prid, `uid`, ufid,
  106. new_user, sign_sum)
  107. values
  108. <foreach collection="list" item="prd" separator=",">
  109. (#{prd.prid,jdbcType=INTEGER}, #{prd.uid,jdbcType=VARCHAR}, #{prd.ufid,jdbcType=VARCHAR},
  110. #{prd.newUser,jdbcType=INTEGER}, #{prd.signSum,jdbcType=INTEGER})
  111. </foreach>
  112. </insert>
  113. <select id="getNamesByPrid" resultType="java.lang.String">
  114. select GROUP_CONCAT(b.nickname)userNames
  115. from public_release_details a left join user b on a.uid =b.id
  116. where prid = #{id}
  117. group by prid
  118. </select>
  119. </mapper>