AdminMapper.xml 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170
  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. where status !='锁定'
  513. <if test="depId != null">
  514. and department_id = #{depId,jdbcType=VARCHAR}
  515. </if>
  516. </select>
  517. <select id="selectByMobile" parameterType="java.lang.String" resultMap="BaseResultMap">
  518. select
  519. <include refid="Base_Column_List" />
  520. from admin
  521. where mobile = #{mobile,jdbcType=VARCHAR}
  522. </select>
  523. <select id="selectRolesByPrimaryKey" parameterType="java.lang.String">
  524. select r.name, r.id, r.type
  525. from role r
  526. left join user_role ur on ur.rid=r.id
  527. where ur.uid = #{uid,jdbcType=VARCHAR}
  528. </select>
  529. <select id="selectCognizanceConsultant" resultMap="BaseResultMap">
  530. select
  531. <include refid="Base_Column_List" />
  532. from admin
  533. where id <![CDATA[ <> ]]> '1'
  534. </select>
  535. <select id="selectCognizancePrincipal" resultMap="BaseResultMap">
  536. select a.id, a.name, a.position from admin a
  537. INNER JOIN user_role ur on a.id = ur.uid
  538. where ur.rid not in('1','2','3','4','5','6')
  539. group by a.id
  540. </select>
  541. <select id="selectPatentAuthor" resultMap="BaseResultMap">
  542. select a.id, a.name, a.position from admin a
  543. INNER JOIN user_role ur on a.id = ur.uid
  544. where ur.rid not in('1','2','3','4','5','6')
  545. group by a.id
  546. </select>
  547. <select id="selectPatentPrincipal" resultMap="BaseResultMap">
  548. select a.id, a.name, a.position from admin a
  549. INNER JOIN user_role ur on a.id = ur.uid
  550. where ur.rid not in('1','2','3','4','5','6')
  551. group by a.id
  552. </select>
  553. <select id="selectCopyrightConsultant" resultMap="BaseResultMap">
  554. select
  555. <include refid="Base_Column_List" />
  556. from admin
  557. where id <![CDATA[ <> ]]> '1'
  558. </select>
  559. <select id="selectCopyrightPrincipal" resultMap="BaseResultMap">
  560. select a.id, a.name, a.position from admin a
  561. INNER JOIN user_role ur on a.id = ur.uid
  562. where ur.rid not in('1','2','3','4','5','6')
  563. group by a.id
  564. </select>
  565. <select id="selectTechprojectConsultant" resultMap="BaseResultMap">
  566. select
  567. <include refid="Base_Column_List" />
  568. from admin
  569. where id <![CDATA[ <> ]]> '1'
  570. </select>
  571. <select id="selectTechprojectPrincipal" resultMap="BaseResultMap">
  572. select a.id, a.name, a.position from admin a
  573. INNER JOIN user_role ur on a.id = ur.uid
  574. where ur.rid not in('1','2','3','4','5','6')
  575. group by a.id
  576. </select>
  577. <select id="selectRoleByPrimaryKey" parameterType="java.lang.String" resultType="String">
  578. SELECT rid FROM user_role
  579. where uid = #{uid,jdbcType=VARCHAR}
  580. </select>
  581. <select id="selectAccoutManager" resultMap="BaseResultMap">
  582. select a.id, a.name, a.position from admin a
  583. INNER JOIN user_role ur on a.id = ur.uid
  584. where ur.rid = '4'
  585. </select>
  586. <select id="selectTechnician" resultMap="BaseResultMap">
  587. select a.id, a.name, a.position from admin a
  588. INNER JOIN user_role ur on a.id = ur.uid
  589. where ur.rid not in('1','2','3','4')
  590. group by a.id
  591. </select>
  592. <select id="selectSalesman" resultMap="BaseResultMap">
  593. select a.id, a.name, a.position from admin a
  594. INNER JOIN user_role ur on a.id = ur.uid
  595. where ur.rid in ('5', '6')
  596. </select>
  597. <select id="selectContractManager" resultMap="BaseResultMap">
  598. select a.id, a.name, a.position from admin a
  599. INNER JOIN user_role ur on a.id = ur.uid
  600. where ur.rid not in('1','2','3','4')
  601. group by a.id
  602. </select>
  603. <select id="selectTechBroder" resultMap="BaseResultMap">
  604. select
  605. u.rid as rolesId, a.name,a.id, a.position
  606. from user_role u
  607. left join admin a on a.id =u.uid
  608. left join role r on r.id =u.rid
  609. where
  610. r.role_name='技术经纪专员'
  611. </select>
  612. <select id="listAdminSelectBySuperAdmin" resultMap="BaseResultMap">
  613. select
  614. <include refid="Base_Column_List" />
  615. from admin
  616. where id <![CDATA[ <> ]]> '1'
  617. </select>
  618. <select id="listAdminSelectByAreaAdmin" resultMap="BaseResultMap">
  619. select
  620. a.id, a.name, a.mobile,
  621. a.create_time as createTime, a.number, aa.name as superior
  622. from admin a
  623. left join admin_location al on al.admin_id = a.id
  624. left join admin aa on aa.id = a.superior_id
  625. where 1 = 1
  626. <if test="provinceList != null and provinceList.size &gt; 0">
  627. and al.province in
  628. <foreach close=")" collection="provinceList" item="plist" open="(" separator=",">
  629. #{plist}
  630. </foreach>
  631. </if>
  632. <if test="cityList != null and cityList.size &gt; 0">
  633. and al.city in
  634. <foreach close=")" collection="cityList" item="clist" open="(" separator=",">
  635. #{clist}
  636. </foreach>
  637. </if>
  638. </select>
  639. <select id="findAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  640. select
  641. a.number, a.mobile, a.name,
  642. a.position, a.email, a.id,
  643. a.province,
  644. a.city,
  645. a.create_time as createTime,
  646. aa.name as superior,
  647. a.superior_id as superiorId,
  648. a.department_id as departmentId,
  649. date_format(a.last_login_time,'%Y-%m-%d %H:%i:%S') as lastLoginTime,
  650. dm.name as departmentName
  651. from admin a
  652. left join admin_location al on a.id = al.admin_id
  653. left join admin aa on aa.id = a.superior_id
  654. left join department dm on a.department_id = dm.id
  655. left join user_role x on x.uid=a.id
  656. left join `role` y on x.rid=y.id
  657. where a.id <![CDATA[ <> ]]> '1'
  658. <if test="roleName != null">
  659. where y.role_name= #{roleName,jdbcType=VARCHAR}
  660. </if>
  661. <if test="mobile != null">
  662. and a.mobile = #{mobile,jdbcType=VARCHAR}
  663. </if>
  664. <if test="name != null">
  665. and a.name = #{name,jdbcType=VARCHAR}
  666. </if>
  667. <if test="number != null">
  668. and a.number = #{number,jdbcType=INTEGER}
  669. </if>
  670. <if test="province != null">
  671. and a.province = #{province,jdbcType=VARCHAR}
  672. </if>
  673. order by a.last_login_time ,a.number
  674. <if test="page_sql!=null">
  675. ${page_sql}
  676. </if>
  677. </select>
  678. <select id="findAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  679. select count(1) from admin
  680. where id <![CDATA[ <> ]]> '1'
  681. left join `role` y on x.rid=y.id
  682. where a.id <![CDATA[ <> ]]> '1'
  683. <if test="roleName != null">
  684. where y.role_name= #{roleName,jdbcType=VARCHAR}
  685. </if>
  686. <if test="mobile != null">
  687. and mobile = #{mobile,jdbcType=VARCHAR}
  688. </if>
  689. <if test="name != null">
  690. and name = #{name,jdbcType=VARCHAR}
  691. </if>
  692. <if test="number != null">
  693. and number = #{number,jdbcType=INTEGER}
  694. </if>
  695. <if test="province != null">
  696. and a.province = #{province,jdbcType=VARCHAR}
  697. </if>
  698. </select>
  699. <select id="listAdminByName" parameterType="java.lang.String" resultMap="BaseResultMap">
  700. select id,name from admin where name like concat('%',#{name},'%')
  701. </select>
  702. <!--*************************************************************************-->
  703. <select id="selectAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  704. select x.*,y.name as departmentName from(select
  705. <!-- a.user_no as userNo, -->
  706. a.mobile, a.name,
  707. a.position, a.email, a.id,
  708. a.province,
  709. a.city,
  710. a.create_time as createTime,
  711. aa.name as superior,
  712. a.superior_id as superiorId,
  713. a.department_id as departmentId,
  714. a.last_login_time as lastLoginTime,
  715. a.contact_mobile as contactMobile,
  716. a.duty,a.status
  717. from admin a
  718. left join admin_location al on a.id = al.admin_id
  719. left join admin aa on aa.id = a.superior_id
  720. left join user_role ur on a.id=ur.uid
  721. left join `role` y on ur.rid=y.id
  722. where a.id <![CDATA[ <> ]]> '1'
  723. <if test="roleName != null">
  724. and y.role_name= #{roleName,jdbcType=VARCHAR}
  725. </if>
  726. <if test="name != null">
  727. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  728. </if>
  729. <if test="departmentId != null">
  730. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  731. </if>
  732. <if test="rid != null">
  733. and ur.rid = #{rid,jdbcType=VARCHAR}
  734. </if>
  735. <if test="duty != null">
  736. and a.duty = #{duty,jdbcType=VARCHAR}
  737. </if>
  738. <if test="position != null">
  739. and a.position = #{position,jdbcType=VARCHAR}
  740. </if>
  741. <if test="status != null">
  742. and a.status = #{status,jdbcType=VARCHAR}
  743. </if>
  744. <if test="mobile != null">
  745. and a.mobile = #{mobile,jdbcType=VARCHAR}
  746. </if>
  747. <if test="superiorId != null">
  748. and a.superior_id = #{superiorId,jdbcType=VARCHAR}
  749. </if>
  750. group by a.id
  751. order by a.last_login_time,a.number )x left join department y on x.departmentId = y.id
  752. <if test="page_sql!=null">
  753. ${page_sql}
  754. </if>
  755. </select>
  756. <select id="selectAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  757. select count(t.counts)
  758. from(select a.id counts from (select a.id from admin a
  759. left join user_role ur on a.id=ur.uid
  760. left join `role` y on ur.rid=y.id
  761. where a.id <![CDATA[ <> ]]> '1'
  762. <if test="roleName != null">
  763. and y.role_name= #{roleName,jdbcType=VARCHAR}
  764. </if>
  765. <if test="name != null">
  766. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  767. </if>
  768. <if test="departmentId != null">
  769. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  770. </if>
  771. <if test="rid != null">
  772. and ur.rid = #{rid,jdbcType=VARCHAR}
  773. </if>
  774. <if test="duty != null">
  775. and a.duty = #{duty,jdbcType=VARCHAR}
  776. </if>
  777. <if test="position != null">
  778. and a.position = #{position,jdbcType=VARCHAR}
  779. </if>
  780. <if test="status != null">
  781. and a.status = #{status,jdbcType=VARCHAR}
  782. </if>
  783. <if test="mobile != null">
  784. and a.mobile = #{mobile,jdbcType=VARCHAR}
  785. </if>
  786. <if test="superiorId != null">
  787. and a.superior_id = #{superiorId,jdbcType=VARCHAR}
  788. </if>
  789. )a
  790. group by a.id)t
  791. </select>
  792. <insert id="insertn" parameterType="com.goafanti.common.model.Admin">
  793. insert into admin (id, mobile, name,
  794. password, email, create_time,
  795. number, province, position, superior_id, city,department_id,status,user_no,duty,district,head_portrait_url,contact_mobile)
  796. values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  797. #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  798. #{number,jdbcType=INTEGER}, #{province,jdbcType=INTEGER}, #{position,jdbcType=VARCHAR},
  799. #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=INTEGER},#{departmentId,jdbcType=VARCHAR},
  800. #{status,jdbcType=VARCHAR},#{userNo,jdbcType=VARCHAR},#{duty,jdbcType=VARCHAR},#{district,jdbcType=VARCHAR},#{headPortraitUrl,jdbcType=VARCHAR},#{contactMobile,jdbcType=VARCHAR}
  801. )
  802. </insert>
  803. <select id="selectUserNoBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
  804. select
  805. user_no as userNo
  806. from admin
  807. where
  808. id=#{superiorId,jdbcType=VARCHAR}
  809. </select>
  810. <select id="selectCountBySuperiorId" parameterType="java.lang.String" resultType="java.lang.Integer">
  811. select
  812. count(1)
  813. from admin
  814. where
  815. superior_id=#{superiorId,jdbcType=VARCHAR}
  816. </select>
  817. <select id="selectIdByUserNo" parameterType="java.lang.String" resultType="java.lang.String">
  818. select
  819. id
  820. from admin
  821. where
  822. user_no=#{UserNo,jdbcType=VARCHAR}
  823. </select>
  824. <select id="selectAllByid" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  825. select
  826. id, mobile, name,
  827. password, email, create_time as createTime,
  828. province, position,
  829. superior_id as superiorId,department_id as departmentId,
  830. status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl,
  831. contact_mobile as contactMobile
  832. from admin
  833. where
  834. id=#{id,jdbcType=VARCHAR}
  835. </select>
  836. <select id="selectNameByid" parameterType="java.lang.String" resultType="java.lang.String">
  837. select
  838. name
  839. from admin
  840. where
  841. id=#{id,jdbcType=VARCHAR}
  842. </select>
  843. <select id="selectRolesByUid" parameterType="java.lang.String" resultType="java.lang.String">
  844. select
  845. r.role_name as roles
  846. from user_role ur
  847. left join role r on r.id = ur.rid
  848. where
  849. uid=#{id,jdbcType=VARCHAR}
  850. </select>
  851. <select id="selectRolesIdByUid" parameterType="java.lang.String" resultType="java.lang.String">
  852. select
  853. rid as rolesId
  854. from user_role
  855. where
  856. uid=#{id,jdbcType=VARCHAR}
  857. </select>
  858. <select id="selectStatusByMobile" parameterType="java.lang.String" resultType="java.lang.String">
  859. select
  860. status
  861. from admin
  862. where
  863. mobile= #{mobile,jdbcType=VARCHAR}
  864. </select>
  865. <delete id="deleteById" parameterType="java.lang.String">
  866. delete from admin
  867. where id = #{id,jdbcType=VARCHAR}
  868. </delete>
  869. <select id="selectIDNBySuperiorId" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  870. select id, mobile, name,
  871. password, email, create_time as createTime,
  872. province, position,
  873. superior_id as superiorId,department_id as departmentId,
  874. status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl
  875. from admin
  876. where
  877. superior_id=#{superiorId,jdbcType=VARCHAR}
  878. </select>
  879. <select id="selectUserNoById" resultType="java.lang.String">
  880. select user_no as userNo
  881. from admin
  882. where
  883. id=#{superiorId,jdbcType=VARCHAR}
  884. </select>
  885. <update id="updateByUserNo" parameterType="com.goafanti.common.model.Admin">
  886. update admin
  887. set user_no = #{userNo,jdbcType=VARCHAR}
  888. where
  889. id=#{id,jdbcType=VARCHAR}
  890. </update>
  891. <select id="selectIdBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
  892. select id
  893. from admin
  894. where
  895. superior_id=#{superiorId,jdbcType=VARCHAR}
  896. </select>
  897. <select id="selectSubList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  898. select
  899. a.id,
  900. a.user_no as userNo,
  901. a.mobile,
  902. a.name,
  903. a.position,
  904. b.name as departmentName
  905. from
  906. admin a left join department b on
  907. a.department_id = b.id
  908. where
  909. a.department_id =(
  910. select
  911. department_id
  912. from
  913. admin
  914. where
  915. id = #{adminId,jdbcType=VARCHAR}
  916. )
  917. and a.id <![CDATA[ <> ]]> #{adminId,jdbcType=VARCHAR}
  918. </select>
  919. <select id="selectAdminByRoleId" parameterType="java.lang.String" resultMap="BaseResultMap">
  920. 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
  921. </select>
  922. <select id="selectDepartmentStaff" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  923. select a.id ,a.name,a.password,a.department_id,b.name
  924. from admin a left join department b
  925. on a.department_id= b.id
  926. where 1=1
  927. <if test="departmentId != null and departmentId !='' ">
  928. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  929. </if>
  930. <if test="name != null">
  931. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  932. </if>
  933. </select>
  934. <select id="selectAdminName" parameterType="java.lang.String" resultMap="BaseResultMap">
  935. select a.id, a.name from admin a left join user_role b on a.id=b.uid
  936. left join `role` c on b.rid=c.id
  937. where c.role_name = #{name,jdbcType=VARCHAR}
  938. </select>
  939. <update id="updateLockIds" parameterType="java.lang.String">
  940. update admin set status = '锁定' where id in (${lockIds})
  941. </update>
  942. <!-- 用户是为正常的 -->
  943. <select id="getCountById" parameterType="java.lang.String" resultType="java.lang.Integer">
  944. select count(a.id) from admin a
  945. inner join user_role ur on a.id=ur.uid
  946. where a.id= #{_parameter,jdbcType=VARCHAR} and ( a.status != '注销' or a.status is null)
  947. </select>
  948. <select id="getAdminRoleList" parameterType="java.lang.String" resultMap="BaseResultMap">
  949. select a.id, a.name from admin a left join user_role b on a.id=b.uid
  950. left join `role` c on b.rid=c.id
  951. where c.role_name = #{name,jdbcType=VARCHAR} and a.status='正常'
  952. </select>
  953. <!-- 获得当前登录人的名字和部门名 -->
  954. <select id="getDeptNameByAid" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  955. select a.name, d.name as departmentName,a.department_id departmentId from admin a
  956. left join department d on a.department_id = d.id
  957. where a.id = #{_parameter,jdbcType=VARCHAR}
  958. </select>
  959. <insert id="addAdminContacts" parameterType="com.goafanti.admin.bo.AdminContacts">
  960. insert into admin_contacts (id,aid,contacts_id)values
  961. (#{id,jdbcType=VARCHAR},#{aid,jdbcType=VARCHAR},#{contactsId,jdbcType=VARCHAR})
  962. </insert>
  963. <select id="frequentContactsList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  964. select a.id,b.id as contactId,b.name,b.position,b.contact_mobile as contactMobile,c.name as departmentName,y.role_name as roleName
  965. from admin_contacts a left join admin b
  966. on a.contacts_id=b.id left join department c
  967. on c.id=b.department_id left join user_role x on x.uid=b.id
  968. left join `role` y on x.rid=y.id
  969. where b.status ='正常'
  970. <if test="roleName != null">
  971. and y.role_name= #{roleName,jdbcType=VARCHAR}
  972. </if>
  973. <if test="aid != null">
  974. and a.aid= #{aid,jdbcType=VARCHAR}
  975. </if>
  976. <if test="name != null">
  977. and b.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  978. </if>
  979. <if test="depId != null">
  980. and b.department_id= #{depId,jdbcType=VARCHAR}
  981. </if>
  982. <if test="page_sql!=null">
  983. ${page_sql}
  984. </if>
  985. </select>
  986. <select id="frequentContactsCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  987. select count(*)
  988. from admin_contacts a left join admin b
  989. on a.contacts_id=b.id
  990. left join user_role x on x.uid=b.id
  991. left join `role` y on x.rid=y.id
  992. where b.status ='正常'
  993. <if test="roleName != null">
  994. and y.role_name= #{roleName,jdbcType=VARCHAR}
  995. </if>
  996. <if test="aid != null">
  997. and a.aid= #{aid,jdbcType=VARCHAR}
  998. </if>
  999. <if test="name != null">
  1000. and b.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1001. </if>
  1002. <if test="depId != null">
  1003. and b.department_id= #{depId,jdbcType=VARCHAR}
  1004. </if>
  1005. </select>
  1006. <delete id="deleteFrequentContacts" parameterType="java.lang.String">
  1007. delete from admin_contacts
  1008. where id = #{id,jdbcType=VARCHAR}
  1009. </delete>
  1010. <select id="getaidFrequentContacts" resultType="java.lang.String">
  1011. select b.id from admin_contacts a left join admin b on a.contacts_id = b.id
  1012. where b.status = '正常' and a.aid= #{id,jdbcType=VARCHAR}
  1013. </select>
  1014. <select id="selectAdminCustomerList" resultType="com.goafanti.admin.bo.AdminCustomerBo">
  1015. select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as inputCount,
  1016. ifnull(d.timeCount,0) as receiveCount from admin a
  1017. left join (select aid,count(aid) as userCount from user where aid is not null
  1018. and share_type=0 and source !=0 and type=1
  1019. group by aid) b on a.id=b.aid
  1020. left join (select aid,count(aid) as timeCount from `user` where aid is not null
  1021. and share_type=0 and source =1 and type=1
  1022. <if test="startTime != null and endTime != null">
  1023. and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1024. </if>
  1025. group by aid) c on a.id=c.aid
  1026. left join (select aid,count(aid) as timeCount from `user` where aid is not null
  1027. and share_type=0 and source =2 and type=1
  1028. <if test="startTime != null and endTime != null">
  1029. and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1030. </if>
  1031. group by aid) d on a.id=d.aid
  1032. left join department d on a.department_id=d.id
  1033. left join user_role e on a.id=e.uid
  1034. left join `role` f on e.rid=f.id
  1035. where f.role_name in ('营销员','营销经理')
  1036. and a.status='正常'
  1037. <if test="depId != null">
  1038. and a.department_id = #{depId,jdbcType=VARCHAR}
  1039. </if>
  1040. <if test="page_sql!=null">
  1041. ${page_sql}
  1042. </if>
  1043. </select>
  1044. <select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  1045. select count(*) from admin a
  1046. left join department d on a.department_id=d.id
  1047. left join user_role e on a.id=e.uid
  1048. left join `role` f on e.rid=f.id
  1049. where f.role_name in ('营销员','营销经理')
  1050. and a.status='正常'
  1051. <if test="depId != null">
  1052. and a.department_id = #{depId,jdbcType=VARCHAR}
  1053. </if>
  1054. </select>
  1055. <select id="selectAdminCustomerDetailList" resultType="com.goafanti.admin.bo.AdminCustomerDetailBo">
  1056. select a.id,a.nickname as name,a.source,c.contacts,c.contact_mobile as contactMobile,
  1057. a.create_time as createTime,b.time_stamp as followTime
  1058. from user a
  1059. left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b on a.id=b.uid
  1060. left join organization_identity c on a.id=c.uid
  1061. where a.aid is not null and a.share_type=0 and a.type=1
  1062. <if test="aid != null">
  1063. and a.aid= #{aid,jdbcType=VARCHAR}
  1064. </if>
  1065. <if test="type==null">
  1066. and a.source in(1,2,3)
  1067. </if>
  1068. <if test="type == 0">
  1069. and a.source =1
  1070. <if test="startTime != null and endTime != null">
  1071. and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1072. </if>
  1073. </if>
  1074. <if test="type == 1">
  1075. and a.source =2
  1076. <if test="startTime != null and endTime != null">
  1077. and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1078. </if>
  1079. </if>
  1080. <if test="page_sql!=null">
  1081. ${page_sql}
  1082. </if>
  1083. </select>
  1084. <select id="selectAdminCustomerDetailCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  1085. select count(*) from user a
  1086. left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b on a.id=b.uid
  1087. left join organization_identity c on a.id=c.uid
  1088. where a.aid is not null and a.share_type=0 and a.type=1
  1089. <if test="aid != null">
  1090. and a.aid= #{aid,jdbcType=VARCHAR}
  1091. </if>
  1092. <if test="type==null">
  1093. and a.source in(1,2,3)
  1094. </if>
  1095. <if test="type == 0">
  1096. and a.source =1
  1097. <if test="startTime != null and endTime != null">
  1098. and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1099. </if>
  1100. </if>
  1101. <if test="type == 1">
  1102. and a.source =2
  1103. <if test="startTime != null and endTime != null">
  1104. and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1105. </if>
  1106. </if>
  1107. </select>
  1108. <select id="listNameByDepAndName" resultType="java.lang.String">
  1109. select a.id from admin a left join user_role b on a.id =b.uid
  1110. left join `role` c on b.rid=c.id
  1111. where department_id= #{depId}
  1112. and c.role_name= #{roleName}
  1113. </select>
  1114. <select id="selectBySuperId" resultType="java.lang.String">
  1115. select id from admin where superior_id= #{aid}
  1116. </select>
  1117. <select id="selectFinanceAdminByOrderDep" resultType="com.goafanti.common.model.Admin">
  1118. select a.finance_id id,b.name from department a left join admin b on a.finance_id=b.id
  1119. where a.id= #{orderDep}
  1120. </select>
  1121. <select id="getPermission" resultType="java.lang.String">
  1122. select c.role_type from admin a left join user_role b on a.id=b.uid left join `role` c on b.rid=c.id
  1123. where a.id= #{transferId}
  1124. </select>
  1125. <select id="selectDepIdWithSpuerId" resultType="java.lang.String">
  1126. select b.id from admin a right join department b on a.id=b.finance_id
  1127. where a.superior_id= #{superId}
  1128. </select>
  1129. </mapper>