AdminMapper.xml 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158
  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 a.status='0'
  1039. and a.department_id= #{depId}
  1040. and c.role_type= #{roleType}
  1041. </select>
  1042. <select id="selectBySuperId" resultType="java.lang.String">
  1043. select id from admin where superior_id= #{aid}
  1044. </select>
  1045. <select id="selectGetSuper" parameterType="java.lang.String" resultMap="BaseResultMap">
  1046. select
  1047. <include refid="Base_Column_List" />
  1048. from admin
  1049. where superior_id= #{aid}
  1050. </select>
  1051. <select id="selectFinanceAdminByOrderDep" resultType="com.goafanti.common.model.Admin">
  1052. select a.finance_id id,b.name from department a left join admin b on a.finance_id=b.id
  1053. where a.id= #{orderDep}
  1054. </select>
  1055. <select id="getPermission" resultType="java.lang.String">
  1056. 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
  1057. where a.id= #{transferId}
  1058. </select>
  1059. <select id="selectDepIdWithSpuerId" resultType="java.lang.String">
  1060. select b.id from admin a right join department b on a.id=b.finance_id
  1061. where a.superior_id= #{superId}
  1062. </select>
  1063. <select id="getAdminRoleListByAid" resultType="java.lang.String">
  1064. select c.role_type from admin a left join user_role b on a.id=b.uid
  1065. left join role c on b.rid =c.id
  1066. where a.id= #{id}
  1067. </select>
  1068. <select id="selectByOpeid" parameterType="java.lang.String" resultMap="BaseResultMap">
  1069. select
  1070. <include refid="Base_Column_List" />
  1071. from admin
  1072. where open_id= #{openid}
  1073. </select>
  1074. <select id="getFinanceDep" resultType="java.lang.String">
  1075. select id from department where finance_id = #{aid}
  1076. </select>
  1077. <select id="getLowerFinanceDep" resultType="java.lang.String">
  1078. select b.id from admin a left join department b on a.id=b.finance_id
  1079. where a.superior_id = #{aid}
  1080. </select>
  1081. <select id="selectByAmbIdCount" resultType="java.lang.Integer">
  1082. SELECT count(*) from admin where amb_id= #{ambId}
  1083. </select>
  1084. <select id="selectAdminByRoleType" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  1085. SELECT a.id,a.name ,a.mobile ,a.email,a.department_id departmentId
  1086. FROM admin a left join user_role b on a.id=b.uid
  1087. left join `role` c on b.rid =c.id
  1088. where a.status='0'
  1089. <if test="roleType =='99998'">
  1090. and c.role_type in ('99998','99988')
  1091. </if>
  1092. <if test="roleType =='99999'">
  1093. and c.role_type in ('99999','99989')
  1094. </if>
  1095. <if test="roleType !='99999' and roleType !='99998'">
  1096. and c.role_type in (#{roleType})
  1097. </if>
  1098. </select>
  1099. </mapper>