UserArchivesMapper.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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.UserArchivesMapper">
  4. <resultMap type="com.goafanti.common.model.UserArchives" id="UserArchivesMap">
  5. <result property="id" column="id" jdbcType="INTEGER"/>
  6. <result property="uid" column="uid" jdbcType="VARCHAR"/>
  7. <result property="patentCount" column="patent_count" jdbcType="INTEGER"/>
  8. <result property="inventionPatentCount" column="invention_patent_count" jdbcType="INTEGER"/>
  9. <result property="utilityModelCount" column="utility_model_count" jdbcType="INTEGER"/>
  10. <result property="appearancePatentCount" column="appearance_patent_count" jdbcType="INTEGER"/>
  11. <result property="softwareWorksCount" column="software_works_count" jdbcType="INTEGER"/>
  12. <result property="otherCount" column="other_count" jdbcType="INTEGER"/>
  13. <result property="financialData" column="financial_data" jdbcType="VARCHAR"/>
  14. <result property="earlyCommunication" column="early_communication" jdbcType="VARCHAR"/>
  15. <result property="interviewIdeas" column="interview_ideas" jdbcType="VARCHAR"/>
  16. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  17. </resultMap>
  18. <sql id="UserArchivesAllSql">
  19. id, uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other_count, financial_data, early_communication, interview_ideas, create_time
  20. </sql>
  21. <!--查询单个-->
  22. <select id="queryById" resultMap="UserArchivesMap">
  23. select
  24. <include refid="UserArchivesAllSql"/>
  25. from user_archives
  26. where id = #{id}
  27. </select>
  28. <!--查询指定行数据-->
  29. <select id="findUserArchivesList" resultMap="UserArchivesMap">
  30. select
  31. <include refid="UserArchivesAllSql"/>
  32. from user_archives
  33. <where>
  34. <if test="id != null">
  35. and id = #{id}
  36. </if>
  37. <if test="uid != null and uid != ''">
  38. and uid = #{uid}
  39. </if>
  40. <if test="patentCount != null">
  41. and patent_count = #{patentCount}
  42. </if>
  43. <if test="inventionPatentCount != null">
  44. and invention_patent_count = #{inventionPatentCount}
  45. </if>
  46. <if test="utilityModelCount != null">
  47. and utility_model_count = #{utilityModelCount}
  48. </if>
  49. <if test="appearancePatentCount != null">
  50. and appearance_patent_count = #{appearancePatentCount}
  51. </if>
  52. <if test="softwareWorksCount != null">
  53. and software_works_count = #{softwareWorksCount}
  54. </if>
  55. <if test="otherCount != null">
  56. and other_count = #{otherCount}
  57. </if>
  58. <if test="financialData != null and financialData != ''">
  59. and financial_data = #{financialData}
  60. </if>
  61. <if test="earlyCommunication != null and earlyCommunication != ''">
  62. and early_communication = #{earlyCommunication}
  63. </if>
  64. <if test="interviewIdeas != null and interviewIdeas != ''">
  65. and interview_ideas = #{interviewIdeas}
  66. </if>
  67. <if test="createTime != null">
  68. and create_time = #{createTime}
  69. </if>
  70. </where>
  71. limit #{pageable.offset}, #{pageable.pageSize}
  72. </select>
  73. <!--统计总行数-->
  74. <select id="findUserArchivesCount" resultType="java.lang.Integer">
  75. select count(1)
  76. from user_archives
  77. <where>
  78. <if test="id != null">
  79. and id = #{id}
  80. </if>
  81. <if test="uid != null and uid != ''">
  82. and uid = #{uid}
  83. </if>
  84. <if test="patentCount != null">
  85. and patent_count = #{patentCount}
  86. </if>
  87. <if test="inventionPatentCount != null">
  88. and invention_patent_count = #{inventionPatentCount}
  89. </if>
  90. <if test="utilityModelCount != null">
  91. and utility_model_count = #{utilityModelCount}
  92. </if>
  93. <if test="appearancePatentCount != null">
  94. and appearance_patent_count = #{appearancePatentCount}
  95. </if>
  96. <if test="softwareWorksCount != null">
  97. and software_works_count = #{softwareWorksCount}
  98. </if>
  99. <if test="otherCount != null">
  100. and other_count = #{otherCount}
  101. </if>
  102. <if test="financialData != null and financialData != ''">
  103. and financial_data = #{financialData}
  104. </if>
  105. <if test="earlyCommunication != null and earlyCommunication != ''">
  106. and early_communication = #{earlyCommunication}
  107. </if>
  108. <if test="interviewIdeas != null and interviewIdeas != ''">
  109. and interview_ideas = #{interviewIdeas}
  110. </if>
  111. <if test="createTime != null">
  112. and create_time = #{createTime}
  113. </if>
  114. </where>
  115. </select>
  116. <!--新增所有列-->
  117. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  118. insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other_count, financial_data, early_communication, interview_ideas)
  119. values (#{uid}, #{patentCount}, #{inventionPatentCount}, #{utilityModelCount}, #{appearancePatentCount}, #{softwareWorksCount}, #{otherCount}, #{financialData}, #{earlyCommunication}, #{interviewIdeas})
  120. </insert>
  121. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  122. insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other_count, financial_data, early_communication, interview_ideas, create_time)
  123. values
  124. <foreach collection="entities" item="entity" separator=",">
  125. (#{entity.uid}, #{entity.patentCount}, #{entity.inventionPatentCount}, #{entity.utilityModelCount}, #{entity.appearancePatentCount}, #{entity.softwareWorksCount}, #{entity.otherCount}, #{entity.financialData}, #{entity.earlyCommunication}, #{entity.interviewIdeas}, #{entity.createTime})
  126. </foreach>
  127. </insert>
  128. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  129. insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other_count, financial_data, early_communication, interview_ideas, create_time)
  130. values
  131. <foreach collection="entities" item="entity" separator=",">
  132. (#{entity.uid}, #{entity.patentCount}, #{entity.inventionPatentCount}, #{entity.utilityModelCount}, #{entity.appearancePatentCount}, #{entity.softwareWorksCount}, #{entity.otherCount}, #{entity.financialData}, #{entity.earlyCommunication}, #{entity.interviewIdeas}, #{entity.createTime})
  133. </foreach>
  134. on duplicate key update
  135. uid = values(uid),
  136. patent_count = values(patent_count),
  137. invention_patent_count = values(invention_patent_count),
  138. utility_model_count = values(utility_model_count),
  139. appearance_patent_count = values(appearance_patent_count),
  140. software_works_count = values(software_works_count),
  141. other_count = values(other_count),
  142. financial_data = values(financial_data),
  143. early_communication = values(early_communication),
  144. interview_ideas = values(interview_ideas),
  145. create_time = values(create_time)
  146. </insert>
  147. <!--通过主键修改数据-->
  148. <update id="update">
  149. update user_archives
  150. <set>
  151. <if test="uid != null and uid != ''">
  152. uid = #{uid},
  153. </if>
  154. <if test="patentCount != null">
  155. patent_count = #{patentCount},
  156. </if>
  157. <if test="inventionPatentCount != null">
  158. invention_patent_count = #{inventionPatentCount},
  159. </if>
  160. <if test="utilityModelCount != null">
  161. utility_model_count = #{utilityModelCount},
  162. </if>
  163. <if test="appearancePatentCount != null">
  164. appearance_patent_count = #{appearancePatentCount},
  165. </if>
  166. <if test="softwareWorksCount != null">
  167. software_works_count = #{softwareWorksCount},
  168. </if>
  169. <if test="otherCount != null">
  170. other_count = #{otherCount},
  171. </if>
  172. <if test="financialData != null and financialData != ''">
  173. financial_data = #{financialData},
  174. </if>
  175. <if test="earlyCommunication != null and earlyCommunication != ''">
  176. early_communication = #{earlyCommunication},
  177. </if>
  178. <if test="interviewIdeas != null and interviewIdeas != ''">
  179. interview_ideas = #{interviewIdeas},
  180. </if>
  181. <if test="createTime != null">
  182. create_time = #{createTime},
  183. </if>
  184. </set>
  185. where id = #{id}
  186. </update>
  187. <!--通过主键删除-->
  188. <delete id="deleteById">
  189. delete from user_archives where id = #{id}
  190. </delete>
  191. <select id="queryByUid" resultMap="UserArchivesMap">
  192. select
  193. <include refid="UserArchivesAllSql"/>
  194. from user_archives
  195. where uid = #{id}
  196. </select>
  197. </mapper>