DemandInterestMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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.DemandInterestMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.DemandInterest" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <id column="uid" property="uid" jdbcType="VARCHAR" />
  7. <result column="demand_id" property="demandId" jdbcType="VARCHAR" />
  8. <result column="uid" property="uid" jdbcType="VARCHAR" />
  9. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  10. </resultMap>
  11. <sql id="Base_Column_List" >
  12. id, demand_id, uid, create_time
  13. </sql>
  14. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  15. select
  16. <include refid="Base_Column_List" />
  17. from demand_interest
  18. where id = #{id,jdbcType=VARCHAR}
  19. </select>
  20. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  21. delete from demand_interest
  22. where 1=1
  23. <if test="id != null" >
  24. and demand_id = #{id,jdbcType=VARCHAR}
  25. </if>
  26. <if test="uid != null" >
  27. and uid = #{uid,jdbcType=VARCHAR}
  28. </if>
  29. </delete>
  30. <insert id="insert" parameterType="com.goafanti.common.model.DemandInterest" >
  31. insert into demand_interest (id, demand_id, uid,
  32. create_time)
  33. values (#{id,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR},
  34. #{createTime,jdbcType=TIMESTAMP})
  35. </insert>
  36. <insert id="insertSelective" parameterType="com.goafanti.common.model.DemandInterest" >
  37. insert into demand_interest
  38. <trim prefix="(" suffix=")" suffixOverrides="," >
  39. <if test="id != null" >
  40. id,
  41. </if>
  42. <if test="demandId != null" >
  43. demand_id,
  44. </if>
  45. <if test="uid != null" >
  46. uid,
  47. </if>
  48. <if test="createTime != null" >
  49. create_time,
  50. </if>
  51. </trim>
  52. <trim prefix="values (" suffix=")" suffixOverrides="," >
  53. <if test="id != null" >
  54. #{id,jdbcType=VARCHAR},
  55. </if>
  56. <if test="demandId != null" >
  57. #{demandId,jdbcType=VARCHAR},
  58. </if>
  59. <if test="uid != null" >
  60. #{uid,jdbcType=VARCHAR},
  61. </if>
  62. <if test="createTime != null" >
  63. #{createTime,jdbcType=TIMESTAMP},
  64. </if>
  65. </trim>
  66. </insert>
  67. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.DemandInterest" >
  68. update demand_interest
  69. <set >
  70. <if test="demandId != null" >
  71. demand_id = #{demandId,jdbcType=VARCHAR},
  72. </if>
  73. <if test="uid != null" >
  74. uid = #{uid,jdbcType=VARCHAR},
  75. </if>
  76. <if test="createTime != null" >
  77. create_time = #{createTime,jdbcType=TIMESTAMP},
  78. </if>
  79. </set>
  80. where id = #{id,jdbcType=VARCHAR}
  81. </update>
  82. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.DemandInterest" >
  83. update demand_interest
  84. set demand_id = #{demandId,jdbcType=VARCHAR},
  85. uid = #{uid,jdbcType=VARCHAR},
  86. create_time = #{createTime,jdbcType=TIMESTAMP}
  87. where id = #{id,jdbcType=VARCHAR}
  88. </update>
  89. <select id="findDemandInterestListByPage" parameterType="String" resultType="com.goafanti.portal.bo.DemandInterestListBo">
  90. select
  91. di.id, di.demand_id as demandId, di.create_time as createTime,
  92. d.name, d.serial_number as serialNumber, d.deleted_sign as deletedSign,
  93. d.audit_status as auditStatus, d.keyword, d.status
  94. from demand_interest di
  95. left join demand d on d.id = di.demand_id
  96. where 1=1
  97. <if test="uid != null">
  98. and di.uid = #{uid,jdbcType=VARCHAR}
  99. </if>
  100. order by di.create_time desc
  101. <if test="page_sql!=null">
  102. ${page_sql}
  103. </if>
  104. </select>
  105. <select id="findDemandInterestCount" parameterType="String" resultType="java.lang.Integer">
  106. select
  107. count(1)
  108. from demand_interest di
  109. where 1=1
  110. <if test="uid != null">
  111. and di.uid = #{uid,jdbcType=VARCHAR}
  112. </if>
  113. </select>
  114. <select id="selectDemandInterestByUidAndDemandId" resultMap="BaseResultMap" >
  115. select
  116. <include refid="Base_Column_List" />
  117. from demand_interest
  118. where uid = #{0} and demand_id = #{1}
  119. </select>
  120. <select id="countInterestById" resultType="Integer">
  121. select count(0) from demand_interest where 1=1
  122. <if test="id != null">
  123. and demand_id = #{id,jdbcType=VARCHAR}
  124. </if>
  125. </select>
  126. <select id="checkUidAndDid" resultType="Integer">
  127. select count(0) from demand_interest where 1=1
  128. <if test="uid != null">
  129. and uid = #{uid,jdbcType=VARCHAR}
  130. </if>
  131. <if test="id != null">
  132. and demand_id = #{id,jdbcType=VARCHAR}
  133. </if>
  134. </select>
  135. <delete id="deleteInterest" parameterType="java.lang.String" >
  136. delete from demand_interest
  137. where demand_id=#{objectId,jdbcType=VARCHAR}
  138. and uid=#{uid,jdbcType=VARCHAR}
  139. </delete>
  140. <select id="checkCount" resultType="Integer">
  141. select count(0) from demand_interest where 1=1
  142. <if test="uid != null">
  143. and demand_id = #{uid,jdbcType=VARCHAR}
  144. </if>
  145. </select>
  146. </mapper>