BisInspPlanYearPrgDao.xml 13 KB

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