AdminMapper.xml 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225
  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 status='正常' and 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.id,a.name, d.name as departmentName,a.department_id departmentId,a.email 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,ifnull(g.timeCount,0) as signCount 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 in (0,2) and source =1 and type=1
  1022. <if test="startTime != null and endTime != null">
  1023. and transfer_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 in (0,2) 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 (select aid,count(aid) as timeCount from `user` where aid is not null
  1033. and share_type =2 and type=1
  1034. <if test="startTime != null and endTime != null">
  1035. and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1036. </if>
  1037. group by aid) g on a.id=g.aid
  1038. left join department d on a.department_id=d.id
  1039. left join user_role e on a.id=e.uid
  1040. left join `role` f on e.rid=f.id
  1041. where f.role_name in ('营销员','营销经理')
  1042. and a.status='正常'
  1043. <if test="depId != null">
  1044. and a.department_id = #{depId,jdbcType=VARCHAR}
  1045. </if>
  1046. <if test="page_sql!=null">
  1047. ${page_sql}
  1048. </if>
  1049. </select>
  1050. <select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  1051. select count(*) from admin a
  1052. left join department d on a.department_id=d.id
  1053. left join user_role e on a.id=e.uid
  1054. left join `role` f on e.rid=f.id
  1055. where f.role_name in ('营销员','营销经理')
  1056. and a.status='正常'
  1057. <if test="depId != null">
  1058. and a.department_id = #{depId,jdbcType=VARCHAR}
  1059. </if>
  1060. </select>
  1061. <select id="selectAdminCustomerDetailList" resultType="com.goafanti.admin.bo.AdminCustomerDetailBo">
  1062. select a.id,a.nickname as name,a.source,c.name contacts,c.mobile as contactMobile,
  1063. a.create_time as createTime,b.time_stamp as followTime
  1064. from user a
  1065. left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b on a.id=b.uid
  1066. left join (select uid,name ,mobile from organization_contact_book where major=1) c on a.id=c.uid
  1067. <if test="type==3 or type==4">
  1068. left join (select aid,uid from user_business
  1069. <if test="type==3">
  1070. where follow_situation=5
  1071. </if>
  1072. <if test="type==4">
  1073. where follow_situation=1
  1074. </if>
  1075. <if test="startTime != null and endTime != null">
  1076. and update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1077. </if>
  1078. group by aid,uid)d on a.id=d.uid
  1079. </if>
  1080. where a.type=1
  1081. <if test=" type !=3 and type !=4 and aid != null">
  1082. and a.aid= #{aid,jdbcType=VARCHAR}
  1083. </if>
  1084. <if test=" (type ==3 or type ==4) and aid != null">
  1085. and d.aid= #{aid,jdbcType=VARCHAR}
  1086. </if>
  1087. <if test="type == 0">
  1088. and a.source in (1,2,3)
  1089. and a.share_type = 0
  1090. </if>
  1091. <if test="type==1 or type==2 ">
  1092. and a.share_type in (0,2)
  1093. </if>
  1094. <if test="type == 5">
  1095. and a.share_type = 2
  1096. </if>
  1097. <if test="type == 1">
  1098. and a.source =1
  1099. <if test="startTime != null and endTime != null">
  1100. and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1101. </if>
  1102. </if>
  1103. <if test="type == 2">
  1104. and a.source =2
  1105. <if test="startTime != null and endTime != null">
  1106. and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1107. </if>
  1108. </if>
  1109. <if test="page_sql!=null">
  1110. ${page_sql}
  1111. </if>
  1112. </select>
  1113. <select id="selectAdminCustomerDetailCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  1114. select count(*)
  1115. from user a
  1116. left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b on a.id=b.uid
  1117. left join (select uid,name ,mobile from organization_contact_book where major=1) c on a.id=c.uid
  1118. <if test="type==3 or type==4">
  1119. left join (select aid,uid from user_business
  1120. <if test="type==3">
  1121. where follow_situation=5
  1122. </if>
  1123. <if test="type==4">
  1124. where follow_situation=1
  1125. </if>
  1126. <if test="startTime != null and endTime != null">
  1127. and update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1128. </if>
  1129. group by aid,uid)d on a.id=d.uid
  1130. </if>
  1131. where a.type=1
  1132. <if test=" type !=3 and type !=4 and aid != null">
  1133. and a.aid= #{aid,jdbcType=VARCHAR}
  1134. </if>
  1135. <if test=" (type ==3 or type ==4) and aid != null">
  1136. and d.aid= #{aid,jdbcType=VARCHAR}
  1137. </if>
  1138. <if test="type == 0">
  1139. and a.source in (1,2,3)
  1140. and a.share_type = 0
  1141. </if>
  1142. <if test="type==1 or type==2 ">
  1143. and a.share_type in (0,2)
  1144. </if>
  1145. <if test="type == 5">
  1146. and a.share_type = 2
  1147. </if>
  1148. <if test="type == 1">
  1149. and a.source =1
  1150. <if test="startTime != null and endTime != null">
  1151. and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1152. </if>
  1153. </if>
  1154. <if test="type == 2">
  1155. and a.source =2
  1156. <if test="startTime != null and endTime != null">
  1157. and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1158. </if>
  1159. </if>
  1160. </select>
  1161. <select id="listNameByDepAndName" resultType="java.lang.String">
  1162. select a.id from admin a left join user_role b on a.id =b.uid
  1163. left join `role` c on b.rid=c.id
  1164. where department_id= #{depId}
  1165. and c.role_name= #{roleName}
  1166. </select>
  1167. <select id="selectBySuperId" resultType="java.lang.String">
  1168. select id from admin where superior_id= #{aid}
  1169. </select>
  1170. <select id="selectFinanceAdminByOrderDep" resultType="com.goafanti.common.model.Admin">
  1171. select a.finance_id id,b.name from department a left join admin b on a.finance_id=b.id
  1172. where a.id= #{orderDep}
  1173. </select>
  1174. <select id="getPermission" resultType="java.lang.String">
  1175. 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
  1176. where a.id= #{transferId}
  1177. </select>
  1178. <select id="selectDepIdWithSpuerId" resultType="java.lang.String">
  1179. select b.id from admin a right join department b on a.id=b.finance_id
  1180. where a.superior_id= #{superId}
  1181. </select>
  1182. </mapper>