f7df1e7dcd7f06953e16e283396f4b5eedb2ab26.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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.TacInspYearBatchGroupPersDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers" id="tacInspYearBatchGroupPersResultMap">
  5. <result property="inTm" column="IN_TM"/>
  6. <result property="upTm" column="UP_TM"/>
  7. <result property="id" column="ID"/>
  8. <result property="yearBatchId" column="YEAR_BATCH_ID"/>
  9. <result property="year" column="YEAR"/>
  10. <result property="batch" column="BATCH"/>
  11. <result property="persId" column="PERS_ID"/>
  12. <result property="groupId" column="GROUP_ID"/>
  13. <result property="groupNm" column="GROUP_NM"/>
  14. <result property="roleType" column="ROLE_TYPE"/>
  15. <result property="isNotice" column="IS_NOTICE"/>
  16. <result property="noticeInfo" column="NOTICE_INFO"/>
  17. <result property="isSms" column="IS_SMS"/>
  18. <result property="dataStat" column="DATA_STAT"/>
  19. <result property="ctPersId" column="CT_PERS_ID"/>
  20. <result property="isJoin" column="IS_JOIN"/>
  21. <result property="sendsmsTm" column="SENDSMS_TM" jdbcType="TIMESTAMP"/>
  22. <result property="phone" column="PHONE"/>
  23. </resultMap>
  24. <sql id="table_columns">
  25. IN_TM,
  26. UP_TM,
  27. ID,
  28. YEAR_BATCH_ID,
  29. "YEAR",
  30. BATCH,
  31. PERS_ID,
  32. GROUP_ID,
  33. GROUP_NM,
  34. ROLE_TYPE,
  35. IS_NOTICE,
  36. NOTICE_INFO,
  37. IS_SMS,
  38. DATA_STAT,
  39. CT_PERS_ID,
  40. IS_JOIN,
  41. SENDSMS_TM,
  42. PHONE
  43. </sql>
  44. <sql id="entity_properties">
  45. #{inTm},
  46. #{upTm},
  47. #{id},
  48. #{yearBatchId},
  49. #{year},
  50. #{batch},
  51. #{persId},
  52. #{groupId},
  53. #{groupNm},
  54. #{roleType},
  55. #{isNotice},
  56. #{noticeInfo},
  57. #{isSms},
  58. #{dataStat},
  59. #{ctPersId},
  60. #{isJoin},
  61. #{sendsmsTm},
  62. #{phone}
  63. </sql>
  64. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  65. <sql id="page_where">
  66. <trim prefix="where" prefixOverrides="and | or ">
  67. <if test="upTm != null">and UP_TM = #{upTm}</if>
  68. <if test="id != null and id != ''">and ID = #{id}</if>
  69. <if test="yearBatchId != null and yearBatchId != ''">and YEAR_BATCH_ID = #{yearBatchId}</if>
  70. <if test="year != null and year != ''">and YEAR = #{year}</if>
  71. <if test="batch != null and batch != ''">and BATCH = #{batch}</if>
  72. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  73. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  74. <if test="groupNm != null and groupNm != ''">and GROUP_NM = #{groupNm}</if>
  75. <if test="roleType != null and roleType != ''">and ROLE_TYPE = #{roleType}</if>
  76. <if test="isNotice != null and isNotice != ''">and IS_NOTICE = #{isNotice}</if>
  77. <if test="noticeInfo != null and noticeInfo != ''">and NOTICE_INFO = #{noticeInfo}</if>
  78. <if test="isSms != null and isSms != ''">and IS_SMS = #{isSms}</if>
  79. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  80. <if test="ctPersId != null and ctPersId != ''">and CT_PERS_ID = #{ctPersId}</if>
  81. <if test="isJoin != null and isJoin != ''">and IS_JOIN = #{isJoin}</if>
  82. <if test="phone != null and phone != ''">and PHONE = #{phone}</if>
  83. <if test="sttm != null and sttm != ''">and SENDSMS_TM &gt;= TO_DATE(#{sttm},'yyyy-mm-dd hh24:mi:ss')</if>
  84. <if test="entm != null and entm != ''">and SENDSMS_TM &lt;= To_DATE(#{entm},'yyyy-mm-dd hh24:mi:ss')</if>
  85. </trim>
  86. </sql>
  87. <select id="get" resultMap="tacInspYearBatchGroupPersResultMap" parameterType="String">
  88. select
  89. <include refid="table_columns"/>
  90. from TAC_INSP_YEAR_BATCH_GROUP_PERS where ID = #{id}
  91. </select>
  92. <select id="getBy" resultMap="tacInspYearBatchGroupPersResultMap">
  93. select
  94. <include refid="table_columns"/>
  95. from TAC_INSP_YEAR_BATCH_GROUP_PERS
  96. <include refid="page_where"/>
  97. </select>
  98. <select id="findAll" resultMap="tacInspYearBatchGroupPersResultMap">
  99. select
  100. <include refid="table_columns"/>
  101. from TAC_INSP_YEAR_BATCH_GROUP_PERS
  102. </select>
  103. <select id="findList" resultMap="tacInspYearBatchGroupPersResultMap">
  104. select
  105. <include refid="table_columns"/>
  106. from TAC_INSP_YEAR_BATCH_GROUP_PERS
  107. <include refid="page_where"/>
  108. </select>
  109. <select id="selectCount" resultType="int">
  110. select count(ID) from TAC_INSP_YEAR_BATCH_GROUP_PERS
  111. <include refid="page_where"/>
  112. </select>
  113. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers">
  114. insert into TAC_INSP_YEAR_BATCH_GROUP_PERS(
  115. <include refid="table_columns"/>
  116. )
  117. values (
  118. <include refid="entity_properties"/>
  119. )
  120. </insert>
  121. <delete id="delete" parameterType="java.lang.String">
  122. delete from TAC_INSP_YEAR_BATCH_GROUP_PERS where ID = #{id}
  123. </delete>
  124. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers">
  125. delete from TAC_INSP_YEAR_BATCH_GROUP_PERS
  126. <include refid="page_where"/>
  127. </delete>
  128. <update id="deleteInFlag" parameterType="java.lang.String">
  129. update TAC_INSP_YEAR_BATCH_GROUP_PERS set flag_valid = 0 where ID = #{id}
  130. </update>
  131. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers">
  132. update TAC_INSP_YEAR_BATCH_GROUP_PERS
  133. <trim prefix="set" suffixOverrides=",">
  134. <if test="upTm != null">UP_TM = #{upTm},</if>
  135. <if test="id != null and id != ''">ID = #{id},</if>
  136. <if test="yearBatchId != null and yearBatchId != ''">YEAR_BATCH_ID = #{yearBatchId},</if>
  137. <if test="year != null and year != ''">"YEAR" = #{year},</if>
  138. <if test="batch != null and batch != ''">BATCH = #{batch},</if>
  139. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  140. GROUP_ID = #{groupId},
  141. GROUP_NM = #{groupNm},
  142. <if test="roleType != null and roleType != ''">ROLE_TYPE = #{roleType},</if>
  143. <if test="isNotice != null and isNotice != ''">IS_NOTICE = #{isNotice},</if>
  144. <if test="noticeInfo != null and noticeInfo != ''">NOTICE_INFO = #{noticeInfo},</if>
  145. <if test="isSms != null and isSms != ''">IS_SMS = #{isSms},</if>
  146. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  147. <if test="ctPersId != null and ctPersId != ''">CT_PERS_ID = #{ctPersId},</if>
  148. <if test="isJoin != null and isJoin != ''">IS_JOIN = #{isJoin},</if>
  149. SENDSMS_TM = #{sendsmsTm},
  150. <if test="phone != null and phone != ''">PHONE = #{phone},</if>
  151. </trim>
  152. <where>ID = #{id}</where>
  153. </update>
  154. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers">
  155. update TAC_INSP_YEAR_BATCH_GROUP_PERS
  156. <trim prefix="set" suffixOverrides=",">
  157. <if test="upTm != null">UP_TM = #{upTm},</if>
  158. <if test="id != null and id != ''">ID = #{id},</if>
  159. <if test="yearBatchId != null and yearBatchId != ''">YEAR_BATCH_ID = #{yearBatchId},</if>
  160. <if test="year != null and year != ''">"YEAR" = #{year},</if>
  161. <if test="batch != null and batch != ''">BATCH = #{batch},</if>
  162. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  163. GROUP_ID = #{groupId},
  164. GROUP_NM = #{groupNm},
  165. <if test="roleType != null and roleType != ''">ROLE_TYPE = #{roleType},</if>
  166. <if test="isNotice != null and isNotice != ''">IS_NOTICE = #{isNotice},</if>
  167. <if test="noticeInfo != null and noticeInfo != ''">NOTICE_INFO = #{noticeInfo},</if>
  168. <if test="isSms != null and isSms != ''">IS_SMS = #{isSms},</if>
  169. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  170. <if test="ctPersId != null and ctPersId != ''">CT_PERS_ID = #{ctPersId},</if>
  171. <if test="isJoin != null and isJoin != ''">IS_JOIN = #{isJoin},</if>
  172. <if test="sendsmsTm != null">SENDSMS_TM = #{sendsmsTm},</if>
  173. <if test="phone != null and phone != ''">PHONE = #{phone},</if>
  174. </trim>
  175. <include refid="page_where"/>
  176. </update>
  177. <sql id="choseSql">
  178. <choose>
  179. <when test="province !=null and province !=''">
  180. and t.province like concat(#{province},'%')
  181. </when>
  182. <otherwise>
  183. and t.province is null
  184. </otherwise>
  185. </choose>
  186. </sql>
  187. <!-- 其他自定义SQL -->
  188. <update id="deleteGroupPersByGroupId"
  189. parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupPersParam">
  190. update TAC_INSP_YEAR_BATCH_GROUP_PERS
  191. set GROUP_NM = '',GROUP_ID = '', IS_NOTICE= '0' ,IS_SMS='0',IS_JOIN='0',SENDSMS_TM = null,NOTICE_INFO='',PHONE='',UP_TM=sysdate where GROUP_ID = #{groupId}
  192. <if test="roleType != null and roleType != ''">
  193. and role_type = #{roleType}
  194. </if>
  195. </update>
  196. <select id="findPersList" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupPersParam"
  197. resultType="cn.com.goldenwater.dcproj.model.BisInspAllRlation">
  198. select #{persId} persid,t.group_id as id,t.ROLE_TYPE as pertype from Tac_Insp_Year_Batch_Group_Pers t
  199. where 1=1
  200. <if test="groupId != null and groupId != ''">
  201. and t.group_id = #{groupId}
  202. </if>
  203. and t.PERS_ID in (select id from TAC_WORKER_B t where t.login_id = #{persId}
  204. <include refid="choseSql"/>
  205. )
  206. </select>
  207. <select id="getYearList" resultType="cn.com.goldenwater.dcproj.dto.BisInspPlanDto"
  208. parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupPersParam">
  209. select DISTINCT YEAR,'008'||YEAR as plnaId,year||'年' as prsnTitle from Tac_Insp_Year_Batch_Group_Pers
  210. where 1=1
  211. <if test="persId != null and persId != ''">
  212. and group_id in (
  213. select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID IN (select t.id from TAC_WORKER_B t
  214. where t.login_id = #{persId}
  215. <include refid="choseSql"/>
  216. )
  217. )
  218. </if>
  219. order by year
  220. </select>
  221. <select id="getBatchList" resultType="cn.com.goldenwater.dcproj.dto.BisInspPlanDto"
  222. parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupPersParam">
  223. select DISTINCT batch,'008'||year || batch as plnaId,'第'|| batch ||'批次' as prsnTitle from
  224. Tac_Insp_Year_Batch_Group_Pers
  225. where 1=1
  226. <if test="persId != null and persId != ''">
  227. and group_id in (
  228. select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (select t.id from TAC_WORKER_B t
  229. where t.login_id = #{persId}
  230. <include refid="choseSql"/>
  231. )
  232. )
  233. </if>
  234. <if test="year != null and year != ''">
  235. and year = #{year}
  236. </if>
  237. order by batch desc
  238. </select>
  239. <select id="getGroupPersList" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers"
  240. parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupPersParam">
  241. select b.*,t.name as persName from Tac_Insp_Year_Batch_Group_Pers b left join tac_worker_b t on b.pers_id = t.id
  242. where t.id is not null
  243. <include refid="choseSql"/>
  244. <if test="yearBatchId != null and yearBatchId != ''">
  245. and b.year_batch_id = #{yearBatchId}
  246. </if>
  247. <if test="roleType != null and roleType != ''">
  248. and b.roleType = #{roleType}
  249. </if>
  250. </select>
  251. <select id="getSmsWorkListByGroupId" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers"
  252. parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupParam">
  253. SELECT p.id,p.YEAR, p.BATCH, p.PERS_ID, GROUP_ID, GROUP_NM
  254. , p.ROLE_TYPE, IS_NOTICE, NOTICE_INFO, IS_SMS, NAME as persName
  255. , MOBILENUMB as phone from TAC_INSP_YEAR_BATCH_GROUP_PERS p left join TAC_WORKER_B t on t.id = p.pers_id
  256. left join tac_insp_year_batch h on p.year_batch_id=h.id
  257. where h.data_stat='0'
  258. <include refid="choseSql"/>
  259. <if test="id != null and id != ''">
  260. and p.GROUP_ID = #{id}
  261. </if>
  262. and IS_NOTICE = '0' and IS_SMS = '0' and IS_JOIN = '0'
  263. </select>
  264. <select id="confirmerGroupPers" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers"
  265. parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupPersParam">
  266. select
  267. <include refid="table_columns"/>
  268. from TAC_INSP_YEAR_BATCH_GROUP_PERS
  269. <trim prefix="where" prefixOverrides="and | or ">
  270. <if test="isNotice != null and isNotice != ''">and IS_NOTICE = #{isNotice}</if>
  271. <if test="isSms != null and isSms != ''">and IS_SMS = #{isSms}</if>
  272. <if test="isJoin != null and isJoin != ''">and IS_JOIN = #{isJoin}</if>
  273. <if test="entm != null and entm != ''">and (sysdate-SENDSMS_TM)*24 &lt;= #{entm}</if>
  274. </trim>
  275. </select>
  276. <select id="getNoReply" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers"
  277. parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupPersParam">
  278. select
  279. <include refid="table_columns"/>
  280. from TAC_INSP_YEAR_BATCH_GROUP_PERS
  281. <trim prefix="where" prefixOverrides="and | or ">
  282. <if test="isNotice != null and isNotice != ''">and IS_NOTICE = #{isNotice}</if>
  283. <if test="isSms != null and isSms != ''">and IS_SMS = #{isSms}</if>
  284. <if test="isJoin != null and isJoin != ''">and IS_JOIN = #{isJoin}</if>
  285. <if test="entm != null and entm != ''">and (sysdate-SENDSMS_TM)*24 &gt;= #{entm}</if>
  286. </trim>
  287. </select>
  288. <!-- 其他自定义SQL -->
  289. <update id="deleteGroupPersInfo"
  290. parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers">
  291. update TAC_INSP_YEAR_BATCH_GROUP_PERS
  292. set GROUP_NM = '',GROUP_ID = '', IS_NOTICE= '0' ,IS_SMS='0',IS_JOIN='0',SENDSMS_TM = null,NOTICE_INFO='',UPTM=sysdate where GROUP_ID = #{groupId}
  293. <if test="persId != null and persId != ''">
  294. and PERS_ID = #{persId}
  295. </if>
  296. </update>
  297. </mapper>