AdminMapper.xml 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  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="open_id" jdbcType="VARCHAR" property="openId" />
  27. <result column="head_portrait_url" jdbcType="VARCHAR" property="headPortraitUrl" />
  28. <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
  29. <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
  30. </resultMap>
  31. <sql id="Example_Where_Clause">
  32. <!--
  33. WARNING - @mbg.generated
  34. This element is automatically generated by MyBatis Generator, do not modify.
  35. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  36. -->
  37. <where>
  38. <foreach collection="oredCriteria" item="criteria" separator="or">
  39. <if test="criteria.valid">
  40. <trim prefix="(" prefixOverrides="and" suffix=")">
  41. <foreach collection="criteria.criteria" item="criterion">
  42. <choose>
  43. <when test="criterion.noValue">
  44. and ${criterion.condition}
  45. </when>
  46. <when test="criterion.singleValue">
  47. and ${criterion.condition} #{criterion.value}
  48. </when>
  49. <when test="criterion.betweenValue">
  50. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  51. </when>
  52. <when test="criterion.listValue">
  53. and ${criterion.condition}
  54. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  55. #{listItem}
  56. </foreach>
  57. </when>
  58. </choose>
  59. </foreach>
  60. </trim>
  61. </if>
  62. </foreach>
  63. </where>
  64. </sql>
  65. <sql id="Update_By_Example_Where_Clause">
  66. <!--
  67. WARNING - @mbg.generated
  68. This element is automatically generated by MyBatis Generator, do not modify.
  69. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  70. -->
  71. <where>
  72. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  73. <if test="criteria.valid">
  74. <trim prefix="(" prefixOverrides="and" suffix=")">
  75. <foreach collection="criteria.criteria" item="criterion">
  76. <choose>
  77. <when test="criterion.noValue">
  78. and ${criterion.condition}
  79. </when>
  80. <when test="criterion.singleValue">
  81. and ${criterion.condition} #{criterion.value}
  82. </when>
  83. <when test="criterion.betweenValue">
  84. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  85. </when>
  86. <when test="criterion.listValue">
  87. and ${criterion.condition}
  88. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  89. #{listItem}
  90. </foreach>
  91. </when>
  92. </choose>
  93. </foreach>
  94. </trim>
  95. </if>
  96. </foreach>
  97. </where>
  98. </sql>
  99. <sql id="Base_Column_List">
  100. <!--
  101. WARNING - @mbg.generated
  102. This element is automatically generated by MyBatis Generator, do not modify.
  103. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  104. -->
  105. id, mobile, name, password, email, create_time, number, province, position, superior_id,
  106. city, department_id, status, user_no, duty, district, head_portrait_url, contact_mobile,
  107. last_login_time
  108. </sql>
  109. <select id="selectByExample" parameterType="com.goafanti.common.model.AdminExample" resultMap="BaseResultMap">
  110. <!--
  111. WARNING - @mbg.generated
  112. This element is automatically generated by MyBatis Generator, do not modify.
  113. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  114. -->
  115. select
  116. <if test="distinct">
  117. distinct
  118. </if>
  119. <include refid="Base_Column_List" />
  120. from admin
  121. <if test="_parameter != null">
  122. <include refid="Example_Where_Clause" />
  123. </if>
  124. <if test="orderByClause != null">
  125. order by ${orderByClause}
  126. </if>
  127. </select>
  128. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  129. <!--
  130. WARNING - @mbg.generated
  131. This element is automatically generated by MyBatis Generator, do not modify.
  132. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  133. -->
  134. select
  135. <include refid="Base_Column_List" />
  136. from admin
  137. where id = #{id,jdbcType=VARCHAR}
  138. </select>
  139. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  140. <!--
  141. WARNING - @mbg.generated
  142. This element is automatically generated by MyBatis Generator, do not modify.
  143. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  144. -->
  145. delete from admin
  146. where id = #{id,jdbcType=VARCHAR}
  147. </delete>
  148. <delete id="deleteByExample" parameterType="com.goafanti.common.model.AdminExample">
  149. <!--
  150. WARNING - @mbg.generated
  151. This element is automatically generated by MyBatis Generator, do not modify.
  152. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  153. -->
  154. delete from admin
  155. <if test="_parameter != null">
  156. <include refid="Example_Where_Clause" />
  157. </if>
  158. </delete>
  159. <insert id="insert" parameterType="com.goafanti.common.model.Admin">
  160. <!--
  161. WARNING - @mbg.generated
  162. This element is automatically generated by MyBatis Generator, do not modify.
  163. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  164. -->
  165. insert into admin (id, mobile, name,
  166. password, email, create_time,
  167. number, province, position,
  168. superior_id, city, department_id,
  169. status, user_no, duty,
  170. district, head_portrait_url, contact_mobile,
  171. last_login_time)
  172. values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  173. #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  174. #{number,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
  175. #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR},
  176. #{status,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR},
  177. #{district,jdbcType=VARCHAR}, #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
  178. #{lastLoginTime,jdbcType=TIMESTAMP})
  179. </insert>
  180. <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin">
  181. <!--
  182. WARNING - @mbg.generated
  183. This element is automatically generated by MyBatis Generator, do not modify.
  184. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  185. -->
  186. insert into admin
  187. <trim prefix="(" suffix=")" suffixOverrides=",">
  188. <if test="id != null">
  189. id,
  190. </if>
  191. <if test="mobile != null">
  192. mobile,
  193. </if>
  194. <if test="name != null">
  195. name,
  196. </if>
  197. <if test="password != null">
  198. password,
  199. </if>
  200. <if test="email != null">
  201. email,
  202. </if>
  203. <if test="createTime != null">
  204. create_time,
  205. </if>
  206. <if test="number != null">
  207. number,
  208. </if>
  209. <if test="province != null">
  210. province,
  211. </if>
  212. <if test="position != null">
  213. position,
  214. </if>
  215. <if test="superiorId != null">
  216. superior_id,
  217. </if>
  218. <if test="city != null">
  219. city,
  220. </if>
  221. <if test="departmentId != null">
  222. department_id,
  223. </if>
  224. <if test="status != null">
  225. status,
  226. </if>
  227. <if test="userNo != null">
  228. user_no,
  229. </if>
  230. <if test="duty != null">
  231. duty,
  232. </if>
  233. <if test="district != null">
  234. district,
  235. </if>
  236. <if test="headPortraitUrl != null">
  237. head_portrait_url,
  238. </if>
  239. <if test="contactMobile != null">
  240. contact_mobile,
  241. </if>
  242. <if test="lastLoginTime != null">
  243. last_login_time,
  244. </if>
  245. </trim>
  246. <trim prefix="values (" suffix=")" suffixOverrides=",">
  247. <if test="id != null">
  248. #{id,jdbcType=VARCHAR},
  249. </if>
  250. <if test="mobile != null">
  251. #{mobile,jdbcType=VARCHAR},
  252. </if>
  253. <if test="name != null">
  254. #{name,jdbcType=VARCHAR},
  255. </if>
  256. <if test="password != null">
  257. #{password,jdbcType=VARCHAR},
  258. </if>
  259. <if test="email != null">
  260. #{email,jdbcType=VARCHAR},
  261. </if>
  262. <if test="createTime != null">
  263. #{createTime,jdbcType=TIMESTAMP},
  264. </if>
  265. <if test="number != null">
  266. #{number,jdbcType=INTEGER},
  267. </if>
  268. <if test="province != null">
  269. #{province,jdbcType=VARCHAR},
  270. </if>
  271. <if test="position != null">
  272. #{position,jdbcType=VARCHAR},
  273. </if>
  274. <if test="superiorId != null">
  275. #{superiorId,jdbcType=VARCHAR},
  276. </if>
  277. <if test="city != null">
  278. #{city,jdbcType=VARCHAR},
  279. </if>
  280. <if test="departmentId != null">
  281. #{departmentId,jdbcType=VARCHAR},
  282. </if>
  283. <if test="status != null">
  284. #{status,jdbcType=VARCHAR},
  285. </if>
  286. <if test="userNo != null">
  287. #{userNo,jdbcType=VARCHAR},
  288. </if>
  289. <if test="duty != null">
  290. #{duty,jdbcType=VARCHAR},
  291. </if>
  292. <if test="district != null">
  293. #{district,jdbcType=VARCHAR},
  294. </if>
  295. <if test="headPortraitUrl != null">
  296. #{headPortraitUrl,jdbcType=VARCHAR},
  297. </if>
  298. <if test="contactMobile != null">
  299. #{contactMobile,jdbcType=VARCHAR},
  300. </if>
  301. <if test="lastLoginTime != null">
  302. #{lastLoginTime,jdbcType=TIMESTAMP},
  303. </if>
  304. </trim>
  305. </insert>
  306. <select id="countByExample" parameterType="com.goafanti.common.model.AdminExample" resultType="java.lang.Long">
  307. <!--
  308. WARNING - @mbg.generated
  309. This element is automatically generated by MyBatis Generator, do not modify.
  310. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  311. -->
  312. select count(*) from admin
  313. <if test="_parameter != null">
  314. <include refid="Example_Where_Clause" />
  315. </if>
  316. </select>
  317. <update id="updateByExampleSelective" parameterType="map">
  318. <!--
  319. WARNING - @mbg.generated
  320. This element is automatically generated by MyBatis Generator, do not modify.
  321. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  322. -->
  323. update admin
  324. <set>
  325. <if test="record.id != null">
  326. id = #{record.id,jdbcType=VARCHAR},
  327. </if>
  328. <if test="record.mobile != null">
  329. mobile = #{record.mobile,jdbcType=VARCHAR},
  330. </if>
  331. <if test="record.name != null">
  332. name = #{record.name,jdbcType=VARCHAR},
  333. </if>
  334. <if test="record.password != null">
  335. password = #{record.password,jdbcType=VARCHAR},
  336. </if>
  337. <if test="record.email != null">
  338. email = #{record.email,jdbcType=VARCHAR},
  339. </if>
  340. <if test="record.createTime != null">
  341. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  342. </if>
  343. <if test="record.number != null">
  344. number = #{record.number,jdbcType=INTEGER},
  345. </if>
  346. <if test="record.province != null">
  347. province = #{record.province,jdbcType=VARCHAR},
  348. </if>
  349. <if test="record.position != null">
  350. position = #{record.position,jdbcType=VARCHAR},
  351. </if>
  352. <if test="record.superiorId != null">
  353. superior_id = #{record.superiorId,jdbcType=VARCHAR},
  354. </if>
  355. <if test="record.city != null">
  356. city = #{record.city,jdbcType=VARCHAR},
  357. </if>
  358. <if test="record.departmentId != null">
  359. department_id = #{record.departmentId,jdbcType=VARCHAR},
  360. </if>
  361. <if test="record.status != null">
  362. status = #{record.status,jdbcType=VARCHAR},
  363. </if>
  364. <if test="record.userNo != null">
  365. user_no = #{record.userNo,jdbcType=VARCHAR},
  366. </if>
  367. <if test="record.duty != null">
  368. duty = #{record.duty,jdbcType=VARCHAR},
  369. </if>
  370. <if test="record.district != null">
  371. district = #{record.district,jdbcType=VARCHAR},
  372. </if>
  373. <if test="record.headPortraitUrl != null">
  374. head_portrait_url = #{record.headPortraitUrl,jdbcType=VARCHAR},
  375. </if>
  376. <if test="record.contactMobile != null">
  377. contact_mobile = #{record.contactMobile,jdbcType=VARCHAR},
  378. </if>
  379. <if test="record.lastLoginTime != null">
  380. last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP},
  381. </if>
  382. </set>
  383. <if test="_parameter != null">
  384. <include refid="Update_By_Example_Where_Clause" />
  385. </if>
  386. </update>
  387. <update id="updateByExample" parameterType="map">
  388. <!--
  389. WARNING - @mbg.generated
  390. This element is automatically generated by MyBatis Generator, do not modify.
  391. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  392. -->
  393. update admin
  394. set id = #{record.id,jdbcType=VARCHAR},
  395. mobile = #{record.mobile,jdbcType=VARCHAR},
  396. name = #{record.name,jdbcType=VARCHAR},
  397. password = #{record.password,jdbcType=VARCHAR},
  398. email = #{record.email,jdbcType=VARCHAR},
  399. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  400. number = #{record.number,jdbcType=INTEGER},
  401. province = #{record.province,jdbcType=VARCHAR},
  402. position = #{record.position,jdbcType=VARCHAR},
  403. superior_id = #{record.superiorId,jdbcType=VARCHAR},
  404. city = #{record.city,jdbcType=VARCHAR},
  405. department_id = #{record.departmentId,jdbcType=VARCHAR},
  406. status = #{record.status,jdbcType=VARCHAR},
  407. user_no = #{record.userNo,jdbcType=VARCHAR},
  408. duty = #{record.duty,jdbcType=VARCHAR},
  409. district = #{record.district,jdbcType=VARCHAR},
  410. head_portrait_url = #{record.headPortraitUrl,jdbcType=VARCHAR},
  411. contact_mobile = #{record.contactMobile,jdbcType=VARCHAR},
  412. last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP}
  413. <if test="_parameter != null">
  414. <include refid="Update_By_Example_Where_Clause" />
  415. </if>
  416. </update>
  417. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
  418. <!--
  419. WARNING - @mbg.generated
  420. This element is automatically generated by MyBatis Generator, do not modify.
  421. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  422. -->
  423. update admin
  424. <set>
  425. <if test="mobile != null">
  426. mobile = #{mobile,jdbcType=VARCHAR},
  427. </if>
  428. <if test="name != null">
  429. name = #{name,jdbcType=VARCHAR},
  430. </if>
  431. <if test="password != null">
  432. password = #{password,jdbcType=VARCHAR},
  433. </if>
  434. <if test="email != null">
  435. email = #{email,jdbcType=VARCHAR},
  436. </if>
  437. <if test="createTime != null">
  438. create_time = #{createTime,jdbcType=TIMESTAMP},
  439. </if>
  440. <if test="number != null">
  441. number = #{number,jdbcType=INTEGER},
  442. </if>
  443. <if test="province != null">
  444. province = #{province,jdbcType=VARCHAR},
  445. </if>
  446. <if test="position != null">
  447. position = #{position,jdbcType=VARCHAR},
  448. </if>
  449. <if test="superiorId != null">
  450. superior_id = #{superiorId,jdbcType=VARCHAR},
  451. </if>
  452. <if test="city != null">
  453. city = #{city,jdbcType=VARCHAR},
  454. </if>
  455. <if test="departmentId != null">
  456. department_id = #{departmentId,jdbcType=VARCHAR},
  457. </if>
  458. <if test="status != null">
  459. status = #{status,jdbcType=VARCHAR},
  460. </if>
  461. <if test="userNo != null">
  462. user_no = #{userNo,jdbcType=VARCHAR},
  463. </if>
  464. <if test="duty != null">
  465. duty = #{duty,jdbcType=VARCHAR},
  466. </if>
  467. <if test="district != null">
  468. district = #{district,jdbcType=VARCHAR},
  469. </if>
  470. <if test="headPortraitUrl != null">
  471. head_portrait_url = #{headPortraitUrl,jdbcType=VARCHAR},
  472. </if>
  473. <if test="contactMobile != null">
  474. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  475. </if>
  476. <if test="lastLoginTime != null">
  477. last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
  478. </if>
  479. <if test="openId != null">
  480. open_id = #{openId},
  481. </if>
  482. </set>
  483. where id = #{id,jdbcType=VARCHAR}
  484. </update>
  485. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Admin">
  486. <!--
  487. WARNING - @mbg.generated
  488. This element is automatically generated by MyBatis Generator, do not modify.
  489. This element was generated on Fri Jun 22 14:12:55 CST 2018.
  490. -->
  491. update admin
  492. set mobile = #{mobile,jdbcType=VARCHAR},
  493. name = #{name,jdbcType=VARCHAR},
  494. password = #{password,jdbcType=VARCHAR},
  495. email = #{email,jdbcType=VARCHAR},
  496. create_time = #{createTime,jdbcType=TIMESTAMP},
  497. number = #{number,jdbcType=INTEGER},
  498. province = #{province,jdbcType=VARCHAR},
  499. position = #{position,jdbcType=VARCHAR},
  500. superior_id = #{superiorId,jdbcType=VARCHAR},
  501. city = #{city,jdbcType=VARCHAR},
  502. department_id = #{departmentId,jdbcType=VARCHAR},
  503. status = #{status,jdbcType=VARCHAR},
  504. user_no = #{userNo,jdbcType=VARCHAR},
  505. duty = #{duty,jdbcType=VARCHAR},
  506. district = #{district,jdbcType=VARCHAR},
  507. head_portrait_url = #{headPortraitUrl,jdbcType=VARCHAR},
  508. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  509. last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP}
  510. where id = #{id,jdbcType=VARCHAR}
  511. </update>
  512. <select id="selectAllAdmin" resultMap="BaseResultMap">
  513. select
  514. <include refid="Base_Column_List" />
  515. from admin
  516. where status !='锁定'
  517. <if test="depId != null">
  518. and department_id = #{depId,jdbcType=VARCHAR}
  519. </if>
  520. </select>
  521. <select id="selectByMobile" parameterType="java.lang.String" resultMap="BaseResultMap">
  522. select
  523. <include refid="Base_Column_List" />
  524. from admin
  525. where mobile = #{mobile,jdbcType=VARCHAR}
  526. </select>
  527. <select id="selectRolesByPrimaryKey" parameterType="java.lang.String">
  528. select r.name, r.id, r.type
  529. from role r
  530. left join user_role ur on ur.rid=r.id
  531. where ur.uid = #{uid,jdbcType=VARCHAR}
  532. </select>
  533. <select id="selectCognizanceConsultant" resultMap="BaseResultMap">
  534. select
  535. <include refid="Base_Column_List" />
  536. from admin
  537. where id <![CDATA[ <> ]]> '1'
  538. </select>
  539. <select id="selectCognizancePrincipal" resultMap="BaseResultMap">
  540. select a.id, a.name, a.position from admin a
  541. INNER JOIN user_role ur on a.id = ur.uid
  542. where ur.rid not in('1','2','3','4','5','6')
  543. group by a.id
  544. </select>
  545. <select id="selectPatentAuthor" resultMap="BaseResultMap">
  546. select a.id, a.name, a.position from admin a
  547. INNER JOIN user_role ur on a.id = ur.uid
  548. where ur.rid not in('1','2','3','4','5','6')
  549. group by a.id
  550. </select>
  551. <select id="selectPatentPrincipal" resultMap="BaseResultMap">
  552. select a.id, a.name, a.position from admin a
  553. INNER JOIN user_role ur on a.id = ur.uid
  554. where ur.rid not in('1','2','3','4','5','6')
  555. group by a.id
  556. </select>
  557. <select id="selectCopyrightConsultant" resultMap="BaseResultMap">
  558. select
  559. <include refid="Base_Column_List" />
  560. from admin
  561. where id <![CDATA[ <> ]]> '1'
  562. </select>
  563. <select id="selectCopyrightPrincipal" resultMap="BaseResultMap">
  564. select a.id, a.name, a.position from admin a
  565. INNER JOIN user_role ur on a.id = ur.uid
  566. where ur.rid not in('1','2','3','4','5','6')
  567. group by a.id
  568. </select>
  569. <select id="selectTechprojectConsultant" resultMap="BaseResultMap">
  570. select
  571. <include refid="Base_Column_List" />
  572. from admin
  573. where id <![CDATA[ <> ]]> '1'
  574. </select>
  575. <select id="selectTechprojectPrincipal" resultMap="BaseResultMap">
  576. select a.id, a.name, a.position from admin a
  577. INNER JOIN user_role ur on a.id = ur.uid
  578. where ur.rid not in('1','2','3','4','5','6')
  579. group by a.id
  580. </select>
  581. <select id="selectRoleByPrimaryKey" parameterType="java.lang.String" resultType="String">
  582. SELECT rid FROM user_role
  583. where uid = #{uid,jdbcType=VARCHAR}
  584. </select>
  585. <select id="selectAccoutManager" resultMap="BaseResultMap">
  586. select a.id, a.name, a.position from admin a
  587. INNER JOIN user_role ur on a.id = ur.uid
  588. where ur.rid = '4'
  589. </select>
  590. <select id="selectTechnician" resultMap="BaseResultMap">
  591. select a.id, a.name, a.position from admin a
  592. INNER JOIN user_role ur on a.id = ur.uid
  593. where ur.rid not in('1','2','3','4')
  594. group by a.id
  595. </select>
  596. <select id="selectSalesman" resultMap="BaseResultMap">
  597. select a.id, a.name, a.position from admin a
  598. INNER JOIN user_role ur on a.id = ur.uid
  599. where ur.rid in ('5', '6')
  600. </select>
  601. <select id="selectContractManager" resultMap="BaseResultMap">
  602. select a.id, a.name, a.position from admin a
  603. INNER JOIN user_role ur on a.id = ur.uid
  604. where ur.rid not in('1','2','3','4')
  605. group by a.id
  606. </select>
  607. <select id="selectTechBroder" resultMap="BaseResultMap">
  608. select
  609. u.rid as rolesId, a.name,a.id, a.position
  610. from user_role u
  611. left join admin a on a.id =u.uid
  612. left join role r on r.id =u.rid
  613. where
  614. r.role_name='技术经纪专员'
  615. </select>
  616. <select id="listAdminSelectBySuperAdmin" resultMap="BaseResultMap">
  617. select
  618. <include refid="Base_Column_List" />
  619. from admin
  620. where id <![CDATA[ <> ]]> '1'
  621. </select>
  622. <select id="listAdminSelectByAreaAdmin" resultMap="BaseResultMap">
  623. select
  624. a.id, a.name, a.mobile,
  625. a.create_time as createTime, a.number, aa.name as superior
  626. from admin a
  627. left join admin_location al on al.admin_id = a.id
  628. left join admin aa on aa.id = a.superior_id
  629. where 1 = 1
  630. <if test="provinceList != null and provinceList.size &gt; 0">
  631. and al.province in
  632. <foreach close=")" collection="provinceList" item="plist" open="(" separator=",">
  633. #{plist}
  634. </foreach>
  635. </if>
  636. <if test="cityList != null and cityList.size &gt; 0">
  637. and al.city in
  638. <foreach close=")" collection="cityList" item="clist" open="(" separator=",">
  639. #{clist}
  640. </foreach>
  641. </if>
  642. </select>
  643. <select id="findAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  644. select
  645. a.number, a.mobile, a.name,
  646. a.position, a.email, a.id,
  647. a.province,
  648. a.city,
  649. a.create_time as createTime,
  650. aa.name as superior,
  651. a.superior_id as superiorId,
  652. a.department_id as departmentId,
  653. date_format(a.last_login_time,'%Y-%m-%d %H:%i:%S') as lastLoginTime,
  654. dm.name as departmentName
  655. from admin a
  656. left join admin_location al on a.id = al.admin_id
  657. left join admin aa on aa.id = a.superior_id
  658. left join department dm on a.department_id = dm.id
  659. left join user_role x on x.uid=a.id
  660. left join `role` y on x.rid=y.id
  661. where a.id <![CDATA[ <> ]]> '1'
  662. <if test="roleName != null">
  663. where y.role_name= #{roleName,jdbcType=VARCHAR}
  664. </if>
  665. <if test="mobile != null">
  666. and a.mobile = #{mobile,jdbcType=VARCHAR}
  667. </if>
  668. <if test="name != null">
  669. and a.name = #{name,jdbcType=VARCHAR}
  670. </if>
  671. <if test="number != null">
  672. and a.number = #{number,jdbcType=INTEGER}
  673. </if>
  674. <if test="province != null">
  675. and a.province = #{province,jdbcType=VARCHAR}
  676. </if>
  677. order by a.last_login_time ,a.number
  678. <if test="page_sql!=null">
  679. ${page_sql}
  680. </if>
  681. </select>
  682. <select id="findAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  683. select count(1) from admin
  684. where id <![CDATA[ <> ]]> '1'
  685. left join `role` y on x.rid=y.id
  686. where a.id <![CDATA[ <> ]]> '1'
  687. <if test="roleName != null">
  688. where y.role_name= #{roleName,jdbcType=VARCHAR}
  689. </if>
  690. <if test="mobile != null">
  691. and mobile = #{mobile,jdbcType=VARCHAR}
  692. </if>
  693. <if test="name != null">
  694. and name = #{name,jdbcType=VARCHAR}
  695. </if>
  696. <if test="number != null">
  697. and number = #{number,jdbcType=INTEGER}
  698. </if>
  699. <if test="province != null">
  700. and a.province = #{province,jdbcType=VARCHAR}
  701. </if>
  702. </select>
  703. <select id="listAdminByName" parameterType="java.lang.String" resultMap="BaseResultMap">
  704. select id,name from admin where status='正常' and name like concat('%',#{name},'%')
  705. </select>
  706. <!--*************************************************************************-->
  707. <select id="selectAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  708. select x.*,y.name as departmentName from(select
  709. <!-- a.user_no as userNo, -->
  710. a.mobile, a.name,
  711. a.position, a.email, a.id,
  712. a.province,
  713. a.city,
  714. a.create_time as createTime,
  715. aa.name as superior,
  716. a.superior_id as superiorId,
  717. a.department_id as departmentId,
  718. a.last_login_time as lastLoginTime,
  719. a.contact_mobile as contactMobile,
  720. a.duty,a.status
  721. from admin a
  722. left join admin_location al on a.id = al.admin_id
  723. left join admin aa on aa.id = a.superior_id
  724. left join user_role ur on a.id=ur.uid
  725. left join `role` y on ur.rid=y.id
  726. where a.id <![CDATA[ <> ]]> '1'
  727. <if test="roleName != null">
  728. and y.role_name= #{roleName,jdbcType=VARCHAR}
  729. </if>
  730. <if test="name != null">
  731. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  732. </if>
  733. <if test="departmentId != null">
  734. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  735. </if>
  736. <if test="rid != null">
  737. and ur.rid = #{rid,jdbcType=VARCHAR}
  738. </if>
  739. <if test="duty != null">
  740. and a.duty = #{duty,jdbcType=VARCHAR}
  741. </if>
  742. <if test="position != null">
  743. and a.position = #{position,jdbcType=VARCHAR}
  744. </if>
  745. <if test="status != null">
  746. and a.status = #{status,jdbcType=VARCHAR}
  747. </if>
  748. <if test="mobile != null">
  749. and a.mobile = #{mobile,jdbcType=VARCHAR}
  750. </if>
  751. <if test="superiorId != null">
  752. and a.superior_id = #{superiorId,jdbcType=VARCHAR}
  753. </if>
  754. group by a.id
  755. order by a.last_login_time,a.number )x left join department y on x.departmentId = y.id
  756. <if test="page_sql!=null">
  757. ${page_sql}
  758. </if>
  759. </select>
  760. <select id="selectAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  761. select count(t.counts)
  762. from(select a.id counts from (select a.id from admin a
  763. left join user_role ur on a.id=ur.uid
  764. left join `role` y on ur.rid=y.id
  765. where a.id <![CDATA[ <> ]]> '1'
  766. <if test="roleName != null">
  767. and y.role_name= #{roleName,jdbcType=VARCHAR}
  768. </if>
  769. <if test="name != null">
  770. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  771. </if>
  772. <if test="departmentId != null">
  773. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  774. </if>
  775. <if test="rid != null">
  776. and ur.rid = #{rid,jdbcType=VARCHAR}
  777. </if>
  778. <if test="duty != null">
  779. and a.duty = #{duty,jdbcType=VARCHAR}
  780. </if>
  781. <if test="position != null">
  782. and a.position = #{position,jdbcType=VARCHAR}
  783. </if>
  784. <if test="status != null">
  785. and a.status = #{status,jdbcType=VARCHAR}
  786. </if>
  787. <if test="mobile != null">
  788. and a.mobile = #{mobile,jdbcType=VARCHAR}
  789. </if>
  790. <if test="superiorId != null">
  791. and a.superior_id = #{superiorId,jdbcType=VARCHAR}
  792. </if>
  793. )a
  794. group by a.id)t
  795. </select>
  796. <insert id="insertn" parameterType="com.goafanti.common.model.Admin">
  797. insert into admin (id, mobile, name,
  798. password, email, create_time,
  799. number, province, position, superior_id, city,department_id,status,user_no,duty,district,head_portrait_url,contact_mobile)
  800. values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  801. #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  802. #{number,jdbcType=INTEGER}, #{province,jdbcType=INTEGER}, #{position,jdbcType=VARCHAR},
  803. #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=INTEGER},#{departmentId,jdbcType=VARCHAR},
  804. #{status,jdbcType=VARCHAR},#{userNo,jdbcType=VARCHAR},#{duty,jdbcType=VARCHAR},#{district,jdbcType=VARCHAR},#{headPortraitUrl,jdbcType=VARCHAR},#{contactMobile,jdbcType=VARCHAR}
  805. )
  806. </insert>
  807. <select id="selectUserNoBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
  808. select
  809. user_no as userNo
  810. from admin
  811. where
  812. id=#{superiorId,jdbcType=VARCHAR}
  813. </select>
  814. <select id="selectCountBySuperiorId" parameterType="java.lang.String" resultType="java.lang.Integer">
  815. select
  816. count(1)
  817. from admin
  818. where
  819. superior_id=#{superiorId,jdbcType=VARCHAR}
  820. </select>
  821. <select id="selectIdByUserNo" parameterType="java.lang.String" resultType="java.lang.String">
  822. select
  823. id
  824. from admin
  825. where
  826. user_no=#{UserNo,jdbcType=VARCHAR}
  827. </select>
  828. <select id="selectAllByid" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  829. select
  830. id, mobile, name,
  831. password, email, create_time as createTime,
  832. province, position,
  833. superior_id as superiorId,department_id as departmentId,
  834. status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl,
  835. contact_mobile as contactMobile
  836. from admin
  837. where
  838. id=#{id,jdbcType=VARCHAR}
  839. </select>
  840. <select id="selectNameByid" parameterType="java.lang.String" resultType="java.lang.String">
  841. select
  842. name
  843. from admin
  844. where
  845. id=#{id,jdbcType=VARCHAR}
  846. </select>
  847. <select id="selectRolesByUid" parameterType="java.lang.String" resultType="java.lang.String">
  848. select
  849. r.role_name as roles
  850. from user_role ur
  851. left join role r on r.id = ur.rid
  852. where
  853. uid=#{id,jdbcType=VARCHAR}
  854. </select>
  855. <select id="selectRolesIdByUid" parameterType="java.lang.String" resultType="java.lang.String">
  856. select
  857. rid as rolesId
  858. from user_role
  859. where
  860. uid=#{id,jdbcType=VARCHAR}
  861. </select>
  862. <select id="selectStatusByMobile" parameterType="java.lang.String" resultType="java.lang.String">
  863. select
  864. status
  865. from admin
  866. where
  867. mobile= #{mobile,jdbcType=VARCHAR}
  868. </select>
  869. <delete id="deleteById" parameterType="java.lang.String">
  870. delete from admin
  871. where id = #{id,jdbcType=VARCHAR}
  872. </delete>
  873. <select id="selectIDNBySuperiorId" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  874. select id, mobile, name,
  875. password, email, create_time as createTime,
  876. province, position,
  877. superior_id as superiorId,department_id as departmentId,
  878. status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl
  879. from admin
  880. where
  881. superior_id=#{superiorId,jdbcType=VARCHAR}
  882. </select>
  883. <select id="selectUserNoById" resultType="java.lang.String">
  884. select user_no as userNo
  885. from admin
  886. where
  887. id=#{superiorId,jdbcType=VARCHAR}
  888. </select>
  889. <update id="updateByUserNo" parameterType="com.goafanti.common.model.Admin">
  890. update admin
  891. set user_no = #{userNo,jdbcType=VARCHAR}
  892. where
  893. id=#{id,jdbcType=VARCHAR}
  894. </update>
  895. <select id="selectIdBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
  896. select id
  897. from admin
  898. where
  899. superior_id=#{superiorId,jdbcType=VARCHAR}
  900. </select>
  901. <select id="selectSubList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  902. select
  903. a.id,
  904. a.user_no as userNo,
  905. a.mobile,
  906. a.name,
  907. a.position,
  908. b.name as departmentName
  909. from
  910. admin a left join department b on
  911. a.department_id = b.id
  912. where
  913. a.department_id =(
  914. select
  915. department_id
  916. from
  917. admin
  918. where
  919. id = #{adminId,jdbcType=VARCHAR}
  920. )
  921. and a.id <![CDATA[ <> ]]> #{adminId,jdbcType=VARCHAR}
  922. </select>
  923. <select id="selectAdminByRoleId" parameterType="java.lang.String" resultMap="BaseResultMap">
  924. 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
  925. </select>
  926. <select id="selectDepartmentStaff" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  927. select a.id ,a.name,a.password,a.department_id,b.name
  928. from admin a left join department b
  929. on a.department_id= b.id
  930. where 1=1
  931. <if test="departmentId != null and departmentId !='' ">
  932. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  933. </if>
  934. <if test="name != null">
  935. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  936. </if>
  937. </select>
  938. <select id="selectAdminName" parameterType="java.lang.String" resultMap="BaseResultMap">
  939. select a.id, a.name from admin a left join user_role b on a.id=b.uid
  940. left join `role` c on b.rid=c.id
  941. where c.role_name = #{name,jdbcType=VARCHAR}
  942. </select>
  943. <update id="updateLockIds" parameterType="java.lang.String">
  944. update admin set status = '锁定' where id in (${lockIds})
  945. </update>
  946. <!-- 用户是为正常的 -->
  947. <select id="getCountById" parameterType="java.lang.String" resultType="java.lang.Integer">
  948. select count(a.id) from admin a
  949. inner join user_role ur on a.id=ur.uid
  950. where a.id= #{_parameter,jdbcType=VARCHAR} and ( a.status != '注销' or a.status is null)
  951. </select>
  952. <select id="getAdminRoleList" parameterType="java.lang.String" resultMap="BaseResultMap">
  953. select a.id, a.name from admin a left join user_role b on a.id=b.uid
  954. left join `role` c on b.rid=c.id
  955. where c.role_name = #{name,jdbcType=VARCHAR} and a.status='正常'
  956. </select>
  957. <!-- 获得当前登录人的名字和部门名 -->
  958. <select id="getDeptNameByAid" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  959. select a.id,a.name, d.name as departmentName,a.department_id departmentId,a.email from admin a
  960. left join department d on a.department_id = d.id
  961. where a.id = #{_parameter,jdbcType=VARCHAR}
  962. </select>
  963. <insert id="addAdminContacts" parameterType="com.goafanti.admin.bo.AdminContacts">
  964. insert into admin_contacts (id,aid,contacts_id)values
  965. (#{id,jdbcType=VARCHAR},#{aid,jdbcType=VARCHAR},#{contactsId,jdbcType=VARCHAR})
  966. </insert>
  967. <select id="frequentContactsList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  968. 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
  969. from admin_contacts a left join admin b
  970. on a.contacts_id=b.id left join department c
  971. on c.id=b.department_id left join user_role x on x.uid=b.id
  972. left join `role` y on x.rid=y.id
  973. where b.status ='正常'
  974. <if test="roleName != null">
  975. and y.role_name= #{roleName,jdbcType=VARCHAR}
  976. </if>
  977. <if test="aid != null">
  978. and a.aid= #{aid,jdbcType=VARCHAR}
  979. </if>
  980. <if test="name != null">
  981. and b.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  982. </if>
  983. <if test="depId != null">
  984. and b.department_id= #{depId,jdbcType=VARCHAR}
  985. </if>
  986. <if test="page_sql!=null">
  987. ${page_sql}
  988. </if>
  989. </select>
  990. <select id="frequentContactsCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  991. select count(*)
  992. from admin_contacts a left join admin b
  993. on a.contacts_id=b.id
  994. left join user_role x on x.uid=b.id
  995. left join `role` y on x.rid=y.id
  996. where b.status ='正常'
  997. <if test="roleName != null">
  998. and y.role_name= #{roleName,jdbcType=VARCHAR}
  999. </if>
  1000. <if test="aid != null">
  1001. and a.aid= #{aid,jdbcType=VARCHAR}
  1002. </if>
  1003. <if test="name != null">
  1004. and b.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1005. </if>
  1006. <if test="depId != null">
  1007. and b.department_id= #{depId,jdbcType=VARCHAR}
  1008. </if>
  1009. </select>
  1010. <delete id="deleteFrequentContacts" parameterType="java.lang.String">
  1011. delete from admin_contacts
  1012. where id = #{id,jdbcType=VARCHAR}
  1013. </delete>
  1014. <select id="getaidFrequentContacts" resultType="java.lang.String">
  1015. select b.id from admin_contacts a left join admin b on a.contacts_id = b.id
  1016. where b.status = '正常' and a.aid= #{id,jdbcType=VARCHAR}
  1017. </select>
  1018. <select id="selectAdminCustomerList" resultType="com.goafanti.admin.bo.AdminCustomerBo">
  1019. 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,
  1020. ifnull(d.timeCount,0) as receiveCount,ifnull(g.timeCount,0) as signCount from admin a
  1021. left join (select aid,count(aid) as userCount from user where aid is not null
  1022. and share_type=0 and source !=0 and type=1
  1023. group by aid) b on a.id=b.aid
  1024. left join (select aid,count(aid) as timeCount from `user` where aid is not null
  1025. and share_type in (0,2) and source =1 and type=1
  1026. <if test="startTime != null and endTime != null">
  1027. and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1028. </if>
  1029. group by aid) c on a.id=c.aid
  1030. left join (select aid,count(aid) as timeCount from `user` where aid is not null
  1031. and share_type in (0,2) and source =2 and type=1
  1032. <if test="startTime != null and endTime != null">
  1033. and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1034. </if>
  1035. group by aid) d on a.id=d.aid
  1036. left join (select aid,count(aid) as timeCount from `user` where aid is not null
  1037. and share_type =2 and type=1
  1038. <if test="startTime != null and endTime != null">
  1039. and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1040. </if>
  1041. group by aid) g on a.id=g.aid
  1042. left join department d on a.department_id=d.id
  1043. left join user_role e on a.id=e.uid
  1044. left join `role` f on e.rid=f.id
  1045. where f.role_name in ('营销员','营销经理')
  1046. and a.status='正常'
  1047. <if test="depId != null">
  1048. and a.department_id = #{depId,jdbcType=VARCHAR}
  1049. </if>
  1050. <if test="page_sql!=null">
  1051. ${page_sql}
  1052. </if>
  1053. </select>
  1054. <select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  1055. select count(*) from admin a
  1056. left join department d on a.department_id=d.id
  1057. left join user_role e on a.id=e.uid
  1058. left join `role` f on e.rid=f.id
  1059. where f.role_name in ('营销员','营销经理')
  1060. and a.status='正常'
  1061. <if test="depId != null">
  1062. and a.department_id = #{depId,jdbcType=VARCHAR}
  1063. </if>
  1064. </select>
  1065. <select id="selectAdminCustomerDetailList" resultType="com.goafanti.admin.bo.AdminCustomerDetailBo">
  1066. select a.id,a.nickname as name,a.source,c.name contacts,c.mobile as contactMobile,
  1067. a.create_time as createTime,b.time_stamp as followTime
  1068. from user a
  1069. left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b on a.id=b.uid
  1070. left join (select uid,name ,mobile from organization_contact_book where major=1) c on a.id=c.uid
  1071. <if test="type==3 or type==4">
  1072. left join (select aid,uid from user_business
  1073. <if test="type==3">
  1074. where follow_situation=5
  1075. </if>
  1076. <if test="type==4">
  1077. where follow_situation=1
  1078. </if>
  1079. <if test="startTime != null and endTime != null">
  1080. and update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1081. </if>
  1082. group by aid,uid)d on a.id=d.uid
  1083. </if>
  1084. where a.type=1
  1085. <if test=" type !=3 and type !=4 and aid != null">
  1086. and a.aid= #{aid,jdbcType=VARCHAR}
  1087. </if>
  1088. <if test=" (type ==3 or type ==4) and aid != null">
  1089. and d.aid= #{aid,jdbcType=VARCHAR}
  1090. </if>
  1091. <if test="type == 0">
  1092. and a.source in (1,2,3)
  1093. and a.share_type = 0
  1094. </if>
  1095. <if test="type==1 or type==2 ">
  1096. and a.share_type in (0,2)
  1097. </if>
  1098. <if test="type == 5">
  1099. and a.share_type = 2
  1100. </if>
  1101. <if test="type == 1">
  1102. and a.source =1
  1103. <if test="startTime != null and endTime != null">
  1104. and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1105. </if>
  1106. </if>
  1107. <if test="type == 2">
  1108. and a.source =2
  1109. <if test="startTime != null and endTime != null">
  1110. and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1111. </if>
  1112. </if>
  1113. <if test="page_sql!=null">
  1114. ${page_sql}
  1115. </if>
  1116. </select>
  1117. <select id="selectAdminCustomerDetailCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  1118. select count(*)
  1119. from user a
  1120. left join (select uid,max(time_stamp) as time_stamp from user_follow group by uid) b on a.id=b.uid
  1121. left join (select uid,name ,mobile from organization_contact_book where major=1) c on a.id=c.uid
  1122. <if test="type==3 or type==4">
  1123. left join (select aid,uid from user_business
  1124. <if test="type==3">
  1125. where follow_situation=5
  1126. </if>
  1127. <if test="type==4">
  1128. where follow_situation=1
  1129. </if>
  1130. <if test="startTime != null and endTime != null">
  1131. and update_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1132. </if>
  1133. group by aid,uid)d on a.id=d.uid
  1134. </if>
  1135. where a.type=1
  1136. <if test=" type !=3 and type !=4 and aid != null">
  1137. and a.aid= #{aid,jdbcType=VARCHAR}
  1138. </if>
  1139. <if test=" (type ==3 or type ==4) and aid != null">
  1140. and d.aid= #{aid,jdbcType=VARCHAR}
  1141. </if>
  1142. <if test="type == 0">
  1143. and a.source in (1,2,3)
  1144. and a.share_type = 0
  1145. </if>
  1146. <if test="type==1 or type==2 ">
  1147. and a.share_type in (0,2)
  1148. </if>
  1149. <if test="type == 5">
  1150. and a.share_type = 2
  1151. </if>
  1152. <if test="type == 1">
  1153. and a.source =1
  1154. <if test="startTime != null and endTime != null">
  1155. and a.create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1156. </if>
  1157. </if>
  1158. <if test="type == 2">
  1159. and a.source =2
  1160. <if test="startTime != null and endTime != null">
  1161. and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1162. </if>
  1163. </if>
  1164. </select>
  1165. <select id="listNameByDepAndName" resultType="java.lang.String">
  1166. select a.id from admin a left join user_role b on a.id =b.uid
  1167. left join `role` c on b.rid=c.id
  1168. where department_id= #{depId}
  1169. and c.role_name= #{roleName}
  1170. </select>
  1171. <select id="selectBySuperId" resultType="java.lang.String">
  1172. select id from admin where superior_id= #{aid}
  1173. </select>
  1174. <select id="selectFinanceAdminByOrderDep" resultType="com.goafanti.common.model.Admin">
  1175. select a.finance_id id,b.name from department a left join admin b on a.finance_id=b.id
  1176. where a.id= #{orderDep}
  1177. </select>
  1178. <select id="getPermission" resultType="java.lang.String">
  1179. 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
  1180. where a.id= #{transferId}
  1181. </select>
  1182. <select id="selectDepIdWithSpuerId" resultType="java.lang.String">
  1183. select b.id from admin a right join department b on a.id=b.finance_id
  1184. where a.superior_id= #{superId}
  1185. </select>
  1186. <select id="getAdminRoleListByAid" resultType="java.lang.String">
  1187. select c.role_type from admin a left join user_role b on a.id=b.uid
  1188. left join role c on b.rid =c.id
  1189. where a.id= #{id}
  1190. </select>
  1191. <select id="selectByOpeid" resultType="java.lang.String">
  1192. select b.open_id from admin a left join admin b on a.superior_id =b.id
  1193. where a.id= #{aid}
  1194. </select>
  1195. </mapper>