AdminMapper.xml 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458
  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. <result column="expense_super_examine" jdbcType="INTEGER" property="expenseSuperExamine" />
  35. </resultMap>
  36. <sql id="Base_Column_List">
  37. id, mobile, `name`, `password`, email, create_time, `number`, province, `position`,
  38. superior_id, city, department_id, `status`, user_no, duty, district, head_portrait_url,
  39. contact_mobile, last_login_time, open_id, `type`, reviewer, amb_id, amb_role, amb_manage,
  40. manager_id, senior_staff, public_purview, expense_open_id, expense_super_examine
  41. </sql>
  42. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  43. select
  44. <include refid="Base_Column_List" />
  45. from admin
  46. where id = #{id,jdbcType=VARCHAR}
  47. </select>
  48. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  49. delete from admin
  50. where id = #{id,jdbcType=VARCHAR}
  51. </delete>
  52. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
  53. insert into admin (mobile, `name`, `password`,
  54. email, create_time, `number`,
  55. province, `position`, superior_id,
  56. city, department_id, `status`,
  57. user_no, duty, district,
  58. head_portrait_url, contact_mobile, last_login_time,
  59. open_id, `type`, reviewer,
  60. amb_id, amb_role, amb_manage,
  61. manager_id, senior_staff, public_purview,
  62. expense_open_id, expense_super_examine)
  63. values (#{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
  64. #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{number,jdbcType=INTEGER},
  65. #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, #{superiorId,jdbcType=VARCHAR},
  66. #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
  67. #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR}, #{district,jdbcType=VARCHAR},
  68. #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}, #{lastLoginTime,jdbcType=TIMESTAMP},
  69. #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{reviewer,jdbcType=VARCHAR},
  70. #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR}, #{ambManage,jdbcType=INTEGER},
  71. #{managerId,jdbcType=VARCHAR}, #{seniorStaff,jdbcType=INTEGER}, #{publicPurview,jdbcType=INTEGER},
  72. #{expenseOpenId,jdbcType=VARCHAR}, #{expenseSuperExamine,jdbcType=INTEGER})
  73. </insert>
  74. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
  75. insert into admin
  76. <trim prefix="(" suffix=")" suffixOverrides=",">
  77. <if test="mobile != null">
  78. mobile,
  79. </if>
  80. <if test="name != null">
  81. `name`,
  82. </if>
  83. <if test="password != null">
  84. `password`,
  85. </if>
  86. <if test="email != null">
  87. email,
  88. </if>
  89. <if test="createTime != null">
  90. create_time,
  91. </if>
  92. <if test="number != null">
  93. `number`,
  94. </if>
  95. <if test="province != null">
  96. province,
  97. </if>
  98. <if test="position != null">
  99. `position`,
  100. </if>
  101. <if test="superiorId != null">
  102. superior_id,
  103. </if>
  104. <if test="city != null">
  105. city,
  106. </if>
  107. <if test="departmentId != null">
  108. department_id,
  109. </if>
  110. <if test="status != null">
  111. `status`,
  112. </if>
  113. <if test="userNo != null">
  114. user_no,
  115. </if>
  116. <if test="duty != null">
  117. duty,
  118. </if>
  119. <if test="district != null">
  120. district,
  121. </if>
  122. <if test="headPortraitUrl != null">
  123. head_portrait_url,
  124. </if>
  125. <if test="contactMobile != null">
  126. contact_mobile,
  127. </if>
  128. <if test="lastLoginTime != null">
  129. last_login_time,
  130. </if>
  131. <if test="openId != null">
  132. open_id,
  133. </if>
  134. <if test="type != null">
  135. `type`,
  136. </if>
  137. <if test="reviewer != null">
  138. reviewer,
  139. </if>
  140. <if test="ambId != null">
  141. amb_id,
  142. </if>
  143. <if test="ambRole != null">
  144. amb_role,
  145. </if>
  146. <if test="ambManage != null">
  147. amb_manage,
  148. </if>
  149. <if test="managerId != null">
  150. manager_id,
  151. </if>
  152. <if test="seniorStaff != null">
  153. senior_staff,
  154. </if>
  155. <if test="publicPurview != null">
  156. public_purview,
  157. </if>
  158. <if test="expenseOpenId != null">
  159. expense_open_id,
  160. </if>
  161. <if test="expenseSuperExamine != null">
  162. expense_super_examine,
  163. </if>
  164. </trim>
  165. <trim prefix="values (" suffix=")" suffixOverrides=",">
  166. <if test="mobile != null">
  167. #{mobile,jdbcType=VARCHAR},
  168. </if>
  169. <if test="name != null">
  170. #{name,jdbcType=VARCHAR},
  171. </if>
  172. <if test="password != null">
  173. #{password,jdbcType=VARCHAR},
  174. </if>
  175. <if test="email != null">
  176. #{email,jdbcType=VARCHAR},
  177. </if>
  178. <if test="createTime != null">
  179. #{createTime,jdbcType=TIMESTAMP},
  180. </if>
  181. <if test="number != null">
  182. #{number,jdbcType=INTEGER},
  183. </if>
  184. <if test="province != null">
  185. #{province,jdbcType=VARCHAR},
  186. </if>
  187. <if test="position != null">
  188. #{position,jdbcType=VARCHAR},
  189. </if>
  190. <if test="superiorId != null">
  191. #{superiorId,jdbcType=VARCHAR},
  192. </if>
  193. <if test="city != null">
  194. #{city,jdbcType=VARCHAR},
  195. </if>
  196. <if test="departmentId != null">
  197. #{departmentId,jdbcType=VARCHAR},
  198. </if>
  199. <if test="status != null">
  200. #{status,jdbcType=VARCHAR},
  201. </if>
  202. <if test="userNo != null">
  203. #{userNo,jdbcType=VARCHAR},
  204. </if>
  205. <if test="duty != null">
  206. #{duty,jdbcType=VARCHAR},
  207. </if>
  208. <if test="district != null">
  209. #{district,jdbcType=VARCHAR},
  210. </if>
  211. <if test="headPortraitUrl != null">
  212. #{headPortraitUrl,jdbcType=VARCHAR},
  213. </if>
  214. <if test="contactMobile != null">
  215. #{contactMobile,jdbcType=VARCHAR},
  216. </if>
  217. <if test="lastLoginTime != null">
  218. #{lastLoginTime,jdbcType=TIMESTAMP},
  219. </if>
  220. <if test="openId != null">
  221. #{openId,jdbcType=VARCHAR},
  222. </if>
  223. <if test="type != null">
  224. #{type,jdbcType=INTEGER},
  225. </if>
  226. <if test="reviewer != null">
  227. #{reviewer,jdbcType=VARCHAR},
  228. </if>
  229. <if test="ambId != null">
  230. #{ambId,jdbcType=VARCHAR},
  231. </if>
  232. <if test="ambRole != null">
  233. #{ambRole,jdbcType=VARCHAR},
  234. </if>
  235. <if test="ambManage != null">
  236. #{ambManage,jdbcType=INTEGER},
  237. </if>
  238. <if test="managerId != null">
  239. #{managerId,jdbcType=VARCHAR},
  240. </if>
  241. <if test="seniorStaff != null">
  242. #{seniorStaff,jdbcType=INTEGER},
  243. </if>
  244. <if test="publicPurview != null">
  245. #{publicPurview,jdbcType=INTEGER},
  246. </if>
  247. <if test="expenseOpenId != null">
  248. #{expenseOpenId,jdbcType=VARCHAR},
  249. </if>
  250. <if test="expenseSuperExamine != null">
  251. #{expenseSuperExamine,jdbcType=INTEGER},
  252. </if>
  253. </trim>
  254. </insert>
  255. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
  256. update admin
  257. <set>
  258. <if test="mobile != null">
  259. mobile = #{mobile,jdbcType=VARCHAR},
  260. </if>
  261. <if test="name != null">
  262. `name` = #{name,jdbcType=VARCHAR},
  263. </if>
  264. <if test="password != null">
  265. `password` = #{password,jdbcType=VARCHAR},
  266. </if>
  267. <if test="email != null">
  268. email = #{email,jdbcType=VARCHAR},
  269. </if>
  270. <if test="createTime != null">
  271. create_time = #{createTime,jdbcType=TIMESTAMP},
  272. </if>
  273. <if test="number != null">
  274. `number` = #{number,jdbcType=INTEGER},
  275. </if>
  276. <if test="province != null">
  277. province = #{province,jdbcType=VARCHAR},
  278. </if>
  279. <if test="position != null">
  280. `position` = #{position,jdbcType=VARCHAR},
  281. </if>
  282. <if test="superiorId != null">
  283. superior_id = #{superiorId,jdbcType=VARCHAR},
  284. </if>
  285. <if test="city != null">
  286. city = #{city,jdbcType=VARCHAR},
  287. </if>
  288. <if test="departmentId != null">
  289. department_id = #{departmentId,jdbcType=VARCHAR},
  290. </if>
  291. <if test="status != null">
  292. `status` = #{status,jdbcType=VARCHAR},
  293. </if>
  294. <if test="userNo != null">
  295. user_no = #{userNo,jdbcType=VARCHAR},
  296. </if>
  297. <if test="duty != null">
  298. duty = #{duty,jdbcType=VARCHAR},
  299. </if>
  300. <if test="district != null">
  301. district = #{district,jdbcType=VARCHAR},
  302. </if>
  303. <if test="headPortraitUrl != null">
  304. head_portrait_url = #{headPortraitUrl,jdbcType=VARCHAR},
  305. </if>
  306. <if test="contactMobile != null">
  307. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  308. </if>
  309. <if test="lastLoginTime != null">
  310. last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
  311. </if>
  312. <if test="openId != null">
  313. open_id = #{openId,jdbcType=VARCHAR},
  314. </if>
  315. <if test="type != null">
  316. `type` = #{type,jdbcType=INTEGER},
  317. </if>
  318. <if test="reviewer != null">
  319. reviewer = #{reviewer,jdbcType=VARCHAR},
  320. </if>
  321. <if test="ambId != null">
  322. amb_id = #{ambId,jdbcType=VARCHAR},
  323. </if>
  324. <if test="ambRole != null">
  325. amb_role = #{ambRole,jdbcType=VARCHAR},
  326. </if>
  327. <if test="ambManage != null">
  328. amb_manage = #{ambManage,jdbcType=INTEGER},
  329. </if>
  330. <if test="managerId != null">
  331. manager_id = #{managerId,jdbcType=VARCHAR},
  332. </if>
  333. <if test="seniorStaff != null">
  334. senior_staff = #{seniorStaff,jdbcType=INTEGER},
  335. </if>
  336. <if test="publicPurview != null">
  337. public_purview = #{publicPurview,jdbcType=INTEGER},
  338. </if>
  339. <if test="expenseOpenId != null">
  340. expense_open_id = #{expenseOpenId,jdbcType=VARCHAR},
  341. </if>
  342. <if test="expenseSuperExamine != null">
  343. expense_super_examine = #{expenseSuperExamine,jdbcType=INTEGER},
  344. </if>
  345. </set>
  346. where id = #{id,jdbcType=VARCHAR}
  347. </update>
  348. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Admin">
  349. update admin
  350. set mobile = #{mobile,jdbcType=VARCHAR},
  351. `name` = #{name,jdbcType=VARCHAR},
  352. `password` = #{password,jdbcType=VARCHAR},
  353. email = #{email,jdbcType=VARCHAR},
  354. create_time = #{createTime,jdbcType=TIMESTAMP},
  355. `number` = #{number,jdbcType=INTEGER},
  356. province = #{province,jdbcType=VARCHAR},
  357. `position` = #{position,jdbcType=VARCHAR},
  358. superior_id = #{superiorId,jdbcType=VARCHAR},
  359. city = #{city,jdbcType=VARCHAR},
  360. department_id = #{departmentId,jdbcType=VARCHAR},
  361. `status` = #{status,jdbcType=VARCHAR},
  362. user_no = #{userNo,jdbcType=VARCHAR},
  363. duty = #{duty,jdbcType=VARCHAR},
  364. district = #{district,jdbcType=VARCHAR},
  365. head_portrait_url = #{headPortraitUrl,jdbcType=VARCHAR},
  366. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  367. last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
  368. open_id = #{openId,jdbcType=VARCHAR},
  369. `type` = #{type,jdbcType=INTEGER},
  370. reviewer = #{reviewer,jdbcType=VARCHAR},
  371. amb_id = #{ambId,jdbcType=VARCHAR},
  372. amb_role = #{ambRole,jdbcType=VARCHAR},
  373. amb_manage = #{ambManage,jdbcType=INTEGER},
  374. manager_id = #{managerId,jdbcType=VARCHAR},
  375. senior_staff = #{seniorStaff,jdbcType=INTEGER},
  376. public_purview = #{publicPurview,jdbcType=INTEGER},
  377. expense_open_id = #{expenseOpenId,jdbcType=VARCHAR},
  378. expense_super_examine = #{expenseSuperExamine,jdbcType=INTEGER}
  379. where id = #{id,jdbcType=VARCHAR}
  380. </update>
  381. <select id="selectAllAdmin" resultMap="BaseResultMap">
  382. select
  383. <include refid="Base_Column_List" />
  384. from admin
  385. where status ='0'
  386. <if test="depId != null">
  387. and department_id = #{depId,jdbcType=VARCHAR}
  388. </if>
  389. </select>
  390. <select id="selectByMobile" parameterType="java.lang.String" resultMap="BaseResultMap">
  391. select
  392. <include refid="Base_Column_List" />
  393. from admin
  394. where mobile = #{mobile,jdbcType=VARCHAR}
  395. </select>
  396. <select id="selectRolesByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.common.model.Role">
  397. select r.role_name name, r.id, r.role_type type
  398. from role r
  399. left join user_role ur on ur.rid=r.id
  400. where ur.uid = #{uid,jdbcType=VARCHAR}
  401. </select>
  402. <select id="selectCognizanceConsultant" resultMap="BaseResultMap">
  403. select
  404. <include refid="Base_Column_List" />
  405. from admin
  406. where id <![CDATA[ <> ]]> '1'
  407. </select>
  408. <select id="selectCognizancePrincipal" resultMap="BaseResultMap">
  409. select a.id, a.name, a.position from admin a
  410. INNER JOIN user_role ur on a.id = ur.uid
  411. where ur.rid not in('1','2','3','4','5','6')
  412. group by a.id
  413. </select>
  414. <select id="selectPatentAuthor" 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 not in('1','2','3','4','5','6')
  418. group by a.id
  419. </select>
  420. <select id="selectPatentPrincipal" resultMap="BaseResultMap">
  421. select a.id, a.name, a.position from admin a
  422. INNER JOIN user_role ur on a.id = ur.uid
  423. where ur.rid not in('1','2','3','4','5','6')
  424. group by a.id
  425. </select>
  426. <select id="selectCopyrightConsultant" resultMap="BaseResultMap">
  427. select
  428. <include refid="Base_Column_List" />
  429. from admin
  430. where id <![CDATA[ <> ]]> '1'
  431. </select>
  432. <select id="selectCopyrightPrincipal" resultMap="BaseResultMap">
  433. select a.id, a.name, a.position from admin a
  434. INNER JOIN user_role ur on a.id = ur.uid
  435. where ur.rid not in('1','2','3','4','5','6')
  436. group by a.id
  437. </select>
  438. <select id="selectTechprojectConsultant" resultMap="BaseResultMap">
  439. select
  440. <include refid="Base_Column_List" />
  441. from admin
  442. where id <![CDATA[ <> ]]> '1'
  443. </select>
  444. <select id="selectTechprojectPrincipal" resultMap="BaseResultMap">
  445. select a.id, a.name, a.position from admin a
  446. INNER JOIN user_role ur on a.id = ur.uid
  447. where ur.rid not in('1','2','3','4','5','6')
  448. group by a.id
  449. </select>
  450. <select id="selectRoleByPrimaryKey" parameterType="java.lang.String" resultType="String">
  451. SELECT rid FROM user_role
  452. where uid = #{uid,jdbcType=VARCHAR}
  453. </select>
  454. <select id="selectAccoutManager" 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 = '4'
  458. </select>
  459. <select id="selectTechnician" 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="selectSalesman" resultMap="BaseResultMap">
  466. select a.id, a.name, a.position from admin a
  467. INNER JOIN user_role ur on a.id = ur.uid
  468. where ur.rid in ('5', '6')
  469. </select>
  470. <select id="selectContractManager" resultMap="BaseResultMap">
  471. select a.id, a.name, a.position from admin a
  472. INNER JOIN user_role ur on a.id = ur.uid
  473. where ur.rid not in('1','2','3','4')
  474. group by a.id
  475. </select>
  476. <select id="selectTechBroder" resultMap="BaseResultMap">
  477. select
  478. u.rid as rolesId, a.name,a.id, a.position
  479. from user_role u
  480. left join admin a on a.id =u.uid
  481. left join role r on r.id =u.rid
  482. where
  483. r.role_name='技术经纪专员'
  484. </select>
  485. <select id="listAdminSelectBySuperAdmin" resultMap="BaseResultMap">
  486. select
  487. <include refid="Base_Column_List" />
  488. from admin
  489. where id <![CDATA[ <> ]]> '1'
  490. </select>
  491. <select id="listAdminSelectByAreaAdmin" resultMap="BaseResultMap">
  492. select
  493. a.id, a.name, a.mobile,
  494. a.create_time as createTime, a.number, aa.name as superior
  495. from admin a
  496. left join admin_location al on al.admin_id = a.id
  497. left join admin aa on aa.id = a.superior_id
  498. where 1 = 1
  499. <if test="provinceList != null and provinceList.size &gt; 0">
  500. and al.province in
  501. <foreach close=")" collection="provinceList" item="plist" open="(" separator=",">
  502. #{plist}
  503. </foreach>
  504. </if>
  505. <if test="cityList != null and cityList.size &gt; 0">
  506. and al.city in
  507. <foreach close=")" collection="cityList" item="clist" open="(" separator=",">
  508. #{clist}
  509. </foreach>
  510. </if>
  511. </select>
  512. <select id="findAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  513. select
  514. a.number, a.mobile, a.name,
  515. a.position, a.email, a.id,
  516. a.province,
  517. a.city,
  518. a.create_time as createTime,
  519. aa.name as superior,
  520. a.superior_id as superiorId,
  521. a.department_id as departmentId,
  522. date_format(a.last_login_time,'%Y-%m-%d %H:%i:%S') as lastLoginTime,
  523. dm.name as departmentName
  524. from admin a
  525. left join admin_location al on a.id = al.admin_id
  526. left join admin aa on aa.id = a.superior_id
  527. left join department dm on a.department_id = dm.id
  528. left join user_role x on x.uid=a.id
  529. left join `role` y on x.rid=y.id
  530. where a.id <![CDATA[ <> ]]> '1'
  531. <if test="roleName != null">
  532. where y.role_name= #{roleName,jdbcType=VARCHAR}
  533. </if>
  534. <if test="mobile != null">
  535. and a.mobile = #{mobile,jdbcType=VARCHAR}
  536. </if>
  537. <if test="name != null">
  538. and a.name = #{name,jdbcType=VARCHAR}
  539. </if>
  540. <if test="number != null">
  541. and a.number = #{number,jdbcType=INTEGER}
  542. </if>
  543. <if test="seniorStaff != null">
  544. and a.senior_staff = #{seniorStaff}
  545. </if>
  546. <if test="province != null">
  547. and a.province = #{province,jdbcType=VARCHAR}
  548. </if>
  549. order by a.last_login_time ,a.number
  550. <if test="page_sql!=null">
  551. ${page_sql}
  552. </if>
  553. </select>
  554. <select id="findAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  555. select count(1) from admin
  556. where id <![CDATA[ <> ]]> '1'
  557. left join `role` y on x.rid=y.id
  558. where a.id <![CDATA[ <> ]]> '1'
  559. <if test="roleName != null">
  560. where y.role_name= #{roleName,jdbcType=VARCHAR}
  561. </if>
  562. <if test="mobile != null">
  563. and mobile = #{mobile,jdbcType=VARCHAR}
  564. </if>
  565. <if test="name != null">
  566. and name = #{name,jdbcType=VARCHAR}
  567. </if>
  568. <if test="number != null">
  569. and number = #{number,jdbcType=INTEGER}
  570. </if>
  571. <if test="seniorStaff != null">
  572. and a.senior_staff = #{seniorStaff}
  573. </if>
  574. <if test="province != null">
  575. and a.province = #{province,jdbcType=VARCHAR}
  576. </if>
  577. </select>
  578. <select id="listAdminByName" parameterType="java.lang.String" resultMap="BaseResultMap">
  579. select id,name from admin where name like concat('%',#{name},'%')
  580. <if test="status==0">
  581. and status= '0'
  582. </if>
  583. <if test="status==1">
  584. and status= '1'
  585. </if>
  586. </select>
  587. <!--*************************************************************************-->
  588. <select id="selectAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  589. 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,
  590. a.superior_id as superiorId, a.department_id as departmentId, a.last_login_time as lastLoginTime, a.contact_mobile as contactMobile,
  591. 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
  592. from admin a
  593. left join admin_location al on a.id = al.admin_id
  594. left join admin aa on aa.id = a.superior_id
  595. left join amb_system ambs on a.amb_id=ambs.id
  596. left join department dep on a.department_id = dep.id
  597. <if test="rid != null">
  598. RIGHT join (select uid from user_role where rid=#{rid,jdbcType=VARCHAR}) ur on a.id=ur.uid
  599. </if>
  600. <if test="roleName != null">
  601. left join user_role ur on a.id=ur.uid
  602. RIGHT join (select id from role where role_name =#{roleName,jdbcType=VARCHAR}) y on ur.rid=y.id
  603. </if>
  604. where a.status in (0,1)
  605. <if test="name != null">
  606. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  607. </if>
  608. <if test="departmentId != null">
  609. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  610. </if>
  611. <if test="duty != null">
  612. and a.duty = #{duty,jdbcType=VARCHAR}
  613. </if>
  614. <if test="position != null">
  615. and a.position = #{position,jdbcType=VARCHAR}
  616. </if>
  617. <if test="status != null">
  618. and a.status = #{status,jdbcType=VARCHAR}
  619. </if>
  620. <if test="mobile != null">
  621. and a.mobile = #{mobile,jdbcType=VARCHAR}
  622. </if>
  623. <if test="superiorId != null">
  624. and a.superior_id = #{superiorId,jdbcType=VARCHAR}
  625. </if>
  626. <if test="ambId != null">
  627. and a.amb_id = #{ambId}
  628. </if>
  629. <if test="seniorStaff != null">
  630. and a.senior_staff = #{seniorStaff}
  631. </if>
  632. <if test="publicPurview != null">
  633. and a.public_purview = #{publicPurview}
  634. </if>
  635. <if test="ancestors != null">
  636. and (ambs.id=#{ancestors} or find_in_set( #{ancestors} ,ambs.ancestors))
  637. </if>
  638. <if test="ambManage !=null">
  639. and a.amb_manage= #{ambManage}
  640. </if>
  641. order by a.last_login_time desc
  642. <if test="page_sql!=null">
  643. ${page_sql}
  644. </if>
  645. </select>
  646. <select id="selectAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  647. select count(*)
  648. from admin a
  649. left join admin_location al on a.id = al.admin_id
  650. left join admin aa on aa.id = a.superior_id
  651. left join amb_system ambs on a.amb_id=ambs.id
  652. left join department dep on a.department_id = dep.id
  653. <if test="rid != null">
  654. RIGHT join (select * from user_role where rid=#{rid,jdbcType=VARCHAR}) ur on a.id=ur.uid
  655. </if>
  656. <if test="roleName != null">
  657. left join user_role ur on a.id=ur.uid
  658. RIGHT join (select * from role where role_name =#{roleName,jdbcType=VARCHAR}) y on ur.rid=y.id
  659. </if>
  660. where a.status in (0,1)
  661. <if test="name != null">
  662. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  663. </if>
  664. <if test="departmentId != null">
  665. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  666. </if>
  667. <if test="duty != null">
  668. and a.duty = #{duty,jdbcType=VARCHAR}
  669. </if>
  670. <if test="position != null">
  671. and a.position = #{position,jdbcType=VARCHAR}
  672. </if>
  673. <if test="status != null">
  674. and a.status = #{status,jdbcType=VARCHAR}
  675. </if>
  676. <if test="mobile != null">
  677. and a.mobile = #{mobile,jdbcType=VARCHAR}
  678. </if>
  679. <if test="superiorId != null">
  680. and a.superior_id = #{superiorId,jdbcType=VARCHAR}
  681. </if>
  682. <if test="ambId != null">
  683. and a.amb_id = #{ambId}
  684. </if>
  685. <if test="seniorStaff != null">
  686. and a.senior_staff = #{seniorStaff}
  687. </if>
  688. <if test="publicPurview != null">
  689. and a.public_purview = #{publicPurview}
  690. </if>
  691. <if test="ancestors != null">
  692. and (ambs.id=#{ancestors} or find_in_set( #{ancestors} ,ambs.ancestors))
  693. </if>
  694. <if test="ambManage !=null">
  695. and a.amb_manage= #{ambManage}
  696. </if>
  697. </select>
  698. <insert id="insertn" parameterType="com.goafanti.common.model.Admin">
  699. insert into admin (id, mobile, name,
  700. password, email, create_time,
  701. number, province, position, superior_id, city,department_id,status,user_no,duty,district,head_portrait_url,contact_mobile,type)
  702. values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  703. #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  704. #{number,jdbcType=INTEGER}, #{province,jdbcType=INTEGER}, #{position,jdbcType=VARCHAR},
  705. #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=INTEGER},#{departmentId,jdbcType=VARCHAR},
  706. #{status,jdbcType=VARCHAR},#{userNo,jdbcType=VARCHAR},#{duty,jdbcType=VARCHAR},#{district,jdbcType=VARCHAR},#{headPortraitUrl,jdbcType=VARCHAR},#{contactMobile,jdbcType=VARCHAR},
  707. #{type})
  708. </insert>
  709. <select id="selectUserNoBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
  710. select
  711. user_no as userNo
  712. from admin
  713. where
  714. id=#{superiorId,jdbcType=VARCHAR}
  715. </select>
  716. <select id="selectCountBySuperiorId" parameterType="java.lang.String" resultType="java.lang.Integer">
  717. select
  718. count(1)
  719. from admin
  720. where
  721. superior_id=#{superiorId,jdbcType=VARCHAR}
  722. </select>
  723. <select id="selectIdByUserNo" parameterType="java.lang.String" resultType="java.lang.String">
  724. select
  725. id
  726. from admin
  727. where
  728. user_no=#{UserNo,jdbcType=VARCHAR}
  729. </select>
  730. <select id="selectAllByid" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  731. select a.id, a.mobile, a.name, a.`password`, a.email, a.create_time as createTime,
  732. a.province, a.`position`,a.reviewer , a.superior_id as superiorId,a.public_purview publicPurview,
  733. a.department_id as departmentId, a.status,a.user_no as userNo,a.duty,a.district,a.expense_super_examine expenseSuperExamine,
  734. a.head_portrait_url as headPortraitUrl, a.contact_mobile as contactMobile,a.senior_staff seniorStaff,
  735. b.name superior,c.name reviewerName,a.type,a.amb_id ambId,a.manager_id managerId ,d.name managerName
  736. from admin a left join admin b on a.superior_id =b.id left join admin c on a.reviewer =c.id
  737. left join admin d on a.manager_id=d.id
  738. where a.id= #{id,jdbcType=VARCHAR}
  739. </select>
  740. <select id="selectNameByid" parameterType="java.lang.String" resultType="java.lang.String">
  741. select
  742. name
  743. from admin
  744. where
  745. id=#{id,jdbcType=VARCHAR}
  746. </select>
  747. <select id="selectRolesByUid" parameterType="com.goafanti.common.model.Role" resultType="com.goafanti.common.model.Role">
  748. select
  749. r.id,r.role_name as roleName
  750. from user_role ur
  751. left join role r on r.id = ur.rid
  752. where
  753. uid=#{id,jdbcType=VARCHAR}
  754. </select>
  755. <select id="selectStatusByMobile" parameterType="java.lang.String" resultType="java.lang.String">
  756. select
  757. status
  758. from admin
  759. where
  760. mobile= #{mobile,jdbcType=VARCHAR}
  761. </select>
  762. <delete id="deleteById" parameterType="java.lang.String">
  763. delete from admin
  764. where id = #{id,jdbcType=VARCHAR}
  765. </delete>
  766. <select id="selectIDNBySuperiorId" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  767. select id, mobile, name,
  768. password, email, create_time as createTime,
  769. province, position,
  770. superior_id as superiorId,department_id as departmentId,
  771. status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl
  772. from admin
  773. where
  774. superior_id=#{superiorId,jdbcType=VARCHAR}
  775. </select>
  776. <select id="selectUserNoById" resultType="java.lang.String">
  777. select user_no as userNo
  778. from admin
  779. where
  780. id=#{superiorId,jdbcType=VARCHAR}
  781. </select>
  782. <update id="updateByUserNo" parameterType="com.goafanti.common.model.Admin">
  783. update admin
  784. set user_no = #{userNo,jdbcType=VARCHAR}
  785. where
  786. id=#{id,jdbcType=VARCHAR}
  787. </update>
  788. <select id="selectIdBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
  789. select id
  790. from admin
  791. where
  792. superior_id=#{superiorId,jdbcType=VARCHAR}
  793. </select>
  794. <select id="selectSubList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  795. select
  796. a.id,
  797. a.user_no as userNo,
  798. a.mobile,
  799. a.name,
  800. a.position,
  801. b.name as departmentName
  802. from
  803. admin a left join department b on
  804. a.department_id = b.id
  805. where
  806. a.department_id =(
  807. select
  808. department_id
  809. from
  810. admin
  811. where
  812. id = #{adminId,jdbcType=VARCHAR}
  813. )
  814. and a.id <![CDATA[ <> ]]> #{adminId,jdbcType=VARCHAR}
  815. </select>
  816. <select id="selectAdminByRoleId" parameterType="java.lang.String" resultMap="BaseResultMap">
  817. 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
  818. </select>
  819. <select id="selectDepartmentStaff" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  820. select a.id ,a.name,a.password,a.department_id,b.name
  821. from admin a left join department b
  822. on a.department_id= b.id
  823. where 1=1
  824. <if test="departmentId != null and departmentId !='' ">
  825. and a.department_id = #{departmentId,jdbcType=VARCHAR}
  826. </if>
  827. <if test="name != null">
  828. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  829. </if>
  830. </select>
  831. <select id="selectAdminName" parameterType="java.lang.String" resultMap="BaseResultMap">
  832. select a.id, a.name from admin a left join user_role b on a.id=b.uid
  833. left join `role` c on b.rid=c.id
  834. where c.role_name = #{name,jdbcType=VARCHAR}
  835. </select>
  836. <update id="updateLockIds" parameterType="java.lang.String">
  837. update admin set status = '1' where id in (${lockIds})
  838. </update>
  839. <!-- 用户是为正常的 -->
  840. <select id="getCountById" parameterType="java.lang.String" resultType="java.lang.Integer">
  841. select count(a.id) from admin a
  842. inner join user_role ur on a.id=ur.uid
  843. where a.id= #{_parameter,jdbcType=VARCHAR} and ( a.status != '注销' or a.status is null)
  844. </select>
  845. <select id="getAdminRoleNameList" parameterType="java.lang.String" resultMap="BaseResultMap">
  846. select a.id, a.name from admin a left join user_role b on a.id=b.uid
  847. left join `role` c on b.rid=c.id
  848. where c.role_name = #{name,jdbcType=VARCHAR} and a.status= 0
  849. </select>
  850. <select id="getAdminRoleNamesList" parameterType="java.lang.String" resultMap="BaseResultMap">
  851. select a.id, a.name from admin a left join user_role b on a.id=b.uid
  852. left join `role` c on b.rid=c.id
  853. where a.status= 0
  854. and c.role_name in
  855. <foreach close=")" collection="list" item="name" open="(" separator=",">
  856. #{name}
  857. </foreach>
  858. </select>
  859. <select id="getAdminRoleTypeList" parameterType="java.lang.String" resultMap="BaseResultMap">
  860. select a.id, a.name from admin a left join user_role b on a.id=b.uid
  861. left join `role` c on b.rid=c.id
  862. where c.role_type = #{roleType} and a.status= 0
  863. </select>
  864. <select id="getAdminRoleTypesList" parameterType="java.lang.String" resultMap="BaseResultMap">
  865. select a.id, a.name from admin a left join user_role b on a.id=b.uid
  866. left join `role` c on b.rid=c.id
  867. where a.status= 0
  868. and c.role_type in
  869. <foreach close=")" collection="list" item="type" open="(" separator=",">
  870. #{type}
  871. </foreach>
  872. </select>
  873. <select id="getDeptNameByAid" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  874. select a.id,a.name, d.name as departmentName,a.department_id departmentId,a.email,a.superior_id superiorId,a.open_id openId,
  875. a.reviewer,d.manager_id depManager,d.finance_id depFinance,a.public_purview publicPurview,a.expense_super_examine expenseSuperExamine
  876. from admin a left join department d on a.department_id = d.id
  877. where a.id = #{_parameter,jdbcType=VARCHAR}
  878. </select>
  879. <insert id="addAdminContacts" parameterType="com.goafanti.admin.bo.AdminContacts">
  880. insert into admin_contacts (id,aid,contacts_id)values
  881. (#{id,jdbcType=VARCHAR},#{aid,jdbcType=VARCHAR},#{contactsId,jdbcType=VARCHAR})
  882. </insert>
  883. <select id="frequentContactsList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
  884. 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
  885. from admin_contacts a left join admin b
  886. on a.contacts_id=b.id left join department c
  887. on c.id=b.department_id left join user_role x on x.uid=b.id
  888. left join `role` y on x.rid=y.id
  889. where b.status ='0'
  890. <if test="roleName != null">
  891. and y.role_name= #{roleName,jdbcType=VARCHAR}
  892. </if>
  893. <if test="aid != null">
  894. and a.aid= #{aid,jdbcType=VARCHAR}
  895. </if>
  896. <if test="name != null">
  897. and b.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  898. </if>
  899. <if test="deps != null">
  900. and b.department_id in
  901. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  902. #{depId}
  903. </foreach>
  904. </if>
  905. <if test="page_sql!=null">
  906. ${page_sql}
  907. </if>
  908. </select>
  909. <select id="frequentContactsCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  910. select count(*)
  911. from admin_contacts a left join admin b
  912. on a.contacts_id=b.id
  913. left join user_role x on x.uid=b.id
  914. left join `role` y on x.rid=y.id
  915. where b.status ='0'
  916. <if test="roleName != null">
  917. and y.role_name= #{roleName,jdbcType=VARCHAR}
  918. </if>
  919. <if test="aid != null">
  920. and a.aid= #{aid,jdbcType=VARCHAR}
  921. </if>
  922. <if test="name != null">
  923. and b.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  924. </if>
  925. <if test="deps != null">
  926. and b.department_id in
  927. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  928. #{depId}
  929. </foreach>
  930. </if>
  931. </select>
  932. <delete id="deleteFrequentContacts" parameterType="java.lang.String">
  933. delete from admin_contacts
  934. where id = #{id,jdbcType=VARCHAR}
  935. </delete>
  936. <select id="getaidFrequentContacts" resultType="java.lang.String">
  937. select b.id from admin_contacts a left join admin b on a.contacts_id = b.id
  938. where b.status = '0' and a.aid= #{id,jdbcType=VARCHAR}
  939. </select>
  940. <select id="selectAdminCustomerList" resultType="com.goafanti.admin.bo.AdminCustomerBo">
  941. 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,
  942. ifnull(d.timeCount,0) as receiveCount,ifnull(g.timeCount,0) as signCount from admin a
  943. left join (select aid,count(aid) as userCount from user where aid is not null
  944. and share_type=0 and source in(1,2,3) and type=1 and new_channel=0
  945. group by aid) b on a.id=b.aid
  946. left join (select aid,count(aid) as timeCount from `user` where aid is not null
  947. and share_type in (0,2) and source =1 and type=1 and new_channel=0
  948. <if test="startTime != null and endTime != null">
  949. and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  950. </if>
  951. group by aid) c on a.id=c.aid
  952. left join (select aid,count(aid) as timeCount from `user` where aid is not null
  953. and share_type in (0,2) and source =2 and type=1 and new_channel=0
  954. <if test="startTime != null and endTime != null">
  955. and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  956. </if>
  957. group by aid) d on a.id=d.aid
  958. left join (select aid,count(aid) as timeCount from `user` where aid is not null
  959. and share_type =2 and type=1 and new_channel=0
  960. <if test="startTime != null and endTime != null">
  961. and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  962. </if>
  963. group by aid) g on a.id=g.aid
  964. left join department d on a.department_id=d.id
  965. left join user_role e on a.id=e.uid
  966. left join `role` f on e.rid=f.id
  967. where f.role_name in ('营销员','营销经理')
  968. and a.status= 0
  969. <if test="depId != null">
  970. and a.department_id = #{depId,jdbcType=VARCHAR}
  971. </if>
  972. <if test="page_sql!=null">
  973. ${page_sql}
  974. </if>
  975. </select>
  976. <select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  977. select count(*) from admin a
  978. left join department d on a.department_id=d.id
  979. left join user_role e on a.id=e.uid
  980. left join `role` f on e.rid=f.id
  981. where f.role_name in ('营销员','营销经理')
  982. and a.status= 0
  983. <if test="depId != null">
  984. and a.department_id = #{depId,jdbcType=VARCHAR}
  985. </if>
  986. </select>
  987. <select id="selectAdminCustomerDetailList" resultType="com.goafanti.admin.bo.AdminCustomerDetailBo">
  988. select a.id,a.nickname as name,a.source,c.contacts contacts,c.contact_mobile as contactMobile,c.contacts_dep contactsDep,
  989. c.contacts_position contactsPosition, a.create_time as createTime,b.last_follow_time as followTime,c.location_province locationProvince,
  990. c.location_city locationCity,c.location_area locationArea,c.business_scope businessScope , c.intended_project intendedProject
  991. from user a left join (select uid,last_follow_time from user_mid where aid= #{aid}) b on a.id=b.uid
  992. left join organization_identity c on a.id=c.uid
  993. <if test="type==5 or type==6">
  994. left join (select aid,uid from public_release a left join public_release_details b on a.id=b.prid
  995. where b.clock_in =1
  996. and aid= #{aid,jdbcType=VARCHAR}
  997. <if test="startTime != null and endTime != null">
  998. and clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  999. </if>
  1000. )e on a.id=e.uid
  1001. </if>
  1002. where a.type=1 and a.new_channel=0
  1003. <if test="type != 5 and type !=6">
  1004. and a.aid= #{aid,jdbcType=VARCHAR}
  1005. </if>
  1006. <if test="type == 5 or type ==6">
  1007. and e.aid= #{aid,jdbcType=VARCHAR}
  1008. </if>
  1009. <if test="type == 0">
  1010. and a.share_type = 0
  1011. </if>
  1012. <if test="type == 1">
  1013. and a.share_type = 3
  1014. </if>
  1015. <if test="type ==0 or type==3 or type==5 or type==7">
  1016. and a.channel=0
  1017. </if>
  1018. <if test="type == 1 or type==4 or type==6">
  1019. and a.channel=1
  1020. </if>
  1021. <if test="type == 2">
  1022. and a.share_type=2
  1023. </if>
  1024. <if test="type == 3 or type==4">
  1025. and a.source=1
  1026. and a.share_type = 0
  1027. </if>
  1028. <if test="type==7 ">
  1029. and a.share_type = 0
  1030. and a.source=2
  1031. </if>
  1032. <if test="type!=5 and type!=6">
  1033. <if test="startTime != null and endTime != null">
  1034. and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1035. </if>
  1036. </if>
  1037. <if test="page_sql!=null">
  1038. ${page_sql}
  1039. </if>
  1040. </select>
  1041. <select id="selectAdminCustomerDetailCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  1042. select count(*)
  1043. from user a
  1044. <if test="type==5 or type==6">
  1045. left join (select aid,uid from public_release a left join public_release_details b on a.id=b.prid
  1046. where b.clock_in =1
  1047. and aid= #{aid,jdbcType=VARCHAR}
  1048. <if test="startTime != null and endTime != null">
  1049. and clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1050. </if>
  1051. )e on a.id=e.uid
  1052. </if>
  1053. where a.type=1 and a.new_channel=0
  1054. <if test="type != 5 and type !=6">
  1055. and a.aid= #{aid,jdbcType=VARCHAR}
  1056. </if>
  1057. <if test="type == 5 or type ==6">
  1058. and e.aid= #{aid,jdbcType=VARCHAR}
  1059. </if>
  1060. <if test="type == 0">
  1061. and a.share_type = 0
  1062. </if>
  1063. <if test="type == 1">
  1064. and a.share_type = 3
  1065. </if>
  1066. <if test="type ==0 or type==3 or type==5 or type==7">
  1067. and a.channel=0
  1068. </if>
  1069. <if test="type == 1 or type==4 or type==6">
  1070. and a.channel=1
  1071. </if>
  1072. <if test="type == 2">
  1073. and a.share_type=2
  1074. </if>
  1075. <if test="type == 3 or type==4">
  1076. and a.source=1
  1077. and a.share_type = 0
  1078. </if>
  1079. <if test="type==7 ">
  1080. and a.share_type = 0
  1081. and a.source=2
  1082. </if>
  1083. <if test="type!=5 and type!=6">
  1084. <if test="startTime != null and endTime != null">
  1085. and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1086. </if>
  1087. </if>
  1088. </select>
  1089. <select id="listNameByDepAndName" resultType="java.lang.String">
  1090. select a.id from admin a left join user_role b on a.id =b.uid
  1091. left join `role` c on b.rid=c.id
  1092. where department_id= #{depId}
  1093. and c.role_type= #{roleType}
  1094. </select>
  1095. <select id="listAdminBydepIdAndRoleType" resultType="com.goafanti.common.model.Admin">
  1096. select a.id,a.name,a.email ,a.open_id openId,a.expense_open_id expenseOpenId
  1097. from admin a left join user_role b on a.id =b.uid left join `role` c on b.rid=c.id
  1098. where a.status='0'
  1099. and a.department_id= #{depId}
  1100. and c.role_type= #{roleType}
  1101. </select>
  1102. <select id="selectBySuperId" resultType="java.lang.String">
  1103. select id from admin where superior_id= #{aid}
  1104. </select>
  1105. <select id="selectMyAndSuperBySuperId" parameterType="java.lang.String" resultType="com.goafanti.common.bo.AdminNoticeBo">
  1106. select
  1107. a.id,a.name,a.email,a.open_id openId,a.expense_open_id expenseOpenId,
  1108. b.id superId,b.name superName,b.email superEmail,b.open_id superOpenId,b.expense_open_id superExpenseOpenId
  1109. from admin a left join admin b on a.superior_id=b.id
  1110. where a.id=#{id}
  1111. </select>
  1112. <select id="selectFinanceAdminByOrderDep" resultType="com.goafanti.common.model.Admin">
  1113. select a.finance_id id,b.name from department a left join admin b on a.finance_id=b.id
  1114. where a.id= #{orderDep}
  1115. </select>
  1116. <select id="getPermission" resultType="java.lang.String">
  1117. 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
  1118. where a.id= #{transferId}
  1119. </select>
  1120. <select id="selectDepIdWithSpuerId" resultType="java.lang.String">
  1121. select b.id from admin a right join department b on a.id=b.finance_id
  1122. where a.superior_id= #{superId}
  1123. </select>
  1124. <select id="getAdminRoleListByAid" resultType="java.lang.String">
  1125. select c.role_type from admin a left join user_role b on a.id=b.uid
  1126. left join role c on b.rid =c.id
  1127. where a.id= #{id}
  1128. </select>
  1129. <select id="selectByOpeid" parameterType="java.lang.String" resultMap="BaseResultMap">
  1130. select
  1131. <include refid="Base_Column_List" />
  1132. from admin
  1133. where open_id= #{openid}
  1134. </select>
  1135. <select id="getFinanceDep" resultType="java.lang.String">
  1136. select id from department where finance_id = #{aid}
  1137. </select>
  1138. <select id="getLowerFinanceDep" resultType="java.lang.String">
  1139. select b.id from admin a left join department b on a.id=b.finance_id
  1140. where a.superior_id = #{aid}
  1141. </select>
  1142. <select id="selectByAmbIdCount" resultType="java.lang.Integer">
  1143. SELECT count(*) from admin where amb_id= #{ambId}
  1144. </select>
  1145. <select id="selectAdminByRoleType" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
  1146. SELECT a.id,a.name ,a.mobile ,a.email,a.department_id departmentId,a.open_id openId,a.expense_open_id expenseOpenId
  1147. FROM admin a left join user_role b on a.id=b.uid
  1148. left join `role` c on b.rid =c.id
  1149. where a.status='0'
  1150. <if test="roleType =='99998'">
  1151. and c.role_type in ('99998','99988')
  1152. </if>
  1153. <if test="roleType =='99999'">
  1154. and c.role_type in ('99999','99989')
  1155. </if>
  1156. <if test="roleType =='99999888'">
  1157. and c.role_type in ('99998','99988','99999','99989')
  1158. </if>
  1159. <if test="roleType !='99999' and roleType !='99998' and roleType !='99999888'">
  1160. and c.role_type in (#{roleType})
  1161. </if>
  1162. </select>
  1163. <select id="selectByDeps" resultType="com.goafanti.admin.bo.AdminCustomerBo">
  1164. SELECT a.id aid,a.name aName,a.department_id depId,d.name depName
  1165. from admin a left join department d on a.department_id = d.id
  1166. where a.status =0 and a.`type` =1
  1167. <if test="seniorStaff != null">
  1168. and a.senior_staff=#{seniorStaff}
  1169. </if>
  1170. <if test="depIds!= null">
  1171. and a.department_id in
  1172. <foreach close=")" collection="depIds" item="deps" open="(" separator=",">
  1173. #{deps.id}
  1174. </foreach>
  1175. </if>
  1176. </select>
  1177. <select id="getAdminByFinanceId" resultType="com.goafanti.common.model.Admin">
  1178. select b.id ,b.name
  1179. from department a left join admin b on a.finance_id=b.id
  1180. where a.id= #{id}
  1181. </select>
  1182. <select id="selectRoleTypeByid" resultType="java.lang.Integer">
  1183. select b.role_type
  1184. from user_role a left join `role` b on a.rid =b.id
  1185. where a.uid = #{aid}
  1186. </select>
  1187. <select id="selectFinanceAdminByAid" resultType="com.goafanti.common.model.Admin">
  1188. select c.id,c.name,c.open_id openId,c.email
  1189. from admin a left join department b on a.department_id=b.id
  1190. left join admin c on b.finance_id=c.id
  1191. where a.id= #{aid}
  1192. </select>
  1193. <select id="adminStatisticsInfo" resultType="com.goafanti.admin.bo.AdminStatisticsBo">
  1194. select *
  1195. from (select aid ,sum(private_count)privateSum ,sum(channel_count)channelSum ,sum(sign_count)signSum ,
  1196. sum(public_release_count)publicReleaseSum ,sum(follow_count) followSum,sum(order_count) orderSum
  1197. from admin_user_count a where aid=#{aid} group by aid)x
  1198. left join(select a.salesman_id aid , sum(if( b.project_status =29,1,0))projectStopSum ,
  1199. sum(if(b.check_status=1,1,0))projectCheckSum from t_order_new a left join t_order_task b
  1200. on a.order_no =b.order_no where a.salesman_id = #{aid})y on x.aid=y.aid
  1201. left join ( select salesman_id aid, sum(1)orderSum, sum(if(delete_sign=2,1,0))changeSum
  1202. from t_order_new where delete_sign in (0,2,3) and process_status >0
  1203. and salesman_id = #{aid})g on x.aid=g.aid
  1204. left join ( select salesman_id aid, sum(if(order_status=3 or order_status=5,1,0))rejectSum
  1205. from t_order_new where delete_sign in (0,2,3)
  1206. and salesman_id = #{aid})z on x.aid=z.aid
  1207. left join ( SELECT b.salesman_id aid ,sum(a.money) receivables
  1208. from new_order_dun a left join t_order_new b on a.order_no =b.order_no
  1209. where a.status =1 and b.delete_sign in (0,2,3)
  1210. and b.salesman_id = #{aid})t on x.aid=t.aid
  1211. </select>
  1212. <select id="adminStatisticsInfoByTime" resultType="com.goafanti.admin.bo.AdminStatisticsBo">
  1213. select sum(private_count)rangePrivateSum ,sum(channel_count)rangeChannelSum ,sum(sign_count)rangeSignSum ,
  1214. sum(follow_count) rangeFollowSum,sum(order_count) rangeOrdersum
  1215. from admin_user_count a where aid=#{aid} and date_time BETWEEN #{startTime} and #{endTime}
  1216. group by aid
  1217. </select>
  1218. <select id="thisMonthUser" resultType="com.goafanti.common.model.AdminUserCount">
  1219. select id,aid,private_count privateCount,sign_count signCount,channel_count channelCount,public_release_count publicReleaseCount,
  1220. follow_count followCount,order_count orderCount, DATE_FORMAT(date_time , '%Y-%m-%d') dateTime
  1221. from admin_user_count
  1222. where date_time BETWEEN #{firstDay} and #{endDay}
  1223. and aid= #{aid}
  1224. order by date_time
  1225. </select>
  1226. <select id="selectAdminPublicRelease" resultType="com.goafanti.common.model.AdminUserCount">
  1227. select aid,count(*)publicReleaseCount, dates dateTime
  1228. from (select aid,DATE_FORMAT(a.release_start , '%Y-%m-%d') dates
  1229. from public_release a left join public_release_details b on a.id=b.prid
  1230. where status =2 and aid= #{aid})x
  1231. group by aid,dates
  1232. </select>
  1233. <select id="selectAdminUserFollow" resultType="com.goafanti.common.model.AdminUserCount">
  1234. select aid ,count(*)followCount, dateTime
  1235. from (select aid,DATE_FORMAT(create_time , '%Y-%m-%d') dateTime
  1236. from user_follow where aid= #{aid} )a
  1237. group by aid,dateTime
  1238. </select>
  1239. <select id="selectAdminOrder" resultType="com.goafanti.common.model.AdminUserCount">
  1240. select salesman_id aid ,count(*)orderCount, dateTime
  1241. from (select salesman_id, DATE_FORMAT(create_time , '%Y-%m-%d') dateTime
  1242. from t_order_new
  1243. where delete_sign in (0,2,3) and process_status >0
  1244. and salesman_id= #{aid} )x
  1245. group by salesman_id ,dateTime
  1246. </select>
  1247. <select id="adminStatisticsPublicReleaseByAidAndTime" resultType="java.lang.Integer">
  1248. select sum(1) rangePublicReleaseSum
  1249. from public_release a left join public_release_details b on a.id=b.prid
  1250. where status =2 and a.aid = #{aid}
  1251. and((a.release_start &gt; #{startTime} and a.release_start &lt; #{endTime})or
  1252. (a.release_end &gt; #{startTime} and a.release_end &lt; #{endTime})or
  1253. (a.release_start &lt; #{startTime} and a.release_end &gt; #{endTime}))
  1254. </select>
  1255. <select id="addAdminContactsRangeReceivables" resultType="java.math.BigDecimal">
  1256. SELECT ifnull(sum(a.money),0) receivables
  1257. from new_order_dun a left join t_order_new b on a.order_no =b.order_no
  1258. where a.status =1 and b.delete_sign in (0,2,3)
  1259. and b.salesman_id = #{aid}
  1260. and a.start_time between #{startTime} and #{endTime}
  1261. </select>
  1262. <select id="consultantStatisticsInfo" resultType="com.goafanti.admin.bo.ConsultantStatisticsBo">
  1263. SELECT x.aid,x.projectCount,x.inProgress,x.complete,x.notStarted,x.stop,y.countPublicRelease,y.countAssist,z.countChange,v.orderPayment
  1264. from (select a.task_receiver aid,sum(commodity_quantity) projectCount, sum(if(a.project_status=1,commodity_quantity,0)) inProgress,
  1265. sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete, sum(if(a.project_status=0,commodity_quantity,0)) notStarted,
  1266. sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop
  1267. from t_order_task a left join t_order_new b on a.order_no =b.order_no
  1268. where b.delete_sign in (0,2,3) and a.split_status in (0,2) and a.task_receiver = #{aid} group by a.task_receiver)x
  1269. left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
  1270. from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid})y on x.aid=y.aid
  1271. left join (SELECT b.aid,count(DISTINCT a.order_no) countChange from new_order_change a
  1272. left join order_examine b on a.order_no =b.order_no where 1=1
  1273. <if test="type==2">
  1274. and a.process_state in (3,4)
  1275. </if>
  1276. <if test="type==0">
  1277. and a.process_state in (3)
  1278. </if>
  1279. <if test="type==1">
  1280. and a.process_state in (4)
  1281. </if>
  1282. and b.aid=#{aid} and b.status =0 group by b.aid)z on x.aid=z.aid
  1283. LEFT join (select b.task_receiver aid, count(*) orderPayment from t_order_payment a
  1284. left join t_order_task b on a.tid=b.id left join t_order_new c on b.order_no=c.order_no
  1285. where b.task_receiver= #{aid} and a.status in(0,1,2) group by b.task_receiver )v on x.aid=v.aid
  1286. </select>
  1287. <select id="consultantStatisticsInfoByTime" resultType="com.goafanti.admin.bo.ConsultantStatisticsBo">
  1288. select a.id,x.projectCount,x.inProgress,x.notStarted,y.complete,y.stop,z.countPublicRelease,z.countAssist
  1289. from admin a left join (select a.task_receiver aid,sum(commodity_quantity) projectCount,
  1290. sum(if(a.project_status=1,commodity_quantity,0)) inProgress,
  1291. sum(if(a.project_status=0,commodity_quantity,0)) notStarted from t_order_task a where a.split_status in (0,2)
  1292. and a.task_receiver = #{aid} and a.task_distribution_time BETWEEN #{startTime} and #{endTime} group by a.task_receiver )x on a.id=x.aid
  1293. left join (SELECT a.task_receiver aid,sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete,
  1294. sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop from t_order_task a left join task_time b on a.id=b.tid
  1295. where a.split_status in (0,2) and b.project_status =a.project_status and a.task_receiver = #{aid}
  1296. and b.date_time BETWEEN #{startTime} and #{endTime} group by a.task_receiver )y on a.id=y.aid
  1297. left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
  1298. from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid} and a.status =2
  1299. and a.release_start BETWEEN #{startTime} and #{endTime} group by a.aid)z on a.id=z.aid
  1300. where a.id=#{aid}
  1301. </select>
  1302. <select id="consultantthisMonthUser" resultType="com.goafanti.admin.bo.ConsultantUserCount">
  1303. select x.dates,sum(projectCount)projectCount,sum(inProgress)inProgress,sum(notStarted)notStarted
  1304. ,0 complete,0 stop,0 countPublicRelease,0 countAssist
  1305. from (select commodity_quantity projectCount, if(a.project_status=1,commodity_quantity,0)inProgress,
  1306. if(a.project_status=0,commodity_quantity,0)notStarted,DATE_FORMAT(a.task_distribution_time,'%Y-%m-%d') dates
  1307. from t_order_task a where a.split_status in (0,2) and a.task_receiver = #{aid}
  1308. and a.task_distribution_time BETWEEN #{firstDay} and #{endDay})x
  1309. group by x.dates
  1310. union
  1311. select x.dates,0 projectCount,0 inProgress,0 notStarted,sum(complete)complete,sum(stop)stop,0,0
  1312. from (SELECT if(a.project_status in (19,27) ,commodity_quantity,0) complete,
  1313. if(a.project_status in (2,3,29),commodity_quantity,0) stop ,DATE_FORMAT(b.date_time ,'%Y-%m-%d') dates
  1314. from t_order_task a left join task_time b on a.id=b.tid
  1315. where a.split_status in (0,2) and b.project_status =a.project_status
  1316. and a.task_receiver = #{aid} and b.date_time BETWEEN #{firstDay} and #{endDay})x
  1317. group by x.dates
  1318. union
  1319. select x.dates,0,0,0,0,0,sum(countPublicRelease)countPublicRelease,sum(countAssist)countAssist
  1320. from ( select if(a.`type` in (0,1,2),1,0) countPublicRelease,if(a.`type` in (3),1,0) countAssist,
  1321. DATE_FORMAT(a.release_start ,'%Y-%m-%d') dates
  1322. from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid}
  1323. and a.status =2
  1324. and a.release_start BETWEEN #{firstDay} and #{endDay})x
  1325. group by x.dates
  1326. </select>
  1327. <select id="selectOrderByFinanace" resultType="com.goafanti.common.model.Admin">
  1328. select c.id,c.name
  1329. from t_order_new a left join department b on a.order_dep=b.id
  1330. left join admin c on b.finance_id=c.id
  1331. where a.order_no =#{orderNo};
  1332. </select>
  1333. <select id="selectAdminByRoleTypes" resultType="com.goafanti.common.model.Admin">
  1334. SELECT a.id,a.name ,a.mobile ,a.email,a.department_id departmentId,a.open_id openId,a.expense_open_id expenseOpenId
  1335. FROM admin a left join user_role b on a.id=b.uid
  1336. left join `role` c on b.rid =c.id
  1337. where a.status='0'
  1338. and c.role_type in
  1339. <foreach collection="list" item="e" open="(" close=")" separator=",">
  1340. #{e}
  1341. </foreach>
  1342. </select>
  1343. <select id="financeInfo" resultType="com.goafanti.admin.bo.OutFinanceCount">
  1344. select x.aid,x.orderCount,x.expenseCount,x.invoiceCount,x.memberCount,x.paymentCount,b.counts publicCount,y.orderUnauditedCount,
  1345. c.counts receivables,y.expenseUnauditedCount,y.invoiceUnauditedCount,y.memberUnauditedCount,y.paymentUnauditedCount
  1346. from ( select a.aid,sum(a.order_count)orderCount ,sum(a.expense_count)expenseCount ,SUM(a.invoice_count) invoiceCount,
  1347. sum(a.member_count) memberCount ,sum(a.payment_count)paymentCount from finance_count a where a.aid= #{aid} )x
  1348. left join(select aid,sum(if(a.`type` in (0,1,2),1,0)) counts from public_release a left join public_release_details b on a.id=b.prid
  1349. where a.status=2 and a.aid= #{aid} )b on x.aid=b.aid
  1350. left join (SELECT c.finance_id aid,sum(a.money) counts from new_order_dun a left join t_order_new b on a.order_no =b.order_no
  1351. left join department c on b.order_dep =c.id where a.status =1 and b.delete_sign in (0,2,3) and c.finance_id = #{aid} )c on x.aid=c.aid
  1352. left join (select a.aid,sum(a.order_unaudited_count)orderUnauditedCount , sum(a.expense_unaudited_count)expenseUnauditedCount ,
  1353. SUM(a.invoice_unaudited_count) invoiceUnauditedCount, sum(a.member_unaudited_count) memberUnauditedCount ,
  1354. sum(a.payment_unaudited_count)paymentUnauditedCount from finance_count a where a.aid= #{aid}
  1355. and a.date_time BETWEEN #{startTime} and #{endTime} group by a.aid)y on x.aid=y.aid
  1356. </select>
  1357. <select id="financeCountRangeReceivables" resultType="java.math.BigDecimal">
  1358. SELECT ifnull(sum(a.money),0) receivables
  1359. from new_order_dun a left join t_order_new b on a.order_no =b.order_no
  1360. left join department c on b.order_dep =c.id
  1361. where a.status =1 and b.delete_sign in (0,2,3)
  1362. and c.finance_id = #{aid}
  1363. and a.start_time between #{startTime} and #{endTime}
  1364. </select>
  1365. <select id="selectFinanceChangeCount" resultType="com.goafanti.admin.bo.OutFinanceCount">
  1366. select c.finance_id aid,sum(if(a.process_state=6,1,0))changeCount,
  1367. sum(if(a.process_state>6 and a.status=2,1,0)) changeInvoiceCount
  1368. from new_order_change a left join t_order_new b on a.order_no =b.order_no
  1369. left join department c on b.order_dep =c.id
  1370. where a.process_state in (6,8,9) and a.status in(1,2) and b.delete_sign in (0,2,3)
  1371. and c.finance_id = #{aid}
  1372. </select>
  1373. <select id="selectFinanceReceivablesCount" resultType="java.math.BigDecimal">
  1374. SELECT sum(a.money) receivables
  1375. from new_order_dun a left join t_order_new b on a.order_no =b.order_no
  1376. left join department c on b.order_dep =c.id
  1377. where a.status =1 and b.delete_sign in (0,2,3)
  1378. and c.finance_id = #{aid}
  1379. and a.start_time between #{startTime} and #{endTime}
  1380. </select>
  1381. <select id="selectExpenseFinanceByAid" resultType="com.goafanti.common.model.Admin">
  1382. select c.id,c.name,c.open_id openId,c.email
  1383. from admin a left join department b on a.department_id=b.id
  1384. left join admin c on b.finance_id=c.id
  1385. where a.id= #{aid}
  1386. </select>
  1387. </mapper>