AdminMapper.xml 44 KB

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