BisInspPlanYearPrgDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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.BisInspPlanYearPrgDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspPlanYearPrg" id="bisInspPlanYearPrgResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="chkYearId" column="CHK_YEAR_ID"/>
  7. <result property="chkForm" column="CHK_FORM"/>
  8. <result property="chkMnth" column="CHK_MNTH"/>
  9. <result property="chkNote" column="CHK_NOTE"/>
  10. <result property="chkGroup" column="CHK_GROUP"/>
  11. <result property="chkPers" column="CHK_PERS"/>
  12. <result property="chkPblm" column="CHK_PBLM"/>
  13. <result property="chkLeder" column="CHK_LEDER"/>
  14. <result property="trainNum" column="TRAIN_NUM"/>
  15. <result property="trainPers" column="TRAIN_PERS"/>
  16. <result property="nextPlan" column="NEXT_PLAN"/>
  17. <result property="note" column="NOTE"/>
  18. <result property="persId" column="PERS_ID"/>
  19. <result property="intm" column="INTM"/>
  20. <result property="uptm" column="UPTM"/>
  21. <result property="dataStat" column="DATA_STAT"/>
  22. <result property="leadDep" column="LEAD_DEP"/>
  23. <result property="joinDep" column="JOIN_DEP"/>
  24. <result property="chkName" column="CHK_NAME"/>
  25. <result property="objType" column="OBJ_TYPE"/>
  26. <result property="sttm" column="STTM"/>
  27. <result property="entm" column="ENTM"/>
  28. <result property="adCode" column="AD_CODE"/>
  29. <result property="isFinish" column="IS_FINISH"/>
  30. <result property="objTypeNm" column="OBJ_TYPE_NM"/>
  31. <result property="chkFormNm" column="CHK_FORM_NM"/>
  32. <result property="isPlanned" column="IS_PLANNED"/>
  33. <result property="unplannedChkNm" column="UNPLANNED_CHK_NM"/>
  34. <result property="nextSttm" column="NEXT_STTM"/>
  35. <result property="nextEntm" column="NEXT_ENTM"/>
  36. <result property="addvnm" column="ADDVNM"/>
  37. <result property="addvcd" column="ADDVCD"/>
  38. <association property="chkYear" javaType="java.lang.String" column="{chkYearId = CHK_YEAR_ID}" select="selectPlanYearByChkYearId"/>
  39. </resultMap>
  40. <sql id="table_columns">
  41. ID,
  42. CHK_YEAR_ID,
  43. CHK_FORM,
  44. CHK_MNTH,
  45. CHK_NOTE,
  46. CHK_GROUP,
  47. CHK_PERS,
  48. CHK_PBLM,
  49. CHK_LEDER,
  50. TRAIN_NUM,
  51. TRAIN_PERS,
  52. NEXT_PLAN,
  53. NOTE,
  54. PERS_ID,
  55. INTM,
  56. UPTM,
  57. LEAD_DEP,
  58. STTM,
  59. ENTM,
  60. OBJ_TYPE,
  61. AD_CODE,
  62. IS_FINISH,
  63. OBJ_TYPE_NM,
  64. CHK_FORM_NM,
  65. DATA_STAT,
  66. IS_PLANNED,
  67. UNPLANNED_CHK_NM,
  68. CHK_NAME,
  69. NEXT_STTM,
  70. NEXT_ENTM,
  71. ADDVNM,
  72. ADDVCD
  73. </sql>
  74. <sql id="entity_properties">
  75. #{id},
  76. #{chkYearId},
  77. #{chkForm},
  78. #{chkMnth},
  79. #{chkNote},
  80. #{chkGroup},
  81. #{chkPers},
  82. #{chkPblm},
  83. #{chkLeder},
  84. #{trainNum},
  85. #{trainPers},
  86. #{nextPlan},
  87. #{note},
  88. #{persId},
  89. #{intm},
  90. #{uptm},
  91. #{leadDep},
  92. #{sttm},
  93. #{entm},
  94. #{objType},
  95. #{adCode},
  96. #{isFinish},
  97. #{objTypeNm},
  98. #{chkFormNm},
  99. #{dataStat},
  100. #{isPlanned},
  101. #{unplannedChkNm},
  102. #{chkName},
  103. #{nextSttm},
  104. #{nextEntm},
  105. #{addvnm},
  106. #{addvcd}
  107. </sql>
  108. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  109. <sql id="page_where">
  110. <trim prefix="where" prefixOverrides="and | or ">
  111. <if test="chkYearId != null and chkYearId != ''">and CHK_YEAR_ID = #{chkYearId}</if>
  112. <if test="chkForm != null and chkForm != ''">and CHK_FORM = #{chkForm}</if>
  113. <if test="chkMnth != null">and CHK_MNTH = #{chkMnth}</if>
  114. <if test="chkNote != null and chkNote != ''">and CHK_NOTE = #{chkNote}</if>
  115. <if test="chkGroup != null and chkGroup != ''">and CHK_GROUP = #{chkGroup}</if>
  116. <if test="chkPers != null and chkPers != ''">and CHK_PERS = #{chkPers}</if>
  117. <if test="chkPblm != null and chkPblm != ''">and CHK_PBLM = #{chkPblm}</if>
  118. <if test="chkLeder != null and chkLeder != ''">and CHK_LEDER = #{chkLeder}</if>
  119. <if test="trainNum != null and trainNum != ''">and TRAIN_NUM = #{trainNum}</if>
  120. <if test="trainPers != null and trainPers != ''">and TRAIN_PERS = #{trainPers}</if>
  121. <if test="nextPlan != null and nextPlan != ''">and NEXT_PLAN = #{nextPlan}</if>
  122. <if test="note != null and note != ''">and NOTE = #{note}</if>
  123. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  124. <if test="intm != null">and INTM = #{intm}</if>
  125. <if test="uptm != null">and UPTM = #{uptm}</if>
  126. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  127. <if test="isPlanned != null and isPlanned != ''">and IS_PLANNED = #{isPlanned}</if>
  128. <if test="chkName != null and chkName != ''">and ( CHK_NAME LIKE CONCAT('%',#{chkName},'%') or UNPLANNED_CHK_NM LIKE CONCAT('%',#{chkName},'%') ) </if>
  129. <if test="nextSttm != null">and NEXT_STTM = #{nextSttm}</if>
  130. <if test="nextEntm != null">and NEXT_ENTM = #{nextEntm}</if>
  131. <if test="addvnm != null and addvnm != ''">and ADDVNM = #{addvnm}</if>
  132. <if test="addvcd != null and addvcd != ''">and ADDVCD = #{addvcd}</if>
  133. </trim>
  134. </sql>
  135. <select id="get" resultMap="bisInspPlanYearPrgResultMap" parameterType="String">
  136. select
  137. <include refid="table_columns"/>
  138. from BIS_INSP_PLAN_YEAR_PRG where ID = #{id}
  139. </select>
  140. <select id="getBy" resultMap="bisInspPlanYearPrgResultMap">
  141. select
  142. <include refid="table_columns"/>
  143. from BIS_INSP_PLAN_YEAR_PRG
  144. <include refid="page_where"/>
  145. </select>
  146. <select id="findAll" resultMap="bisInspPlanYearPrgResultMap">
  147. select
  148. <include refid="table_columns"/>
  149. from BIS_INSP_PLAN_YEAR_PRG
  150. </select>
  151. <select id="findList" resultMap="bisInspPlanYearPrgResultMap">
  152. SELECT <include refid="table_columns"/>
  153. from BIS_INSP_PLAN_YEAR_PRG
  154. where 1=1
  155. <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
  156. <if test="chkName != null and chkName != ''">and (CHK_NAME LIKE '${chkName}%' or UNPLANNED_CHK_NM LIKE '${chkName}%' ) </if>
  157. <if test="isPlanned != null and isPlanned != ''">and IS_PLANNED = #{isPlanned} </if>
  158. <if test="sttm != null and sttm != ''">and STTM &gt;= to_date(substr(#{sttm},0,10),'yyyy-mm-dd')</if>
  159. <if test="entm != null and entm != ''">and ENTM &lt;= to_date(substr(#{entm},0,10),'yyyy-mm-dd')</if>
  160. <if test="objType != null and objType != ''">and
  161. <foreach item="item" index="index" collection="objType.split(',')" open="(" separator="or" close=")" >
  162. OBJ_TYPE LIKE concat('%${item}','%')
  163. </foreach>
  164. </if>
  165. <if test="leadDep != null and leadDep != ''">and LEAD_DEP LIKE '%${leadDep}%'</if>
  166. <if test="chkForm != null and chkForm != ''">and
  167. <foreach item="item" index="index" collection="chkForm.split(',')" open="(" separator="or" close=")" >
  168. CHK_FORM LIKE concat('%${item}','%')
  169. </foreach>
  170. </if>
  171. and DATA_STAT = '0'
  172. <if test="chkYearId != null and chkYearId != ''">
  173. and CHK_YEAR_ID = #{chkYearId}
  174. </if>
  175. order by ENTM desc
  176. </select>
  177. <select id="findListByMonth" resultMap="bisInspPlanYearPrgResultMap">
  178. SELECT <include refid="table_columns"/>
  179. from BIS_INSP_PLAN_YEAR_PRG
  180. where 1=1
  181. <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
  182. <if test="sttm != null and sttm != ''">and to_char(STTM,'yyyy-MM') >= #{sttm}</if>
  183. <if test="entm != null and entm != ''">and to_char(ENTM,'yyyy-MM') &lt;= #{entm}</if>
  184. <if test="objType != null and objType != ''">and
  185. <foreach item="item" index="index" collection="objType.split(',')" open="(" separator="or" close=")" >
  186. OBJ_TYPE LIKE concat('%${item}','%')
  187. </foreach>
  188. </if>
  189. <if test="leadDep != null and leadDep != ''">and LEAD_DEP LIKE '%${leadDep}%'</if>
  190. <if test="chkForm != null and chkForm != ''">and
  191. <foreach item="item" index="index" collection="chkForm.split(',')" open="(" separator="or" close=")" >
  192. CHK_FORM LIKE concat('%${item}','%')
  193. </foreach>
  194. </if>
  195. and DATA_STAT = '0'
  196. </select>
  197. <select id="selectCount" resultType="int">
  198. select count(ID) from BIS_INSP_PLAN_YEAR_PRG
  199. <include refid="page_where"/>
  200. </select>
  201. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanYearPrg">
  202. insert into BIS_INSP_PLAN_YEAR_PRG(
  203. <include refid="table_columns"/>
  204. )
  205. values (
  206. <include refid="entity_properties"/>
  207. )
  208. </insert>
  209. <delete id="delete" parameterType="java.lang.String">
  210. update BIS_INSP_PLAN_YEAR_PRG set DATA_STAT='9' where ID = #{id}
  211. </delete>
  212. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanYearPrg">
  213. delete from BIS_INSP_PLAN_YEAR_PRG
  214. <include refid="page_where"/>
  215. </delete>
  216. <update id="deleteInFlag" parameterType="java.lang.String">
  217. update BIS_INSP_PLAN_YEAR_PRG set flag_valid = 0 where ID = #{id}
  218. </update>
  219. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanYearPrg">
  220. update BIS_INSP_PLAN_YEAR_PRG
  221. <trim prefix="set" suffixOverrides=",">
  222. <if test="chkYearId != null and chkYearId != ''">CHK_YEAR_ID = #{chkYearId},</if>
  223. <if test="chkName != null and chkName != ''">CHK_NAME = #{chkName},</if>
  224. <if test="chkForm != null and chkForm != ''">CHK_FORM = #{chkForm},</if>
  225. <if test="chkMnth != null">CHK_MNTH = #{chkMnth},</if>
  226. <if test="chkNote != null and chkNote != ''">CHK_NOTE = #{chkNote},</if>
  227. <if test="chkGroup != null and chkGroup != ''">CHK_GROUP = #{chkGroup},</if>
  228. <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
  229. <if test="chkPblm != null and chkPblm != ''">CHK_PBLM = #{chkPblm},</if>
  230. <if test="chkLeder != null and chkLeder != ''">CHK_LEDER = #{chkLeder},</if>
  231. <if test="trainNum != null and trainNum != ''">TRAIN_NUM = #{trainNum},</if>
  232. <if test="trainPers != null and trainPers != ''">TRAIN_PERS = #{trainPers},</if>
  233. <if test="nextPlan != null and nextPlan != ''">NEXT_PLAN = #{nextPlan},</if>
  234. <if test="note != null and note != ''">NOTE = #{note},</if>
  235. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  236. <if test="intm != null">INTM = #{intm},</if>
  237. <if test="uptm != null">UPTM = #{uptm},</if>
  238. <if test="leadDep != null and leadDep != ''">LEAD_DEP = #{leadDep},</if>
  239. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  240. <if test="sttm != null">STTM = #{sttm},</if>
  241. <if test="entm != null">ENTM = #{entm},</if>
  242. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  243. <if test="isFinish != null and isFinish != ''">IS_FINISH = #{isFinish},</if>
  244. <if test="objTypeNm != null and objTypeNm != ''">OBJ_TYPE_NM = #{objTypeNm},</if>
  245. <if test="chkFormNm != null and chkFormNm != ''">CHK_FORM_NM = #{chkFormNm},</if>
  246. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  247. <if test="isPlanned != null and isPlanned != ''">IS_PLANNED = #{isPlanned},</if>
  248. <if test="unplannedChkNm != null ">UNPLANNED_CHK_NM = #{unplannedChkNm},</if>
  249. <if test="nextSttm != null"> NEXT_STTM = #{nextSttm},</if>
  250. <if test="nextEntm != null">NEXT_ENTM = #{nextEntm},</if>
  251. <if test="addvnm != null and addvnm != ''">ADDVNM = #{addvnm},</if>
  252. <if test="addvcd != null and addvcd != ''">ADDVCD = #{addvcd},</if>
  253. </trim>
  254. <where>ID = #{id}</where>
  255. </update>
  256. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanYearPrg">
  257. update BIS_INSP_PLAN_YEAR_PRG
  258. <trim prefix="set" suffixOverrides=",">
  259. <if test="chkYearId != null and chkYearId != ''">CHK_YEAR_ID = #{chkYearId},</if>
  260. <if test="chkName != null and chkName != ''">CHK_NAME = #{chkName},</if>
  261. <if test="chkForm != null and chkForm != ''">CHK_FORM = #{chkForm},</if>
  262. <if test="chkMnth != null">CHK_MNTH = #{chkMnth},</if>
  263. <if test="chkNote != null and chkNote != ''">CHK_NOTE = #{chkNote},</if>
  264. <if test="chkGroup != null and chkGroup != ''">CHK_GROUP = #{chkGroup},</if>
  265. <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
  266. <if test="chkPblm != null and chkPblm != ''">CHK_PBLM = #{chkPblm},</if>
  267. <if test="chkLeder != null and chkLeder != ''">CHK_LEDER = #{chkLeder},</if>
  268. <if test="trainNum != null and trainNum != ''">TRAIN_NUM = #{trainNum},</if>
  269. <if test="trainPers != null and trainPers != ''">TRAIN_PERS = #{trainPers},</if>
  270. <if test="nextPlan != null and nextPlan != ''">NEXT_PLAN = #{nextPlan},</if>
  271. <if test="note != null and note != ''">NOTE = #{note},</if>
  272. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  273. <if test="intm != null">INTM = #{intm},</if>
  274. <if test="uptm != null">UPTM = #{uptm},</if>
  275. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  276. <if test="isPlanned != null and isPlanned != ''">IS_PLANNED = #{isPlanned},</if>
  277. <if test="unplannedChkNm != null ">UNPLANNED_CHK_NM = #{unplannedChkNm},</if>
  278. <if test="nextSttm != null">NEXT_STTM = #{nextSttm},</if>
  279. <if test="nextEntm != null">NEXT_ENTM = #{nextEntm},</if>
  280. <if test="addvnm != null and addvnm != ''"> ADDVNM = #{addvnm},</if>
  281. <if test="addvcd != null and addvcd != ''"> ADDVCD = #{addvcd},</if>
  282. </trim>
  283. <include refid="page_where"/>
  284. </update>
  285. <!-- 其他自定义SQL -->
  286. <select id="getPlanByYearId" resultType="cn.com.goldenwater.dcproj.model.BisInspPlanYearPrg">
  287. select * from BIS_INSP_PLAN_YEAR_PRG where chk_year_id=#{yearId}
  288. </select>
  289. <select id="selectPlanYearByChkYearId" resultType="String">
  290. select CHK_YEAR from BIS_INSP_PLAN_YEAR where ID = #{chkYearId}
  291. </select>
  292. </mapper>