AdminMapper.xml 42 KB

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