TacWorkerBDao.xml 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203
  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.TacWorkerBDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacWorkerB" id="tacWorkerBResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="loginId" column="LOGIN_ID"/>
  7. <result property="name" column="NAME"/>
  8. <result property="sex" column="SEX"/>
  9. <result property="age" column="AGE"/>
  10. <result property="birthdate" column="BIRTHDATE"/>
  11. <result property="idNo" column="ID_NO"/>
  12. <result property="telnumb" column="TELNUMB"/>
  13. <result property="mobilenumb" column="MOBILENUMB"/>
  14. <result property="email" column="EMAIL"/>
  15. <result property="roleType" column="ROLE_TYPE"/>
  16. <result property="groupType" column="GROUP_TYPE"/>
  17. <result property="education" column="EDUCATION"/>
  18. <result property="isOffice" column="IS_OFFICE"/>
  19. <result property="isTraining" column="IS_TRAINING"/>
  20. <result property="recommendedUnits" column="RECOMMENDED_UNITS"/>
  21. <result property="workAd" column="WORK_AD"/>
  22. <result property="workAdNm" column="WORK_AD_NM"/>
  23. <result property="workDpNm" column="WORK_DP_NM"/>
  24. <result property="workTrendAd" column="WORK_TREND_AD"/>
  25. <result property="workTrendNm" column="WORK_TREND_NM"/>
  26. <result property="unitRanks" column="UNIT_RANKS"/>
  27. <result property="titles" column="TITLES"/>
  28. <result property="duty" column="DUTY"/>
  29. <result property="professional" column="PROFESSIONAL"/>
  30. <result property="orgCode" column="ORG_CODE"/>
  31. <result property="orgNm" column="ORG_NM"/>
  32. <result property="emgcCntct" column="EMGC_CNTCT"/>
  33. <result property="emgcCntctPhone" column="EMGC_CNTCT_PHONE"/>
  34. <result property="bankAccount" column="BANK_ACCOUNT"/>
  35. <result property="bankName" column="BANK_NAME"/>
  36. <result property="oe" column="OE"/>
  37. <result property="resume" column="RESUME"/>
  38. <result property="isA" column="IS_A"/>
  39. <result property="isB" column="IS_B"/>
  40. <result property="isC" column="IS_C"/>
  41. <result property="isD" column="IS_D"/>
  42. <result property="isE" column="IS_E"/>
  43. <result property="isNew" column="IS_NEW"/>
  44. <result property="persId" column="PERS_ID"/>
  45. <result property="inTm" column="IN_TM"/>
  46. <result property="upTm" column="UP_TM"/>
  47. <result property="dataStat" column="DATA_STAT"/>
  48. <result property="province" column="PROVINCE"/>
  49. <result property="isExternal" column="IS_EXTERNAL"/>
  50. </resultMap>
  51. <sql id="table_columns">
  52. ID,
  53. LOGIN_ID,
  54. NAME,
  55. SEX,
  56. AGE,
  57. BIRTHDATE,
  58. ID_NO,
  59. TELNUMB,
  60. MOBILENUMB,
  61. EMAIL,
  62. ROLE_TYPE,
  63. GROUP_TYPE,
  64. EDUCATION,
  65. IS_OFFICE,
  66. IS_TRAINING,
  67. RECOMMENDED_UNITS,
  68. WORK_AD,
  69. WORK_AD_NM,
  70. WORK_DP_NM,
  71. WORK_TREND_AD,
  72. WORK_TREND_NM,
  73. UNIT_RANKS,
  74. TITLES,
  75. DUTY,
  76. PROFESSIONAL,
  77. ORG_CODE,
  78. ORG_NM,
  79. EMGC_CNTCT,
  80. EMGC_CNTCT_PHONE,
  81. BANK_ACCOUNT,
  82. BANK_NAME,
  83. OE,
  84. RESUME,
  85. IS_A,
  86. IS_B,
  87. IS_C,
  88. IS_D,
  89. IS_E,
  90. IS_NEW,
  91. PERS_ID,
  92. IN_TM,
  93. UP_TM,
  94. DATA_STAT,PROVINCE,IS_EXTERNAL
  95. </sql>
  96. <sql id="entity_properties">
  97. #{id},
  98. #{loginId},
  99. #{name},
  100. #{sex},
  101. #{age},
  102. #{birthdate},
  103. #{idNo},
  104. #{telnumb},
  105. #{mobilenumb},
  106. #{email},
  107. #{roleType},
  108. #{groupType},
  109. #{education},
  110. #{isOffice},
  111. #{isTraining},
  112. #{recommendedUnits},
  113. #{workAd},
  114. #{workAdNm},
  115. #{workDpNm},
  116. #{workTrendAd},
  117. #{workTrendNm},
  118. #{unitRanks},
  119. #{titles},
  120. #{duty},
  121. #{professional},
  122. #{orgCode},
  123. #{orgNm},
  124. #{emgcCntct},
  125. #{emgcCntctPhone},
  126. #{bankAccount},
  127. #{bankName},
  128. #{oe},
  129. #{resume},
  130. #{isA},
  131. #{isB},
  132. #{isC},
  133. #{isD},
  134. #{isE},
  135. #{isNew},
  136. #{persId},
  137. #{inTm},
  138. #{upTm},
  139. #{dataStat},#{province},#{isExternal}
  140. </sql>
  141. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  142. <sql id="page_where">
  143. <trim prefix="where" prefixOverrides="and | or ">
  144. <if test="loginId != null and loginId != ''">and LOGIN_ID = #{loginId}</if>
  145. <if test="name != null and name != ''">and NAME like '%${name}%'</if>
  146. <if test="sex != null and sex != ''">and SEX = #{sex}</if>
  147. <if test="age != null and age != ''">and AGE = #{age}</if>
  148. <if test="birthdate != null">and BIRTHDATE = #{birthdate}</if>
  149. <if test="idNo != null and idNo != ''">and ID_NO = #{idNo}</if>
  150. <if test="telnumb != null and telnumb != ''">and TELNUMB = #{telnumb}</if>
  151. <if test="mobilenumb != null and mobilenumb != ''">and MOBILENUMB = #{mobilenumb}</if>
  152. <if test="email != null and email != ''">and EMAIL = #{email}</if>
  153. <if test="roleType != null and roleType != ''">and ROLE_TYPE = #{roleType}</if>
  154. <if test="groupType != null and groupType != ''">and GROUP_TYPE = #{groupType}</if>
  155. <if test="education != null and education != ''">and EDUCATION = #{education}</if>
  156. <if test="isOffice != null and isOffice != ''">and IS_OFFICE = #{isOffice}</if>
  157. <if test="isTraining != null and isTraining != ''">and IS_TRAINING = #{isTraining}</if>
  158. <if test="recommendedUnits != null and recommendedUnits != ''">and RECOMMENDED_UNITS = #{recommendedUnits}</if>
  159. <if test="workAd != null and workAd != ''">and WORK_AD = #{workAd}</if>
  160. <if test="workAdNm != null and workAdNm != ''">and WORK_AD_NM = #{workAdNm}</if>
  161. <if test="workDpNm != null and workDpNm != ''">and WORK_DP_NM = #{workDpNm}</if>
  162. <if test="workTrendAd != null and workTrendAd != ''">and WORK_TREND_AD = #{workTrendAd}</if>
  163. <if test="workTrendNm != null and workTrendNm != ''">and WORK_TREND_NM = #{workTrendNm}</if>
  164. <if test="unitRanks != null and unitRanks != ''">and UNIT_RANKS = #{unitRanks}</if>
  165. <if test="titles != null and titles != ''">and TITLES = #{titles}</if>
  166. <if test="duty != null and duty != ''">and DUTY = #{duty}</if>
  167. <if test="professional != null and professional != ''">and PROFESSIONAL = #{professional}</if>
  168. <if test="orgCode != null and orgCode != ''">and ORG_CODE = #{orgCode}</if>
  169. <if test="orgNm != null and orgNm != ''">and ORG_NM = #{orgNm}</if>
  170. <if test="emgcCntct != null and emgcCntct != ''">and EMGC_CNTCT = #{emgcCntct}</if>
  171. <if test="emgcCntctPhone != null and emgcCntctPhone != ''">and EMGC_CNTCT_PHONE = #{emgcCntctPhone}</if>
  172. <if test="bankAccount != null and bankAccount != ''">and BANK_ACCOUNT = #{bankAccount}</if>
  173. <if test="bankName != null and bankName != ''">and BANK_NAME = #{bankName}</if>
  174. <if test="oe != null and oe != ''">and OE = #{oe}</if>
  175. <if test="resume != null and resume != ''">and RESUME = #{resume}</if>
  176. <if test="isA != null and isA != ''">and IS_A = #{isA}</if>
  177. <if test="isB != null and isB != ''">and IS_B = #{isB}</if>
  178. <if test="isC != null and isC != ''">and IS_C = #{isC}</if>
  179. <if test="isD != null and isD != ''">and IS_D = #{isD}</if>
  180. <if test="isE != null and isE != ''">and IS_E = #{isE}</if>
  181. <if test="isNew != null and isNew != ''">and IS_NEW = #{isNew}</if>
  182. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  183. <if test="inTm != null">and IN_TM = #{inTm}</if>
  184. <if test="upTm != null">and UP_TM = #{upTm}</if>
  185. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  186. <if test="isExternal != null and isExternal != ''">and IS_EXTERNAL = #{isExternal}</if>
  187. <include refid="choseSql"/>
  188. </trim>
  189. </sql>
  190. <sql id="choseSql">
  191. <choose>
  192. <when test="province !=null and province !=''">
  193. and t.PROVINCE = #{province}
  194. </when>
  195. <otherwise>
  196. and t.PROVINCE is null
  197. </otherwise>
  198. </choose>
  199. </sql>
  200. <select id="get" resultMap="tacWorkerBResultMap" parameterType="String" >
  201. select <include refid="table_columns" /> from TAC_WORKER_B where ID = #{id}
  202. </select>
  203. <select id="getBy" resultMap="tacWorkerBResultMap">
  204. select <include refid="table_columns" /> from TAC_WORKER_B t <include refid="page_where" />
  205. </select>
  206. <select id="findAll" resultMap="tacWorkerBResultMap">
  207. select <include refid="table_columns" /> from TAC_WORKER_B
  208. </select>
  209. <select id="findList" resultMap="tacWorkerBResultMap">
  210. select <include refid="table_columns" /> from TAC_WORKER_B t <include refid="page_where" />
  211. </select>
  212. <select id="selectCount" resultType="int" >
  213. select count(ID) from TAC_WORKER_B t <include refid="page_where" />
  214. </select>
  215. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacWorkerB">
  216. insert into TAC_WORKER_B( <include refid="table_columns" /> )
  217. values ( <include refid="entity_properties" /> )
  218. </insert>
  219. <select id="findBlankList" parameterType="String" resultMap="tacWorkerBResultMap">
  220. select * from tac_worker_b o where o.login_id is null
  221. <choose>
  222. <when test="province !=null and province !=''">
  223. and o.province=#{province}
  224. </when>
  225. <otherwise>
  226. and o.province is null
  227. </otherwise>
  228. </choose>
  229. </select>
  230. <select id="findPerInZLOrTPY" resultMap="tacWorkerBResultMap">
  231. select * from tac_worker_b o where (o.role_type like '%19%' or o.role_type like '%20%') and o.login_id=#{loginId}
  232. </select>
  233. <delete id="delete" parameterType="java.lang.String">
  234. delete from TAC_WORKER_B where ID = #{id}
  235. </delete>
  236. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacWorkerB">
  237. delete from TAC_WORKER_B <include refid="page_where" />
  238. </delete>
  239. <update id="deleteInFlag" parameterType="java.lang.String">
  240. update TAC_WORKER_B set flag_valid = 0 where ID = #{id}
  241. </update>
  242. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacWorkerB">
  243. update TAC_WORKER_B
  244. <trim prefix="set" suffixOverrides=",">
  245. <if test="loginId != null and loginId != ''">LOGIN_ID = #{loginId},</if>
  246. <if test="name != null and name != ''">NAME = #{name},</if>
  247. <if test="sex != null and sex != ''">SEX = #{sex},</if>
  248. <if test="age != null and age != ''">AGE = #{age},</if>
  249. <if test="birthdate != null">BIRTHDATE = #{birthdate},</if>
  250. <if test="idNo != null and idNo != ''">ID_NO = #{idNo},</if>
  251. <if test="telnumb != null and telnumb != ''">TELNUMB = #{telnumb},</if>
  252. <if test="mobilenumb != null and mobilenumb != ''">MOBILENUMB = #{mobilenumb},</if>
  253. <if test="email != null and email != ''">EMAIL = #{email},</if>
  254. <if test="roleType != null and roleType != ''">ROLE_TYPE = #{roleType},</if>
  255. <if test="groupType != null and groupType != ''">GROUP_TYPE = #{groupType},</if>
  256. <if test="education != null and education != ''">EDUCATION = #{education},</if>
  257. <if test="isOffice != null and isOffice != ''">IS_OFFICE = #{isOffice},</if>
  258. <if test="isTraining != null and isTraining != ''">IS_TRAINING = #{isTraining},</if>
  259. <if test="recommendedUnits != null and recommendedUnits != ''">RECOMMENDED_UNITS = #{recommendedUnits},</if>
  260. <if test="workAd != null and workAd != ''">WORK_AD = #{workAd},</if>
  261. <if test="workAdNm != null and workAdNm != ''">WORK_AD_NM = #{workAdNm},</if>
  262. <if test="workDpNm != null and workDpNm != ''">WORK_DP_NM = #{workDpNm},</if>
  263. <if test="workTrendAd != null and workTrendAd != ''">WORK_TREND_AD = #{workTrendAd},</if>
  264. <if test="workTrendNm != null and workTrendNm != ''">WORK_TREND_NM = #{workTrendNm},</if>
  265. <if test="unitRanks != null and unitRanks != ''">UNIT_RANKS = #{unitRanks},</if>
  266. <if test="titles != null and titles != ''">TITLES = #{titles},</if>
  267. <if test="duty != null and duty != ''">DUTY = #{duty},</if>
  268. <if test="professional != null and professional != ''">PROFESSIONAL = #{professional},</if>
  269. <if test="orgCode != null and orgCode != ''">ORG_CODE = #{orgCode},</if>
  270. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  271. <if test="emgcCntct != null and emgcCntct != ''">EMGC_CNTCT = #{emgcCntct},</if>
  272. <if test="emgcCntctPhone != null and emgcCntctPhone != ''">EMGC_CNTCT_PHONE = #{emgcCntctPhone},</if>
  273. <if test="bankAccount != null and bankAccount != ''">BANK_ACCOUNT = #{bankAccount},</if>
  274. <if test="bankName != null and bankName != ''">BANK_NAME = #{bankName},</if>
  275. <if test="oe != null and oe != ''">OE = #{oe},</if>
  276. <if test="resume != null and resume != ''">RESUME = #{resume},</if>
  277. <if test="isA != null and isA != ''">IS_A = #{isA},</if>
  278. <if test="isB != null and isB != ''">IS_B = #{isB},</if>
  279. <if test="isC != null and isC != ''">IS_C = #{isC},</if>
  280. <if test="isD != null and isD != ''">IS_D = #{isD},</if>
  281. <if test="isE != null and isE != ''">IS_E = #{isE},</if>
  282. <if test="isNew != null and isNew != ''">IS_NEW = #{isNew},</if>
  283. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  284. <if test="inTm != null">IN_TM = #{inTm},</if>
  285. <if test="upTm != null">UP_TM = #{upTm},</if>
  286. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  287. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  288. <if test="isExternal != null and isExternal != ''">IS_EXTERNAL = #{isExternal},</if>
  289. </trim>
  290. <where>ID = #{id}</where>
  291. </update>
  292. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacWorkerB">
  293. update TAC_WORKER_B
  294. <trim prefix="set" suffixOverrides=",">
  295. <if test="loginId != null and loginId != ''">LOGIN_ID = #{loginId},</if>
  296. <if test="name != null and name != ''">NAME = #{name},</if>
  297. <if test="sex != null and sex != ''">SEX = #{sex},</if>
  298. <if test="age != null and age != ''">AGE = #{age},</if>
  299. <if test="birthdate != null">BIRTHDATE = #{birthdate},</if>
  300. <if test="idNo != null and idNo != ''">ID_NO = #{idNo},</if>
  301. <if test="telnumb != null and telnumb != ''">TELNUMB = #{telnumb},</if>
  302. <if test="mobilenumb != null and mobilenumb != ''">MOBILENUMB = #{mobilenumb},</if>
  303. <if test="email != null and email != ''">EMAIL = #{email},</if>
  304. <if test="roleType != null and roleType != ''">ROLE_TYPE = #{roleType},</if>
  305. <if test="groupType != null and groupType != ''">GROUP_TYPE = #{groupType},</if>
  306. <if test="education != null and education != ''">EDUCATION = #{education},</if>
  307. <if test="isOffice != null and isOffice != ''">IS_OFFICE = #{isOffice},</if>
  308. <if test="isTraining != null and isTraining != ''">IS_TRAINING = #{isTraining},</if>
  309. <if test="recommendedUnits != null and recommendedUnits != ''">RECOMMENDED_UNITS = #{recommendedUnits},</if>
  310. <if test="workAd != null and workAd != ''">WORK_AD = #{workAd},</if>
  311. <if test="workAdNm != null and workAdNm != ''">WORK_AD_NM = #{workAdNm},</if>
  312. <if test="workDpNm != null and workDpNm != ''">WORK_DP_NM = #{workDpNm},</if>
  313. <if test="workTrendAd != null and workTrendAd != ''">WORK_TREND_AD = #{workTrendAd},</if>
  314. <if test="workTrendNm != null and workTrendNm != ''">WORK_TREND_NM = #{workTrendNm},</if>
  315. <if test="unitRanks != null and unitRanks != ''">UNIT_RANKS = #{unitRanks},</if>
  316. <if test="titles != null and titles != ''">TITLES = #{titles},</if>
  317. <if test="duty != null and duty != ''">DUTY = #{duty},</if>
  318. <if test="professional != null and professional != ''">PROFESSIONAL = #{professional},</if>
  319. <if test="orgCode != null and orgCode != ''">ORG_CODE = #{orgCode},</if>
  320. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  321. <if test="emgcCntct != null and emgcCntct != ''">EMGC_CNTCT = #{emgcCntct},</if>
  322. <if test="emgcCntctPhone != null and emgcCntctPhone != ''">EMGC_CNTCT_PHONE = #{emgcCntctPhone},</if>
  323. <if test="bankAccount != null and bankAccount != ''">BANK_ACCOUNT = #{bankAccount},</if>
  324. <if test="bankName != null and bankName != ''">BANK_NAME = #{bankName},</if>
  325. <if test="oe != null and oe != ''">OE = #{oe},</if>
  326. <if test="resume != null and resume != ''">RESUME = #{resume},</if>
  327. <if test="isA != null and isA != ''">IS_A = #{isA},</if>
  328. <if test="isB != null and isB != ''">IS_B = #{isB},</if>
  329. <if test="isC != null and isC != ''">IS_C = #{isC},</if>
  330. <if test="isD != null and isD != ''">IS_D = #{isD},</if>
  331. <if test="isE != null and isE != ''">IS_E = #{isE},</if>
  332. <if test="isNew != null and isNew != ''">IS_NEW = #{isNew},</if>
  333. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  334. <if test="inTm != null">IN_TM = #{inTm},</if>
  335. <if test="upTm != null">UP_TM = #{upTm},</if>
  336. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  337. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  338. <if test="isExternal != null and isExternal != ''">IS_EXTERNAL = #{isExternal},</if>
  339. </trim>
  340. <include refid="page_where" />
  341. </update>
  342. <!-- 其他自定义SQL -->
  343. <select id="countByAdCode" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam" resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  344. select count(*) count, WORK_AD code,WORK_AD_NM name from TAC_WORKER_B t
  345. where 1 = 1
  346. <include refid="choseSql"/>
  347. <if test="name != null and name != ''">
  348. AND NAME like '${name}%'
  349. </if>
  350. <if test="isOffice != null and isOffice != ''">
  351. AND IS_OFFICE = #{isOffice}
  352. </if>
  353. <if test="isExternal != null and isExternal != ''">
  354. AND IS_EXTERNAL = #{isExternal}
  355. </if>
  356. <if test="isTraining != null and isTraining != ''">
  357. AND IS_TRAINING = #{isTraining}
  358. </if>
  359. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  360. AND (IN_TM &gt;to_date(#{sttm},'yyyy-MM-dd') and in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd')+1)
  361. </if>
  362. <if test="groupType != null and groupType != ''">
  363. AND GROUP_TYPE in (${groupType})
  364. </if>
  365. <if test="roleType != null and roleType != ''">
  366. AND t.id in (select workerId from tac_worker_type where value in (${roleType}))
  367. </if>
  368. <if test="workAd!= null and workAd != ''">
  369. AND WORK_AD in (${workAd})
  370. </if>
  371. <if test="orgCode != null and orgCode != ''">
  372. AND ORG_CODE in (${orgCode})
  373. </if>
  374. <if test="education != null and education != ''">
  375. AND EDUCATION in (${education})
  376. </if>
  377. <if test="titles != null and titles != ''">
  378. AND TITLES in (${titles})
  379. </if>
  380. <if test="unitRanks != null and unitRanks != ''">
  381. AND UNIT_RANKS in (${unitRanks})
  382. </if>
  383. <if test="ageLimits != null and ageLimits != ''">
  384. ${ageLimits}
  385. </if>
  386. <if test="isAll != null and isAll != ''">
  387. ${isAll}
  388. </if>
  389. group by WORK_AD,WORK_AD_NM
  390. </select>
  391. <select id="countByTitles" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam" resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  392. select count(*) count, TITLES CODE,
  393. (
  394. CASE WHEN TITLES = '1' THEN '正高'
  395. WHEN TITLES = '2' THEN '副高'
  396. WHEN TITLES = '3' THEN '中级'
  397. WHEN TITLES = '4' THEN '初级'
  398. end
  399. ) NAME FROM TAC_WORKER_B t
  400. where 1 = 1
  401. <include refid="choseSql"/>
  402. <if test="name != null and name != ''">
  403. AND NAME like '${name}%'
  404. </if>
  405. <if test="isOffice != null and isOffice != ''">
  406. AND IS_OFFICE = #{isOffice}
  407. </if>
  408. <if test="isExternal != null and isExternal != ''">
  409. AND IS_EXTERNAL = #{isExternal}
  410. </if>
  411. <if test="isTraining != null and isTraining != ''">
  412. AND IS_TRAINING = #{isTraining}
  413. </if>
  414. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  415. AND (IN_TM &gt;to_date(#{sttm},'yyyy-MM-dd') and in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd')+1)
  416. </if>
  417. <if test="groupType != null and groupType != ''">
  418. AND GROUP_TYPE in (${groupType})
  419. </if>
  420. <if test="roleType != null and roleType != ''">
  421. AND t.id in (select workerId from tac_worker_type where value in (${roleType}))
  422. </if>
  423. <if test="workAd!= null and workAd != ''">
  424. AND WORK_AD in (${workAd})
  425. </if>
  426. <if test="orgCode != null and orgCode != ''">
  427. AND ORG_CODE in (${orgCode})
  428. </if>
  429. <if test="education != null and education != ''">
  430. AND EDUCATION in (${education})
  431. </if>
  432. <if test="titles != null and titles != ''">
  433. AND TITLES in (${titles})
  434. </if>
  435. <if test="unitRanks != null and unitRanks != ''">
  436. AND UNIT_RANKS in (${unitRanks})
  437. </if>
  438. <if test="ageLimits != null and ageLimits != ''">
  439. ${ageLimits}
  440. </if>
  441. <if test="isAll != null and isAll != ''">
  442. ${isAll}
  443. </if>
  444. GROUP BY TITLES
  445. </select>
  446. <select id="countByRole" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam" resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  447. select count(*) count, p.VALUE CODE,
  448. (
  449. CASE WHEN p.VALUE = '20' THEN '专家组长'
  450. WHEN p.VALUE = '19' THEN '助理'
  451. WHEN p.VALUE = '11' THEN '前期专家'
  452. WHEN p.VALUE = '12' THEN '建管专家'
  453. WHEN p.VALUE = '13' THEN '计划专家'
  454. WHEN p.VALUE = '14' THEN '财务专家'
  455. WHEN p.VALUE = '15' THEN '质量专家'
  456. WHEN p.VALUE = '16' THEN '安全专家'
  457. WHEN p.VALUE = '21' THEN '特派员'
  458. end
  459. ) NAME FROM TAC_WORKER_B t left join (select * from tac_worker_type where type = '1') p on t.id = p.workerId
  460. where 1 = 1 and p.id is not null
  461. <include refid="choseSql"/>
  462. <if test="yearBatchId != null and yearBatchId != ''">
  463. and t.Id not in (
  464. select t.pers_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t where t.year_batch_id = #{yearBatchId}
  465. )
  466. </if>
  467. <if test="name != null and name != ''">
  468. AND t.NAME like '${name}%'
  469. </if>
  470. <if test="isOffice != null and isOffice != ''">
  471. AND t.IS_OFFICE = #{isOffice}
  472. </if>
  473. <if test="isExternal != null and isExternal != ''">
  474. AND t.IS_EXTERNAL = #{isExternal}
  475. </if>
  476. <if test="isTraining != null and isTraining != ''">
  477. AND t.IS_TRAINING = #{isTraining}
  478. </if>
  479. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  480. AND (t.IN_TM &gt;to_date(#{sttm},'yyyy-MM-dd') and t.in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd')+1)
  481. </if>
  482. <if test="groupType != null and groupType != ''">
  483. AND t.GROUP_TYPE in (${groupType})
  484. </if>
  485. <if test="roleType != null and roleType != ''">
  486. AND p.VALUE in (${roleType})
  487. </if>
  488. <if test="workAd!= null and workAd != ''">
  489. AND t.WORK_AD in (${workAd})
  490. </if>
  491. <if test="orgCode != null and orgCode != ''">
  492. AND t.ORG_CODE in (${orgCode})
  493. </if>
  494. <if test="education != null and education != ''">
  495. AND t.EDUCATION in (${education})
  496. </if>
  497. <if test="titles != null and titles != ''">
  498. AND t.TITLES in (${titles})
  499. </if>
  500. <if test="unitRanks != null and unitRanks != ''">
  501. AND t.UNIT_RANKS in (${unitRanks})
  502. </if>
  503. <if test="ageLimits != null and ageLimits != ''">
  504. ${ageLimits}
  505. </if>
  506. <if test="isAll != null and isAll != ''">
  507. ${isAll}
  508. </if>
  509. GROUP BY p.VALUE
  510. </select>
  511. <select id="countByEdu" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam" resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  512. select count(*) count, EDUCATION CODE,
  513. (
  514. CASE WHEN EDUCATION = '1' THEN '专科及以下'
  515. WHEN EDUCATION = '2' THEN '本科'
  516. WHEN EDUCATION = '3' THEN '研究生'
  517. WHEN EDUCATION = '4' THEN '博士'
  518. end
  519. ) NAME FROM TAC_WORKER_B t
  520. where 1 = 1
  521. <include refid="choseSql"/>
  522. <if test="name != null and name != ''">
  523. AND NAME like '${name}%'
  524. </if>
  525. <if test="isOffice != null and isOffice != ''">
  526. AND IS_OFFICE = #{isOffice}
  527. </if>
  528. <if test="isExternal != null and isExternal != ''">
  529. AND IS_EXTERNAL = #{isExternal}
  530. </if>
  531. <if test="isTraining != null and isTraining != ''">
  532. AND IS_TRAINING = #{isTraining}
  533. </if>
  534. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  535. AND (IN_TM &gt;to_date(#{sttm},'yyyy-MM-dd') and in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd')+1)
  536. </if>
  537. <if test="groupType != null and groupType != ''">
  538. AND GROUP_TYPE in (${groupType})
  539. </if>
  540. <if test="roleType != null and roleType != ''">
  541. AND t.id in (select workerId from tac_worker_type where value in (${roleType}))
  542. </if>
  543. <if test="workAd!= null and workAd != ''">
  544. AND WORK_AD in (${workAd})
  545. </if>
  546. <if test="orgCode != null and orgCode != ''">
  547. AND ORG_CODE in (${orgCode})
  548. </if>
  549. <if test="education != null and education != ''">
  550. AND EDUCATION in (${education})
  551. </if>
  552. <if test="titles != null and titles != ''">
  553. AND TITLES in (${titles})
  554. </if>
  555. <if test="unitRanks != null and unitRanks != ''">
  556. AND UNIT_RANKS in (${unitRanks})
  557. </if>
  558. <if test="ageLimits != null and ageLimits != ''">
  559. ${ageLimits}
  560. </if>
  561. <if test="isAll != null and isAll != ''">
  562. ${isAll}
  563. </if>
  564. GROUP BY EDUCATION
  565. </select>
  566. <select id="countByAge" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam" resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  567. select count(*) count,
  568. (
  569. CASE WHEN AGE &lt;= 30 THEN '30岁以下'
  570. WHEN AGE BETWEEN 31 and 35 THEN '31-35岁'
  571. WHEN AGE BETWEEN 36 and 40 THEN '36-40岁'
  572. WHEN AGE BETWEEN 41 and 45 THEN '41-45岁'
  573. WHEN AGE BETWEEN 46 and 50 THEN '46-50岁'
  574. WHEN AGE BETWEEN 51 and 55 THEN '51-55岁'
  575. WHEN AGE BETWEEN 56 and 60 THEN '56-60岁'
  576. WHEN AGE BETWEEN 61 and 65 THEN '61-65岁'
  577. WHEN AGE BETWEEN 66 and 70 THEN '66-70岁'
  578. WHEN AGE &gt;=71 THEN '71岁以上'
  579. when age is null then '没有年龄信息'
  580. end
  581. ) NAME FROM TAC_WORKER_B t
  582. where 1 = 1
  583. <include refid="choseSql"/>
  584. <if test="name != null and name != ''">
  585. AND NAME like '${name}%'
  586. </if>
  587. <if test="isOffice != null and isOffice != ''">
  588. AND IS_OFFICE = #{isOffice}
  589. </if>
  590. <if test="isExternal != null and isExternal != ''">
  591. AND IS_EXTERNAL = #{isExternal}
  592. </if>
  593. <if test="isTraining != null and isTraining != ''">
  594. AND IS_TRAINING = #{isTraining}
  595. </if>
  596. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  597. AND (IN_TM &gt;to_date(#{sttm},'yyyy-MM-dd') and in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd')+1)
  598. </if>
  599. <if test="groupType != null and groupType != ''">
  600. AND GROUP_TYPE in (${groupType})
  601. </if>
  602. <if test="roleType != null and roleType != ''">
  603. AND t.id in (select workerId from tac_worker_type where value in (${roleType}))
  604. </if>
  605. <if test="workAd!= null and workAd != ''">
  606. AND WORK_AD in (${workAd})
  607. </if>
  608. <if test="orgCode != null and orgCode != ''">
  609. AND ORG_CODE in (${orgCode})
  610. </if>
  611. <if test="education != null and education != ''">
  612. AND EDUCATION in (${education})
  613. </if>
  614. <if test="titles != null and titles != ''">
  615. AND TITLES in (${titles})
  616. </if>
  617. <if test="unitRanks != null and unitRanks != ''">
  618. AND UNIT_RANKS in (${unitRanks})
  619. </if>
  620. <if test="ageLimits != null and ageLimits != ''">
  621. ${ageLimits}
  622. </if>
  623. <if test="isAll != null and isAll != ''">
  624. ${isAll}
  625. </if>
  626. GROUP BY CASE WHEN AGE &lt;= 30 THEN '30岁以下'
  627. WHEN AGE BETWEEN 31 and 35 THEN '31-35岁'
  628. WHEN AGE BETWEEN 36 and 40 THEN '36-40岁'
  629. WHEN AGE BETWEEN 41 and 45 THEN '41-45岁'
  630. WHEN AGE BETWEEN 46 and 50 THEN '46-50岁'
  631. WHEN AGE BETWEEN 51 and 55 THEN '51-55岁'
  632. WHEN AGE BETWEEN 56 and 60 THEN '56-60岁'
  633. WHEN AGE BETWEEN 61 and 65 THEN '61-65岁'
  634. WHEN AGE BETWEEN 66 and 70 THEN '66-70岁'
  635. WHEN AGE &gt;=71 THEN '71岁以上'
  636. when age is null then '没有年龄信息' end
  637. </select>
  638. <select id="countByOffice" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam" resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  639. select count(*) count, IS_OFFICE CODE,
  640. (
  641. CASE WHEN IS_OFFICE = '1' THEN '在职'
  642. WHEN IS_OFFICE = '2' THEN '离职'
  643. end
  644. ) NAME FROM TAC_WORKER_B t
  645. where 1 = 1
  646. <include refid="choseSql"/>
  647. <if test="name != null and name != ''">
  648. AND NAME like '${name}%'
  649. </if>
  650. <if test="isOffice != null and isOffice != ''">
  651. AND IS_OFFICE = #{isOffice}
  652. </if>
  653. <if test="isExternal != null and isExternal != ''">
  654. AND IS_EXTERNAL = #{isExternal}
  655. </if>
  656. <if test="isTraining != null and isTraining != ''">
  657. AND IS_TRAINING = #{isTraining}
  658. </if>
  659. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  660. AND (IN_TM &gt;to_date(#{sttm},'yyyy-MM-dd') and in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd')+1)
  661. </if>
  662. <if test="groupType != null and groupType != ''">
  663. AND GROUP_TYPE in (${groupType})
  664. </if>
  665. <if test="roleType != null and roleType != ''">
  666. AND t.id in (select workerId from tac_worker_type where value in (${roleType}))
  667. </if>
  668. <if test="workAd!= null and workAd != ''">
  669. AND WORK_AD in (${workAd})
  670. </if>
  671. <if test="orgCode != null and orgCode != ''">
  672. AND ORG_CODE in (${orgCode})
  673. </if>
  674. <if test="education != null and education != ''">
  675. AND EDUCATION in (${education})
  676. </if>
  677. <if test="titles != null and titles != ''">
  678. AND TITLES in (${titles})
  679. </if>
  680. <if test="unitRanks != null and unitRanks != ''">
  681. AND UNIT_RANKS in (${unitRanks})
  682. </if>
  683. <if test="ageLimits != null and ageLimits != ''">
  684. ${ageLimits}
  685. </if>
  686. <if test="isAll != null and isAll != ''">
  687. ${isAll}
  688. </if>
  689. GROUP BY IS_OFFICE
  690. </select>
  691. <select id="getWorkerList" resultType="cn.com.goldenwater.dcproj.model.TacWorkerB" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam">
  692. select distinct t.* from (
  693. select t.*,case when b.count is null then 0 else b.count end as count from TAC_WORKER_B t
  694. left join (select * from tac_worker_type where type = '1' )p on t.id = p.workerId
  695. left join (select count(*) count,pers_id from TAC_INSP_YEAR_BATCH_GROUP_PERS group by pers_id) b on t.id = b.pers_id
  696. <if test="roleType != null and roleType != ''">
  697. where p.value = #{roleType}
  698. </if>
  699. ) t
  700. WHERE 1=1
  701. <include refid="choseSql"/>
  702. <if test="groupType != null and groupType != ''">
  703. and t.GROUP_TYPE = #{groupType}
  704. </if>
  705. <if test="newSize != null and newSize != ''">
  706. and t.count &lt;= #{newSize}
  707. </if>
  708. <if test="isAll != null and isAll != ''">
  709. and (${isAll})
  710. </if>
  711. <if test="yearBatchId != null and yearBatchId != ''">
  712. AND t.id not in (
  713. select t.pers_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t where t.year_batch_id = #{yearBatchId}
  714. <if test="roleType != null and roleType != ''">
  715. and t.ROLE_TYPE = #{roleType}
  716. </if>
  717. )
  718. </if>
  719. <if test="name != null and name != ''">
  720. And t.name like '%${name}%'
  721. </if>
  722. <if test="styr != null and enyr != null">
  723. AND t.id in (
  724. select t.pers_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t where t.year &gt;= #{styr} and t.year &lt; #{enyr}
  725. )
  726. </if>
  727. <if test="stba != null and enba != null">
  728. AND t.id in (
  729. select t.pers_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t where t.batch &gt;= #{stba} and t.batch &lt; #{enba}
  730. )
  731. </if>
  732. </select>
  733. <select id="getIsNotFitWorkerList" resultType="cn.com.goldenwater.dcproj.model.TacWorkerB" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam">
  734. select t.* from (
  735. select t.*,case when b.count is null then 0 else b.count end as count from TAC_WORKER_B t
  736. left join (select * from tac_worker_type where type = '1' ) p on t.id = p.workerId
  737. left join (select count(*) count,pers_id from TAC_INSP_YEAR_BATCH_GROUP_PERS group by pers_id) b on t.id = b.pers_id
  738. <if test="roleType != null and roleType != ''">
  739. where p.value = #{roleType}
  740. </if>
  741. ) t
  742. WHERE 1=1
  743. <include refid="choseSql"/>
  744. <if test="groupType != null and groupType != ''">
  745. and t.GROUP_TYPE = #{groupType}
  746. </if>
  747. <if test="isNew != null and isNew != ''">
  748. and t.count &gt; #{newSize}
  749. </if>
  750. <if test="isNotAll != null and isNotAll != ''">
  751. and (${isNotAll})
  752. </if>
  753. <if test="yearBatchId != null and yearBatchId != ''">
  754. AND t.id not in (
  755. select t.pers_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t where t.year_batch_id = #{yearBatchId}
  756. )
  757. </if>
  758. </select>
  759. <select id="getWorkerbsList" resultMap="tacWorkerBResultMap" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam">
  760. select t.* from TAC_WORKER_B t
  761. where 1 = 1
  762. <include refid="choseSql"/>
  763. <if test="name != null and name != ''">
  764. AND NAME like '${name}%'
  765. </if>
  766. <if test="isOffice != null and isOffice != ''">
  767. AND IS_OFFICE = #{isOffice}
  768. </if>
  769. <if test="isExternal != null and isExternal != ''">
  770. <choose>
  771. <when test='isExternal=="1"'>
  772. AND IS_EXTERNAL = #{isExternal}
  773. </when>
  774. <otherwise>
  775. AND (IS_EXTERNAL = #{isExternal} or IS_EXTERNAL is NULL)
  776. </otherwise>
  777. </choose>
  778. </if>
  779. <if test="isTraining != null and isTraining != ''">
  780. AND IS_TRAINING = #{isTraining}
  781. </if>
  782. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  783. AND (IN_TM &gt;to_date(#{sttm},'yyyy-MM-dd') and in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd')+1)
  784. </if>
  785. <if test="groupType != null and groupType != ''">
  786. AND GROUP_TYPE in (${groupType})
  787. </if>
  788. <if test="roleType != null and roleType != ''">
  789. AND t.id in (select workerId from tac_worker_type where value in (${roleType}))
  790. </if>
  791. <if test="workAd!= null and workAd != ''">
  792. AND WORK_AD in (${workAd})
  793. </if>
  794. <if test="orgCode != null and orgCode != ''">
  795. AND ORG_CODE in (${orgCode})
  796. </if>
  797. <if test="education != null and education != ''">
  798. AND EDUCATION in (${education})
  799. </if>
  800. <if test="titles != null and titles != ''">
  801. AND TITLES in (${titles})
  802. </if>
  803. <if test="unitRanks != null and unitRanks != ''">
  804. AND UNIT_RANKS in (${unitRanks})
  805. </if>
  806. <if test="ageLimits != null and ageLimits != ''">
  807. ${ageLimits}
  808. </if>
  809. <if test="isAll != null and isAll != ''">
  810. ${isAll}
  811. </if>
  812. <if test="workDpNm != null and workDpNm != ''">
  813. AND WORK_DP_NM LIKE '%${workDpNm}%'
  814. </if>
  815. <if test="professional != null and professional != ''">
  816. AND PROFESSIONAL LIKE '%${professional}%'
  817. </if>
  818. </select>
  819. <select id="countPersBatch" resultType="cn.com.goldenwater.dcproj.dto.TacWorkerBDto" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam">
  820. select t.name,t.sex,t.work_dp_nm,t.role_type,(case when ba.count is null then 0 else ba.count end )as count from TAC_WORKER_B t left join
  821. (
  822. select count(*) as count,b.pers_id from (
  823. select distinct p.year_batch_id,p.pers_id from
  824. TAC_INSP_YEAR_BATCH_GROUP_PERS p
  825. where 1=1
  826. <if test="year != null and year != 0">
  827. and p.year = #{year}
  828. </if>
  829. <if test="batch != null and batch != 0">
  830. and p.batch = #{batch}
  831. </if>
  832. ) b group by b.pers_id
  833. ) ba
  834. on t.id = ba.pers_id
  835. where 1=1
  836. <include refid="choseSql"/>
  837. <if test="roleType != null and roleType!= ''">
  838. AND t.id in (select workerId from tac_worker_type where value in (${roleType}))
  839. </if>
  840. <if test="groupType != null and groupType !=''">
  841. and t.group_type = #{groupType}
  842. </if>
  843. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  844. AND (IN_TM &gt;to_date(#{sttm},'yyyy-MM-dd') and in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd')+1)
  845. </if>
  846. </select>
  847. <select id="getWorkListByGroupId" resultType="cn.com.goldenwater.dcproj.model.TacWorkerB" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam">
  848. select p.role_type,t.name,t.id,p.IS_JOIN as "isJoin" from TAC_INSP_YEAR_BATCH_GROUP_PERS p left join TAC_WORKER_B t on t.id = p.pers_id
  849. left join tac_insp_year_batch h on p.year_batch_id=h.id
  850. where h.data_stat='0'
  851. <include refid="choseSql"/>
  852. <if test="groupId != null and groupId != ''">
  853. and p.GROUP_ID = #{groupId}
  854. </if>
  855. <if test="name != null and name != ''">
  856. and t.name like '%${name}%'
  857. </if>
  858. </select>
  859. <select id="getWorkerbsListById" resultType="cn.com.goldenwater.dcproj.model.TacWorkerB" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam">
  860. select DISTINCT t.* from TAC_WORKER_B t
  861. left join TAC_INSP_YEAR_BATCH_GROUP_PERS p on t.id = p.pers_id
  862. left join tac_insp_year_batch h on p.year_batch_id=h.id
  863. left join (select * from tac_worker_type where type = '1' ) a on t.id = a.workerId
  864. where h.data_stat='0'
  865. <include refid="choseSql"/>
  866. <if test="id != null and id !=''">
  867. AND t.id != #{id}
  868. </if>
  869. <if test="loginId != null and loginId != ''">
  870. AND t.login_id != loginId and p.group_id in (select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (select b.id from TAC_WORKER_B b where b.login_id = #{loginId})
  871. </if>
  872. <if test="persId != null and persId != ''">
  873. AND p.GROUP_ID in ( select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (select b.id from TAC_WORKER_B b where b.login_id = #{persId})
  874. )
  875. </if>
  876. <if test="groupId != null and groupId != ''">
  877. and p.GROUP_ID = #{groupId}
  878. </if>
  879. <if test="roleType != null and roleType != ''">
  880. and p.role_type = #{roleType}
  881. </if>
  882. <if test="yearBatchId != null and yearBatchId != ''">
  883. and p.YEAR_BATCH_ID = #{yearBatchId}
  884. </if>
  885. <if test="name != null and name != ''">
  886. and t.name like '%${name}%'
  887. </if>
  888. <if test="groupType != null and groupType != ''">
  889. and t.group_type = #{groupType}
  890. </if>
  891. </select>
  892. <select id="getWorkerbsListByYear" resultType="cn.com.goldenwater.dcproj.model.TacWorkerB" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam">
  893. select * from (
  894. SELECT t.ID, LOGIN_ID, NAME, SEX, AGE
  895. , BIRTHDATE, ID_NO, TELNUMB, MOBILENUMB, EMAIL
  896. , p.ROLE_TYPE, GROUP_TYPE, EDUCATION, IS_OFFICE, IS_TRAINING
  897. , RECOMMENDED_UNITS, WORK_AD, WORK_AD_NM, WORK_DP_NM, WORK_TREND_AD
  898. , WORK_TREND_NM, UNIT_RANKS, TITLES, DUTY, PROFESSIONAL
  899. , ORG_CODE, ORG_NM, EMGC_CNTCT, EMGC_CNTCT_PHONE, BANK_ACCOUNT
  900. , BANK_NAME, OE, RESUME, IS_A, IS_B
  901. , IS_C, IS_D, IS_E, IS_NEW, t.PERS_ID
  902. , t.IN_TM, t.UP_TM, t.DATA_STAT, PROVINCE, IS_CVL
  903. , l.syn_lot
  904. FROM TAC_WORKER_B t
  905. LEFT JOIN (
  906. SELECT *
  907. FROM TAC_YEAR_LOT t
  908. WHERE t.year = #{year}
  909. ) l
  910. ON t.id = l.pers_id
  911. LEFT JOIN TAC_INSP_YEAR_BATCH_GROUP_PERS p ON t.id = p.pers_id
  912. WHERE 1 = 1
  913. <if test="id != null and id !=''">
  914. AND t.id != id
  915. </if>
  916. <include refid="choseSql"/>
  917. <if test="groupId != null and groupId != ''">
  918. and p.GROUP_ID = #{groupId}
  919. </if>
  920. <if test="yearBatchId != null and yearBatchId != ''">
  921. and p.YEAR_BATCH_ID = #{yearBatchId}
  922. </if>
  923. )t
  924. <if test="orderBy != null and orderBy != ''">
  925. where t.syn_lot is not null
  926. order by ${orderBy}
  927. </if>
  928. </select>
  929. <select id="countByRoleNew" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam" resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
  930. select count(*) count, a.VALUE CODE,
  931. (
  932. CASE WHEN a.VALUE = '20' THEN '专家组长'
  933. WHEN a.VALUE = '19' THEN '助理'
  934. WHEN a.VALUE = '11' THEN '前期专家'
  935. WHEN a.VALUE = '12' THEN '建管专家'
  936. WHEN a.VALUE = '13' THEN '计划专家'
  937. WHEN a.VALUE = '14' THEN '财务专家'
  938. WHEN a.VALUE = '15' THEN '质量专家'
  939. WHEN a.VALUE = '16' THEN '安全专家'
  940. WHEN a.VALUE = '21' THEN '特派员'
  941. end
  942. ) NAME FROM (
  943. select w.* from (
  944. select w.*,case when ba.count is null then 0 else ba.count end as count from
  945. TAC_WORKER_B w left join
  946. (
  947. select count(*) as count,b.pers_id from (
  948. select distinct p.year_batch_id,p.pers_id from
  949. TAC_INSP_YEAR_BATCH_GROUP_PERS p
  950. ) b group by b.pers_id
  951. ) ba
  952. on w.id = ba.pers_id
  953. ) w where 1 = 1
  954. and w.count &lt;= #{newSize}
  955. ) t
  956. left join (select * from tac_worker_type where type = '1' ) a on t.id = a.workerId
  957. where a.id is not NULL
  958. <include refid="choseSql"/>
  959. group by a.VALUE
  960. </select>
  961. <select id="getNotDisPersList" resultType="cn.com.goldenwater.dcproj.model.TacWorkerB" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam">
  962. select distinct b.* from TAC_INSP_YEAR_BATCH_GROUP_PERS t left join TAC_WORKER_B b on t.pers_id = b.id
  963. where t.year_batch_id =#{yearBatchId}
  964. <if test="roleType != null and roleType != ''">
  965. AND t.role_type = #{roleType}
  966. </if>
  967. <if test="name != null and name != ''">
  968. AND b.name like '%${name}%'
  969. </if>
  970. <if test="groupId != null and groupId != ''">
  971. AND case when t.group_id is null then '0' else t.group_id end != #{groupId}
  972. </if>
  973. <if test="workerIds != null and workerIds != ''">
  974. AND t.pers_id not in (${workerIds})
  975. </if>
  976. <trim>
  977. <choose>
  978. <when test="province !=null and province !=''">
  979. AND b.PROVINCE=#{province}
  980. </when>
  981. <otherwise>
  982. AND b.PROVINCE is null
  983. </otherwise>
  984. </choose>
  985. </trim>
  986. and b.id is not null
  987. </select>
  988. <select id="getObjTacWorkerbList" resultType="cn.com.goldenwater.dcproj.model.TacWorkerB" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam">
  989. select b.* from TAC_INSP_YEAR_BATCH_GROUP_PERS t left join TAC_WORKER_B b on t.pers_id = b.id
  990. where 1=1
  991. and REGEXP_LIKE(
  992. t.group_id,'^('||
  993. ( case when(SELECT count(group_id) from TAC_INSP_YEAR_BATCH_GROUP_PERS WHERE PERS_ID =#{persId})>0 then
  994. (SELECT LISTAGG(group_id, '|') as
  995. id FROM TAC_INSP_YEAR_BATCH_GROUP_PERS WHERE PERS_ID =#{persId} GROUP BY PERSID)
  996. else (select 'non' from dual) end)
  997. ||')')
  998. <if test='isLevel != null and isLevel == "yearBatch"' >
  999. and t.group_id is null
  1000. </if>
  1001. <trim>
  1002. <choose>
  1003. <when test="province !=null and province !=''">
  1004. AND b.PROVINCE=#{province}
  1005. </when>
  1006. <otherwise>
  1007. AND b.PROVINCE is null
  1008. </otherwise>
  1009. </choose>
  1010. </trim>
  1011. <if test="year != null and year != ''">
  1012. And t.year = #{year}
  1013. </if>
  1014. <if test="batch != null and batch != ''">
  1015. ANd t.batch = #{batch}
  1016. </if>
  1017. <if test="yearBatchId != null and yearBatchId != ''">
  1018. And t.year_batch_id = #{yearBatchId}
  1019. </if>
  1020. <if test="groupId != null and groupId != ''">
  1021. AND t.group_id = #{groupId}
  1022. </if>
  1023. </select>
  1024. <select id="countWorkerAudit" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam" resultType="cn.com.goldenwater.dcproj.dto.TacWorkerbAuditDto">
  1025. select a.count,b.* from (
  1026. select t.pers_id,count(t.GROUP_ID) count from tac_insp_year_batch_group_pers t,TAC_INSP_YEAR_BATCH j
  1027. where t.year_batch_id=j.id and t.pers_id is not null and j.data_stat='0'
  1028. <if test="years != null and years != ''">
  1029. and t.year in (${years})
  1030. </if>
  1031. <if test="year != null">
  1032. and t.year = #{year}
  1033. </if>
  1034. <if test="batch != null">
  1035. and t.batch = #{batch}
  1036. </if>
  1037. <if test="batchs != null and batchs != ''">
  1038. and t.batch in $(batchs)
  1039. </if>
  1040. <if test="roleType != null and roleType != ''">
  1041. AND ROLE_TYPE in (${roleType})
  1042. </if>
  1043. group by t.pers_id
  1044. ) a left join tac_worker_b b on a.pers_id = b.id
  1045. where b.id is not null ORDER BY B.COUNT DESC
  1046. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  1047. AND (b.IN_TM &gt;to_date(#{sttm},'yyyy-MM-dd') and b.in_tm &lt; to_date(#{entm}, 'yyyy-MM-dd')+1)
  1048. </if>
  1049. <if test="groupType != null and groupType != ''">
  1050. AND b.GROUP_TYPE in (${groupType})
  1051. </if>
  1052. <trim>
  1053. <choose>
  1054. <when test="province !=null and province !=''">
  1055. AND b.PROVINCE=#{province}
  1056. </when>
  1057. <otherwise>
  1058. AND b.PROVINCE is null
  1059. </otherwise>
  1060. </choose>
  1061. </trim>
  1062. <if test="name != null and name != ''">
  1063. and b.name like '%${name}%'
  1064. </if>
  1065. </select>
  1066. <select id="getWorkerNotJoinCountList" resultType="cn.com.goldenwater.dcproj.dto.TacWorkerBCountDto" parameterType="cn.com.goldenwater.dcproj.param.TacWorkerBParam">
  1067. select a.timeoutCount ,a.refuseCount,a.year,b.* from (
  1068. select t.year,t.pers_id2,count(*) as count,sum(case when t.nin_reason = '回复超时' then 1 else 0 end) as timeoutCount,sum(case when t.nin_reason = '回复不参加' then 1 else 0 end) as refuseCount from TAC_INSP_YEAR_BATCH_REASON t where t.nin_reason is not null and t.nin_reason != '其他原因'
  1069. <if test="year != null">
  1070. and t.year = #{year}
  1071. </if>
  1072. <if test="roleType != null and roleType != ''">
  1073. and t.role_type in (${roleType})
  1074. </if>
  1075. group by t.year,t.pers_id2
  1076. order by t.year DESC
  1077. ) a left join tac_worker_b b on a.pers_id2 = b.id where b.id is not null
  1078. <if test="name != null and name != ''">
  1079. and b.name like '%${name}%'
  1080. </if>
  1081. <if test="groupType != null and groupType != ''">
  1082. and b.group_type in (${groupType})
  1083. </if>
  1084. <trim>
  1085. <choose>
  1086. <when test="province !=null and province !=''">
  1087. AND b.PROVINCE=#{province}
  1088. </when>
  1089. <otherwise>
  1090. AND b.PROVINCE is null
  1091. </otherwise>
  1092. </choose>
  1093. </trim>
  1094. </select>
  1095. <select id="listByMap" parameterType="java.util.Map" resultType="cn.com.goldenwater.dcproj.dto.TacWorkerPerDto">
  1096. select DISTINCT
  1097. P.ID,
  1098. P.LOGIN_ID,
  1099. P.NAME,
  1100. P.SEX,
  1101. P.AGE,
  1102. P.BIRTHDATE,
  1103. P.ID_NO,
  1104. P.TELNUMB,
  1105. P.MOBILENUMB,
  1106. P.EMAIL,
  1107. P.ROLE_TYPE,
  1108. P.GROUP_TYPE,
  1109. P.EDUCATION,
  1110. P.IS_OFFICE,
  1111. P.IS_EXTERNAL,
  1112. P.IS_TRAINING,
  1113. P.RECOMMENDED_UNITS,
  1114. P.WORK_AD,
  1115. P.WORK_AD_NM,
  1116. P.WORK_DP_NM,
  1117. P.WORK_TREND_AD,
  1118. P.WORK_TREND_NM,
  1119. P.UNIT_RANKS,
  1120. P.TITLES,
  1121. P.DUTY,
  1122. P.PROFESSIONAL,
  1123. P.ORG_CODE,
  1124. P.ORG_NM,
  1125. P.EMGC_CNTCT,
  1126. P.EMGC_CNTCT_PHONE,
  1127. P.BANK_ACCOUNT,
  1128. P.BANK_NAME,
  1129. P.OE,
  1130. P.RESUME,
  1131. P.IS_A,
  1132. P.IS_B,
  1133. P.IS_C,
  1134. P.IS_D,
  1135. P.IS_E,
  1136. P.IS_NEW,
  1137. P.PERS_ID,
  1138. P.IN_TM,
  1139. P.UP_TM,
  1140. P.DATA_STAT
  1141. FROM TAC_WORKER_B P
  1142. JOIN TAC_INSP_YEAR_BATCH_OBJ L ON P.LOGIN_ID = L.PERS_ID
  1143. JOIN TAC_INSP_YEAR_BATCH_AREA N ON N.GROUP_ID = L.GROUP_ID
  1144. <where>
  1145. <if test="province != null and province != ''">
  1146. and N.PROVINCE = #{province}
  1147. </if>
  1148. <if test="name != null and name != ''">
  1149. and P.NAME like '%' || #{name} || '%'
  1150. </if>
  1151. <if test="dataStat != null and dataStat != ''">
  1152. and P.dataStat = 0
  1153. </if>
  1154. </where>
  1155. </select>
  1156. <select id="findListExist" resultType="cn.com.goldenwater.dcproj.model.TacWorkerB">
  1157. select * from TAC_WORKER_B where (ID_NO = #{idNo} or MOBILENUMB = #{mobilenumb})
  1158. <if test="id != null and id != ''">and ID &lt;&gt; #{id}</if>
  1159. </select>
  1160. </mapper>