TacEvaluationExternalExpertDao.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="cn.com.goldenwater.dcproj.dao.TacEvaluationExternalExpertDao">
  6. <resultMap type="cn.com.goldenwater.dcproj.model.TacEvaluationExternalExpert" id="tacEvaluationExternalExpertResultMap">
  7. <result property="id" column="ID" />
  8. <result property="orgId" column="ORG_ID" />
  9. <result property="adCode" column="AD_CODE" />
  10. <result property="batchYear" column="BATCH_YEAR" />
  11. <result property="batchNum" column="BATCH_NUM" />
  12. <result property="groupId" column="GROUP_ID" />
  13. <result property="projId" column="PROJ_ID" />
  14. <result property="expertId" column="EXPERT_ID" />
  15. <result property="expertName" column="EXPERT_NAME" />
  16. <result property="expertProf" column="EXPERT_PROF" />
  17. <result property="businessLevel" column="BUSINESS_LEVEL" />
  18. <result property="qualityResults" column="QUALITY_RESULTS" />
  19. <result property="workStyle" column="WORK_STYLE" />
  20. <result property="oneVeto" column="ONE_VETO" />
  21. <result property="score" column="SCORE" />
  22. <result property="evalLevel" column="EVAL_LEVEL" />
  23. <result property="note" column="NOTE" />
  24. <result property="backUp" column="BACKUP" />
  25. <result property="persId" column="PERS_ID" />
  26. <result property="intm" column="INTM" />
  27. <result property="uptm" column="UPTM" />
  28. </resultMap>
  29. <!-- 数据库表字段列表 table_columns -->
  30. <sql id="table_columns">
  31. ID,
  32. ORG_ID,
  33. AD_CODE,
  34. GROUP_ID,
  35. PROJ_ID,
  36. EXPERT_ID,
  37. EXPERT_NAME,
  38. EXPERT_PROF,
  39. BUSINESS_LEVEL,
  40. QUALITY_RESULTS,
  41. WORK_STYLE,
  42. ONE_VETO,
  43. SCORE,
  44. EVAL_LEVEL,
  45. NOTE,
  46. PERS_ID,
  47. INTM,
  48. UPTM
  49. </sql>
  50. <!-- 实体类属性 列表 entity_properties -->
  51. <sql id="entity_properties">
  52. #{id},
  53. #{orgId},
  54. #{adCode},
  55. #{groupId},
  56. #{projId},
  57. #{expertId},
  58. #{expertName},
  59. #{expertProf},
  60. #{businessLevel},
  61. #{qualityResults},
  62. #{workStyle},
  63. #{oneVeto},
  64. #{score},
  65. #{evalLevel},
  66. #{note},
  67. #{persId},
  68. #{intm},
  69. #{uptm}
  70. </sql>
  71. <!-- 实体类属性 列表 entity_properties_item for循环使用 -->
  72. <sql id="entity_properties_item">
  73. #{item.id} as ID ,
  74. #{item.orgId} as ORG_ID ,
  75. #{item.adCode} as AD_CODE ,
  76. #{item.groupId} as GROUP_ID ,
  77. #{item.projId} as PROJ_ID ,
  78. #{item.expertId} as EXPERT_ID ,
  79. #{item.expertName} as EXPERT_NAME ,
  80. #{item.expertProf} as EXPERT_PROF ,
  81. #{item.businessLevel} as BUSINESS_LEVEL ,
  82. #{item.qualityResults} as QUALITY_RESULTS ,
  83. #{item.workStyle} as WORK_STYLE ,
  84. #{item.oneVeto} as ONE_VETO ,
  85. #{item.score} as SCORE ,
  86. #{item.evalLevel} as EVAL_LEVEL ,
  87. #{item.note} as NOTE ,
  88. #{item.persId} as PERS_ID ,
  89. #{item.intm} as INTM ,
  90. #{item.uptm} as UPTM
  91. </sql>
  92. <!-- 查询条件 -->
  93. <sql id="page_where">
  94. <trim prefix="where" prefixOverrides="and | or ">
  95. <if test='orgId != null and orgId != ""'> and ORG_ID = #{orgId}</if>
  96. <if test='adCode != null and adCode != ""'> and AD_CODE like '${adCode}%'</if>
  97. <if test='groupId != null and groupId != ""'> and GROUP_ID = #{groupId}</if>
  98. <if test='projId != null and projId != ""'> and PROJ_ID = #{projId}</if>
  99. <if test='expertId != null and expertId != ""'> and EXPERT_ID = #{expertId}</if>
  100. <if test='expertName != null and expertName != ""'> and EXPERT_NAME like '%${expertName}%'</if>
  101. <if test='expertProf != null and expertProf != ""'>
  102. and
  103. <foreach collection="expertProf.split(',')" index="index" item="item" separator="or" open="(" close=")">
  104. LOCATE(CONCAT(',',${item},',') , CONCAT(',',EXPERT_PROF,',') ) &gt; 0
  105. </foreach>
  106. </if>
  107. <if test='businessLevel != null '> and BUSINESS_LEVEL = #{businessLevel}</if>
  108. <if test='qualityResults != null '> and QUALITY_RESULTS = #{qualityResults}</if>
  109. <if test='workStyle != null '> and WORK_STYLE = #{workStyle}</if>
  110. <if test='oneVeto != null and oneVeto != ""'> and ONE_VETO = #{oneVeto}</if>
  111. <if test='score != null '> and SCORE = #{score}</if>
  112. <if test='evalLevel != null and evalLevel != ""'> and EVAL_LEVEL = #{evalLevel}</if>
  113. <if test='note != null and note != ""'> and NOTE = #{note}</if>
  114. <if test='persId != null and persId != ""'> and PERS_ID = #{persId}</if>
  115. <if test='intm != null '> and DATE_FORMAT(INTM,'%Y-%m-%d') = DATE_FORMAT(#{intm},'%Y-%m-%d')</if>
  116. <if test='uptm != null '> and UPTM = #{uptm}</if>
  117. <if test='null != batchYear and "" != batchYear '>
  118. and GROUP_ID in ( select GROUP_ID from TAC_INSP_YEAR_BATCH_GROUP_PERS where YEAR = #{batchYear} and GROUP_ID is not null )
  119. </if>
  120. </trim>
  121. </sql>
  122. <!-- 根据Id查询 -->
  123. <select id="get" resultMap="tacEvaluationExternalExpertResultMap" parameterType="String">
  124. select
  125. <include refid="table_columns"/>,BACKUP
  126. from TAC_EVALUATION_EXTERNAL_EXPERT where ID = #{id}
  127. </select>
  128. <!-- 根据条件筛选查询 -->
  129. <select id="getBy" resultMap="tacEvaluationExternalExpertResultMap" parameterType="cn.com.goldenwater.dcproj.param.TacEvaluationExternalExpertParam">
  130. select
  131. <include refid="table_columns"/>
  132. from TAC_EVALUATION_EXTERNAL_EXPERT
  133. <include refid="page_where"/>
  134. </select>
  135. <!-- 查询所有 -->
  136. <select id="findAll" resultMap="tacEvaluationExternalExpertResultMap">
  137. select
  138. <include refid="table_columns"/>
  139. from TAC_EVALUATION_EXTERNAL_EXPERT
  140. </select>
  141. <!-- 根据条件筛选 查询所有 -->
  142. <select id="findList" resultMap="tacEvaluationExternalExpertResultMap" parameterType="cn.com.goldenwater.dcproj.param.TacEvaluationExternalExpertParam">
  143. select
  144. <include refid="table_columns"/>
  145. from TAC_EVALUATION_EXTERNAL_EXPERT
  146. <include refid="page_where"/>
  147. </select>
  148. <!-- 根据条件筛选 统计记录数 -->
  149. <select id="selectCount" resultType="int" parameterType="cn.com.goldenwater.dcproj.param.TacEvaluationExternalExpertParam">
  150. select count( ID ) from TAC_EVALUATION_EXTERNAL_EXPERT
  151. <include refid="page_where"/>
  152. </select>
  153. <!-- 添加 -->
  154. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacEvaluationExternalExpert" >
  155. insert into TAC_EVALUATION_EXTERNAL_EXPERT(
  156. <include refid="table_columns"/>
  157. )
  158. values (
  159. <include refid="entity_properties"/>
  160. )
  161. </insert>
  162. <!-- 批量添加 -->
  163. <insert id="insertBatchFile" parameterType="java.util.List" useGeneratedKeys="false">
  164. insert into TAC_EVALUATION_EXTERNAL_EXPERT
  165. (<include refid="table_columns"/>)
  166. select t.* from (
  167. <foreach item="item" index="index" collection="list" separator="union all">
  168. select <include refid="entity_properties_item"/> from dual
  169. </foreach>
  170. ) t
  171. </insert>
  172. <!-- 主键删除 -->
  173. <delete id="delete" parameterType="java.lang.String">
  174. update TAC_EVALUATION_EXTERNAL_EXPERT set DATA_STAT='9' where ID = #{id}
  175. </delete>
  176. <!-- 条件删除 -->
  177. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacEvaluationExternalExpert">
  178. update TAC_EVALUATION_EXTERNAL_EXPERT set DATA_STAT='9'
  179. <include refid="page_where"/>
  180. </delete>
  181. <!-- 逻辑删除 -->
  182. <update id="deleteInFlag" parameterType="java.lang.String">
  183. update TAC_EVALUATION_EXTERNAL_EXPERT set DATA_STAT = '9' where ID = #{id}
  184. </update>
  185. <!-- 主键更新 -->
  186. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacEvaluationExternalExpert">
  187. update TAC_EVALUATION_EXTERNAL_EXPERT
  188. <trim prefix="SET" suffixOverrides=",">
  189. <if test='orgId != null'>ORG_ID = #{orgId},</if>
  190. <if test='adCode != null'>AD_CODE = #{adCode},</if>
  191. <if test='groupId != null'>GROUP_ID = #{groupId},</if>
  192. <if test='projId != null'>PROJ_ID = #{projId},</if>
  193. <if test='expertId != null'>EXPERT_ID = #{expertId},</if>
  194. <if test='expertName != null'>EXPERT_NAME = #{expertName},</if>
  195. <if test='expertProf != null'>EXPERT_PROF = #{expertProf},</if>
  196. <if test='businessLevel != null'>BUSINESS_LEVEL = #{businessLevel},</if>
  197. <if test='qualityResults != null'>QUALITY_RESULTS = #{qualityResults},</if>
  198. <if test='workStyle != null'>WORK_STYLE = #{workStyle},</if>
  199. <if test='oneVeto != null'>ONE_VETO = #{oneVeto},</if>
  200. <if test='score != null'>SCORE = #{score}, BACKUP = null,</if>
  201. <if test='evalLevel != null'>EVAL_LEVEL = #{evalLevel},</if>
  202. <if test='note != null'>NOTE = #{note},</if>
  203. <if test='uptm != null'>UPTM = #{uptm},</if>
  204. </trim>
  205. where ID = #{id}
  206. </update>
  207. <!-- 条件更新 -->
  208. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacEvaluationExternalExpert">
  209. update TAC_EVALUATION_EXTERNAL_EXPERT
  210. <trim prefix="SET" suffixOverrides=",">
  211. <if test='orgId != null'>ORG_ID = #{orgId},</if>
  212. <if test='adCode != null'>AD_CODE = #{adCode},</if>
  213. <if test='groupId != null'>GROUP_ID = #{groupId},</if>
  214. <if test='projId != null'>PROJ_ID = #{projId},</if>
  215. <if test='expertId != null'>EXPERT_ID = #{expertId},</if>
  216. <if test='expertName != null'>EXPERT_NAME = #{expertName},</if>
  217. <if test='expertProf != null'>EXPERT_PROF = #{expertProf},</if>
  218. <if test='businessLevel != null'>BUSINESS_LEVEL = #{businessLevel},</if>
  219. <if test='qualityResults != null'>QUALITY_RESULTS = #{qualityResults},</if>
  220. <if test='workStyle != null'>WORK_STYLE = #{workStyle},</if>
  221. <if test='oneVeto != null'>ONE_VETO = #{oneVeto},</if>
  222. <if test='score != null'>SCORE = #{score}, BACKUP = null,</if>
  223. <if test='evalLevel != null'>EVAL_LEVEL = #{evalLevel},</if>
  224. <if test='note != null'>NOTE = #{note},</if>
  225. <if test='uptm != null'>UPTM = #{uptm},</if>
  226. </trim>
  227. <include refid="page_where"/>
  228. </update>
  229. <!-- 其他自定义SQL -->
  230. <!-- 查询小组里的人员列表 筛选出角色为 稽查专家、稽查助理、稽查组长、稽查特派员 -->
  231. <resultMap type="cn.com.goldenwater.dcproj.vo.TacEvaluationExternalExpertVo" id="tacEvaluationExternalExpertResultVoMap">
  232. <result property="id" column="ID" />
  233. <result property="groupId" column="GROUP_ID" />
  234. <result property="projId" column="PROJ_ID" />
  235. <result property="projName" column="PROJ_NM" />
  236. <result property="expertId" column="EXPERT_ID" />
  237. <result property="expertName" column="EXPERT_NAME" />
  238. <result property="mobilenumb" column="MOBILENUMB" />
  239. <result property="expertProf" column="EXPERT_PROF" />
  240. <result property="freq" column="FREQ" />
  241. <result property="businessLevel" column="BUSINESS_LEVEL" />
  242. <result property="qualityResults" column="QUALITY_RESULTS" />
  243. <result property="workStyle" column="WORK_STYLE" />
  244. <result property="oneVeto" column="ONE_VETO" />
  245. <result property="score" column="SCORE" />
  246. <result property="evalLevel" column="EVAL_LEVEL" />
  247. <result property="note" column="NOTE" />
  248. <result property="persId" column="PERS_ID" />
  249. <result property="grader" column="GRADER" />
  250. <result property="intm" column="INTM" />
  251. <result property="jctm" column="JCTM" />
  252. <result property="modifyFlag" column="MODIFYFLAG" />
  253. <result property="backUp" column="BACKUP" />
  254. </resultMap>
  255. <select id="selectEavlPersListByGroupId" parameterType="cn.com.goldenwater.dcproj.param.TacEvaluationExternalExpertParam" resultMap="tacEvaluationExternalExpertResultVoMap">
  256. select eee.ID as ID, r.GROUP_ID, r.PERS_ID as EXPERT_ID, r.PERS_NM as EXPERT_NAME , r.ROLE_TYPE as EXPERT_PROF,
  257. eee.BUSINESS_LEVEL , eee.QUALITY_RESULTS, eee.WORK_STYLE, eee.ONE_VETO, eee.SCORE , eee.EVAL_LEVEL , eee.NOTE
  258. from (
  259. select t.GROUP_ID, t.PERS_ID ,t.PERS_NM,
  260. GROUP_CONCAT(t.ROLE_TYPE order by t.ROLE_TYPE asc SEPARATOR ',') as ROLE_TYPE
  261. from ( select
  262. iybgp.GROUP_ID,
  263. wb.LOGIN_ID as PERS_ID,
  264. iybgp.ROLE_TYPE,
  265. wb.NAME as PERS_NM
  266. from TAC_INSP_YEAR_BATCH_GROUP_PERS iybgp
  267. ,TAC_WORKER_B wb
  268. where iybgp.DATA_STAT = '0'
  269. and wb.ID = iybgp.PERS_ID
  270. and iybgp.GROUP_ID = #{groupId}
  271. <!-- 稽查专家 -->
  272. and iybgp.ROLE_TYPE in ('11','12','13','14','15','16')
  273. <!-- 外聘稽查专家 isExternal 是否外聘 0否 1是 -->
  274. and wb.IS_EXTERNAL = '1'
  275. ) t
  276. group by t.GROUP_ID, t.PERS_ID ,t.PERS_NM
  277. ) r
  278. left join TAC_EVALUATION_EXTERNAL_EXPERT eee on eee.GROUP_ID = r.GROUP_ID and eee.EXPERT_ID = r.PERS_ID and eee.PERS_ID = #{persId}
  279. <if test='null != projId and "" != projId'>
  280. and eee.PROJ_ID = #{projId}
  281. </if>
  282. </select>
  283. <!-- 查询外聘专家的测评结果 -->
  284. <select id="findEvaluationResult" parameterType="cn.com.goldenwater.dcproj.param.TacEvaluationExternalExpertParam" resultMap="tacEvaluationExternalExpertResultVoMap">
  285. select t.* , wb.MOBILENUMB, wb.ROLE_TYPE as EXPERT_PROF
  286. from (select count(ID) as FREQ , round(avg(SCORE),2) as SCORE ,EXPERT_ID ,EXPERT_NAME
  287. from TAC_EVALUATION_EXTERNAL_EXPERT
  288. <trim prefix="where" prefixOverrides="and | or ">
  289. <if test='orgId != null and orgId != ""'> and ORG_ID = #{orgId}</if>
  290. <if test='adCode != null and adCode != ""'> and AD_CODE like '${adCode}%'</if>
  291. <if test='groupId != null and groupId != ""'> and GROUP_ID = #{groupId}</if>
  292. <if test='projId != null and projId != ""'> and PROJ_ID = #{projId}</if>
  293. <if test='expertId != null and expertId != ""'> and EXPERT_ID = #{expertId}</if>
  294. <if test='expertName != null and expertName != ""'> and EXPERT_NAME like '%${expertName}%'</if>
  295. <if test='businessLevel != null '> and BUSINESS_LEVEL = #{businessLevel}</if>
  296. <if test='qualityResults != null '> and QUALITY_RESULTS = #{qualityResults}</if>
  297. <if test='workStyle != null '> and WORK_STYLE = #{workStyle}</if>
  298. <if test='oneVeto != null and oneVeto != ""'> and ONE_VETO = #{oneVeto}</if>
  299. <if test='score != null '> and SCORE = #{score}</if>
  300. <if test='evalLevel != null and evalLevel != ""'> and EVAL_LEVEL = #{evalLevel}</if>
  301. <if test='note != null and note != ""'> and NOTE = #{note}</if>
  302. <if test='persId != null and persId != ""'> and PERS_ID = #{persId}</if>
  303. <if test='intm != null '> and DATE_FORMAT(INTM,'%Y-%m-%d') = DATE_FORMAT(#{intm},'%Y-%m-%d')</if>
  304. <if test='uptm != null '> and UPTM = #{uptm}</if>
  305. <if test='null != batchYear and "" != batchYear '>
  306. and GROUP_ID in ( select GROUP_ID from TAC_INSP_YEAR_BATCH_GROUP_PERS where YEAR = #{batchYear} and GROUP_ID is not null )
  307. </if>
  308. </trim>
  309. group by EXPERT_ID ,EXPERT_NAME )t
  310. left join tac_worker_b wb on wb.ID = t.EXPERT_ID
  311. <trim prefix="where" prefixOverrides="and | or ">
  312. 1=1
  313. <if test='null !=mobilenumb and ""!= mobilenumb '>
  314. and wb.MOBILENUMB like '%${mobilenumb}%'
  315. </if>
  316. <if test='expertProf != null and expertProf != ""'>
  317. and
  318. <foreach collection="expertProf.split(',')" index="index" item="item" separator="or" open="(" close=")">
  319. LOCATE(CONCAT(',',${item},',') , CONCAT(',',wb.ROLE_TYPE,',') ) &gt; 0
  320. </foreach>
  321. </if>
  322. </trim>
  323. order by t.SCORE desc
  324. </select>
  325. <select id="findEvaluationResult2" parameterType="cn.com.goldenwater.dcproj.param.TacEvaluationExternalExpertParam" resultMap="tacEvaluationExternalExpertResultVoMap">
  326. select t.* from (
  327. select a.EXPERT_ID,b.NAME as EXPERT_NAME,b.MOBILENUMB,b.ROLE_TYPE as EXPERT_PROF,a.SCORE as SCORE,c.YEAR,
  328. (select count(ID) as FREQ from TAC_EVALUATION_EXTERNAL_EXPERT where PERS_ID is null and EXPERT_ID=a.EXPERT_ID) as FREQ
  329. from (
  330. select round(avg(SCORE),2) as SCORE, EXPERT_ID from TAC_EVALUATION_EXTERNAL_EXPERT where PERS_ID is null
  331. group by EXPERT_ID
  332. ) a left join TAC_WORKER_B b on a.EXPERT_ID=b.LOGIN_ID
  333. left join (
  334. select distinct a.EXPERT_ID,c.YEAR from TAC_EVALUATION_EXTERNAL_EXPERT a
  335. left join TAC_PAWP_RGSTR b on a.PROJ_ID=b.OBJ_ID
  336. left join TAC_INSP_YEAR_BATCH_GROUP_PERS c on b.GROUP_ID=c.GROUP_ID
  337. where a.PERS_ID is null
  338. ) c on a.EXPERT_ID=c.EXPERT_ID
  339. ) t
  340. where 1=1
  341. <if test='expertName != null and expertName != ""'> and t.EXPERT_NAME like '%${expertName}%'</if>
  342. <if test='null !=mobilenumb and ""!= mobilenumb '> and t.MOBILENUMB like '%${mobilenumb}%'</if>
  343. <if test='expertProf != null and expertProf != ""'>
  344. and
  345. <foreach collection="expertProf.split(',')" index="index" item="item" separator="or" open="(" close=")">
  346. LOCATE(CONCAT(',',${item},',') , CONCAT(',',t.EXPERT_PROF,',') ) &gt; 0
  347. </foreach>
  348. </if>
  349. <if test='null != batchYear and "" != batchYear '> and t.YEAR = #{batchYear}</if>
  350. order by t.SCORE desc
  351. </select>
  352. <!-- 查询外聘专家的测评记录 -->
  353. <select id="findEvaluationResultDetails" parameterType="cn.com.goldenwater.dcproj.param.TacEvaluationExternalExpertParam" resultMap="tacEvaluationExternalExpertResultVoMap">
  354. select
  355. eee.ID,
  356. eee.ORG_ID,
  357. eee.AD_CODE,
  358. eee.GROUP_ID,
  359. eee.PROJ_ID,
  360. eee.EXPERT_ID,
  361. eee.EXPERT_NAME,
  362. eee.EXPERT_PROF,
  363. eee.BUSINESS_LEVEL,
  364. eee.QUALITY_RESULTS,
  365. eee.WORK_STYLE,
  366. eee.ONE_VETO,
  367. eee.SCORE,
  368. eee.EVAL_LEVEL,
  369. eee.NOTE,
  370. eee.PERS_ID,
  371. eee.INTM,
  372. eee.BACKUP,
  373. iybo.OJB_NM as PROJ_NM
  374. <if test='null == projId or "" == projId'>
  375. ,CONCAT(DATE_FORMAT(iybg.ST_TM,'%Y-%m-%d'),'至',DATE_FORMAT(iybg.EN_TM ,'%Y-%m-%d')) as JCTM
  376. ,(CASE WHEN eee.BACKUP is null THEN '0' ELSE '1' END) AS "MODIFYFLAG"
  377. </if>
  378. <if test='projId != null and projId != ""'>
  379. ,twb.NAME as GRADER
  380. </if>
  381. from TAC_EVALUATION_EXTERNAL_EXPERT eee
  382. left join TAC_INSP_YEAR_BATCH_OBJ iybo on iybo.ID = eee.PROJ_ID and iybo.DATA_STAT='0'
  383. <if test=' null == projId or "" == projId'>
  384. left join TAC_INSP_YEAR_BATCH_GROUP iybg on iybg.ID = eee.GROUP_ID
  385. </if>
  386. <if test='projId != null and projId != ""'>
  387. left join TAC_WORKER_B twb on twb.LOGIN_ID = eee.PERS_ID
  388. </if>
  389. <trim prefix="where" prefixOverrides="and | or ">
  390. <if test='orgId != null and orgId != ""'> and eee.ORG_ID = #{orgId}</if>
  391. <if test='adCode != null and adCode != ""'> and eee.AD_CODE like '${adCode}%'</if>
  392. <if test='groupId != null and groupId != ""'> and eee.GROUP_ID = #{groupId}</if>
  393. <if test='projId != null and projId != ""'> and eee.PROJ_ID = #{projId}</if>
  394. <if test='expertId != null and expertId != ""'> and eee.EXPERT_ID = #{expertId}</if>
  395. <if test='expertName != null and expertName != ""'> and eee.EXPERT_NAME like '%${expertName}%'</if>
  396. <if test='expertProf != null and expertProf != ""'>
  397. and
  398. <foreach collection="expertProf.split(',')" index="index" item="item" separator="or" open="(" close=")">
  399. LOCATE(CONCAT(',',#{item},','), CONCAT(',',eee.EXPERT_PROF,',')) &gt; 0
  400. </foreach>
  401. </if>
  402. <if test='businessLevel != null '> and eee.BUSINESS_LEVEL = #{businessLevel}</if>
  403. <if test='qualityResults != null '> and eee.QUALITY_RESULTS = #{qualityResults}</if>
  404. <if test='workStyle != null '> and eee.WORK_STYLE = #{workStyle}</if>
  405. <if test='oneVeto != null and oneVeto != ""'> and eee.ONE_VETO = #{oneVeto}</if>
  406. <if test='score != null '> and eee.SCORE = #{score}</if>
  407. <if test='evalLevel != null and evalLevel != ""'> and eee.EVAL_LEVEL = #{evalLevel}</if>
  408. <if test='persId != null and persId != ""'> and eee.PERS_ID = #{persId}</if>
  409. <if test='intm != null '> and DATE_FORMAT(eee.INTM,'%Y-%m-%d') = DATE_FORMAT(#{intm},'%Y-%m-%d')</if>
  410. </trim>
  411. </select>
  412. <select id="findEvaluationResultDetails2" parameterType="java.lang.String" resultMap="tacEvaluationExternalExpertResultVoMap">
  413. select
  414. eee.ID,eee.PROJ_ID,eee.PERS_ID,eee.ONE_VETO,eee.EXPERT_ID,eee.EXPERT_NAME,eee.BUSINESS_LEVEL,eee.QUALITY_RESULTS,eee.WORK_STYLE,eee.SCORE,eee.EVAL_LEVEL,eee.NOTE,eee.BACKUP,
  415. ccc.NAME as PROJ_NM,
  416. CONCAT(DATE_FORMAT(iybg.ST_TM,'%Y-%m-%d'),'至',DATE_FORMAT(iybg.EN_TM ,'%Y-%m-%d') ) as JCTM,
  417. bbb.ROLE_TYPE as EXPERT_PROF
  418. <if test='projId != null and projId != ""'>
  419. ,twb.NAME as GRADER
  420. </if>
  421. from TAC_EVALUATION_EXTERNAL_EXPERT eee
  422. left join TAC_WORKER_B bbb on eee.EXPERT_ID=bbb.LOGIN_ID
  423. left join TAC_PAWP_RGSTR ccc on ccc.OBJ_ID=eee.PROJ_ID
  424. left join TAC_INSP_YEAR_BATCH_GROUP iybg on iybg.ID = ccc.GROUP_ID
  425. <if test='projId != null and projId != ""'>
  426. left join TAC_WORKER_B twb on twb.LOGIN_ID = eee.PERS_ID
  427. </if>
  428. where eee.EXPERT_ID=#{expertId}
  429. <if test=' projId!=null and projId!="" '>
  430. and eee.PROJ_ID = #{projId} and eee.PERS_ID is not null
  431. </if>
  432. <if test=' projId==null or projId=="" '>
  433. and eee.PERS_ID is null
  434. </if>
  435. </select>
  436. <!-- 修改 可恢复 -->
  437. <update id="updateScoreById" parameterType="cn.com.goldenwater.dcproj.model.TacEvaluationExternalExpert">
  438. update TAC_EVALUATION_EXTERNAL_EXPERT
  439. <trim prefix="SET" suffixOverrides=",">
  440. <if test='businessLevel != null'>BUSINESS_LEVEL = #{businessLevel},</if>
  441. <if test='qualityResults != null'>QUALITY_RESULTS = #{qualityResults},</if>
  442. <if test='workStyle != null'>WORK_STYLE = #{workStyle},</if>
  443. <if test='score != null'>SCORE = #{score},</if>
  444. <if test='evalLevel != null'>EVAL_LEVEL = #{evalLevel},</if>
  445. <if test='note != null'>NOTE = #{note},</if>
  446. BACKUP = CONCAT(BUSINESS_LEVEL,',',QUALITY_RESULTS,',',WORK_STYLE,',',SCORE,',',EVAL_LEVEL,',',|NOTE) ,
  447. UPTM = sysdate()
  448. </trim>
  449. where ID = #{id}
  450. </update>
  451. <!-- 恢复修改内容 并清空备份 -->
  452. <update id="revertScoreById" parameterType="cn.com.goldenwater.dcproj.model.TacEvaluationExternalExpert">
  453. update TAC_EVALUATION_EXTERNAL_EXPERT
  454. set BUSINESS_LEVEL = #{businessLevel},
  455. QUALITY_RESULTS = #{qualityResults},
  456. WORK_STYLE = #{workStyle},
  457. SCORE = #{score},
  458. EVAL_LEVEL = #{evalLevel},
  459. NOTE = #{note},
  460. BACKUP = null,
  461. UPTM = sysdate()
  462. where ID = #{id}
  463. </update>
  464. <select id="selectOneDetailByProjIdAndExpertId" parameterType="java.lang.String" resultType="cn.com.goldenwater.dcproj.model.TacEvaluationExternalExpert">
  465. select * from TAC_EVALUATION_EXTERNAL_EXPERT
  466. where PROJ_ID=#{projId} and EXPERT_ID=#{expertId} and PERS_ID is null
  467. </select>
  468. <select id="selectHjScoreByProjIdAndExpertId" parameterType="java.lang.String" resultType="cn.com.goldenwater.dcproj.model.TacEvaluationExternalExpert">
  469. select
  470. round(avg(BUSINESS_LEVEL),2)BUSINESS_LEVEL,
  471. round(avg(QUALITY_RESULTS),2)QUALITY_RESULTS,
  472. round(avg(WORK_STYLE),2)WORK_STYLE,
  473. round(avg(SCORE),2)SCORE
  474. from TAC_EVALUATION_EXTERNAL_EXPERT
  475. where PROJ_ID=#{projId} and EXPERT_ID=#{expertId} and PERS_ID is not null
  476. </select>
  477. </mapper>