BisInspPlanMonthDao.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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.BisInspPlanMonthDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspPlanMonth" id="bisInspPlanMonthResultMap">
  5. <result property="organDep" column="ORGAN_DEP"/>
  6. <result property="yearPlanId" column="YEAR_PLAN_ID"/>
  7. <result property="yearChkName" column="YEAR_CHK_NAME"/>
  8. <result property="yearChkType" column="YEAR_CHK_TYPE"/>
  9. <result property="ordr" column="ORDR"/>
  10. <result property="adCode" column="AD_CODE"/>
  11. <result property="chkTitle" column="CHK_TITLE"/>
  12. <result property="chkMonth" column="CHK_MONTH"/>
  13. <result property="chkDep" column="CHK_DEP"/>
  14. <result property="chkGrp" column="CHK_GRP"/>
  15. <result property="planSttm" column="PLAN_STTM"/>
  16. <result property="planEntm" column="PLAN_ENTM"/>
  17. <result property="leadDep" column="LEAD_DEP"/>
  18. <result property="joinDep" column="JOIN_DEP"/>
  19. <result property="chkCity" column="CHK_CITY"/>
  20. <result property="chkCountry" column="CHK_COUNTRY"/>
  21. <result property="chkSize" column="CHK_SIZE"/>
  22. <result property="chkType" column="CHK_TYPE"/>
  23. <result property="chkPers" column="CHK_PERS"/>
  24. <result property="chkPersTel" column="CHK_PERS_TEL"/>
  25. <result property="chkNote" column="CHK_NOTE"/>
  26. <result property="persId" column="PERS_ID"/>
  27. <result property="intm" column="INTM"/>
  28. <result property="uptm" column="UPTM"/>
  29. <result property="dataStat" column="DATA_STAT"/>
  30. <result property="id" column="ID"/>
  31. <result property="chkCityCode" column="chk_city_code"/>
  32. <result property="chkCountryCode" column="chk_country_code"/>
  33. <!-- <collection property="area" javaType="java.util.ArrayList" ofType="cn.com.goldenwater.dcproj.model.BisInspPlanMonthArea">-->
  34. <!-- <result property="adCode" column="area_ad_code"/>-->
  35. <!-- <result property="adName" column="area_ad_name"/>-->
  36. <!-- <result property="adGrad" column="area_ad_grad"/>-->
  37. <!-- </collection>-->
  38. </resultMap>
  39. <sql id="table_columns">
  40. ORDR,
  41. AD_CODE,
  42. CHK_TITLE,
  43. CHK_MONTH,
  44. CHK_DEP,
  45. CHK_GRP,
  46. PLAN_STTM,
  47. PLAN_ENTM,
  48. LEAD_DEP,
  49. JOIN_DEP,
  50. <!-- CHK_CITY,-->
  51. <!-- CHK_COUNTRY,-->
  52. CHK_SIZE,
  53. CHK_TYPE,
  54. CHK_PERS,
  55. CHK_PERS_TEL,
  56. CHK_NOTE,
  57. PERS_ID,
  58. INTM,
  59. UPTM,
  60. DATA_STAT,
  61. ID,
  62. YEAR_PLAN_ID,
  63. YEAR_CHK_NAME,
  64. YEAR_CHK_TYPE,
  65. ORGAN_DEP
  66. </sql>
  67. <sql id="entity_properties">
  68. #{ordr},
  69. #{adCode},
  70. #{chkTitle},
  71. #{chkMonth},
  72. #{chkDep},
  73. #{chkGrp},
  74. #{planSttm},
  75. #{planEntm},
  76. #{leadDep},
  77. #{joinDep},
  78. <!-- #{chkCity},-->
  79. <!-- #{chkCountry},-->
  80. #{chkSize},
  81. #{chkType},
  82. #{chkPers},
  83. #{chkPersTel},
  84. #{chkNote},
  85. #{persId},
  86. #{intm},
  87. #{uptm},
  88. #{dataStat},
  89. #{id},
  90. #{yearPlanId},
  91. #{yearChkName},
  92. #{yearChkType},
  93. #{organDep}
  94. </sql>
  95. <sql id="join_colum">
  96. t1.ORDR,
  97. t1.AD_CODE,
  98. t1.CHK_TITLE,
  99. t1.CHK_MONTH,
  100. t1.CHK_DEP,
  101. t1.CHK_GRP,
  102. t1.PLAN_STTM,
  103. t1.PLAN_ENTM,
  104. t1.LEAD_DEP,
  105. t1.JOIN_DEP,
  106. (SELECT
  107. GROUP_CONCAT(ad_code ORDER BY plan_month SEPARATOR ',' ) AS chkArea
  108. FROM
  109. BIS_INSP_PLAN_MONTH_AREA
  110. WHERE
  111. plan_month = t1.id
  112. AND data_stat = '0'
  113. AND ad_grad = '3'
  114. GROUP BY
  115. plan_month) as CHK_CITY_CODE,
  116. (SELECT
  117. GROUP_CONCAT(ad_name ORDER BY plan_month SEPARATOR ',' ) AS chkArea
  118. FROM
  119. BIS_INSP_PLAN_MONTH_AREA
  120. WHERE
  121. plan_month = t1.id
  122. AND data_stat = '0'
  123. AND ad_grad = '3'
  124. GROUP BY
  125. plan_month) as CHK_CITY,
  126. (SELECT
  127. GROUP_CONCAT(ad_code ORDER BY plan_month SEPARATOR ',' ) AS chkArea
  128. FROM
  129. BIS_INSP_PLAN_MONTH_AREA
  130. WHERE
  131. plan_month = t1.id
  132. AND data_stat = '0'
  133. AND ad_grad = '4'
  134. GROUP BY
  135. plan_month) as CHK_COUNTRY_CODE,
  136. (SELECT
  137. GROUP_CONCAT(ad_name ORDER BY plan_month SEPARATOR ',' ) AS chkArea
  138. FROM
  139. BIS_INSP_PLAN_MONTH_AREA
  140. WHERE
  141. plan_month = t1.id
  142. AND data_stat = '0'
  143. AND ad_grad = '4'
  144. GROUP BY
  145. plan_month) as CHK_COUNTRY,
  146. t1.CHK_SIZE,
  147. t1.CHK_TYPE,
  148. t1.CHK_PERS,
  149. t1.CHK_PERS_TEL,
  150. t1.CHK_NOTE,
  151. t1.PERS_ID,
  152. t1.INTM,
  153. t1.UPTM,
  154. t1.DATA_STAT,
  155. t1.ID,
  156. t1.YEAR_PLAN_ID,
  157. t1.YEAR_CHK_NAME,
  158. t1.YEAR_CHK_TYPE,
  159. t1.ORGAN_DEP
  160. </sql>
  161. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  162. <sql id="page_where">
  163. <trim prefix="where" prefixOverrides="and | or ">
  164. <if test="adCode != null and adCode != ''">and t1.AD_CODE like '${adCode}%'</if>
  165. <if test="chkTitle != null and chkTitle != ''">and t1.CHK_TITLE like '%${chkTitle}%'</if>
  166. <if test="chkMonth != null">and DATE_FORMAT(t1.CHK_MONTH,'%Y-%m') = DATE_FORMAT(#{chkMonth},'%Y-%m')</if>
  167. <if test="chkDep != null and chkDep != ''">and t1.CHK_DEP like '%${chkDep}%'</if>
  168. <if test="chkGrp != null and chkGrp != ''">and t1.CHK_GRP like '%${chkGrp}%'</if>
  169. <if test="planSttm != null">and t1.PLAN_STTM = #{planSttm}</if>
  170. <if test="planEntm != null">and t1.PLAN_ENTM = #{planEntm}</if>
  171. <if test="leadDep != null and leadDep != ''">and t1.LEAD_DEP = #{leadDep}</if>
  172. <if test="joinDep != null and joinDep != ''">and t1.JOIN_DEP = #{joinDep}</if>
  173. <!-- <if test="chkCity != null and chkCity != ''">and CHK_CITY = #{chkCity}</if>-->
  174. <!-- <if test="chkCountry != null and chkCountry != ''">and CHK_COUNTRY = #{chkCountry}</if>-->
  175. <if test="chkSize != null and chkSize != ''">and t1.CHK_SIZE = #{chkSize}</if>
  176. <if test="chkType != null and chkType != ''">and t1.CHK_TYPE = #{chkType}</if>
  177. <if test="chkPers != null and chkPers != ''">and t1.CHK_PERS = #{chkPers}</if>
  178. <if test="chkPersTel != null and chkPersTel != ''">and t1.CHK_PERS_TEL = #{chkPersTel}</if>
  179. <if test="chkNote != null and chkNote != ''">and t1.CHK_NOTE = #{chkNote}</if>
  180. <if test="persId != null and persId != ''">and t1.PERS_ID = #{persId}</if>
  181. <if test="intm != null">and t1.INTM = #{intm}</if>
  182. <if test="uptm != null">and t1.UPTM = #{uptm}</if>
  183. <if test="id != null and id != ''">and t1.ID = #{id}</if>
  184. <if test="yearChkName != null and yearChkName != ''">and YEAR_CHK_NAME = #{yearChkName}</if>
  185. <if test="yearChkType != null and yearChkType != ''">and YEAR_CHK_TYPE = #{yearChkType}</if>
  186. <if test="organDep != null and organDep != ''">and ORGAN_DEP = #{organDep}</if>
  187. and t1.DATA_STAT = '0'
  188. </trim>
  189. </sql>
  190. <select id="get" resultMap="bisInspPlanMonthResultMap" parameterType="String" >
  191. select <include refid="join_colum"/>
  192. from BIS_INSP_PLAN_MONTH t1
  193. where t1.ID = #{id}
  194. </select>
  195. <select id="getBy" resultMap="bisInspPlanMonthResultMap">
  196. select <include refid="join_colum"/>
  197. from BIS_INSP_PLAN_MONTH t1
  198. <include refid="page_where" />
  199. order by t1.ORDR ASC
  200. </select>
  201. <select id="findAll" resultMap="bisInspPlanMonthResultMap">
  202. select <include refid="join_colum"/>
  203. order by ORDR ASC
  204. </select>
  205. <select id="findList" resultMap="bisInspPlanMonthResultMap">
  206. SELECT * FROM (select <include refid="join_colum"/>
  207. from BIS_INSP_PLAN_MONTH t1
  208. <include refid="page_where"/>
  209. ) T2
  210. WHERE 1=1
  211. <if test="chkCity != null and chkCity != ''">
  212. AND ((CHK_CITY like '%${chkCity}%') or (CHK_COUNTRY like '%${chkCity}%'))
  213. </if>
  214. order by ORDR ASC
  215. </select>
  216. <select id="selectCount" resultType="int" >
  217. select count(ID) from BIS_INSP_PLAN_MONTH <include refid="page_where" />
  218. </select>
  219. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanMonth">
  220. insert into BIS_INSP_PLAN_MONTH( <include refid="table_columns" /> )
  221. values ( <include refid="entity_properties" /> )
  222. </insert>
  223. <delete id="delete" parameterType="java.lang.String">
  224. update BIS_INSP_PLAN_MONTH set DATA_STAT='9' where ID = #{id}
  225. </delete>
  226. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanMonth">
  227. delete from BIS_INSP_PLAN_MONTH <include refid="page_where" />
  228. </delete>
  229. <update id="deleteInFlag" parameterType="java.lang.String">
  230. update BIS_INSP_PLAN_MONTH set flag_valid = 0 where ID = #{id}
  231. </update>
  232. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanMonth">
  233. update BIS_INSP_PLAN_MONTH
  234. <trim prefix="set" suffixOverrides=",">
  235. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  236. <if test="chkTitle != null and chkTitle != ''">CHK_TITLE = #{chkTitle},</if>
  237. <if test="chkMonth != null">CHK_MONTH = #{chkMonth},</if>
  238. <if test="chkDep != null and chkDep != ''">CHK_DEP = #{chkDep},</if>
  239. <if test="chkGrp != null and chkGrp != ''">CHK_GRP = #{chkGrp},</if>
  240. <if test="planSttm != null">PLAN_STTM = #{planSttm},</if>
  241. <if test="planEntm != null">PLAN_ENTM = #{planEntm},</if>
  242. <if test="leadDep != null and leadDep != ''">LEAD_DEP = #{leadDep},</if>
  243. <if test="joinDep != null and joinDep != ''">JOIN_DEP = #{joinDep},</if>
  244. <!-- <if test="chkCity != null and chkCity != ''">CHK_CITY = #{chkCity},</if>-->
  245. <!-- <if test="chkCountry != null and chkCountry != ''">CHK_COUNTRY = #{chkCountry},</if>-->
  246. <if test="chkSize != null and chkSize != ''">CHK_SIZE = #{chkSize},</if>
  247. <if test="chkType != null and chkType != ''">CHK_TYPE = #{chkType},</if>
  248. <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
  249. <if test="chkPersTel != null and chkPersTel != ''">CHK_PERS_TEL = #{chkPersTel},</if>
  250. <if test="chkNote != null and chkNote != ''">CHK_NOTE = #{chkNote},</if>
  251. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  252. <if test="intm != null">INTM = #{intm},</if>
  253. <if test="uptm != null">UPTM = #{uptm},</if>
  254. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  255. <if test="ordr != null and ordr != ''">ORDR = #{ordr},</if>
  256. <if test="yearChkName != null and yearChkName != ''">YEAR_CHK_NAME = #{yearChkName},</if>
  257. <if test="yearChkType != null and yearChkType != ''">YEAR_CHK_TYPE = #{yearChkType},</if>
  258. <if test="yearPlanId != null and yearPlanId != ''">YEAR_PLAN_ID = #{yearPlanId},</if>
  259. <if test="organDep != null and organDep != ''">ORGAN_DEP = #{organDep},</if>
  260. </trim>
  261. <where>ID = #{id}</where>
  262. </update>
  263. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanMonth">
  264. update BIS_INSP_PLAN_MONTH
  265. <trim prefix="set" suffixOverrides=",">
  266. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  267. <if test="chkTitle != null and chkTitle != ''">CHK_TITLE = #{chkTitle},</if>
  268. <if test="chkMonth != null">CHK_MONTH = STR_TO_DATE(#{chkMonth},'%Y-%m'),</if>
  269. <if test="chkDep != null and chkDep != ''">CHK_DEP = #{chkDep},</if>
  270. <if test="chkGrp != null and chkGrp != ''">CHK_GRP = #{chkGrp},</if>
  271. <if test="planSttm != null">PLAN_STTM = #{planSttm},</if>
  272. <if test="planEntm != null">PLAN_ENTM = #{planEntm},</if>
  273. <if test="leadDep != null and leadDep != ''">LEAD_DEP = #{leadDep},</if>
  274. <if test="joinDep != null and joinDep != ''">JOIN_DEP = #{joinDep},</if>
  275. <!-- <if test="chkCity != null and chkCity != ''">CHK_CITY = #{chkCity},</if>-->
  276. <!-- <if test="chkCountry != null and chkCountry != ''">CHK_COUNTRY = #{chkCountry},</if>-->
  277. <if test="chkSize != null and chkSize != ''">CHK_SIZE = #{chkSize},</if>
  278. <if test="chkType != null and chkType != ''">CHK_TYPE = #{chkType},</if>
  279. <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
  280. <if test="chkPersTel != null and chkPersTel != ''">CHK_PERS_TEL = #{chkPersTel},</if>
  281. <if test="chkNote != null and chkNote != ''">CHK_NOTE = #{chkNote},</if>
  282. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  283. <if test="intm != null">INTM = #{intm},</if>
  284. <if test="uptm != null">UPTM = #{uptm},</if>
  285. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  286. <if test="id != null and id != ''">ID = #{id},</if>
  287. <if test="yearChkName != null and yearChkName != ''">YEAR_CHK_NAME = #{yearChkName},</if>
  288. <if test="yearChkType != null and yearChkType != ''">YEAR_CHK_TYPE = #{yearChkType},</if>
  289. <if test="yearPlanId != null and yearPlanId != ''">YEAR_PLAN_ID = #{yearPlanId},</if>
  290. <if test="organDep != null and organDep != ''">ORGAN_DEP = #{organDep},</if>
  291. </trim>
  292. <include refid="page_where" />
  293. </update>
  294. <select id="getByTimeRange" resultMap="bisInspPlanMonthResultMap">
  295. select <include refid="join_colum"/>
  296. from BIS_INSP_PLAN_MONTH t1
  297. where DATE_FORMAT(t1.CHK_MONTH,'%Y-%m') = DATE_FORMAT(#{checkMonth},'%Y-%m')
  298. and DATA_STAT = '0'
  299. </select>
  300. </mapper>