OrganizationContactBookMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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.OrganizationContactBookMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.OrganizationContactBook">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  9. -->
  10. <id column="id" jdbcType="VARCHAR" property="id" />
  11. <result column="uid" jdbcType="VARCHAR" property="uid" />
  12. <result column="name" jdbcType="VARCHAR" property="name" />
  13. <result column="sex" jdbcType="CHAR" property="sex" />
  14. <result column="mobile" jdbcType="VARCHAR" property="mobile" />
  15. <result column="email" jdbcType="VARCHAR" property="email" />
  16. <result column="qq" jdbcType="VARCHAR" property="qq" />
  17. <result column="wechat" jdbcType="VARCHAR" property="wechat" />
  18. <result column="department" jdbcType="VARCHAR" property="department" />
  19. <result column="position" jdbcType="VARCHAR" property="position" />
  20. <result column="tel_num" jdbcType="VARCHAR" property="telNum" />
  21. <result column="major" jdbcType="INTEGER" property="major" />
  22. <result column="aid" jdbcType="VARCHAR" property="aid" />
  23. </resultMap>
  24. <sql id="Example_Where_Clause">
  25. <!--
  26. WARNING - @mbg.generated
  27. This element is automatically generated by MyBatis Generator, do not modify.
  28. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  29. -->
  30. <where>
  31. <foreach collection="oredCriteria" item="criteria" separator="or">
  32. <if test="criteria.valid">
  33. <trim prefix="(" prefixOverrides="and" suffix=")">
  34. <foreach collection="criteria.criteria" item="criterion">
  35. <choose>
  36. <when test="criterion.noValue">
  37. and ${criterion.condition}
  38. </when>
  39. <when test="criterion.singleValue">
  40. and ${criterion.condition} #{criterion.value}
  41. </when>
  42. <when test="criterion.betweenValue">
  43. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  44. </when>
  45. <when test="criterion.listValue">
  46. and ${criterion.condition}
  47. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  48. #{listItem}
  49. </foreach>
  50. </when>
  51. </choose>
  52. </foreach>
  53. </trim>
  54. </if>
  55. </foreach>
  56. </where>
  57. </sql>
  58. <sql id="Update_By_Example_Where_Clause">
  59. <!--
  60. WARNING - @mbg.generated
  61. This element is automatically generated by MyBatis Generator, do not modify.
  62. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  63. -->
  64. <where>
  65. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  66. <if test="criteria.valid">
  67. <trim prefix="(" prefixOverrides="and" suffix=")">
  68. <foreach collection="criteria.criteria" item="criterion">
  69. <choose>
  70. <when test="criterion.noValue">
  71. and ${criterion.condition}
  72. </when>
  73. <when test="criterion.singleValue">
  74. and ${criterion.condition} #{criterion.value}
  75. </when>
  76. <when test="criterion.betweenValue">
  77. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  78. </when>
  79. <when test="criterion.listValue">
  80. and ${criterion.condition}
  81. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  82. #{listItem}
  83. </foreach>
  84. </when>
  85. </choose>
  86. </foreach>
  87. </trim>
  88. </if>
  89. </foreach>
  90. </where>
  91. </sql>
  92. <sql id="Base_Column_List">
  93. <!--
  94. WARNING - @mbg.generated
  95. This element is automatically generated by MyBatis Generator, do not modify.
  96. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  97. -->
  98. id, uid, name, sex, mobile, email, qq, wechat, department, position, tel_num,
  99. major, aid
  100. </sql>
  101. <select id="selectByExample" parameterType="com.goafanti.common.model.OrganizationContactBookExample" resultMap="BaseResultMap">
  102. <!--
  103. WARNING - @mbg.generated
  104. This element is automatically generated by MyBatis Generator, do not modify.
  105. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  106. -->
  107. select
  108. <if test="distinct">
  109. distinct
  110. </if>
  111. <include refid="Base_Column_List" />
  112. from organization_contact_book
  113. <if test="_parameter != null">
  114. <include refid="Example_Where_Clause" />
  115. </if>
  116. <if test="orderByClause != null">
  117. order by ${orderByClause}
  118. </if>
  119. </select>
  120. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  121. <!--
  122. WARNING - @mbg.generated
  123. This element is automatically generated by MyBatis Generator, do not modify.
  124. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  125. -->
  126. select
  127. <include refid="Base_Column_List" />
  128. from organization_contact_book
  129. where id = #{id,jdbcType=VARCHAR}
  130. </select>
  131. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  132. <!--
  133. WARNING - @mbg.generated
  134. This element is automatically generated by MyBatis Generator, do not modify.
  135. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  136. -->
  137. delete from organization_contact_book
  138. where id = #{id,jdbcType=VARCHAR}
  139. </delete>
  140. <delete id="deleteByExample" parameterType="com.goafanti.common.model.OrganizationContactBookExample">
  141. <!--
  142. WARNING - @mbg.generated
  143. This element is automatically generated by MyBatis Generator, do not modify.
  144. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  145. -->
  146. delete from organization_contact_book
  147. <if test="_parameter != null">
  148. <include refid="Example_Where_Clause" />
  149. </if>
  150. </delete>
  151. <insert id="insert" parameterType="com.goafanti.common.model.OrganizationContactBook">
  152. <!--
  153. WARNING - @mbg.generated
  154. This element is automatically generated by MyBatis Generator, do not modify.
  155. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  156. -->
  157. insert into organization_contact_book (id, uid, name,
  158. sex, mobile, email, qq,
  159. wechat, department, position,
  160. tel_num, major,
  161. aid)
  162. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  163. #{sex,jdbcType=CHAR}, #{mobile,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{qq,jdbcType=VARCHAR},
  164. #{wechat,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
  165. #{telNum,jdbcType=VARCHAR}, #{major,jdbcType=INTEGER},
  166. #{aid,jdbcType=VARCHAR})
  167. </insert>
  168. <insert id="insertSelective" parameterType="com.goafanti.common.model.OrganizationContactBook">
  169. <!--
  170. WARNING - @mbg.generated
  171. This element is automatically generated by MyBatis Generator, do not modify.
  172. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  173. -->
  174. insert into organization_contact_book
  175. <trim prefix="(" suffix=")" suffixOverrides=",">
  176. <if test="id != null">
  177. id,
  178. </if>
  179. <if test="uid != null">
  180. uid,
  181. </if>
  182. <if test="name != null">
  183. name,
  184. </if>
  185. <if test="sex != null">
  186. sex,
  187. </if>
  188. <if test="mobile != null">
  189. mobile,
  190. </if>
  191. <if test="email != null">
  192. email,
  193. </if>
  194. <if test="qq != null">
  195. qq,
  196. </if>
  197. <if test="wechat != null">
  198. wechat,
  199. </if>
  200. <if test="department != null">
  201. department,
  202. </if>
  203. <if test="position != null">
  204. position,
  205. </if>
  206. <if test="telNum != null">
  207. tel_num,
  208. </if>
  209. <if test="major != null">
  210. major,
  211. </if>
  212. <if test="aid != null">
  213. aid,
  214. </if>
  215. </trim>
  216. <trim prefix="values (" suffix=")" suffixOverrides=",">
  217. <if test="id != null">
  218. #{id,jdbcType=VARCHAR},
  219. </if>
  220. <if test="uid != null">
  221. #{uid,jdbcType=VARCHAR},
  222. </if>
  223. <if test="name != null">
  224. #{name,jdbcType=VARCHAR},
  225. </if>
  226. <if test="sex != null">
  227. #{sex,jdbcType=CHAR},
  228. </if>
  229. <if test="mobile != null">
  230. #{mobile,jdbcType=VARCHAR},
  231. </if>
  232. <if test="email != null">
  233. #{email,jdbcType=VARCHAR},
  234. </if>
  235. <if test="qq != null">
  236. #{qq,jdbcType=VARCHAR},
  237. </if>
  238. <if test="wechat != null">
  239. #{wechat,jdbcType=VARCHAR},
  240. </if>
  241. <if test="department != null">
  242. #{department,jdbcType=VARCHAR},
  243. </if>
  244. <if test="position != null">
  245. #{position,jdbcType=VARCHAR},
  246. </if>
  247. <if test="telNum != null">
  248. #{telNum,jdbcType=VARCHAR},
  249. </if>
  250. <if test="major != null">
  251. #{major,jdbcType=INTEGER},
  252. </if>
  253. <if test="aid != null">
  254. #{aid,jdbcType=VARCHAR},
  255. </if>
  256. </trim>
  257. </insert>
  258. <select id="countByExample" parameterType="com.goafanti.common.model.OrganizationContactBookExample" resultType="java.lang.Long">
  259. <!--
  260. WARNING - @mbg.generated
  261. This element is automatically generated by MyBatis Generator, do not modify.
  262. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  263. -->
  264. select count(*) from organization_contact_book
  265. <if test="_parameter != null">
  266. <include refid="Example_Where_Clause" />
  267. </if>
  268. </select>
  269. <update id="updateByExampleSelective" parameterType="map">
  270. <!--
  271. WARNING - @mbg.generated
  272. This element is automatically generated by MyBatis Generator, do not modify.
  273. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  274. -->
  275. update organization_contact_book
  276. <set>
  277. <if test="record.id != null">
  278. id = #{record.id,jdbcType=VARCHAR},
  279. </if>
  280. <if test="record.uid != null">
  281. uid = #{record.uid,jdbcType=VARCHAR},
  282. </if>
  283. <if test="record.name != null">
  284. name = #{record.name,jdbcType=VARCHAR},
  285. </if>
  286. <if test="record.sex != null">
  287. sex = #{record.sex,jdbcType=CHAR},
  288. </if>
  289. <if test="record.mobile != null">
  290. mobile = #{record.mobile,jdbcType=VARCHAR},
  291. </if>
  292. <if test="record.email != null">
  293. email = #{record.email,jdbcType=VARCHAR},
  294. </if>
  295. <if test="record.qq != null">
  296. qq = #{record.qq,jdbcType=VARCHAR},
  297. </if>
  298. <if test="record.wechat != null">
  299. wechat = #{record.wechat,jdbcType=VARCHAR},
  300. </if>
  301. <if test="record.department != null">
  302. department = #{record.department,jdbcType=VARCHAR},
  303. </if>
  304. <if test="record.position != null">
  305. position = #{record.position,jdbcType=VARCHAR},
  306. </if>
  307. <if test="record.telNum != null">
  308. tel_num = #{record.telNum,jdbcType=VARCHAR},
  309. </if>
  310. <if test="record.major != null">
  311. major = #{record.major,jdbcType=INTEGER},
  312. </if>
  313. <if test="record.aid != null">
  314. aid = #{record.aid,jdbcType=VARCHAR},
  315. </if>
  316. </set>
  317. <if test="_parameter != null">
  318. <include refid="Update_By_Example_Where_Clause" />
  319. </if>
  320. </update>
  321. <update id="updateByExample" parameterType="map">
  322. <!--
  323. WARNING - @mbg.generated
  324. This element is automatically generated by MyBatis Generator, do not modify.
  325. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  326. -->
  327. update organization_contact_book
  328. set id = #{record.id,jdbcType=VARCHAR},
  329. uid = #{record.uid,jdbcType=VARCHAR},
  330. name = #{record.name,jdbcType=VARCHAR},
  331. sex = #{record.sex,jdbcType=CHAR},
  332. mobile = #{record.mobile,jdbcType=VARCHAR},
  333. email = #{record.email,jdbcType=VARCHAR},
  334. qq = #{record.qq,jdbcType=VARCHAR},
  335. wechat = #{record.wechat,jdbcType=VARCHAR},
  336. department = #{record.department,jdbcType=VARCHAR},
  337. position = #{record.position,jdbcType=VARCHAR},
  338. tel_num = #{record.telNum,jdbcType=VARCHAR},
  339. major = #{record.major,jdbcType=INTEGER},
  340. aid = #{record.aid,jdbcType=VARCHAR}
  341. <if test="_parameter != null">
  342. <include refid="Update_By_Example_Where_Clause" />
  343. </if>
  344. </update>
  345. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OrganizationContactBook">
  346. <!--
  347. WARNING - @mbg.generated
  348. This element is automatically generated by MyBatis Generator, do not modify.
  349. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  350. -->
  351. update organization_contact_book
  352. <set>
  353. <if test="uid != null">
  354. uid = #{uid,jdbcType=VARCHAR},
  355. </if>
  356. <if test="name != null">
  357. name = #{name,jdbcType=VARCHAR},
  358. </if>
  359. <if test="sex != null">
  360. sex = #{sex,jdbcType=CHAR},
  361. </if>
  362. <if test="mobile != null">
  363. mobile = #{mobile,jdbcType=VARCHAR},
  364. </if>
  365. <if test="email != null">
  366. email = #{email,jdbcType=VARCHAR},
  367. </if>
  368. <if test="qq != null">
  369. qq = #{qq,jdbcType=VARCHAR},
  370. </if>
  371. <if test="wechat != null">
  372. wechat = #{wechat,jdbcType=VARCHAR},
  373. </if>
  374. <if test="department != null">
  375. department = #{department,jdbcType=VARCHAR},
  376. </if>
  377. <if test="position != null">
  378. position = #{position,jdbcType=VARCHAR},
  379. </if>
  380. <if test="telNum != null">
  381. tel_num = #{telNum,jdbcType=VARCHAR},
  382. </if>
  383. <if test="major != null">
  384. major = #{major,jdbcType=INTEGER},
  385. </if>
  386. <if test="aid != null">
  387. aid = #{aid,jdbcType=VARCHAR},
  388. </if>
  389. </set>
  390. where id = #{id,jdbcType=VARCHAR}
  391. </update>
  392. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OrganizationContactBook">
  393. <!--
  394. WARNING - @mbg.generated
  395. This element is automatically generated by MyBatis Generator, do not modify.
  396. This element was generated on Tue Jun 12 16:31:20 CST 2018.
  397. -->
  398. update organization_contact_book
  399. set uid = #{uid,jdbcType=VARCHAR},
  400. name = #{name,jdbcType=VARCHAR},
  401. sex = #{sex,jdbcType=CHAR},
  402. mobile = #{mobile,jdbcType=VARCHAR},
  403. email = #{email,jdbcType=VARCHAR},
  404. qq = #{qq,jdbcType=VARCHAR},
  405. wechat = #{wechat,jdbcType=VARCHAR},
  406. department = #{department,jdbcType=VARCHAR},
  407. position = #{position,jdbcType=VARCHAR},
  408. tel_num = #{telNum,jdbcType=VARCHAR},
  409. major = #{major,jdbcType=INTEGER},
  410. aid = #{aid,jdbcType=VARCHAR}
  411. where id = #{id,jdbcType=VARCHAR}
  412. </update>
  413. <select id="checkContacts" resultType="java.lang.Integer">
  414. select
  415. count( 0 )
  416. from
  417. organization_contact_book
  418. where 1=1
  419. <if test="uid != null">
  420. and uid = #{uid,jdbcType=VARCHAR}
  421. </if>
  422. <if test="aid != null">
  423. and aid = #{aid,jdbcType=VARCHAR}
  424. </if>
  425. <if test="mobile != null">
  426. and mobile = #{mobile,jdbcType=VARCHAR}
  427. </if>
  428. </select>
  429. <update id="updateSubContact">
  430. update organization_contact_book set major = 0 where uid = #{uid,jdbcType=VARCHAR}
  431. </update>
  432. <update id="updateMainContact">
  433. update organization_contact_book set major = 1 where id = #{ocbId,jdbcType=VARCHAR}
  434. </update>
  435. <select id="selectContactByUid" resultType="com.goafanti.user.bo.UserContactBo">
  436. select id,name,mobile,email,qq,wechat,department,position,major from organization_contact_book
  437. where uid = #{uid,jdbcType=VARCHAR}
  438. </select>
  439. </mapper>