GwComFileDao.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  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.GwComFileDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.GwComFile" id="gwComFileResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="fileTitle" column="FILE_TITLE"/>
  7. <result property="keyWord" column="KEY_WORD"/>
  8. <result property="fileType" column="FILE_TYPE"/>
  9. <result property="abs" column="ABS"/>
  10. <result property="fileName" column="FILE_NAME"/>
  11. <result property="fileSize" column="FILE_SIZE"/>
  12. <result property="fileExt" column="FILE_EXT"/>
  13. <result property="filePath" column="FILE_PATH"/>
  14. <result property="thumbnailUrl" column="THUMBNAIL_URL"/>
  15. <result property="bizType" column="BIZ_TYPE"/>
  16. <result property="bizId" column="BIZ_ID"/>
  17. <result property="longitude" column="LONGITUDE"/>
  18. <result property="latitude" column="LATITUDE"/>
  19. <result property="createBy" column="CREATE_BY"/>
  20. <result property="createDate" column="CREATE_DATE"/>
  21. <result property="updateBy" column="UPDATE_BY"/>
  22. <result property="updateDate" column="UPDATE_DATE"/>
  23. <result property="downNum" column="DOWN_NUM"/>
  24. <result property="sn" column="SN"/>
  25. <result property="topValue" column="TOP"/>
  26. <result property="topDate" column="TOP_DATE"/>
  27. </resultMap>
  28. <sql id="table_columns">
  29. ID,
  30. FILE_TITLE,
  31. KEY_WORD,
  32. FILE_TYPE,
  33. ABS,
  34. FILE_NAME,
  35. FILE_SIZE,
  36. FILE_EXT,
  37. FILE_PATH,
  38. THUMBNAIL_URL,
  39. BIZ_TYPE,
  40. BIZ_ID,
  41. LONGITUDE,
  42. LATITUDE,
  43. CREATE_BY,
  44. CREATE_DATE,
  45. UPDATE_BY,
  46. UPDATE_DATE,
  47. DOWN_NUM,
  48. SN,
  49. TOP,
  50. TOP_DATE
  51. </sql>
  52. <sql id="entity_properties">
  53. #{id},
  54. #{fileTitle},
  55. #{keyWord},
  56. #{fileType},
  57. #{abs},
  58. #{fileName},
  59. #{fileSize},
  60. #{fileExt},
  61. #{filePath},
  62. #{thumbnailUrl},
  63. #{bizType},
  64. #{bizId},
  65. #{longitude},
  66. #{latitude},
  67. #{createBy},
  68. #{createDate},
  69. #{updateBy},
  70. #{updateDate},
  71. #{downNum},
  72. #{sn},
  73. #{topValue},
  74. #{topDate}
  75. </sql>
  76. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  77. <sql id="page_where">
  78. <trim prefix="where" prefixOverrides="and | or ">
  79. <if test="fileTitle != null and fileTitle != ''">and FILE_TITLE = #{fileTitle}</if>
  80. <if test="keyWord != null and keyWord != ''">and KEY_WORD = #{keyWord}</if>
  81. <if test="fileType != null and fileType != ''">and FILE_TYPE = #{fileType}</if>
  82. <if test="abs != null and abs != ''">and ABS = #{abs}</if>
  83. <if test="fileName != null and fileName != ''">and FILE_NAME like '${fileName}%'</if>
  84. <if test="fileSize != null and fileSize != ''">and FILE_SIZE = #{fileSize}</if>
  85. <if test="fileExt != null and fileExt != ''">and FILE_EXT = #{fileExt}</if>
  86. <if test="filePath != null and filePath != ''">and FILE_PATH = #{filePath}</if>
  87. <if test="thumbnailUrl != null and thumbnailUrl != ''">and THUMBNAIL_URL = #{thumbnailUrl}</if>
  88. <if test="bizType != null and bizType != ''">and BIZ_TYPE like '${bizType}%'</if>
  89. <if test="bizId != null and bizId != ''">and BIZ_ID = #{bizId}</if>
  90. <if test="longitude != null and longitude != ''">and LONGITUDE = #{longitude}</if>
  91. <if test="latitude != null and latitude != ''">and LATITUDE = #{latitude}</if>
  92. <if test="createBy != null and createBy != ''">and CREATE_BY = #{createBy}</if>
  93. <if test="createDate != null">and CREATE_DATE = #{createDate}</if>
  94. <if test="updateBy != null and updateBy != ''">and UPDATE_BY = #{updateBy}</if>
  95. <if test="updateDate != null">and UPDATE_DATE = #{updateDate}</if>
  96. <if test="downNum != null and downNum != ''">and DOWN_NUM = #{downNum}</if>
  97. <if test="sn != null and sn != ''">and SN = #{sn}</if>
  98. <if test="topValue != null and top != ''">and TOP = #{topValue}</if>
  99. <if test="topDate != null">and TOP_DATE = #{topDate}</if>
  100. </trim>
  101. </sql>
  102. <select id="get" resultMap="gwComFileResultMap" parameterType="String">
  103. select
  104. <include refid="table_columns"/>
  105. from gw_com_file where ID = #{id}
  106. </select>
  107. <select id="getBy" resultMap="gwComFileResultMap">
  108. select
  109. <include refid="table_columns"/>
  110. from gw_com_file
  111. <include refid="page_where"/>
  112. </select>
  113. <select id="findAll" resultMap="gwComFileResultMap">
  114. select
  115. <include refid="table_columns"/>
  116. from gw_com_file
  117. ORDER BY CREATE_DATE
  118. </select>
  119. <select id="findList" resultMap="gwComFileResultMap">
  120. select
  121. <include refid="table_columns"/>
  122. from gw_com_file
  123. <include refid="page_where"/>
  124. ORDER BY CREATE_DATE
  125. </select>
  126. <select id="selectCount" resultType="int">
  127. select count(ID) from gw_com_file
  128. <include refid="page_where"/>
  129. </select>
  130. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.GwComFile">
  131. insert into gw_com_file(
  132. <include refid="table_columns"/>
  133. )
  134. values (
  135. <include refid="entity_properties"/>
  136. )
  137. </insert>
  138. <delete id="delete" parameterType="java.lang.String">
  139. delete from gw_com_file where ID = #{id}
  140. </delete>
  141. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.GwComFile">
  142. delete from gw_com_file
  143. <include refid="page_where"/>
  144. </delete>
  145. <update id="deleteInFlag" parameterType="java.lang.String">
  146. update gw_com_file set flag_valid = 0 where ID = #{id}
  147. </update>
  148. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.GwComFile">
  149. update gw_com_file
  150. <trim prefix="set" suffixOverrides=",">
  151. <if test="fileTitle != null and fileTitle != ''">FILE_TITLE = #{fileTitle},</if>
  152. <if test="keyWord != null and keyWord != ''">KEY_WORD = #{keyWord},</if>
  153. <if test="fileType != null and fileType != ''">FILE_TYPE = #{fileType},</if>
  154. <if test="abs != null and abs != ''">ABS = #{abs},</if>
  155. <if test="fileName != null and fileName != ''">FILE_NAME = #{fileName},</if>
  156. <if test="fileSize != null and fileSize != ''">FILE_SIZE = #{fileSize},</if>
  157. <if test="fileExt != null and fileExt != ''">FILE_EXT = #{fileExt},</if>
  158. <if test="filePath != null and filePath != ''">FILE_PATH = #{filePath},</if>
  159. <if test="thumbnailUrl != null and thumbnailUrl != ''">THUMBNAIL_URL = #{thumbnailUrl},</if>
  160. <if test="bizType != null and bizType != ''">BIZ_TYPE = #{bizType},</if>
  161. <if test="bizId != null and bizId != ''">BIZ_ID = #{bizId},</if>
  162. <if test="longitude != null and longitude != ''">LONGITUDE = #{longitude},</if>
  163. <if test="latitude != null and latitude != ''">LATITUDE = #{latitude},</if>
  164. <if test="createBy != null and createBy != ''">CREATE_BY = #{createBy},</if>
  165. <if test="createDate != null">CREATE_DATE = #{createDate},</if>
  166. <if test="updateBy != null and updateBy != ''">UPDATE_BY = #{updateBy},</if>
  167. <if test="updateDate != null">UPDATE_DATE = #{updateDate},</if>
  168. <if test="downNum != null and downNum != ''">DOWN_NUM = #{downNum},</if>
  169. <if test="sn != null and sn != ''">SN = #{sn},</if>
  170. <if test="topValue != null and topValue != ''">TOP = #{topValue},</if>
  171. <if test="topDate != null">TOP_DATE = #{topDate}</if>
  172. </trim>
  173. <where>ID = #{id}</where>
  174. </update>
  175. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.GwComFile">
  176. update gw_com_file
  177. <trim prefix="set" suffixOverrides=",">
  178. <if test="fileTitle != null and fileTitle != ''">FILE_TITLE = #{fileTitle},</if>
  179. <if test="keyWord != null and keyWord != ''">KEY_WORD = #{keyWord},</if>
  180. <if test="fileType != null and fileType != ''">FILE_TYPE = #{fileType},</if>
  181. <if test="abs != null and abs != ''">ABS = #{abs},</if>
  182. <if test="fileName != null and fileName != ''">FILE_NAME = #{fileName},</if>
  183. <if test="fileSize != null and fileSize != ''">FILE_SIZE = #{fileSize},</if>
  184. <if test="fileExt != null and fileExt != ''">FILE_EXT = #{fileExt},</if>
  185. <if test="filePath != null and filePath != ''">FILE_PATH = #{filePath},</if>
  186. <if test="thumbnailUrl != null and thumbnailUrl != ''">THUMBNAIL_URL = #{thumbnailUrl},</if>
  187. <if test="bizType != null and bizType != ''">BIZ_TYPE = #{bizType},</if>
  188. <if test="bizId != null and bizId != ''">BIZ_ID = #{bizId},</if>
  189. <if test="longitude != null and longitude != ''">LONGITUDE = #{longitude},</if>
  190. <if test="latitude != null and latitude != ''">LATITUDE = #{latitude},</if>
  191. <if test="createBy != null and createBy != ''">CREATE_BY = #{createBy},</if>
  192. <if test="createDate != null">CREATE_DATE = #{createDate},</if>
  193. <if test="updateBy != null and updateBy != ''">UPDATE_BY = #{updateBy},</if>
  194. <if test="updateDate != null">UPDATE_DATE = #{updateDate},</if>
  195. <if test="downNum != null and downNum != ''">DOWN_NUM = #{downNum},</if>
  196. <if test="sn != null and sn != ''">SN = #{sn},</if>
  197. <if test="topValue != null and topValue != ''">TOP = #{topValue},</if>
  198. <if test="topDate != null">TOP_DATE = #{topDate}</if>
  199. </trim>
  200. <include refid="page_where"/>
  201. </update>
  202. <select id="findLongFileExt" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  203. select * from gw_com_file e where length(e.file_ext)>12
  204. </select>
  205. <!-- 其他自定义SQL -->
  206. <select id="findFileByBiz" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  207. SELECT
  208. <include refid="table_columns"/>
  209. from gw_com_file WHERE BIZ_ID = #{bizId} ORDER BY SN,CREATE_DATE
  210. </select>
  211. <select id="findFileByRgId" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  212. SELECT
  213. <include refid="table_columns"/>
  214. from gw_com_file WHERE BIZ_ID in (
  215. select id from BIS_INSP_STSTN_SCORE t where case_id in (
  216. select id from BIS_INSP_STSTN_SCENE t where rgstr_id=#{rgId}
  217. union all
  218. select id from BIS_INSP_STSTN_TMPR t where rgstr_id=#{rgId}
  219. union all
  220. select id from BIS_INSP_STSTN_SAF t where rgstr_id=#{rgId}
  221. )
  222. )
  223. </select>
  224. <select id="countByPblmId" parameterType="String" resultType="java.lang.Integer">
  225. SELECT
  226. COUNT(*)
  227. FROM GW_COM_FILE
  228. WHERE BIZ_ID = #{bizId}
  229. </select>
  230. <select id="listByCon" resultMap="gwComFileResultMap"
  231. parameterType="cn.com.goldenwater.dcproj.param.GwComFileParam">
  232. SELECT
  233. <include refid="table_columns"/>
  234. FROM gw_com_file
  235. <where>
  236. <if test="bizType != null and bizType != '' and bizType != 'signature' ">
  237. and BIZ_TYPE = #{bizType}
  238. </if>
  239. <if test="fileName != null and fileName != '' ">
  240. AND FILE_NAME LIKE CONCAT('%', CONCAT(#{fileName}, '%'))
  241. </if>
  242. <if test="bizId != null and bizId != ''">
  243. and BIZ_ID = #{bizId}
  244. </if>
  245. </where>
  246. ORDER BY TOP_DATE DESC nulls last, CREATE_DATE DESC
  247. </select>
  248. <update id="updateBizId">
  249. UPDATE gw_com_file set BIZ_ID = #{bizId} where ID = #{id}
  250. </update>
  251. <update id="updateTop">
  252. UPDATE
  253. gw_com_file
  254. set
  255. TOP = #{topValue},
  256. TOP_DATE = #{topDate}
  257. where
  258. ID = #{id}
  259. </update>
  260. <!--根据条件获取最新n条近期面貌数据-->
  261. <select id="findImgPage" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  262. select * from (
  263. select A.*,B.RSVR_NM OBJ_NAME from gw_com_file A left join bis_insp_rsvr_rgstr B ON A.BIZ_ID=B.rgstr_id
  264. where A.biz_id is not null
  265. and FILE_EXT IN ('jpg','JPG','PNG','png')
  266. AND B.AD_CODE like CONCAT(#{adCode}, '%')
  267. AND B.RSVR_NM IS NOT NULL
  268. order by A.create_date desc
  269. ) where rownum&lt;=#{n}
  270. </select>
  271. <!--根据条件获取最新n条近期面貌数据-->
  272. <select id="getImgByBizId" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  273. select * from (
  274. select A.*
  275. from gw_com_file A
  276. where FILE_EXT IN ('jpg','JPG','PNG','png')
  277. AND A.BIZ_ID = #{bizId}
  278. order by A.create_date desc
  279. ) where rownum &lt;= #{n}
  280. </select>
  281. <!--根据条件获取最新n条近期面貌数据-->
  282. <select id="getTopNFace" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  283. select * from (
  284. select A.*,B.RSVR_NM OBJ_NAME from gw_com_file A left join bis_insp_rsvr_rgstr B ON A.BIZ_ID=B.rgstr_id
  285. where A.biz_id is not null
  286. and FILE_EXT IN ('jpg','JPG','PNG','png')
  287. AND B.AD_CODE like CONCAT(#{adCode}, '%')
  288. AND B.RSVR_NM IS NOT NULL
  289. order by A.create_date desc
  290. ) where rownum&lt;=#{n}
  291. </select>
  292. <!--根据条件获取水闸最新n条近期面貌数据-->
  293. <select id="getTopHnNFace" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  294. select * from (
  295. select A.*,B.gate_name OBJ_NAME from gw_com_file A left join ATT_WAGA_RGSTR B ON A.BIZ_ID=B.obj_id
  296. where A.biz_id is not null
  297. and FILE_EXT IN ('jpg','JPG','PNG','png')
  298. AND B.AD_CODE like CONCAT(#{adCode}, '%')
  299. AND B.gate_name IS NOT NULL
  300. order by A.create_date desc
  301. ) where rownum&lt;=#{n}
  302. </select>
  303. <!--根据条件获取最新n条近期问题-->
  304. <select id="getTopNPblm" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  305. select * from (
  306. select A.*,B.OBJ_NAME from gw_com_file A LEFT JOIN bis_insp_pblm B ON A.BIZ_ID=B.pblm_id
  307. where A.biz_id is not null
  308. and A.FILE_EXT IN ('jpg','JPG','PNG','png')
  309. AND B.obj_ad_code like CONCAT(#{currentAdCode}, '%')
  310. AND B.OBJ_NAME IS NOT NULL
  311. <if test="pType != null and pType != '' ">
  312. and B.obj_type=#{pType}
  313. </if>
  314. <if test="adCode != null and adCode != '' ">
  315. and B.obj_ad_code like CONCAT(#{adCode}, '%')
  316. </if>
  317. <!-- 四川的首页问题图片只展示严重问题图片 因小水库打分制,取消掉严重等级过滤
  318. <if test='adCode != null and adCode != "" and adCode.substring(0,2) == "51" '>
  319. 问题严重等级:0 一般;1较重 2严重 3特别严重
  320. AND B.INSP_PBLM_CATE in ('0','1',,'2','3')
  321. </if> -->
  322. order by create_date desc
  323. ) where rownum&lt;=#{n}
  324. </select>
  325. <!--根据条件获取最新n条近期问题视频-->
  326. <select id="getTopNPblmVido" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  327. select * from (
  328. select * from gw_com_file A LEFT JOIN bis_insp_pblm B ON A.biz_id=B.pblm_id
  329. where A.biz_id is not null
  330. and A.FILE_EXT IN ('mp4','MP4','3gp','m4a','MP3','mp3','avi')
  331. AND B.OBJ_NAME IS NOT NULL
  332. AND B.obj_ad_code like CONCAT(#{adCode}, '%')
  333. <!-- 四川的首页问题视频只展示严重问题视频 -->
  334. <if test='adCode != null and adCode != "" and adCode.substring(0,2) == "51" '>
  335. <!-- 问题严重等级:0 一般;1较重 2严重 3特别严重 -->
  336. AND B.INSP_PBLM_CATE in ('2','3')
  337. </if>
  338. order by create_date desc
  339. ) where rownum&lt;=#{n}
  340. </select>
  341. <!--根据条件获取最新n条稽察问题数据-->
  342. <select id="getTopTacPlam" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  343. select * from (
  344. select A.*,C.OJB_NM OBJ_NAME from gw_com_file A LEFT JOIN TAC_PBLM_INFO B ON A.biz_id=B.ID
  345. left join TAC_INSP_YEAR_BATCH_OBJ C on B.OBJ_ID=C.ID
  346. where A.biz_id is not null
  347. and FILE_EXT IN ('jpg','JPG','PNG','png')
  348. AND B.PROVINCE =#{province}
  349. AND C.OJB_NM IS NOT NULL
  350. order by A.create_date desc
  351. ) where rownum&lt;=#{n}
  352. </select>
  353. <!--根据条件获取最新n条稽察问题数据-->
  354. <select id="getTopTacPlamVideo" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  355. select * from (
  356. select A.*,C.OJB_NM OBJ_NAME from gw_com_file A LEFT JOIN TAC_PBLM_INFO B ON A.biz_id=B.ID
  357. left join TAC_INSP_YEAR_BATCH_OBJ C on B.OBJ_ID=C.ID
  358. where A.biz_id is not null
  359. AND B.PROVINCE =#{province}
  360. and A.FILE_EXT IN ('mp4','MP4','3gp','m4a','MP3','mp3','avi')
  361. AND C.OJB_NM IS NOT NULL
  362. order by create_date desc
  363. ) where rownum&lt;=#{n}
  364. </select>
  365. <select id="getPrjectInfo" resultType="java.util.HashMap">
  366. select * from BIS_INSP_STSTN t where to_char(intm,'yyyy')=2022
  367. </select>
  368. <select id="selectListByYear" resultMap="gwComFileResultMap"
  369. parameterType="cn.com.goldenwater.dcproj.param.GwComFileParam">
  370. SELECT
  371. <include refid="table_columns"/>
  372. FROM gw_com_file
  373. WHERE CREATE_DATE &gt;= to_date(#{createDateStr},'yyyy-mm-dd HH24:MI:SS') AND CREATE_DATE &lt; to_date(#{updateDateStr},'yyyy-mm-dd HH24:MI:SS') AND file_path is not null
  374. ORDER BY CREATE_DATE DESC
  375. </select>
  376. <select id="selectCountByYear" resultType="int" parameterType="cn.com.goldenwater.dcproj.param.GwComFileParam">
  377. select count(ID) from gw_com_file
  378. WHERE CREATE_DATE &gt;= to_date(#{createDateStr},'yyyy-mm-dd HH24:MI:SS') AND CREATE_DATE &lt; to_date(#{updateDateStr},'yyyy-mm-dd HH24:MI:SS') AND file_path is not null
  379. </select>
  380. </mapper>