BisInspAllRlationPersDao.xml 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  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="cn.com.goldenwater.dcproj.dao.BisInspAllRlationPersDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspAllRlationPers" id="bisInspAllRlationPersResultMap">
  5. <result property="callnumber" column="CALLNUMBER"/>
  6. <result property="dpnm" column="DPNM"/>
  7. <result property="dppost" column="DPPOST"/>
  8. <result property="idnm" column="IDNM"/>
  9. <result property="plst" column="PLST"/>
  10. <result property="school" column="SCHOOL"/>
  11. <result property="specialty" column="SPECIALTY"/>
  12. <result property="imgurl" column="IMGURL"/>
  13. <result property="guid" column="GUID"/>
  14. <result property="persName" column="PERS_NAME"/>
  15. <result property="pwd" column="PWD"/>
  16. <result property="sex" column="SEX"/>
  17. <result property="telnumb" column="TELNUMB"/>
  18. <result property="faxnumb" column="FAXNUMB"/>
  19. <result property="mobilenumb" column="MOBILENUMB"/>
  20. <result property="email" column="EMAIL"/>
  21. <result property="bornDate" column="BORN_DATE"/>
  22. <result property="orgId" column="ORG_ID"/>
  23. <result property="orgNm" column="ORG_NM"/>
  24. <result property="admDuty" column="ADM_DUTY"/>
  25. <result property="collTime" column="COLL_TIME"/>
  26. <result property="remark" column="REMARK"/>
  27. <result property="persType" column="PERS_TYPE"/>
  28. <result property="permission" column="PERMISSION"/>
  29. <result property="ownerSystem" column="OWNER_SYSTEM"/>
  30. <result property="province" column="PROVINCE"/>
  31. <result property="departId" column="DEPART_ID"/>
  32. <result property="departNm" column="DEPART_NM"/>
  33. <result property="wUnit" column="W_UNIT"/>
  34. <result property="planDpId" column="PLAN_DP_ID"/>
  35. <result property="isEnable" column="IS_ENABLE"/>
  36. </resultMap>
  37. <resultMap type="cn.com.goldenwater.dcproj.dto.BisInspAllRlationPersDto" id="bisInspAllRlationPersDtoResultMap">
  38. <result property="callnumber" column="CALLNUMBER"/>
  39. <result property="dpnm" column="DPNM"/>
  40. <result property="dppost" column="DPPOST"/>
  41. <result property="idnm" column="IDNM"/>
  42. <result property="plst" column="PLST"/>
  43. <result property="school" column="SCHOOL"/>
  44. <result property="specialty" column="SPECIALTY"/>
  45. <result property="imgurl" column="IMGURL"/>
  46. <result property="guid" column="GUID"/>
  47. <result property="persName" column="PERS_NAME"/>
  48. <result property="pwd" column="PWD"/>
  49. <result property="sex" column="SEX"/>
  50. <result property="telnumb" column="TELNUMB"/>
  51. <result property="faxnumb" column="FAXNUMB"/>
  52. <result property="mobilenumb" column="MOBILENUMB"/>
  53. <result property="email" column="EMAIL"/>
  54. <result property="bornDate" column="BORN_DATE"/>
  55. <result property="orgId" column="ORG_ID"/>
  56. <result property="orgNm" column="ORG_NM"/>
  57. <result property="admDuty" column="ADM_DUTY"/>
  58. <result property="collTime" column="COLL_TIME"/>
  59. <result property="remark" column="REMARK"/>
  60. <result property="pertype" column="PERS_TYPE"/>
  61. <result property="permission" column="PERMISSION"/>
  62. <result property="operateTime" column="OPERATE_TIME"/>
  63. <result property="index" column="ROW_ID"/>
  64. <result property="wUnit" column="W_UNIT"/>
  65. <result property="planDpId" column="PLAN_DP_ID"/>
  66. <result property="isEnable" column="IS_ENABLE"/>
  67. </resultMap>
  68. <sql id="table_columns">
  69. CALLNUMBER,
  70. PROVINCE,
  71. DEPART_ID,
  72. DEPART_NM,
  73. DPNM,
  74. DPPOST,
  75. IDNM,
  76. PLST,
  77. SCHOOL,
  78. SPECIALTY,
  79. IMGURL,
  80. GUID,
  81. PERS_NAME,
  82. PWD,
  83. SEX,
  84. TELNUMB,
  85. FAXNUMB,
  86. MOBILENUMB,
  87. EMAIL,
  88. BORN_DATE,
  89. ORG_ID,
  90. ORG_NM,
  91. ADM_DUTY,
  92. COLL_TIME,
  93. REMARK,
  94. PERS_TYPE,
  95. PERMISSION,
  96. OWNER_SYSTEM,
  97. W_UNIT,
  98. PLAN_DP_ID,
  99. IS_ENABLE
  100. </sql>
  101. <sql id="entity_properties">
  102. #{callnumber},#{province},#{departId},#{departNm},
  103. #{dpnm},
  104. #{dppost},
  105. #{idnm},
  106. #{plst},
  107. #{school},
  108. #{specialty},
  109. #{imgurl},
  110. #{guid},
  111. #{persName},
  112. #{pwd},
  113. #{sex},
  114. #{telnumb},
  115. #{faxnumb},
  116. #{mobilenumb},
  117. #{email},
  118. #{bornDate},
  119. #{orgId},
  120. #{orgNm},
  121. #{admDuty},
  122. #{collTime},
  123. #{remark},
  124. #{persType},
  125. #{permission},
  126. #{ownerSystem},
  127. #{wUnit},
  128. #{planDpId},
  129. #{isEnable}
  130. </sql>
  131. <sql id="table_columns2">
  132. CALLNUMBER ,DEPART_ID,DEPART_NM,
  133. DPNM,
  134. DPPOST,
  135. IDNM,
  136. PLST,
  137. SCHOOL,
  138. SPECIALTY,
  139. IMGURL,
  140. GUID,
  141. PERS_NAME,
  142. SEX,
  143. TELNUMB,
  144. FAXNUMB,
  145. MOBILENUMB,
  146. EMAIL,
  147. BORN_DATE,
  148. ORG_ID,
  149. ORG_NM,
  150. ADM_DUTY,
  151. COLL_TIME,
  152. REMARK,
  153. PERS_TYPE,
  154. PERMISSION,
  155. OWNER_SYSTEM,
  156. W_UNIT,
  157. PLAN_DP_ID,
  158. PROVINCE
  159. </sql>
  160. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  161. <!-- '%' || #{roleName} || '%'; -->
  162. <sql id="page_where">
  163. <trim prefix="where" prefixOverrides="and | or ">
  164. <if test="callnumber != null and callnumber != ''">and CALLNUMBER = #{callnumber}</if>
  165. <if test="wUnit != null and wUnit != ''">and W_UNIT = #{wUnit}</if>
  166. <if test="dppost != null and dppost != ''">and DPPOST = #{dppost}</if>
  167. <if test="departId != null and departId != ''">and depart_Id = #{departId}</if>
  168. <if test="departNm != null and departNm != ''">and depart_Nm = #{departNm}</if>
  169. <if test="idnm != null and idnm != ''">and IDNM like #{idnm} || '%'</if>
  170. <if test="plst != null and plst != ''">and PLST = #{plst}</if>
  171. <if test="school != null and school != ''">and SCHOOL = #{school}</if>
  172. <if test="specialty != null and specialty != ''">and SPECIALTY = #{specialty}</if>
  173. <if test="imgurl != null and imgurl != ''">and IMGURL = #{imgurl}</if>
  174. <if test="guid != null and guid != ''">and GUID = #{guid}</if>
  175. <if test="persName != null and persName != ''">and PERS_NAME like '%' || #{persName} || '%'</if>
  176. <if test="pwd != null and pwd != ''">and PWD = #{pwd}</if>
  177. <if test="sex != null">and SEX = #{sex}</if>
  178. <if test="telnumb != null and telnumb != ''">and TELNUMB like #{telnumb} || '%'</if>
  179. <if test="faxnumb != null and faxnumb != ''">and FAXNUMB = #{faxnumb}</if>
  180. <if test="mobilenumb != null and mobilenumb != ''">and MOBILENUMB = #{mobilenumb}</if>
  181. <if test="email != null and email != ''">and EMAIL = #{email}</if>
  182. <if test="bornDate != null">and BORN_DATE = #{bornDate}</if>
  183. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  184. <if test="orgNm != null and orgNm != ''">and ORG_NM like #{orgNm} || '%'</if>
  185. <if test="admDuty != null and admDuty != ''">and ADM_DUTY = #{admDuty}</if>
  186. <if test="collTime != null">and COLL_TIME = #{collTime}</if>
  187. <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
  188. <if test="permission != null and permission != ''">and PERMISSION = #{permission}</if>
  189. <if test="phoneIsNull!=null and phoneIsNull!=''">and MOBILENUMB is null</if>
  190. <if test="ownerSystem != null and ownerSystem != ''">and OWNER_SYSTEM = #{ownerSystem}</if>
  191. <if test="dpnm != null and dpnm != ''">and DPNM = #{dpnm}</if>
  192. <if test="persType != null and persType != ''">and PERS_TYPE = #{persType}</if>
  193. <if test="province != null and province != ''">and PROVINCE = #{province}</if>
  194. <if test="planDpId != null and planDpId != ''">and PLAN_DP_ID = #{planDpId}</if>
  195. </trim>
  196. </sql>
  197. <select id="get" resultMap="bisInspAllRlationPersResultMap" parameterType="String">
  198. select
  199. <include refid="table_columns2"/>
  200. from BIS_INSP_ALL_RLATION_PERS where guid = #{id}
  201. </select>
  202. <select id="getBy" resultMap="bisInspAllRlationPersResultMap">
  203. select
  204. <include refid="table_columns"/>
  205. from BIS_INSP_ALL_RLATION_PERS
  206. <include refid="page_where"/>
  207. </select>
  208. <select id="findAll" resultMap="bisInspAllRlationPersResultMap">
  209. select
  210. <include refid="table_columns"/>
  211. from BIS_INSP_ALL_RLATION_PERS
  212. </select>
  213. <select id="findList" resultMap="bisInspAllRlationPersResultMap">
  214. select
  215. <include refid="table_columns"/>
  216. from BIS_INSP_ALL_RLATION_PERS
  217. <include refid="page_where"/>
  218. </select>
  219. <select id="findListByOrgIdOrderByOperateTime" resultMap="bisInspAllRlationPersDtoResultMap">
  220. select distinct tp.GUID,
  221. tp.DPNM,
  222. tp.W_UNIT,
  223. tp.DPPOST,
  224. tp.IDNM,
  225. tp.PLST,
  226. tp.SCHOOL,
  227. tp.SPECIALTY,
  228. tp.IMGURL,
  229. tp.PERS_NAME,
  230. tp.SEX,
  231. tp.TELNUMB,
  232. tp.FAXNUMB,
  233. tp.MOBILENUMB,
  234. tp.EMAIL,
  235. tp.BORN_DATE,
  236. tp.ORG_ID,
  237. tp.ORG_NM,
  238. tp.ADM_DUTY,
  239. tp.COLL_TIME,
  240. tp.REMARK,tp.PERMISSION,
  241. cr.operate_time,cr.LONGITUDE lgtd,cr.LATITUDE lttd,cr.LON centerXGd,cr.LAT centerYGd,
  242. CASE WHEN tr.GUID IS NOT NULL THEN '1'
  243. WHEN tr.GUID IS NULL THEN '0'
  244. END AS STATE
  245. from
  246. (
  247. select distinct t.GUID,
  248. t.DPNM,
  249. t.W_UNIT,
  250. t.DPPOST,
  251. t.IDNM,
  252. t.PLST,
  253. t.SCHOOL,
  254. t.SPECIALTY,
  255. t.IMGURL,
  256. t.PERS_NAME,
  257. t.SEX,
  258. t.TELNUMB,
  259. t.FAXNUMB,
  260. t.MOBILENUMB,
  261. t.EMAIL,
  262. t.BORN_DATE,
  263. t.ORG_ID,
  264. t.ORG_NM,
  265. t.ADM_DUTY,
  266. t.COLL_TIME,
  267. t.REMARK,t.PERMISSION from BIS_INSP_ALL_RLATION rla
  268. left join (
  269. select s.*,o.org_id as real_org from bis_insp_all_rlation_pers s,
  270. (select * from bis_insp_pers_org g where 1=1
  271. <if test="orgId !=null and orgId !=''">
  272. and g.org_id =#{orgId}
  273. </if>
  274. ) o where s.guid=o.pers_id
  275. ) t on rla.persid = t.guid
  276. <if test="orgId !=null and orgId !=''">
  277. where REGEXP_LIKE( Id,'^('||
  278. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  279. and ad_code =#{province}
  280. )>0 then
  281. (SELECT LISTAGG(id, '|') as
  282. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persId}
  283. and ad_code =#{province} GROUP BY PERSID
  284. )
  285. else (select 'non' from dual) end)
  286. ||')')
  287. </if>
  288. <if test="province !=null and province !=''">
  289. and rla.ad_code=#{province}
  290. </if>
  291. ) tp LEFT JOIN
  292. (SELECT t.GUID,
  293. t.DPNM,
  294. t.W_UNIT,
  295. t.DPPOST,
  296. t.IDNM,
  297. t.PLST,
  298. t.SCHOOL,
  299. t.SPECIALTY,
  300. t.IMGURL,
  301. t.PERS_NAME,
  302. t.SEX,
  303. t.TELNUMB,
  304. t.FAXNUMB,
  305. t.MOBILENUMB,
  306. t.EMAIL,
  307. t.BORN_DATE,
  308. t.ORG_ID,
  309. t.ORG_NM,
  310. t.ADM_DUTY,
  311. t.COLL_TIME,
  312. t.REMARK,t.PERMISSION,
  313. t1.operate_time,t1.LONGITUDE lgtd,t1.LATITUDE lttd,
  314. t1.LON centerXGd,t1.LAT centerYGd FROM (
  315. select s.* from bis_insp_all_rlation_pers s,(select * from bis_insp_pers_org g where 1=1
  316. <if test="orgId !=null and orgId !=''">
  317. and g.org_id =#{orgId}
  318. </if>
  319. ) o where s.guid=o.pers_id )t
  320. left join pers_position_latest t1 on t.guid = t1.pers_id
  321. where 1 = 1 and t1.PERS_ID is not null
  322. and t1.OPERATE_TIME >= #{operateTime}
  323. ) tr on tp.guid = tr.guid
  324. LEFT JOIN pers_position_latest cr on tp.guid = cr.PERS_ID
  325. WHERE 1 = 1
  326. <if test="isAdmin!=true">
  327. AND cr.OPERATE_TIME > SYSDATE-1
  328. </if>
  329. <if test="persName != null and persName != ''">and tp.PERS_NAME like '%' || #{persName} || '%'</if>
  330. <if test="certificateCode != null and certificateCode != ''">AND (tp.IDNM LIKE '%${certificateCode}%' OR
  331. tp.TELNUMB LIKE '%${certificateCode}%')
  332. </if>
  333. <if test="deptName != null and deptName != ''">AND (tp.DPNM LIKE '%${deptName}%' OR tp.ORG_NM LIKE
  334. '%${deptName}%')
  335. </if>
  336. <if test="status != null and status != ''">AND tr.GUID IS NOT NULL</if>
  337. </select>
  338. <select id="findListByClassify" resultMap="bisInspAllRlationPersDtoResultMap"
  339. parameterType="cn.com.goldenwater.dcproj.param.PersPositionParam">
  340. select
  341. DISTINCT t3.GUID,
  342. t3.DPNM,
  343. t3.W_UNIT,
  344. t3.DPPOST,
  345. t3.IDNM,
  346. t3.PLST,
  347. t3.SCHOOL,
  348. t3.SPECIALTY,
  349. t3.IMGURL,
  350. t3.PERS_NAME,
  351. t3.SEX,
  352. t3.TELNUMB,
  353. t3.FAXNUMB,
  354. t3.MOBILENUMB,
  355. t3.EMAIL,
  356. t3.BORN_DATE,
  357. t3.ORG_ID,
  358. t3.ORG_NM,
  359. t3.ADM_DUTY,
  360. t3.COLL_TIME,
  361. t3.REMARK,
  362. t4.operate_time,t4.LONGITUDE lgtd,t4.LATITUDE lttd,
  363. (case
  364. when t4.OPERATE_TIME >= #{operateTime} then
  365. '1'
  366. else
  367. '0'
  368. end) state
  369. from bis_insp_all t1
  370. LEFT JOIN (select * from BIS_INSP_ALL_RLATION n where 1=1
  371. <include refid="provinceSql"/>
  372. ) t2 ON t2.id = t1.id
  373. left join BIS_INSP_ALL_RLATION_PERS t3 ON t3.guid = t2.persid
  374. left join pers_position_latest t4 on t4.pers_id=t3.guid
  375. where 1 = 1
  376. <if test="id != null and id != ''">AND
  377. <foreach item="item" index="index" collection="id.split(',')" open="(" separator="OR" close=")">
  378. t1.id LIKE #{item}||'%'
  379. </foreach>
  380. </if>
  381. <if test="persName != null and persName != ''">and t3.PERS_NAME like '%' || #{persName} || '%'</if>
  382. <if test="pertype != null and pertype != ''">and t2.PERTYPE =#{pertype}</if>
  383. <if test='status == "1"'>and t4.OPERATE_TIME >= #{operateTime}</if>
  384. <if test="orderBy == null or orderBy == ''">order by operate_time</if>
  385. <if test="orderBy != null and orderBy != ''">order by ${orderBy}</if>
  386. </select>
  387. <select id="findListCountByClassify" resultType="int"
  388. parameterType="cn.com.goldenwater.dcproj.param.PersPositionParam">
  389. select
  390. count(DISTINCT t3.GUID)
  391. from bis_insp_all t1
  392. LEFT JOIN (select * from BIS_INSP_ALL_RLATION n where 1=1
  393. <include refid="provinceSql"/>
  394. ) t2 ON t2.id = t1.id
  395. left join BIS_INSP_ALL_RLATION_PERS t3 ON t3.guid = t2.persid
  396. left join pers_position_latest t4 on t4.pers_id=t3.guid
  397. where t1.id like concat(#{id},'%') and t4.PERS_ID is not null
  398. <if test="persName != null and persName != ''">and t3.PERS_NAME like '%' || #{persName} || '%'</if>
  399. <if test="pertype != null and pertype != ''">and t2.PERTYPE =#{pertype}</if>
  400. <if test="operateTime != null">and t4.OPERATE_TIME >= #{operateTime}</if>
  401. </select>
  402. <sql id="provinceSql">
  403. <choose>
  404. <when test="province !=null and province !=''">
  405. AND AD_CODE=#{province}
  406. </when>
  407. <otherwise>
  408. AND AD_CODE is null
  409. </otherwise>
  410. </choose>
  411. </sql>
  412. <select id="selectCount" resultType="int">
  413. select count(DISTINCT t1.GUID) from BIS_INSP_ALL_RLATION_PERS t1
  414. where t1.ORG_ID LIKE concat(#{orgId}, '%')
  415. </select>
  416. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllRlationPers">
  417. insert into BIS_INSP_ALL_RLATION_PERS(
  418. <include refid="table_columns"/>
  419. )
  420. values (
  421. <include refid="entity_properties"/>
  422. )
  423. </insert>
  424. <delete id="delete" parameterType="java.lang.String">
  425. delete from BIS_INSP_ALL_RLATION_PERS where guid = #{id}
  426. </delete>
  427. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllRlationPers">
  428. delete from BIS_INSP_ALL_RLATION_PERS
  429. <include refid="page_where"/>
  430. </delete>
  431. <update id="deleteInFlag" parameterType="java.lang.String">
  432. update BIS_INSP_ALL_RLATION_PERS set flag_valid = 0 where guid = #{id}
  433. </update>
  434. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllRlationPers">
  435. update BIS_INSP_ALL_RLATION_PERS
  436. <trim prefix="set" suffixOverrides=",">
  437. <if test="callnumber != null and callnumber != ''">CALLNUMBER = #{callnumber},</if>
  438. <if test="wUnit != null and wUnit != ''">W_UNIT = #{wUnit},</if>
  439. <if test="departId != null and departId != ''">depart_Id = #{departId},</if>
  440. <if test="departNm != null and departNm != ''">depart_Nm = #{departNm},</if>
  441. <if test="dppost != null and dppost != ''">DPPOST = #{dppost},</if>
  442. <if test="idnm != null and idnm != ''">IDNM = #{idnm},</if>
  443. <if test="plst != null and plst != ''">PLST = #{plst},</if>
  444. <if test="school != null and school != ''">SCHOOL = #{school},</if>
  445. <if test="specialty != null and specialty != ''">SPECIALTY = #{specialty},</if>
  446. <if test="imgurl != null and imgurl != ''">IMGURL = #{imgurl},</if>
  447. <if test="dpnm != null and dpnm != ''">DPNM = #{dpnm},</if>
  448. <if test="persName != null and persName != ''">PERS_NAME = #{persName},</if>
  449. <if test="pwd != null and pwd != ''">PWD = #{pwd},</if>
  450. <if test="sex != null">SEX = #{sex},</if>
  451. <if test="telnumb != null and telnumb != ''">TELNUMB = #{telnumb},</if>
  452. <if test="faxnumb != null and faxnumb != ''">FAXNUMB = #{faxnumb},</if>
  453. <if test="mobilenumb != null and mobilenumb != ''">MOBILENUMB = #{mobilenumb},</if>
  454. <if test="email != null and email != ''">EMAIL = #{email},</if>
  455. <if test="bornDate != null">BORN_DATE = #{bornDate},</if>
  456. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  457. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  458. <if test="admDuty != null and admDuty != ''">ADM_DUTY = #{admDuty},</if>
  459. <if test="collTime != null">COLL_TIME = #{collTime},</if>
  460. <if test="loginTm != null">LOGIN_TM = #{loginTm},</if>
  461. <if test="remark != null and remark != ''">REMARK = #{remark},</if>
  462. <if test="permission != null and permission != ''">PERMISSION = #{permission},</if>
  463. <if test="ownerSystem != null and ownerSystem != ''">OWNER_SYSTEM = #{ownerSystem},</if>
  464. <if test="persType != null and persType != ''">PERS_TYPE = #{persType},</if>
  465. <if test="planDpId != null and planDpId != ''">PLAN_DP_ID = #{planDpId},</if>
  466. <if test="isEnable != null and isEnable != ''">IS_ENABLE = #{isEnable},</if>
  467. </trim>
  468. <where>guid = #{guid}</where>
  469. </update>
  470. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllRlationPers">
  471. update BIS_INSP_ALL_RLATION_PERS
  472. <trim prefix="set" suffixOverrides=",">
  473. <if test="callnumber != null and callnumber != ''">CALLNUMBER = #{callnumber},</if>
  474. <if test="wUnit != null and wUnit != ''">W_UNIT = #{wUnit},</if>
  475. <if test="departId != null and departId != ''">depart_Id = #{departId},</if>
  476. <if test="departNm != null and departNm != ''">depart_Nm = #{departNm},</if>
  477. <if test="dppost != null and dppost != ''">DPPOST = #{dppost},</if>
  478. <if test="idnm != null and idnm != ''">IDNM = #{idnm},</if>
  479. <if test="plst != null and plst != ''">PLST = #{plst},</if>
  480. <if test="school != null and school != ''">SCHOOL = #{school},</if>
  481. <if test="specialty != null and specialty != ''">SPECIALTY = #{specialty},</if>
  482. <if test="imgurl != null and imgurl != ''">IMGURL = #{imgurl},</if>
  483. <if test="dpnm != null and dpnm != ''">DPNM = #{dpnm},</if>
  484. <if test="persName != null and persName != ''">PERS_NAME = #{persName},</if>
  485. <if test="pwd != null and pwd != ''">PWD = #{pwd},</if>
  486. <if test="sex != null">SEX = #{sex},</if>
  487. <if test="telnumb != null and telnumb != ''">TELNUMB = #{telnumb},</if>
  488. <if test="faxnumb != null and faxnumb != ''">FAXNUMB = #{faxnumb},</if>
  489. <if test="mobilenumb != null and mobilenumb != ''">MOBILENUMB = #{mobilenumb},</if>
  490. <if test="email != null and email != ''">EMAIL = #{email},</if>
  491. <if test="bornDate != null">BORN_DATE = #{bornDate},</if>
  492. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  493. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  494. <if test="admDuty != null and admDuty != ''">ADM_DUTY = #{admDuty},</if>
  495. <if test="collTime != null">COLL_TIME = #{collTime},</if>
  496. <if test="remark != null and remark != ''">REMARK = #{remark},</if>
  497. <if test="permission != null and permission != ''">PERMISSION = #{permission},</if>
  498. <if test="ownerSystem != null and ownerSystem != ''">OWNER_SYSTEM = #{ownerSystem},</if>
  499. <if test="persType != null and persType != ''">PERS_TYPE = #{persType},</if>
  500. <if test="isEnable != null and isEnable != ''">IS_ENABLE = #{isEnable},</if>
  501. </trim>
  502. <include refid="page_where"/>
  503. </update>
  504. <!-- 其他自定义SQL -->
  505. <select id="getZjList" resultMap="bisInspAllRlationPersResultMap">
  506. SELECT * FROM BIS_INSP_ALL_RLATION_PERS WHERE IDNM IS NOT NULL
  507. </select>
  508. <!-- 在线人数resultType="Integer" -->
  509. <select id="selectCountOnlinePers" resultType="java.lang.Integer" parameterType="java.lang.String">
  510. SELECT COUNT(*) FROM(
  511. SELECT DISTINCT USER_ID FROM
  512. BIS_INSP_LOG
  513. WHERE INTM &gt;= TO_DATE(#{sttm}, 'yyyy-mm-dd hh24:mi:ss')
  514. AND INTM &lt;= TO_DATE(#{entm}, 'yyyy-mm-dd hh24:mi:ss')
  515. <include refid="orgIdsql"/>
  516. GROUP BY USER_ID
  517. )
  518. </select>
  519. <sql id="orgIdsql">
  520. <choose>
  521. <when test="orgId !=null and orgId !=''">
  522. AND ORG_ID=#{orgId}
  523. </when>
  524. <otherwise>
  525. AND ORG_ID is null
  526. </otherwise>
  527. </choose>
  528. </sql>
  529. <select id="selectOnlinePers" resultType="java.util.HashMap" parameterType="java.lang.String">
  530. SELECT B.* FROM (
  531. SELECT DISTINCT USER_ID FROM
  532. BIS_INSP_LOG
  533. WHERE INTM &gt;= TO_DATE(#{sttm}, 'yyyy-mm-dd hh24:mi:ss')
  534. AND INTM &lt;= TO_DATE(#{entm}, 'yyyy-mm-dd hh24:mi:ss')
  535. <include refid="orgIdsql"/>
  536. GROUP BY USER_ID
  537. )A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B ON B.GUID = A.USER_ID
  538. </select>
  539. <update id="setHeadMan" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllRlation">
  540. UPDATE BIS_INSP_ALL_RLATION SET PERTYPE = #{pertype} WHERE PERSID = #{persid} AND ID = #{id} AND ORG_ID=#{orgId}
  541. </update>
  542. <select id="getLeaderByGroup" parameterType="cn.com.goldenwater.dcproj.param.GroupLeaderParam"
  543. resultType="cn.com.goldenwater.dcproj.dto.GroupLeaderDto">
  544. SELECT A.GUID,A.PERS_NAME,A.MOBILENUMB FROM BIS_INSP_ALL_RLATION_PERS A
  545. LEFT JOIN (SELECT B.PERSID PERSID,B.AD_CODE FROM BIS_INSP_ALL_RLATION B LEFT JOIN BIS_INSP_ALL_OBJ C ON B.ID =
  546. C.ID
  547. WHERE B.ID LIKE '${id}%' AND C.OBJ_ID = #{objId} AND B.PERTYPE = '1') T1
  548. ON A.GUID = T1.PERSID where T1.PERSID IS NOT NULL
  549. <if test="province !=null and province !=''">
  550. AND T1.ad_code=#{province}
  551. </if>
  552. AND ROWNUM &lt; 2
  553. </select>
  554. <select id="findPersData" parameterType="cn.com.goldenwater.dcproj.param.BisInspAllRlationPersParam"
  555. resultType="cn.com.goldenwater.dcproj.dto.PersListDto">
  556. select CALLNUMBER,
  557. DPNM,
  558. W_UNIT,
  559. DPPOST,
  560. IDNM,
  561. PLST,
  562. SCHOOL,
  563. SPECIALTY,
  564. IMGURL,
  565. GUID,
  566. PERS_NAME,
  567. SEX,
  568. TELNUMB,
  569. FAXNUMB,
  570. MOBILENUMB,
  571. EMAIL,
  572. BORN_DATE,
  573. ORG_ID,
  574. ORG_NM,
  575. ADM_DUTY,
  576. COLL_TIME,
  577. REMARK,
  578. PERMISSION,PERS_TYPE from BIS_INSP_ALL_RLATION_PERS WHERE 1 = 1
  579. <if test="callnumber != null and callnumber != ''">and CALLNUMBER = #{callnumber}</if>
  580. <if test="dppost != null and dppost != ''">and DPPOST = #{dppost}</if>
  581. <if test="idnm != null and idnm != ''">and IDNM like #{idnm} || '%'</if>
  582. <if test="plst != null and plst != ''">and PLST = #{plst}</if>
  583. <if test="school != null and school != ''">and SCHOOL = #{school}</if>
  584. <if test="specialty != null and specialty != ''">and SPECIALTY = #{specialty}</if>
  585. <if test="imgurl != null and imgurl != ''">and IMGURL = #{imgurl}</if>
  586. <if test="guid != null and guid != ''">and GUID = #{guid}</if>
  587. <if test="persName != null and persName != ''">and PERS_NAME like '%' || #{persName} || '%'</if>
  588. <if test="pwd != null and pwd != ''">and PWD = #{pwd}</if>
  589. <if test="sex != null">and SEX = #{sex}</if>
  590. <if test="telnumb != null and telnumb != ''">and TELNUMB like #{telnumb} || '%'</if>
  591. <if test="faxnumb != null and faxnumb != ''">and FAXNUMB = #{faxnumb}</if>
  592. <if test="mobilenumb != null and mobilenumb != ''">and MOBILENUMB = #{mobilenumb}</if>
  593. <if test="email != null and email != ''">and EMAIL = #{email}</if>
  594. <if test="bornDate != null">and BORN_DATE = #{bornDate}</if>
  595. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  596. <if test="orgNm != null and orgNm != ''">and ORG_NM like #{orgNm} || '%'</if>
  597. <if test="admDuty != null and admDuty != ''">and ADM_DUTY = #{admDuty}</if>
  598. <if test="collTime != null">and COLL_TIME = #{collTime}</if>
  599. <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
  600. <if test="permission != null and permission != ''">and PERMISSION = #{permission}</if>
  601. <if test="phoneIsNull!=null and phoneIsNull!=''">and MOBILENUMB is null</if>
  602. <if test="planDpId != null and planDpId != ''">and PLAN_DP_ID = #{planDpId}</if>
  603. </select>
  604. <select id="listByCurUser" resultType="cn.com.goldenwater.dcproj.dto.PersListDto">
  605. SELECT
  606. A.*,B.ROLES,s.org_ids,s.org_names
  607. FROM BIS_INSP_ALL_RLATION_PERS A
  608. LEFT JOIN (
  609. SELECT
  610. A.GUID,listagg(C.ROLE_NAME, ',') as ROLES
  611. FROM BIS_INSP_ALL_RLATION_PERS A
  612. left join GW_SYS_REL_USER_ROLE B ON A.GUID=B.USER_ID
  613. LEFT JOIN GW_SYS_ROLE C ON B.ROLE_ID=C.ID
  614. GROUP BY A.GUID
  615. )B ON A.GUID=B.GUID
  616. left join (
  617. Select
  618. g.pers_id, listagg(g.org_id, ',') org_ids,
  619. listagg(o.org_nm, ',') org_names
  620. from Bis_Insp_Pers_Org g, bis_insp_org o
  621. where g.org_id=o.org_id
  622. <if test="province !=null and province !=''">
  623. and o.rlcode like concat(#{province},'%')
  624. </if>
  625. group by g.pers_id,g.org_id
  626. )s on A.Guid=s.pers_id
  627. WHERE 1=1
  628. <if test="name != null and name != ''">and A.PERS_NAME like '%' || #{name} || '%'</if>
  629. <if test="list != null and list.size()>0">
  630. AND A.OWNER_SYSTEM IN
  631. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  632. #{item}
  633. </foreach>
  634. </if>
  635. <if test="orgId !=null and orgId !=''">
  636. and s.org_ids like '%${orgId}%'
  637. </if>
  638. <if test="phoneIsNull!=null and phoneIsNull!=''">and A.MOBILENUMB is null</if>
  639. <if test="orgNm != null and orgNm != ''">and (A.ORG_NM like '%'||#{orgNm}|| '%' or s.org_names like
  640. '%'||#{orgNm}|| '%')
  641. </if>
  642. <if test="mobilenumb != null and mobilenumb != ''">and A.MOBILENUMB = #{mobilenumb}</if>
  643. <if test="dpnm != null and dpnm != ''">and A.DPNM like '%${dpnm}%'</if>
  644. <if test="planDpId != null and planDpId != ''">and A.PLAN_DP_ID = #{planDpId}</if>
  645. ORDER BY A.INTM,A.PERS_NAME desc
  646. </select>
  647. <select id="getByPlanId" resultType="cn.com.goldenwater.dcproj.dto.BisInspAllRlationDto">
  648. select A.PERTYPE,B.GUID,PERS_NAME,MOBILENUMB from bis_insp_all_rlation A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B ON A.PERSID=B.GUID where A.id=#{planId}
  649. </select>
  650. <update id="updatePersTypeById">
  651. UPDATE BIS_INSP_ALL_RLATION_PERS SET PERS_TYPE = #{persType} WHERE GUID = #{guid}
  652. </update>
  653. <update id="updatePersState">
  654. UPDATE BIS_INSP_ALL_RLATION_PERS SET IS_ENABLE = #{isEnable} WHERE GUID = #{guid}
  655. </update>
  656. <update id="updatePassword" parameterType="cn.com.goldenwater.dcproj.model.BisInspAllRlationPers">
  657. update BIS_INSP_ALL_RLATION_PERS set PWD = #{pwd} where GUID = #{guid}
  658. </update>
  659. <insert id="insertRelation">
  660. INSERT INTO BIS_INSP_ALL_RLATION(persId,id,PERTYPE,org_id,ad_code,type) VALUES(#{guid},#{s},'2',#{orgId},#{adCode},#{type})
  661. </insert>
  662. <select id="getNodeInfo" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.BisInspAllDto">
  663. SELECT * FROM BIS_INSP_ALL WHERE ID = #{s}
  664. </select>
  665. <select id="getRelationData" resultType="cn.com.goldenwater.dcproj.model.BisInspAllRlation">
  666. SELECT * FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{guid} AND ID = #{s}
  667. <if test="orgId !=null and orgId !=''">
  668. and ORG_ID=#{orgId}
  669. </if>
  670. <choose>
  671. <when test="adCode !=null and adCode !=''">
  672. and ad_code=#{adCode}
  673. </when>
  674. <otherwise>
  675. and ad_code is null
  676. </otherwise>
  677. </choose>
  678. </select>
  679. <select id="getSysUsers" parameterType="java.util.Map" resultType="java.util.Map">
  680. SELECT * FROM BIS_INSP_ALL_RLATION_PERS T
  681. WHERE 1=1
  682. <if test="orgIds != null and orgIds != ''">AND
  683. <foreach item="item" index="index" collection="orgIds.split(',')" open="(" separator="OR" close=")">
  684. T.ORG_ID = #{item}
  685. </foreach>
  686. </if>
  687. <if test="persTypes != null and persTypes != ''">AND
  688. <foreach item="item" index="index" collection="persTypes.split(',')" open="(" separator="OR" close=")">
  689. T.PERS_TYPE = #{item}
  690. </foreach>
  691. </if>
  692. </select>
  693. <select id="findListByPersId" resultMap="bisInspAllRlationPersDtoResultMap"
  694. parameterType="cn.com.goldenwater.dcproj.param.PersPositionParam">
  695. select distinct tp.GUID,
  696. tp.DPNM,
  697. tp.W_UNIT,
  698. tp.DPPOST,
  699. tp.IDNM,
  700. tp.PLST,
  701. tp.SCHOOL,
  702. tp.SPECIALTY,
  703. tp.IMGURL,
  704. tp.PERS_NAME,
  705. tp.SEX,
  706. tp.TELNUMB,
  707. tp.FAXNUMB,
  708. tp.MOBILENUMB,
  709. tp.EMAIL,
  710. tp.BORN_DATE,
  711. tp.ORG_ID,
  712. tp.ORG_NM,
  713. tp.ADM_DUTY,
  714. tp.COLL_TIME,
  715. tp.REMARK,tp.PERMISSION,
  716. cr.operate_time,cr.LONGITUDE lgtd,cr.LATITUDE lttd,cr.LON centerXGd,cr.LAT centerYGd,
  717. CASE WHEN tr.GUID IS NOT NULL THEN '1'
  718. WHEN tr.GUID IS NULL THEN '0'
  719. END AS STATE
  720. from
  721. (
  722. select distinct t.GUID,
  723. t.DPNM,
  724. t.W_UNIT,
  725. t.DPPOST,
  726. t.IDNM,
  727. t.PLST,
  728. t.SCHOOL,
  729. t.SPECIALTY,
  730. t.IMGURL,
  731. t.PERS_NAME,
  732. t.SEX,
  733. t.TELNUMB,
  734. t.FAXNUMB,
  735. t.MOBILENUMB,
  736. t.EMAIL,
  737. t.BORN_DATE,
  738. t.ORG_ID,
  739. t.ORG_NM,
  740. t.ADM_DUTY,
  741. t.COLL_TIME,
  742. t.REMARK,t.PERMISSION from Tac_Insp_Year_Batch_Group_Pers rla left join tac_worker_b b on rla.pers_id = b.id
  743. left join bis_insp_all_rlation_pers t on b.login_id = t.guid
  744. where b.id is not null and t.guid is not null
  745. <if test="persId != null and persId != ''">
  746. and rla.group_id in (select group_id from Tac_Insp_Year_Batch_Group_Pers p where p.pers_id in (select id
  747. from tac_worker_b b where b.login_id = #{persId}))
  748. </if>
  749. <if test="orgId != null and orgId != ''">
  750. and rla.group_id = #{orgId}
  751. </if>
  752. <if test="year != null">
  753. and rla.year = #{year}
  754. </if>
  755. <if test="batch != null">
  756. and rla.batch = #{batch}
  757. </if>
  758. <if test="persName != null and persName != ''">and b.name like '%' || #{persName} || '%'</if>
  759. ) tp LEFT JOIN
  760. (SELECT t.GUID,
  761. t.DPNM,
  762. t.W_UNIT,
  763. t.DPPOST,
  764. t.IDNM,
  765. t.PLST,
  766. t.SCHOOL,
  767. t.SPECIALTY,
  768. t.IMGURL,
  769. t.PERS_NAME,
  770. t.SEX,
  771. t.TELNUMB,
  772. t.FAXNUMB,
  773. t.MOBILENUMB,
  774. t.EMAIL,
  775. t.BORN_DATE,
  776. t.ORG_ID,
  777. t.ORG_NM,
  778. t.ADM_DUTY,
  779. t.COLL_TIME,
  780. t.REMARK,t.PERMISSION,
  781. t1.operate_time,t1.LONGITUDE lgtd,t1.LATITUDE lttd,
  782. t1.LON centerXGd,t1.LAT centerYGd FROM bis_insp_all_rlation_pers t
  783. left join pers_position_latest t1 on t.guid = t1.pers_id
  784. where t1.PERS_ID is not null
  785. and t1.OPERATE_TIME >= #{operateTime}
  786. ) tr on tp.guid = tr.guid
  787. LEFT JOIN pers_position_latest cr on tp.guid = cr.PERS_ID
  788. <if test="status != null and status != ''">AND tr.GUID IS NOT NULL</if>
  789. </select>
  790. <select id="listByMap" parameterType="java.util.Map" resultType="cn.com.goldenwater.dcproj.dto.PersListDto">
  791. <choose>
  792. <when test='null != isAll and "" != isAll and "1" == isAll.toString() '>
  793. SELECT P.CALLNUMBER,
  794. P.DPNM,
  795. P.W_UNIT,
  796. P.DPPOST,
  797. P.IDNM,
  798. P.PLST,
  799. P.SCHOOL,
  800. P.SPECIALTY,
  801. P.IMGURL,
  802. P.GUID,
  803. P.PERS_NAME,
  804. P.SEX,
  805. P.TELNUMB,
  806. P.FAXNUMB,
  807. P.MOBILENUMB,
  808. P.EMAIL,
  809. P.BORN_DATE,
  810. P.ORG_ID,
  811. P.ORG_NM,
  812. P.ADM_DUTY,
  813. P.COLL_TIME,
  814. P.REMARK,
  815. P.PERMISSION,
  816. p.MOHURD,
  817. P.AGE,
  818. count(case when BR.PERSID is not null then BR.PERSID end ) as "dcNum"
  819. FROM BIS_INSP_ALL_RLATION_PERS P
  820. JOIN BIS_INSP_PERS_ORG BIPO ON BIPO.PERS_ID = P.GUID
  821. JOIN BIS_INSP_ORG BIO ON BIPO.org_id = BIO.org_id
  822. LEFT JOIN (select B.PERSID,B.ID, T.NAME,C.STTM,C.INTM
  823. FROM BIS_INSP_ALL_RLATION B
  824. JOIN BIS_INSP_ALL C ON B.ID = C.ID
  825. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  826. <where>
  827. <if test="orgId != null and orgId != '' ">
  828. AND ORG_ID = #{orgId}
  829. </if>
  830. </where>
  831. )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
  832. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  833. <where>
  834. LENGTH(C.ID) = 12
  835. <if test="depm != null and depm.size() > 0 ">
  836. AND SUBSTR(C.ID, 1, 3) IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
  837. <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
  838. '${item}'
  839. </foreach>
  840. )
  841. </if>
  842. <if test="orgId != null and orgId != '' ">
  843. AND B.ID LIKE '___${orgId}%'
  844. </if>
  845. <if test="sttm != null and sttm != '' ">
  846. and C.STTM &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  847. </if>
  848. <if test="entm != null and entm != '' ">
  849. and C.INTM &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  850. </if>
  851. <if test="adCode != null and adCode != ''">and O.OBJ_AD_CODE like concat(#{adCode}, '%')</if>
  852. <if test="objType != null and objType != ''">and B.ID like '${objType}%'</if>
  853. <if test="objTypeName != null and objTypeName != ''">and T.NAME like '%${objTypeName}%'</if>
  854. <if test="pnm != null and pnm != ''">and C.PNM LIKE '%${pnm}%'</if>
  855. </where>
  856. ) BR ON P.GUID = BR.PERSID
  857. <where>
  858. <if test='orgId != null and orgId != "" '>
  859. AND BIO.ORG_ID = #{orgId}
  860. </if>
  861. <if test='adCode != null and adCode != "" '>
  862. AND BIO.AD_CODE LIKE CONCAT(#{adCode}, '%' )
  863. </if>
  864. <if test='objType != null and objType != ""'>and BR.ID like '${objType}%'</if>
  865. <if test='objTypeName != null and objTypeName != "" '>and BR.NAME like '%${objTypeName}%'</if>
  866. <if test="persName != null and persName != ''">and P.PERS_NAME like concat(concat('%' , #{persName}) , '%')</if>
  867. <if test="telnumb != null and telnumb != ''">and P.TELNUMB LIKE concat(concat('%' , #{telnumb}), '%')</if>
  868. <if test="faxnumb != null and faxnumb != ''">and P.FAXNUMB = #{faxnumb}</if>
  869. <if test="mobilenumb != null and mobilenumb != ''">and P.MOBILENUMB LIKE '%${mobilenumb}%'</if>
  870. <if test="email != null and email != ''">and P.EMAIL = #{email}</if>
  871. <if test="orgNm != null and orgNm != ''">and P.ORG_NM LIKE '%${orgNm}%'</if>
  872. <if test="admDuty != null and admDuty != ''">and P.ADM_DUTY = #{admDuty}</if>
  873. <if test="remark != null and remark != ''">and P.REMARK = #{remark}</if>
  874. <if test="permission != null and permission != ''">and P.PERMISSION = #{permission}</if>
  875. <if test="planDpId != null and planDpId != ''">and P.PLAN_DP_ID = #{planDpId}</if>
  876. </where>
  877. GROUP BY P.CALLNUMBER,
  878. P.DPNM,
  879. P.W_UNIT,
  880. P.DPPOST,
  881. P.IDNM,
  882. P.PLST,
  883. P.SCHOOL,
  884. P.SPECIALTY,
  885. P.IMGURL,
  886. P.GUID,
  887. P.PERS_NAME,
  888. P.SEX,
  889. P.TELNUMB,
  890. P.FAXNUMB,
  891. P.MOBILENUMB,
  892. P.EMAIL,
  893. P.BORN_DATE,
  894. P.ORG_ID,
  895. P.ORG_NM,
  896. P.ADM_DUTY,
  897. P.COLL_TIME,
  898. P.REMARK,
  899. P.PERMISSION,
  900. p.MOHURD,
  901. P.AGE
  902. order by count(case when BR.PERSID is not null then BR.PERSID end ) desc
  903. </when>
  904. <!-- 默认查询 督查人员 列表 -->
  905. <otherwise>
  906. SELECT P.CALLNUMBER,
  907. P.DPNM,
  908. P.W_UNIT,
  909. P.DPPOST,
  910. P.IDNM,
  911. P.PLST,
  912. P.SCHOOL,
  913. P.SPECIALTY,
  914. P.IMGURL,
  915. P.GUID,
  916. P.PERS_NAME,
  917. P.SEX,
  918. P.TELNUMB,
  919. P.FAXNUMB,
  920. P.MOBILENUMB,
  921. P.EMAIL,
  922. P.BORN_DATE,
  923. P.ORG_ID,
  924. P.ORG_NM,
  925. P.ADM_DUTY,
  926. P.COLL_TIME,
  927. P.REMARK,
  928. P.PERMISSION,
  929. p.MOHURD,
  930. P.AGE,
  931. count(B.PERSID) as "dcNum"
  932. FROM BIS_INSP_ALL_RLATION B
  933. JOIN BIS_INSP_ALL C ON B.ID = C.ID
  934. JOIN BIS_INSP_ALL_RLATION_PERS P ON P.GUID = B.PERSID
  935. JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
  936. <where>
  937. <if test="orgId != null and orgId != '' ">
  938. AND ORG_ID = #{orgId}
  939. </if>
  940. </where>
  941. )) T ON SUBSTR(C.ID, 0, 3) = T.CODE
  942. LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
  943. <where>
  944. LENGTH(C.ID) = 12
  945. <if test="depm != null and depm.size() > 0 ">
  946. AND SUBSTR(C.ID, 0, 3) IN (SELECT PTYPE FROM ATT_INSP_TYPE_DUTY where DUTY_DEP IN
  947. <foreach item="item" index="index" collection="depm" open="(" separator="," close=")">
  948. '${item}'
  949. </foreach>
  950. )
  951. </if>
  952. <if test="orgId != null and orgId != '' ">
  953. AND B.ID LIKE '___${orgId}%'
  954. </if>
  955. <if test="sttm != null and sttm != '' ">
  956. and C.STTM &gt;= to_date(#{sttm}, 'yyyy-MM-dd')
  957. </if>
  958. <if test="entm != null and entm != '' ">
  959. and C.INTM &lt; to_date(#{entm}, 'yyyy-MM-dd') + 1
  960. </if>
  961. <if test="adCode != null and adCode != ''">and O.OBJ_AD_CODE like concat(#{adCode}, '%')</if>
  962. <if test="objType != null and objType != ''">and B.ID like '${objType}%'</if>
  963. <if test="objTypeName != null and objTypeName != ''">and T.NAME like '%${objTypeName}%'</if>
  964. <if test="persName != null and persName != ''">and P.PERS_NAME like '%' || #{persName} || '%'</if>
  965. <if test="telnumb != null and telnumb != ''">and P.TELNUMB LIKE '%' || #{telnumb} || '%'</if>
  966. <if test="faxnumb != null and faxnumb != ''">and P.FAXNUMB = #{faxnumb}</if>
  967. <if test="mobilenumb != null and mobilenumb != ''">and P.MOBILENUMB LIKE '%${mobilenumb}%'</if>
  968. <if test="pnm != null and pnm != ''">and C.PNM LIKE '%${pnm}%'</if>
  969. <if test="email != null and email != ''">and P.EMAIL = #{email}</if>
  970. <if test="orgNm != null and orgNm != ''">and P.ORG_NM LIKE '%${orgNm}%'</if>
  971. <if test="admDuty != null and admDuty != ''">and P.ADM_DUTY = #{admDuty}</if>
  972. <if test="remark != null and remark != ''">and P.REMARK = #{remark}</if>
  973. <if test="permission != null and permission != ''">and P.PERMISSION = #{permission}</if>
  974. <if test="planDpId != null and planDpId != ''">and P.PLAN_DP_ID = #{planDpId}</if>
  975. </where>
  976. GROUP BY P.CALLNUMBER,
  977. P.DPNM,
  978. P.W_UNIT,
  979. P.DPPOST,
  980. P.IDNM,
  981. P.PLST,
  982. P.SCHOOL,
  983. P.SPECIALTY,
  984. P.IMGURL,
  985. P.GUID,
  986. P.PERS_NAME,
  987. P.SEX,
  988. P.TELNUMB,
  989. P.FAXNUMB,
  990. P.MOBILENUMB,
  991. P.EMAIL,
  992. P.BORN_DATE,
  993. P.ORG_ID,
  994. P.ORG_NM,
  995. P.ADM_DUTY,
  996. P.COLL_TIME,
  997. P.REMARK,
  998. P.PERMISSION,
  999. p.MOHURD,
  1000. P.AGE
  1001. </otherwise>
  1002. </choose>
  1003. </select>
  1004. <select id="getPersByObjId" resultType="cn.com.goldenwater.dcproj.model.BisInspAllRlationPers">
  1005. select distinct pe.* from BIS_INSP_ALL_OBJ t
  1006. left join bis_insp_all a on t.id = a.id
  1007. left join bis_insp_all_rlation p on a.id = p.id
  1008. left join bis_insp_all_rlation_pers pe on p.persid = pe.guid
  1009. where t.obj_id = #{objId} and p.pertype = #{pertype}
  1010. </select>
  1011. </mapper>