AdminMapper.xml 45 KB

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