AdminMapper.xml 40 KB

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