AdminMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  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" property="id" jdbcType="VARCHAR" />
  6. <result column="mobile" property="mobile" jdbcType="VARCHAR" />
  7. <result column="name" property="name" jdbcType="VARCHAR" />
  8. <result column="password" property="password" jdbcType="VARCHAR" />
  9. <result column="email" property="email" jdbcType="VARCHAR" />
  10. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  11. <result column="number" property="number" jdbcType="INTEGER" />
  12. <result column="province" property="province" jdbcType="INTEGER" />
  13. <result column="position" property="position" jdbcType="VARCHAR" />
  14. <result column="superior_id" property="superiorId" jdbcType="VARCHAR" />
  15. <result column="city" property="city" jdbcType="INTEGER" />
  16. <result column="department_id" property="departmentId" jdbcType="VARCHAR"/>
  17. </resultMap>
  18. <sql id="Base_Column_List" >
  19. id, mobile, name, password, email, create_time, number, province, position, superior_id,
  20. city,department_id
  21. </sql>
  22. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  23. select
  24. <include refid="Base_Column_List" />
  25. from admin
  26. where id = #{id,jdbcType=VARCHAR}
  27. </select>
  28. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  29. delete from admin
  30. where id = #{id,jdbcType=VARCHAR}
  31. </delete>
  32. <insert id="insert" parameterType="com.goafanti.common.model.Admin" >
  33. insert into admin (id, mobile, name,
  34. password, email, create_time,
  35. number, province, position, superior_id, city,department_id)
  36. values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  37. #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  38. #{number,jdbcType=INTEGER}, #{province,jdbcType=INTEGER}, #{position,jdbcType=VARCHAR},
  39. #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=INTEGER},#{departmentId,jdbcType=VARCHAR}
  40. )
  41. </insert>
  42. <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin" >
  43. insert into admin
  44. <trim prefix="(" suffix=")" suffixOverrides="," >
  45. <if test="id != null" >
  46. id,
  47. </if>
  48. <if test="mobile != null" >
  49. mobile,
  50. </if>
  51. <if test="name != null" >
  52. name,
  53. </if>
  54. <if test="password != null" >
  55. password,
  56. </if>
  57. <if test="email != null" >
  58. email,
  59. </if>
  60. <if test="createTime != null" >
  61. create_time,
  62. </if>
  63. <if test="number != null" >
  64. number,
  65. </if>
  66. <if test="province != null" >
  67. province,
  68. </if>
  69. <if test="position != null" >
  70. position,
  71. </if>
  72. <if test="superiorId != null" >
  73. superior_id,
  74. </if>
  75. <if test="city != null" >
  76. city,
  77. </if>
  78. <if test="departmentId != null">
  79. department_id,
  80. </if>
  81. </trim>
  82. <trim prefix="values (" suffix=")" suffixOverrides="," >
  83. <if test="id != null" >
  84. #{id,jdbcType=VARCHAR},
  85. </if>
  86. <if test="mobile != null" >
  87. #{mobile,jdbcType=VARCHAR},
  88. </if>
  89. <if test="name != null" >
  90. #{name,jdbcType=VARCHAR},
  91. </if>
  92. <if test="password != null" >
  93. #{password,jdbcType=VARCHAR},
  94. </if>
  95. <if test="email != null" >
  96. #{email,jdbcType=VARCHAR},
  97. </if>
  98. <if test="createTime != null" >
  99. #{createTime,jdbcType=TIMESTAMP},
  100. </if>
  101. <if test="number != null" >
  102. #{number,jdbcType=INTEGER},
  103. </if>
  104. <if test="province != null" >
  105. #{province,jdbcType=INTEGER},
  106. </if>
  107. <if test="position != null" >
  108. #{position,jdbcType=VARCHAR},
  109. </if>
  110. <if test="superiorId != null" >
  111. #{superiorId,jdbcType=VARCHAR},
  112. </if>
  113. <if test="city != null" >
  114. #{city,jdbcType=INTEGER},
  115. </if>
  116. <if test="departmentId != null">
  117. #{departmentId,jdbcType=VARCHAR},
  118. </if>
  119. </trim>
  120. </insert>
  121. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin" >
  122. update admin
  123. <set >
  124. <if test="mobile != null" >
  125. mobile = #{mobile,jdbcType=VARCHAR},
  126. </if>
  127. <if test="name != null" >
  128. name = #{name,jdbcType=VARCHAR},
  129. </if>
  130. <if test="password != null" >
  131. password = #{password,jdbcType=VARCHAR},
  132. </if>
  133. <if test="email != null" >
  134. email = #{email,jdbcType=VARCHAR},
  135. </if>
  136. <if test="createTime != null" >
  137. create_time = #{createTime,jdbcType=TIMESTAMP},
  138. </if>
  139. <if test="number != null" >
  140. number = #{number,jdbcType=INTEGER},
  141. </if>
  142. <if test="province != null" >
  143. province = #{province,jdbcType=INTEGER},
  144. </if>
  145. <if test="position != null" >
  146. position = #{position,jdbcType=VARCHAR},
  147. </if>
  148. <if test="superiorId != null" >
  149. superior_id = #{superiorId,jdbcType=VARCHAR},
  150. </if>
  151. <if test="city != null" >
  152. city = #{city,jdbcType=INTEGER},
  153. </if>
  154. <if test="departmentId != null">
  155. department_id = #{departmentId,jdbcType=VARCHAR},
  156. </if>
  157. <if test="status != null">
  158. status = #{status,jdbcType=VARCHAR},
  159. </if>
  160. <if test="userNo != null">
  161. user_no = #{userNo,jdbcType=VARCHAR},
  162. </if>
  163. <if test="duty != null">
  164. duty = #{duty,jdbcType=VARCHAR},
  165. </if>
  166. <if test="district != null">
  167. district = #{district,jdbcType=VARCHAR},
  168. </if>
  169. <if test="headPortraitUrl != null">
  170. head_portrait_url = #{headPortraitUrl,jdbcType=VARCHAR},
  171. </if>
  172. </set>
  173. where id = #{id,jdbcType=VARCHAR}
  174. </update>
  175. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Admin" >
  176. update admin
  177. set mobile = #{mobile,jdbcType=VARCHAR},
  178. name = #{name,jdbcType=VARCHAR},
  179. password = #{password,jdbcType=VARCHAR},
  180. email = #{email,jdbcType=VARCHAR},
  181. create_time = #{createTime,jdbcType=TIMESTAMP},
  182. number = #{number,jdbcType=INTEGER},
  183. province = #{province,jdbcType=INTEGER},
  184. position = #{position,jdbcType=VARCHAR},
  185. superior_id = #{superiorId,jdbcType=VARCHAR},
  186. city = #{city,jdbcType=INTEGER},
  187. department_id = #{departmentId,jdbcType=VARCHAR}
  188. where id = #{id,jdbcType=VARCHAR}
  189. </update>
  190. <select id="selectAllAdmin" resultMap="BaseResultMap">
  191. select
  192. <include refid="Base_Column_List" />
  193. from admin
  194. </select>
  195. <select id="selectByMobile" resultMap="BaseResultMap">
  196. select
  197. a.id, a.mobile, a.name, a.password, a.email, a.create_time, a.number, a.province, a.position, a.superior_id,
  198. a.city,a.department_id
  199. from admin a
  200. left join user_role b on a.id = b.uid
  201. left join role c on b.rid = c.id
  202. where mobile = #{mobile,jdbcType=VARCHAR}
  203. <if test="roleName !=null">
  204. and #{roleName,jdbcType=VARCHAR}=c.role_name
  205. </if>
  206. </select>
  207. <select id="selectRolesByPrimaryKey" parameterType="java.lang.String">
  208. select r.name, r.id, r.type
  209. from role r
  210. left join user_role ur on ur.rid=r.id
  211. where ur.uid = #{uid,jdbcType=VARCHAR}
  212. </select>
  213. <select id="selectCognizanceConsultant" resultMap="BaseResultMap" >
  214. select
  215. <include refid="Base_Column_List" />
  216. from admin
  217. where id <![CDATA[ <> ]]> '1'
  218. </select>
  219. <select id="selectCognizancePrincipal" resultMap="BaseResultMap" >
  220. select a.id, a.name, a.position from admin a
  221. INNER JOIN user_role ur on a.id = ur.uid
  222. where ur.rid not in('1','2','3','4','5','6')
  223. group by a.id
  224. </select>
  225. <select id="selectPatentAuthor" resultMap="BaseResultMap" >
  226. select a.id, a.name, a.position from admin a
  227. INNER JOIN user_role ur on a.id = ur.uid
  228. where ur.rid not in('1','2','3','4','5','6')
  229. group by a.id
  230. </select>
  231. <select id="selectPatentPrincipal" resultMap="BaseResultMap" >
  232. select a.id, a.name, a.position from admin a
  233. INNER JOIN user_role ur on a.id = ur.uid
  234. where ur.rid not in('1','2','3','4','5','6')
  235. group by a.id
  236. </select>
  237. <select id="selectCopyrightConsultant" resultMap="BaseResultMap" >
  238. select
  239. <include refid="Base_Column_List" />
  240. from admin
  241. where id <![CDATA[ <> ]]> '1'
  242. </select>
  243. <select id="selectCopyrightPrincipal" resultMap="BaseResultMap" >
  244. select a.id, a.name, a.position from admin a
  245. INNER JOIN user_role ur on a.id = ur.uid
  246. where ur.rid not in('1','2','3','4','5','6')
  247. group by a.id
  248. </select>
  249. <select id="selectTechprojectConsultant" resultMap="BaseResultMap" >
  250. select
  251. <include refid="Base_Column_List" />
  252. from admin
  253. where id <![CDATA[ <> ]]> '1'
  254. </select>
  255. <select id="selectTechprojectPrincipal" resultMap="BaseResultMap" >
  256. select a.id, a.name, a.position from admin a
  257. INNER JOIN user_role ur on a.id = ur.uid
  258. where ur.rid not in('1','2','3','4','5','6')
  259. group by a.id
  260. </select>
  261. <select id="selectRoleByPrimaryKey" parameterType="java.lang.String" resultType="String">
  262. SELECT rid FROM user_role
  263. where uid = #{uid,jdbcType=VARCHAR}
  264. </select>
  265. <select id="selectAccoutManager" resultMap="BaseResultMap">
  266. select a.id, a.name, a.position from admin a
  267. INNER JOIN user_role ur on a.id = ur.uid
  268. where ur.rid = '4'
  269. </select>
  270. <select id="selectTechnician" resultMap="BaseResultMap">
  271. select a.id, a.name, a.position from admin a
  272. INNER JOIN user_role ur on a.id = ur.uid
  273. where ur.rid not in('1','2','3','4')
  274. group by a.id
  275. </select>
  276. <select id="selectSalesman" resultMap="BaseResultMap">
  277. select a.id, a.name, a.position from admin a
  278. INNER JOIN user_role ur on a.id = ur.uid
  279. where ur.rid in ('5', '6')
  280. </select>
  281. <select id="selectContractManager" resultMap="BaseResultMap" >
  282. select a.id, a.name, a.position from admin a
  283. INNER JOIN user_role ur on a.id = ur.uid
  284. where ur.rid not in('1','2','3','4')
  285. group by a.id
  286. </select>
  287. <select id="selectTechBroder" resultMap="BaseResultMap">
  288. select
  289. u.rid as rolesId, a.name,a.id, a.position
  290. from user_role u
  291. left join admin a on a.id =u.uid
  292. left join role r on r.id =u.rid
  293. where
  294. r.role_name='技术经纪专员'
  295. </select>
  296. <select id="listAdminSelectBySuperAdmin" resultMap="BaseResultMap">
  297. select
  298. <include refid="Base_Column_List" />
  299. from admin
  300. where id <![CDATA[ <> ]]> '1'
  301. </select>
  302. <select id="listAdminSelectByAreaAdmin" resultMap="BaseResultMap">
  303. select
  304. a.id, a.name, a.mobile,
  305. a.create_time as createTime, a.number, aa.name as superior
  306. from admin a
  307. left join admin_location al on al.admin_id = a.id
  308. left join admin aa on aa.id = a.superior_id
  309. where 1 = 1
  310. <if test="provinceList != null and provinceList.size > 0">
  311. and al.province in
  312. <foreach collection="provinceList" item="plist" open="(" separator="," close=")">
  313. #{plist}
  314. </foreach>
  315. </if>
  316. <if test="cityList != null and cityList.size > 0">
  317. and al.city in
  318. <foreach collection="cityList" item="clist" open="(" separator="," close=")">
  319. #{clist}
  320. </foreach>
  321. </if>
  322. </select>
  323. <select id= "findAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo" >
  324. select
  325. a.number, a.mobile, a.name,
  326. a.position, a.email, a.id,
  327. a.province,
  328. a.city,
  329. a.create_time as createTime,
  330. aa.name as superior,
  331. a.superior_id as superiorId,
  332. a.department_id as departmentId,
  333. dm.name as departmentName
  334. from admin a
  335. left join admin_location al on a.id = al.admin_id
  336. left join admin aa on aa.id = a.superior_id
  337. left join department_management dm on a.department_id = dm.id
  338. where a.id <![CDATA[ <> ]]> '1'
  339. <if test = "mobile != null">
  340. and a.mobile = #{mobile,jdbcType=VARCHAR}
  341. </if>
  342. <if test = "name != null">
  343. and a.name = #{name,jdbcType=VARCHAR}
  344. </if>
  345. <if test = "number != null">
  346. and a.number = #{number,jdbcType=INTEGER}
  347. </if>
  348. <if test = "province != null">
  349. and a.province = #{province,jdbcType=VARCHAR}
  350. </if>
  351. order by a.number
  352. <if test="page_sql!=null">
  353. ${page_sql}
  354. </if>
  355. </select>
  356. <select id = "findAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  357. select count(1) from admin
  358. where id <![CDATA[ <> ]]> '1'
  359. <if test = "mobile != null">
  360. and mobile = #{mobile,jdbcType=VARCHAR}
  361. </if>
  362. <if test = "name != null">
  363. and name = #{name,jdbcType=VARCHAR}
  364. </if>
  365. <if test = "number != null">
  366. and number = #{number,jdbcType=INTEGER}
  367. </if>
  368. <if test = "province != null">
  369. and a.province = #{province,jdbcType=VARCHAR}
  370. </if>
  371. </select>
  372. <select id="listAdminByName" parameterType="java.lang.String" resultMap="BaseResultMap">
  373. select id,name from admin where name like concat('%',#{name},'%')
  374. </select>
  375. <!--*************************************************************************-->
  376. <select id= "selectAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo" >
  377. select x.*,y.name as departmentName from(select
  378. a.user_no as userNo, a.mobile, a.name,
  379. a.position, a.email, a.id,
  380. a.province,
  381. a.city,
  382. a.create_time as createTime,
  383. aa.name as superior,
  384. a.superior_id as superiorId,
  385. a.department_id as departmentId,
  386. a.duty,a.status
  387. from admin a
  388. left join admin_location al on a.id = al.admin_id
  389. left join admin aa on aa.id = a.superior_id
  390. left join user_role ur on a.id=ur.uid
  391. where a.id <![CDATA[ <> ]]> '1'
  392. and (a.status !='注销' or a.status is null)
  393. <if test = "name != null">
  394. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  395. </if>
  396. <if test = "departmentId != null">
  397. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  398. </if>
  399. <if test = "rid != null">
  400. and ur.rid = #{rid,jdbcType=VARCHAR}
  401. </if>
  402. <if test = "duty != null">
  403. and a.duty = #{duty,jdbcType=VARCHAR}
  404. </if>
  405. <if test = "position != null">
  406. and a.position = #{position,jdbcType=VARCHAR}
  407. </if>
  408. <if test = "status != null">
  409. and a.status = #{status,jdbcType=VARCHAR}
  410. </if>
  411. <if test = "mobile != null">
  412. and a.mobile = #{mobile,jdbcType=VARCHAR}
  413. </if>
  414. <if test = "superiorId != null">
  415. and a.superior_id = #{superiorId,jdbcType=VARCHAR}
  416. </if>
  417. group by a.id
  418. order by a.number )x left join department_management y on x.departmentId = y.id
  419. <if test="page_sql!=null">
  420. ${page_sql}
  421. </if>
  422. </select>
  423. <select id = "selectAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  424. select count(t.counts)
  425. from(select a.id counts from (select a.id from admin a
  426. left join user_role ur on a.id=ur.uid
  427. where a.id <![CDATA[ <> ]]> '1'
  428. and (a.status != '注销' or a.status is null)
  429. <if test = "name != null">
  430. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  431. </if>
  432. <if test = "departmentId != null">
  433. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  434. </if>
  435. <if test = "rid != null">
  436. and ur.rid = #{rid,jdbcType=VARCHAR}
  437. </if>
  438. <if test = "duty != null">
  439. and a.duty = #{duty,jdbcType=VARCHAR}
  440. </if>
  441. <if test = "position != null">
  442. and a.position = #{position,jdbcType=VARCHAR}
  443. </if>
  444. <if test = "status != null">
  445. and a.status = #{status,jdbcType=VARCHAR}
  446. </if>
  447. <if test = "mobile != null">
  448. and a.mobile = #{mobile,jdbcType=VARCHAR}
  449. </if>
  450. <if test = "superiorId != null">
  451. and a.superior_id = #{superiorId,jdbcType=VARCHAR}
  452. </if>
  453. )a
  454. group by a.id)t
  455. </select>
  456. <insert id="insertn" parameterType="com.goafanti.common.model.Admin" >
  457. insert into admin (id, mobile, name,
  458. password, email, create_time,
  459. number, province, position, superior_id, city,department_id,status,user_no,duty,district,head_portrait_url)
  460. values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  461. #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  462. #{number,jdbcType=INTEGER}, #{province,jdbcType=INTEGER}, #{position,jdbcType=VARCHAR},
  463. #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=INTEGER},#{departmentId,jdbcType=VARCHAR},
  464. #{status,jdbcType=VARCHAR},#{userNo,jdbcType=VARCHAR},#{duty,jdbcType=VARCHAR},#{district,jdbcType=VARCHAR},#{headPortraitUrl,jdbcType=VARCHAR}
  465. )
  466. </insert>
  467. <select id="selectUserNoBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
  468. select
  469. user_no as userNo
  470. from admin
  471. where
  472. id=#{superiorId,jdbcType=VARCHAR}
  473. </select>
  474. <select id="selectCountBySuperiorId" parameterType="java.lang.String" resultType="java.lang.Integer">
  475. select
  476. count(1)
  477. from admin
  478. where
  479. superior_id=#{superiorId,jdbcType=VARCHAR}
  480. </select>
  481. <select id="selectIdByUserNo" parameterType="java.lang.String" resultType="java.lang.String">
  482. select
  483. id
  484. from admin
  485. where
  486. user_no=#{UserNo,jdbcType=VARCHAR}
  487. </select>
  488. <select id= "selectAllByid" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin" >
  489. select
  490. id, mobile, name,
  491. password, email, create_time as createTime,
  492. province, position,
  493. superior_id as superiorId,department_id as departmentId,
  494. status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl
  495. from admin
  496. where
  497. id=#{id,jdbcType=VARCHAR}
  498. </select>
  499. <select id= "selectNameByid" parameterType="java.lang.String" resultType="java.lang.String" >
  500. select
  501. name
  502. from admin
  503. where
  504. id=#{id,jdbcType=VARCHAR}
  505. </select>
  506. <select id= "selectRolesByUid" parameterType="java.lang.String" resultType="java.lang.String">
  507. select
  508. r.role_name as roles
  509. from user_role ur
  510. left join role r on r.id = ur.rid
  511. where
  512. uid=#{id,jdbcType=VARCHAR}
  513. </select>
  514. <select id= "selectRolesIdByUid" parameterType="java.lang.String" resultType="java.lang.String">
  515. select
  516. rid as rolesId
  517. from user_role
  518. where
  519. uid=#{id,jdbcType=VARCHAR}
  520. </select>
  521. <select id= "selectStatusByMobile" parameterType="java.lang.String" resultType="java.lang.String" >
  522. select
  523. status
  524. from admin
  525. where
  526. mobile=#{mobile,jdbcType=VARCHAR}
  527. </select>
  528. <delete id="deleteById" parameterType="java.lang.String" >
  529. delete from admin
  530. where id = #{id,jdbcType=VARCHAR}
  531. </delete>
  532. <select id="selectIDNBySuperiorId" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  533. select id, mobile, name,
  534. password, email, create_time as createTime,
  535. province, position,
  536. superior_id as superiorId,department_id as departmentId,
  537. status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl
  538. from admin
  539. where
  540. superior_id=#{superiorId,jdbcType=VARCHAR}
  541. </select>
  542. <select id="selectUserNoById" resultType="java.lang.String">
  543. select user_no as userNo
  544. from admin
  545. where
  546. id=#{superiorId,jdbcType=VARCHAR}
  547. </select>
  548. <update id="updateByUserNo" parameterType="com.goafanti.common.model.Admin">
  549. update admin
  550. set user_no = #{userNo,jdbcType=VARCHAR}
  551. where
  552. id=#{id,jdbcType=VARCHAR}
  553. </update>
  554. <select id="selectIdBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
  555. select id
  556. from admin
  557. where
  558. superior_id=#{superiorId,jdbcType=VARCHAR}
  559. </select>
  560. <select id="selectSubList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  561. select
  562. a.id,
  563. a.user_no as userNo,
  564. a.mobile,
  565. a.name,
  566. a.position,
  567. b.name as departmentName
  568. from
  569. admin a left join department_management b on
  570. a.department_id = b.id
  571. where
  572. a.department_id =(
  573. select
  574. department_id
  575. from
  576. admin
  577. where
  578. id = #{adminId,jdbcType=VARCHAR}
  579. )
  580. and a.id <![CDATA[ <> ]]> #{adminId,jdbcType=VARCHAR}
  581. </select>
  582. <select id="selectAdminByRoleId" parameterType="java.lang.String" resultMap="BaseResultMap">
  583. 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
  584. </select>
  585. <select id="selectDepartmentStaff" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  586. select a.id ,a.name,a.department_id,b.name
  587. from admin a left join department_management b
  588. on a.department_id= b.id
  589. where 1=1
  590. <if test = "departmentId != null and departmentId !='' ">
  591. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  592. </if>
  593. <if test = "name != null">
  594. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  595. </if>
  596. </select>
  597. <select id="selectAdminName" parameterType="java.lang.String" resultMap="BaseResultMap">
  598. select id, name from admin where name = #{name,jdbcType=VARCHAR}
  599. </select>
  600. </mapper>