OrganizationContactBookMapper.xml 16 KB

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