AdminMapper.xml 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  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.AdminMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.Admin">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  9. -->
  10. <id column="id" jdbcType="VARCHAR" property="id" />
  11. <result column="mobile" jdbcType="VARCHAR" property="mobile" />
  12. <result column="name" jdbcType="VARCHAR" property="name" />
  13. <result column="password" jdbcType="VARCHAR" property="password" />
  14. <result column="email" jdbcType="VARCHAR" property="email" />
  15. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  16. <result column="number" jdbcType="INTEGER" property="number" />
  17. <result column="province" jdbcType="VARCHAR" property="province" />
  18. <result column="position" jdbcType="VARCHAR" property="position" />
  19. <result column="superior_id" jdbcType="VARCHAR" property="superiorId" />
  20. <result column="city" jdbcType="VARCHAR" property="city" />
  21. <result column="department_id" jdbcType="VARCHAR" property="departmentId" />
  22. <result column="status" jdbcType="VARCHAR" property="status" />
  23. <result column="user_no" jdbcType="VARCHAR" property="userNo" />
  24. <result column="duty" jdbcType="VARCHAR" property="duty" />
  25. <result column="district" jdbcType="VARCHAR" property="district" />
  26. <result column="head_portrait_url" jdbcType="VARCHAR" property="headPortraitUrl" />
  27. <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
  28. <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
  29. </resultMap>
  30. <sql id="Example_Where_Clause">
  31. <!--
  32. WARNING - @mbg.generated
  33. This element is automatically generated by MyBatis Generator, do not modify.
  34. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  35. -->
  36. <where>
  37. <foreach collection="oredCriteria" item="criteria" separator="or">
  38. <if test="criteria.valid">
  39. <trim prefix="(" prefixOverrides="and" suffix=")">
  40. <foreach collection="criteria.criteria" item="criterion">
  41. <choose>
  42. <when test="criterion.noValue">
  43. and ${criterion.condition}
  44. </when>
  45. <when test="criterion.singleValue">
  46. and ${criterion.condition} #{criterion.value}
  47. </when>
  48. <when test="criterion.betweenValue">
  49. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  50. </when>
  51. <when test="criterion.listValue">
  52. and ${criterion.condition}
  53. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  54. #{listItem}
  55. </foreach>
  56. </when>
  57. </choose>
  58. </foreach>
  59. </trim>
  60. </if>
  61. </foreach>
  62. </where>
  63. </sql>
  64. <sql id="Update_By_Example_Where_Clause">
  65. <!--
  66. WARNING - @mbg.generated
  67. This element is automatically generated by MyBatis Generator, do not modify.
  68. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  69. -->
  70. <where>
  71. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  72. <if test="criteria.valid">
  73. <trim prefix="(" prefixOverrides="and" suffix=")">
  74. <foreach collection="criteria.criteria" item="criterion">
  75. <choose>
  76. <when test="criterion.noValue">
  77. and ${criterion.condition}
  78. </when>
  79. <when test="criterion.singleValue">
  80. and ${criterion.condition} #{criterion.value}
  81. </when>
  82. <when test="criterion.betweenValue">
  83. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  84. </when>
  85. <when test="criterion.listValue">
  86. and ${criterion.condition}
  87. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  88. #{listItem}
  89. </foreach>
  90. </when>
  91. </choose>
  92. </foreach>
  93. </trim>
  94. </if>
  95. </foreach>
  96. </where>
  97. </sql>
  98. <sql id="Base_Column_List">
  99. <!--
  100. WARNING - @mbg.generated
  101. This element is automatically generated by MyBatis Generator, do not modify.
  102. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  103. -->
  104. id, mobile, name, password, email, create_time, number, province, position, superior_id,
  105. city, department_id, status, user_no, duty, district, head_portrait_url, contact_mobile,
  106. last_login_time
  107. </sql>
  108. <select id="selectByExample" parameterType="com.goafanti.common.model.AdminExample" resultMap="BaseResultMap">
  109. <!--
  110. WARNING - @mbg.generated
  111. This element is automatically generated by MyBatis Generator, do not modify.
  112. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  113. -->
  114. select
  115. <if test="distinct">
  116. distinct
  117. </if>
  118. <include refid="Base_Column_List" />
  119. from admin
  120. <if test="_parameter != null">
  121. <include refid="Example_Where_Clause" />
  122. </if>
  123. <if test="orderByClause != null">
  124. order by ${orderByClause}
  125. </if>
  126. </select>
  127. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  128. <!--
  129. WARNING - @mbg.generated
  130. This element is automatically generated by MyBatis Generator, do not modify.
  131. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  132. -->
  133. select
  134. <include refid="Base_Column_List" />
  135. from admin
  136. where id = #{id,jdbcType=VARCHAR}
  137. </select>
  138. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  139. <!--
  140. WARNING - @mbg.generated
  141. This element is automatically generated by MyBatis Generator, do not modify.
  142. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  143. -->
  144. delete from admin
  145. where id = #{id,jdbcType=VARCHAR}
  146. </delete>
  147. <delete id="deleteByExample" parameterType="com.goafanti.common.model.AdminExample">
  148. <!--
  149. WARNING - @mbg.generated
  150. This element is automatically generated by MyBatis Generator, do not modify.
  151. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  152. -->
  153. delete from admin
  154. <if test="_parameter != null">
  155. <include refid="Example_Where_Clause" />
  156. </if>
  157. </delete>
  158. <insert id="insert" parameterType="com.goafanti.common.model.Admin">
  159. <!--
  160. WARNING - @mbg.generated
  161. This element is automatically generated by MyBatis Generator, do not modify.
  162. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  163. -->
  164. insert into admin (id, mobile, name,
  165. password, email, create_time,
  166. number, province, position,
  167. superior_id, city, department_id,
  168. status, user_no, duty,
  169. district, head_portrait_url, contact_mobile,
  170. last_login_time)
  171. values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  172. #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  173. #{number,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
  174. #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR},
  175. #{status,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR},
  176. #{district,jdbcType=VARCHAR}, #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
  177. #{lastLoginTime,jdbcType=TIMESTAMP})
  178. </insert>
  179. <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin">
  180. <!--
  181. WARNING - @mbg.generated
  182. This element is automatically generated by MyBatis Generator, do not modify.
  183. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  184. -->
  185. insert into admin
  186. <trim prefix="(" suffix=")" suffixOverrides=",">
  187. <if test="id != null">
  188. id,
  189. </if>
  190. <if test="mobile != null">
  191. mobile,
  192. </if>
  193. <if test="name != null">
  194. name,
  195. </if>
  196. <if test="password != null">
  197. password,
  198. </if>
  199. <if test="email != null">
  200. email,
  201. </if>
  202. <if test="createTime != null">
  203. create_time,
  204. </if>
  205. <if test="number != null">
  206. number,
  207. </if>
  208. <if test="province != null">
  209. province,
  210. </if>
  211. <if test="position != null">
  212. position,
  213. </if>
  214. <if test="superiorId != null">
  215. superior_id,
  216. </if>
  217. <if test="city != null">
  218. city,
  219. </if>
  220. <if test="departmentId != null">
  221. department_id,
  222. </if>
  223. <if test="status != null">
  224. status,
  225. </if>
  226. <if test="userNo != null">
  227. user_no,
  228. </if>
  229. <if test="duty != null">
  230. duty,
  231. </if>
  232. <if test="district != null">
  233. district,
  234. </if>
  235. <if test="headPortraitUrl != null">
  236. head_portrait_url,
  237. </if>
  238. <if test="contactMobile != null">
  239. contact_mobile,
  240. </if>
  241. <if test="lastLoginTime != null">
  242. last_login_time,
  243. </if>
  244. </trim>
  245. <trim prefix="values (" suffix=")" suffixOverrides=",">
  246. <if test="id != null">
  247. #{id,jdbcType=VARCHAR},
  248. </if>
  249. <if test="mobile != null">
  250. #{mobile,jdbcType=VARCHAR},
  251. </if>
  252. <if test="name != null">
  253. #{name,jdbcType=VARCHAR},
  254. </if>
  255. <if test="password != null">
  256. #{password,jdbcType=VARCHAR},
  257. </if>
  258. <if test="email != null">
  259. #{email,jdbcType=VARCHAR},
  260. </if>
  261. <if test="createTime != null">
  262. #{createTime,jdbcType=TIMESTAMP},
  263. </if>
  264. <if test="number != null">
  265. #{number,jdbcType=INTEGER},
  266. </if>
  267. <if test="province != null">
  268. #{province,jdbcType=VARCHAR},
  269. </if>
  270. <if test="position != null">
  271. #{position,jdbcType=VARCHAR},
  272. </if>
  273. <if test="superiorId != null">
  274. #{superiorId,jdbcType=VARCHAR},
  275. </if>
  276. <if test="city != null">
  277. #{city,jdbcType=VARCHAR},
  278. </if>
  279. <if test="departmentId != null">
  280. #{departmentId,jdbcType=VARCHAR},
  281. </if>
  282. <if test="status != null">
  283. #{status,jdbcType=VARCHAR},
  284. </if>
  285. <if test="userNo != null">
  286. #{userNo,jdbcType=VARCHAR},
  287. </if>
  288. <if test="duty != null">
  289. #{duty,jdbcType=VARCHAR},
  290. </if>
  291. <if test="district != null">
  292. #{district,jdbcType=VARCHAR},
  293. </if>
  294. <if test="headPortraitUrl != null">
  295. #{headPortraitUrl,jdbcType=VARCHAR},
  296. </if>
  297. <if test="contactMobile != null">
  298. #{contactMobile,jdbcType=VARCHAR},
  299. </if>
  300. <if test="lastLoginTime != null">
  301. #{lastLoginTime,jdbcType=TIMESTAMP},
  302. </if>
  303. </trim>
  304. </insert>
  305. <select id="countByExample" parameterType="com.goafanti.common.model.AdminExample" resultType="java.lang.Long">
  306. <!--
  307. WARNING - @mbg.generated
  308. This element is automatically generated by MyBatis Generator, do not modify.
  309. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  310. -->
  311. select count(*) from admin
  312. <if test="_parameter != null">
  313. <include refid="Example_Where_Clause" />
  314. </if>
  315. </select>
  316. <update id="updateByExampleSelective" parameterType="map">
  317. <!--
  318. WARNING - @mbg.generated
  319. This element is automatically generated by MyBatis Generator, do not modify.
  320. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  321. -->
  322. update admin
  323. <set>
  324. <if test="record.id != null">
  325. id = #{record.id,jdbcType=VARCHAR},
  326. </if>
  327. <if test="record.mobile != null">
  328. mobile = #{record.mobile,jdbcType=VARCHAR},
  329. </if>
  330. <if test="record.name != null">
  331. name = #{record.name,jdbcType=VARCHAR},
  332. </if>
  333. <if test="record.password != null">
  334. password = #{record.password,jdbcType=VARCHAR},
  335. </if>
  336. <if test="record.email != null">
  337. email = #{record.email,jdbcType=VARCHAR},
  338. </if>
  339. <if test="record.createTime != null">
  340. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  341. </if>
  342. <if test="record.number != null">
  343. number = #{record.number,jdbcType=INTEGER},
  344. </if>
  345. <if test="record.province != null">
  346. province = #{record.province,jdbcType=VARCHAR},
  347. </if>
  348. <if test="record.position != null">
  349. position = #{record.position,jdbcType=VARCHAR},
  350. </if>
  351. <if test="record.superiorId != null">
  352. superior_id = #{record.superiorId,jdbcType=VARCHAR},
  353. </if>
  354. <if test="record.city != null">
  355. city = #{record.city,jdbcType=VARCHAR},
  356. </if>
  357. <if test="record.departmentId != null">
  358. department_id = #{record.departmentId,jdbcType=VARCHAR},
  359. </if>
  360. <if test="record.status != null">
  361. status = #{record.status,jdbcType=VARCHAR},
  362. </if>
  363. <if test="record.userNo != null">
  364. user_no = #{record.userNo,jdbcType=VARCHAR},
  365. </if>
  366. <if test="record.duty != null">
  367. duty = #{record.duty,jdbcType=VARCHAR},
  368. </if>
  369. <if test="record.district != null">
  370. district = #{record.district,jdbcType=VARCHAR},
  371. </if>
  372. <if test="record.headPortraitUrl != null">
  373. head_portrait_url = #{record.headPortraitUrl,jdbcType=VARCHAR},
  374. </if>
  375. <if test="record.contactMobile != null">
  376. contact_mobile = #{record.contactMobile,jdbcType=VARCHAR},
  377. </if>
  378. <if test="record.lastLoginTime != null">
  379. last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP},
  380. </if>
  381. </set>
  382. <if test="_parameter != null">
  383. <include refid="Update_By_Example_Where_Clause" />
  384. </if>
  385. </update>
  386. <update id="updateByExample" parameterType="map">
  387. <!--
  388. WARNING - @mbg.generated
  389. This element is automatically generated by MyBatis Generator, do not modify.
  390. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  391. -->
  392. update admin
  393. set id = #{record.id,jdbcType=VARCHAR},
  394. mobile = #{record.mobile,jdbcType=VARCHAR},
  395. name = #{record.name,jdbcType=VARCHAR},
  396. password = #{record.password,jdbcType=VARCHAR},
  397. email = #{record.email,jdbcType=VARCHAR},
  398. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  399. number = #{record.number,jdbcType=INTEGER},
  400. province = #{record.province,jdbcType=VARCHAR},
  401. position = #{record.position,jdbcType=VARCHAR},
  402. superior_id = #{record.superiorId,jdbcType=VARCHAR},
  403. city = #{record.city,jdbcType=VARCHAR},
  404. department_id = #{record.departmentId,jdbcType=VARCHAR},
  405. status = #{record.status,jdbcType=VARCHAR},
  406. user_no = #{record.userNo,jdbcType=VARCHAR},
  407. duty = #{record.duty,jdbcType=VARCHAR},
  408. district = #{record.district,jdbcType=VARCHAR},
  409. head_portrait_url = #{record.headPortraitUrl,jdbcType=VARCHAR},
  410. contact_mobile = #{record.contactMobile,jdbcType=VARCHAR},
  411. last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP}
  412. <if test="_parameter != null">
  413. <include refid="Update_By_Example_Where_Clause" />
  414. </if>
  415. </update>
  416. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
  417. <!--
  418. WARNING - @mbg.generated
  419. This element is automatically generated by MyBatis Generator, do not modify.
  420. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  421. -->
  422. update admin
  423. <set>
  424. <if test="mobile != null">
  425. mobile = #{mobile,jdbcType=VARCHAR},
  426. </if>
  427. <if test="name != null">
  428. name = #{name,jdbcType=VARCHAR},
  429. </if>
  430. <if test="password != null">
  431. password = #{password,jdbcType=VARCHAR},
  432. </if>
  433. <if test="email != null">
  434. email = #{email,jdbcType=VARCHAR},
  435. </if>
  436. <if test="createTime != null">
  437. create_time = #{createTime,jdbcType=TIMESTAMP},
  438. </if>
  439. <if test="number != null">
  440. number = #{number,jdbcType=INTEGER},
  441. </if>
  442. <if test="province != null">
  443. province = #{province,jdbcType=VARCHAR},
  444. </if>
  445. <if test="position != null">
  446. position = #{position,jdbcType=VARCHAR},
  447. </if>
  448. <if test="superiorId != null">
  449. superior_id = #{superiorId,jdbcType=VARCHAR},
  450. </if>
  451. <if test="city != null">
  452. city = #{city,jdbcType=VARCHAR},
  453. </if>
  454. <if test="departmentId != null">
  455. department_id = #{departmentId,jdbcType=VARCHAR},
  456. </if>
  457. <if test="status != null">
  458. status = #{status,jdbcType=VARCHAR},
  459. </if>
  460. <if test="userNo != null">
  461. user_no = #{userNo,jdbcType=VARCHAR},
  462. </if>
  463. <if test="duty != null">
  464. duty = #{duty,jdbcType=VARCHAR},
  465. </if>
  466. <if test="district != null">
  467. district = #{district,jdbcType=VARCHAR},
  468. </if>
  469. <if test="headPortraitUrl != null">
  470. head_portrait_url = #{headPortraitUrl,jdbcType=VARCHAR},
  471. </if>
  472. <if test="contactMobile != null">
  473. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  474. </if>
  475. <if test="lastLoginTime != null">
  476. last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
  477. </if>
  478. </set>
  479. where id = #{id,jdbcType=VARCHAR}
  480. </update>
  481. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Admin">
  482. <!--
  483. WARNING - @mbg.generated
  484. This element is automatically generated by MyBatis Generator, do not modify.
  485. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  486. -->
  487. update admin
  488. set mobile = #{mobile,jdbcType=VARCHAR},
  489. name = #{name,jdbcType=VARCHAR},
  490. password = #{password,jdbcType=VARCHAR},
  491. email = #{email,jdbcType=VARCHAR},
  492. create_time = #{createTime,jdbcType=TIMESTAMP},
  493. number = #{number,jdbcType=INTEGER},
  494. province = #{province,jdbcType=VARCHAR},
  495. position = #{position,jdbcType=VARCHAR},
  496. superior_id = #{superiorId,jdbcType=VARCHAR},
  497. city = #{city,jdbcType=VARCHAR},
  498. department_id = #{departmentId,jdbcType=VARCHAR},
  499. status = #{status,jdbcType=VARCHAR},
  500. user_no = #{userNo,jdbcType=VARCHAR},
  501. duty = #{duty,jdbcType=VARCHAR},
  502. district = #{district,jdbcType=VARCHAR},
  503. head_portrait_url = #{headPortraitUrl,jdbcType=VARCHAR},
  504. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  505. last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP}
  506. where id = #{id,jdbcType=VARCHAR}
  507. </update>
  508. <select id="selectAllAdmin" resultMap="BaseResultMap">
  509. select
  510. <include refid="Base_Column_List" />
  511. from admin
  512. </select>
  513. <select id="selectByMobile" parameterType="java.lang.String" resultMap="BaseResultMap">
  514. select
  515. <include refid="Base_Column_List" />
  516. from admin
  517. where mobile = #{mobile,jdbcType=VARCHAR}
  518. </select>
  519. <select id="selectRolesByPrimaryKey" parameterType="java.lang.String">
  520. select r.name, r.id, r.type
  521. from role r
  522. left join user_role ur on ur.rid=r.id
  523. where ur.uid = #{uid,jdbcType=VARCHAR}
  524. </select>
  525. <select id="selectCognizanceConsultant" resultMap="BaseResultMap">
  526. select
  527. <include refid="Base_Column_List" />
  528. from admin
  529. where id <![CDATA[ <> ]]> '1'
  530. </select>
  531. <select id="selectCognizancePrincipal" resultMap="BaseResultMap">
  532. select a.id, a.name, a.position from admin a
  533. INNER JOIN user_role ur on a.id = ur.uid
  534. where ur.rid not in('1','2','3','4','5','6')
  535. group by a.id
  536. </select>
  537. <select id="selectPatentAuthor" resultMap="BaseResultMap">
  538. select a.id, a.name, a.position from admin a
  539. INNER JOIN user_role ur on a.id = ur.uid
  540. where ur.rid not in('1','2','3','4','5','6')
  541. group by a.id
  542. </select>
  543. <select id="selectPatentPrincipal" resultMap="BaseResultMap">
  544. select a.id, a.name, a.position from admin a
  545. INNER JOIN user_role ur on a.id = ur.uid
  546. where ur.rid not in('1','2','3','4','5','6')
  547. group by a.id
  548. </select>
  549. <select id="selectCopyrightConsultant" resultMap="BaseResultMap">
  550. select
  551. <include refid="Base_Column_List" />
  552. from admin
  553. where id <![CDATA[ <> ]]> '1'
  554. </select>
  555. <select id="selectCopyrightPrincipal" resultMap="BaseResultMap">
  556. select a.id, a.name, a.position from admin a
  557. INNER JOIN user_role ur on a.id = ur.uid
  558. where ur.rid not in('1','2','3','4','5','6')
  559. group by a.id
  560. </select>
  561. <select id="selectTechprojectConsultant" resultMap="BaseResultMap">
  562. select
  563. <include refid="Base_Column_List" />
  564. from admin
  565. where id <![CDATA[ <> ]]> '1'
  566. </select>
  567. <select id="selectTechprojectPrincipal" resultMap="BaseResultMap">
  568. select a.id, a.name, a.position from admin a
  569. INNER JOIN user_role ur on a.id = ur.uid
  570. where ur.rid not in('1','2','3','4','5','6')
  571. group by a.id
  572. </select>
  573. <select id="selectRoleByPrimaryKey" parameterType="java.lang.String" resultType="String">
  574. SELECT rid FROM user_role
  575. where uid = #{uid,jdbcType=VARCHAR}
  576. </select>
  577. <select id="selectAccoutManager" resultMap="BaseResultMap">
  578. select a.id, a.name, a.position from admin a
  579. INNER JOIN user_role ur on a.id = ur.uid
  580. where ur.rid = '4'
  581. </select>
  582. <select id="selectTechnician" resultMap="BaseResultMap">
  583. select a.id, a.name, a.position from admin a
  584. INNER JOIN user_role ur on a.id = ur.uid
  585. where ur.rid not in('1','2','3','4')
  586. group by a.id
  587. </select>
  588. <select id="selectSalesman" resultMap="BaseResultMap">
  589. select a.id, a.name, a.position from admin a
  590. INNER JOIN user_role ur on a.id = ur.uid
  591. where ur.rid in ('5', '6')
  592. </select>
  593. <select id="selectContractManager" resultMap="BaseResultMap">
  594. select a.id, a.name, a.position from admin a
  595. INNER JOIN user_role ur on a.id = ur.uid
  596. where ur.rid not in('1','2','3','4')
  597. group by a.id
  598. </select>
  599. <select id="selectTechBroder" resultMap="BaseResultMap">
  600. select
  601. u.rid as rolesId, a.name,a.id, a.position
  602. from user_role u
  603. left join admin a on a.id =u.uid
  604. left join role r on r.id =u.rid
  605. where
  606. r.role_name='技术经纪专员'
  607. </select>
  608. <select id="listAdminSelectBySuperAdmin" resultMap="BaseResultMap">
  609. select
  610. <include refid="Base_Column_List" />
  611. from admin
  612. where id <![CDATA[ <> ]]> '1'
  613. </select>
  614. <select id="listAdminSelectByAreaAdmin" resultMap="BaseResultMap">
  615. select
  616. a.id, a.name, a.mobile,
  617. a.create_time as createTime, a.number, aa.name as superior
  618. from admin a
  619. left join admin_location al on al.admin_id = a.id
  620. left join admin aa on aa.id = a.superior_id
  621. where 1 = 1
  622. <if test="provinceList != null and provinceList.size &gt; 0">
  623. and al.province in
  624. <foreach close=")" collection="provinceList" item="plist" open="(" separator=",">
  625. #{plist}
  626. </foreach>
  627. </if>
  628. <if test="cityList != null and cityList.size &gt; 0">
  629. and al.city in
  630. <foreach close=")" collection="cityList" item="clist" open="(" separator=",">
  631. #{clist}
  632. </foreach>
  633. </if>
  634. </select>
  635. <select id="findAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  636. select
  637. a.number, a.mobile, a.name,
  638. a.position, a.email, a.id,
  639. a.province,
  640. a.city,
  641. a.create_time as createTime,
  642. aa.name as superior,
  643. a.superior_id as superiorId,
  644. a.department_id as departmentId,
  645. date_format(a.last_login_time,'%Y-%m-%d %H:%i:%S') as lastLoginTime,
  646. dm.name as departmentName
  647. from admin a
  648. left join admin_location al on a.id = al.admin_id
  649. left join admin aa on aa.id = a.superior_id
  650. left join department_management dm on a.department_id = dm.id
  651. where a.id <![CDATA[ <> ]]> '1'
  652. <if test="mobile != null">
  653. and a.mobile = #{mobile,jdbcType=VARCHAR}
  654. </if>
  655. <if test="name != null">
  656. and a.name = #{name,jdbcType=VARCHAR}
  657. </if>
  658. <if test="number != null">
  659. and a.number = #{number,jdbcType=INTEGER}
  660. </if>
  661. <if test="province != null">
  662. and a.province = #{province,jdbcType=VARCHAR}
  663. </if>
  664. order by a.last_login_time ,a.number
  665. <if test="page_sql!=null">
  666. ${page_sql}
  667. </if>
  668. </select>
  669. <select id="findAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  670. select count(1) from admin
  671. where id <![CDATA[ <> ]]> '1'
  672. <if test="mobile != null">
  673. and mobile = #{mobile,jdbcType=VARCHAR}
  674. </if>
  675. <if test="name != null">
  676. and name = #{name,jdbcType=VARCHAR}
  677. </if>
  678. <if test="number != null">
  679. and number = #{number,jdbcType=INTEGER}
  680. </if>
  681. <if test="province != null">
  682. and a.province = #{province,jdbcType=VARCHAR}
  683. </if>
  684. </select>
  685. <select id="listAdminByName" parameterType="java.lang.String" resultMap="BaseResultMap">
  686. select id,name from admin where name like concat('%',#{name},'%')
  687. </select>
  688. <!--*************************************************************************-->
  689. <select id="selectAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  690. select x.*,y.name as departmentName from(select
  691. a.user_no as userNo, a.mobile, a.name,
  692. a.position, a.email, a.id,
  693. a.province,
  694. a.city,
  695. a.create_time as createTime,
  696. aa.name as superior,
  697. a.superior_id as superiorId,
  698. a.department_id as departmentId,
  699. a.last_login_time as lastLoginTime,
  700. a.duty,a.status
  701. from admin a
  702. left join admin_location al on a.id = al.admin_id
  703. left join admin aa on aa.id = a.superior_id
  704. left join user_role ur on a.id=ur.uid
  705. where a.id <![CDATA[ <> ]]> '1'
  706. and (a.status !='注销' or a.status is null)
  707. <if test="name != null">
  708. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  709. </if>
  710. <if test="departmentId != null">
  711. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  712. </if>
  713. <if test="rid != null">
  714. and ur.rid = #{rid,jdbcType=VARCHAR}
  715. </if>
  716. <if test="duty != null">
  717. and a.duty = #{duty,jdbcType=VARCHAR}
  718. </if>
  719. <if test="position != null">
  720. and a.position = #{position,jdbcType=VARCHAR}
  721. </if>
  722. <if test="status != null">
  723. and a.status = #{status,jdbcType=VARCHAR}
  724. </if>
  725. <if test="mobile != null">
  726. and a.mobile = #{mobile,jdbcType=VARCHAR}
  727. </if>
  728. <if test="superiorId != null">
  729. and a.superior_id = #{superiorId,jdbcType=VARCHAR}
  730. </if>
  731. group by a.id
  732. order by a.last_login_time,a.number )x left join department_management y on x.departmentId = y.id
  733. <if test="page_sql!=null">
  734. ${page_sql}
  735. </if>
  736. </select>
  737. <select id="selectAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  738. select count(t.counts)
  739. from(select a.id counts from (select a.id from admin a
  740. left join user_role ur on a.id=ur.uid
  741. where a.id <![CDATA[ <> ]]> '1'
  742. and (a.status != '注销' or a.status is null)
  743. <if test="name != null">
  744. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  745. </if>
  746. <if test="departmentId != null">
  747. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  748. </if>
  749. <if test="rid != null">
  750. and ur.rid = #{rid,jdbcType=VARCHAR}
  751. </if>
  752. <if test="duty != null">
  753. and a.duty = #{duty,jdbcType=VARCHAR}
  754. </if>
  755. <if test="position != null">
  756. and a.position = #{position,jdbcType=VARCHAR}
  757. </if>
  758. <if test="status != null">
  759. and a.status = #{status,jdbcType=VARCHAR}
  760. </if>
  761. <if test="mobile != null">
  762. and a.mobile = #{mobile,jdbcType=VARCHAR}
  763. </if>
  764. <if test="superiorId != null">
  765. and a.superior_id = #{superiorId,jdbcType=VARCHAR}
  766. </if>
  767. )a
  768. group by a.id)t
  769. </select>
  770. <insert id="insertn" parameterType="com.goafanti.common.model.Admin">
  771. insert into admin (id, mobile, name,
  772. password, email, create_time,
  773. number, province, position, superior_id, city,department_id,status,user_no,duty,district,head_portrait_url,contact_mobile)
  774. values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  775. #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  776. #{number,jdbcType=INTEGER}, #{province,jdbcType=INTEGER}, #{position,jdbcType=VARCHAR},
  777. #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=INTEGER},#{departmentId,jdbcType=VARCHAR},
  778. #{status,jdbcType=VARCHAR},#{userNo,jdbcType=VARCHAR},#{duty,jdbcType=VARCHAR},#{district,jdbcType=VARCHAR},#{headPortraitUrl,jdbcType=VARCHAR},#{contactMobile,jdbcType=VARCHAR}
  779. )
  780. </insert>
  781. <select id="selectUserNoBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
  782. select
  783. user_no as userNo
  784. from admin
  785. where
  786. id=#{superiorId,jdbcType=VARCHAR}
  787. </select>
  788. <select id="selectCountBySuperiorId" parameterType="java.lang.String" resultType="java.lang.Integer">
  789. select
  790. count(1)
  791. from admin
  792. where
  793. superior_id=#{superiorId,jdbcType=VARCHAR}
  794. </select>
  795. <select id="selectIdByUserNo" parameterType="java.lang.String" resultType="java.lang.String">
  796. select
  797. id
  798. from admin
  799. where
  800. user_no=#{UserNo,jdbcType=VARCHAR}
  801. </select>
  802. <select id="selectAllByid" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  803. select
  804. id, mobile, name,
  805. password, email, create_time as createTime,
  806. province, position,
  807. superior_id as superiorId,department_id as departmentId,
  808. status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl,
  809. contact_mobile as contactMobile
  810. from admin
  811. where
  812. id=#{id,jdbcType=VARCHAR}
  813. </select>
  814. <select id="selectNameByid" parameterType="java.lang.String" resultType="java.lang.String">
  815. select
  816. name
  817. from admin
  818. where
  819. id=#{id,jdbcType=VARCHAR}
  820. </select>
  821. <select id="selectRolesByUid" parameterType="java.lang.String" resultType="java.lang.String">
  822. select
  823. r.role_name as roles
  824. from user_role ur
  825. left join role r on r.id = ur.rid
  826. where
  827. uid=#{id,jdbcType=VARCHAR}
  828. </select>
  829. <select id="selectRolesIdByUid" parameterType="java.lang.String" resultType="java.lang.String">
  830. select
  831. rid as rolesId
  832. from user_role
  833. where
  834. uid=#{id,jdbcType=VARCHAR}
  835. </select>
  836. <select id="selectStatusByMobile" parameterType="java.lang.String" resultType="java.lang.String">
  837. select
  838. status
  839. from admin
  840. where
  841. mobile= #{mobile,jdbcType=VARCHAR}
  842. </select>
  843. <delete id="deleteById" parameterType="java.lang.String">
  844. delete from admin
  845. where id = #{id,jdbcType=VARCHAR}
  846. </delete>
  847. <select id="selectIDNBySuperiorId" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  848. select id, mobile, name,
  849. password, email, create_time as createTime,
  850. province, position,
  851. superior_id as superiorId,department_id as departmentId,
  852. status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl
  853. from admin
  854. where
  855. superior_id=#{superiorId,jdbcType=VARCHAR}
  856. </select>
  857. <select id="selectUserNoById" resultType="java.lang.String">
  858. select user_no as userNo
  859. from admin
  860. where
  861. id=#{superiorId,jdbcType=VARCHAR}
  862. </select>
  863. <update id="updateByUserNo" parameterType="com.goafanti.common.model.Admin">
  864. update admin
  865. set user_no = #{userNo,jdbcType=VARCHAR}
  866. where
  867. id=#{id,jdbcType=VARCHAR}
  868. </update>
  869. <select id="selectIdBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
  870. select id
  871. from admin
  872. where
  873. superior_id=#{superiorId,jdbcType=VARCHAR}
  874. </select>
  875. <select id="selectSubList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  876. select
  877. a.id,
  878. a.user_no as userNo,
  879. a.mobile,
  880. a.name,
  881. a.position,
  882. b.name as departmentName
  883. from
  884. admin a left join department_management b on
  885. a.department_id = b.id
  886. where
  887. a.department_id =(
  888. select
  889. department_id
  890. from
  891. admin
  892. where
  893. id = #{adminId,jdbcType=VARCHAR}
  894. )
  895. and a.id <![CDATA[ <> ]]> #{adminId,jdbcType=VARCHAR}
  896. </select>
  897. <select id="selectAdminByRoleId" parameterType="java.lang.String" resultMap="BaseResultMap">
  898. select a.id,a.name from admin a left join user_role b on a.id = b.uid left join role c on b.rid = c.id where c.id = #{roleId,jdbcType=VARCHAR} limit 1
  899. </select>
  900. <select id="selectDepartmentStaff" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  901. select a.id ,a.name,a.department_id,b.name
  902. from admin a left join department_management b
  903. on a.department_id= b.id
  904. where 1=1
  905. <if test="departmentId != null and departmentId !='' ">
  906. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  907. </if>
  908. <if test="name != null">
  909. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  910. </if>
  911. </select>
  912. <select id="selectAdminName" parameterType="java.lang.String" resultMap="BaseResultMap">
  913. select a.id, a.name from admin a left join user_role b on a.id=b.uid
  914. left join `role` c on b.rid=c.id
  915. where c.role_name = #{name,jdbcType=VARCHAR}
  916. </select>
  917. </mapper>