BisInspAllRlationPersDao.xml 42 KB

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