GwComFileDao.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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="countByPblmId" parameterType="String" resultType="java.lang.Integer">
  212. SELECT
  213. COUNT(*)
  214. FROM GW_COM_FILE
  215. WHERE BIZ_ID = #{bizId}
  216. </select>
  217. <select id="listByCon" resultMap="gwComFileResultMap"
  218. parameterType="cn.com.goldenwater.dcproj.param.GwComFileParam">
  219. SELECT
  220. <include refid="table_columns"/>
  221. FROM gw_com_file
  222. <where>
  223. <if test="bizType != null and bizType != '' and bizType != 'signature' ">
  224. and BIZ_TYPE = #{bizType}
  225. </if>
  226. <if test="fileName != null and fileName != '' ">
  227. AND FILE_NAME LIKE CONCAT('%', CONCAT(#{fileName}, '%'))
  228. </if>
  229. <if test="fileIds != null and fileIds.size() > 0">
  230. and BIZ_ID IN
  231. <foreach collection="fileIds" index="index" item="item" open="(" separator="," close=")">
  232. #{item}
  233. </foreach>
  234. </if>
  235. </where>
  236. ORDER BY TOP_DATE is null, TOP_DATE, CREATE_DATE DESC
  237. </select>
  238. <update id="updateBizId">
  239. UPDATE gw_com_file set BIZ_ID = #{bizId} where ID = #{id}
  240. </update>
  241. <update id="updateTop">
  242. UPDATE
  243. gw_com_file
  244. set
  245. TOP = #{topValue},
  246. TOP_DATE = #{topDate}
  247. where
  248. ID = #{id}
  249. </update>
  250. <!--根据条件获取最新n条近期面貌数据-->
  251. <select id="findImgPage" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  252. 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
  253. where A.biz_id is not null
  254. and FILE_EXT IN ('jpg','JPG','PNG','png')
  255. AND B.AD_CODE like CONCAT(#{adCode}, '%')
  256. AND B.RSVR_NM IS NOT NULL
  257. order by A.create_date desc
  258. limit ${n}
  259. </select>
  260. <!--根据条件获取最新n条近期面貌数据-->
  261. <select id="getImgByBizId" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  262. select A.*
  263. from gw_com_file A
  264. where FILE_EXT IN ('jpg','JPG','PNG','png')
  265. AND A.BIZ_ID = #{bizId}
  266. order by A.create_date desc
  267. limit ${n}
  268. </select>
  269. <!--根据条件获取最新n条近期面貌数据-->
  270. <select id="getTopNFace" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  271. 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
  272. where A.biz_id is not null
  273. and FILE_EXT IN ('jpg','JPG','PNG','png')
  274. AND B.AD_CODE like CONCAT(#{adCode}, '%')
  275. AND B.RSVR_NM IS NOT NULL
  276. order by A.create_date desc
  277. limit ${n}
  278. </select>
  279. <!--根据条件获取水闸最新n条近期面貌数据-->
  280. <select id="getTopHnNFace" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  281. 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
  282. where A.biz_id is not null
  283. and FILE_EXT IN ('jpg','JPG','PNG','png')
  284. AND B.AD_CODE like CONCAT(#{adCode}, '%')
  285. AND B.gate_name IS NOT NULL
  286. order by A.create_date desc
  287. limit ${n}
  288. </select>
  289. <!--根据条件获取最新n条近期问题-->
  290. <select id="getTopNPblm" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  291. select A.*,B.OBJ_NAME from gw_com_file A LEFT JOIN bis_insp_pblm B ON A.BIZ_ID=B.pblm_id
  292. where A.biz_id is not null
  293. and A.FILE_EXT IN ('jpg','JPG','PNG','png')
  294. AND B.obj_ad_code like CONCAT(#{currentAdCode}, '%')
  295. AND B.OBJ_NAME IS NOT NULL
  296. <if test="pType != null and pType != '' ">
  297. and B.obj_type=#{pType}
  298. </if>
  299. <if test="adCode != null and adCode != '' ">
  300. and B.obj_ad_code like CONCAT(#{adCode}, '%')
  301. </if>
  302. order by create_date desc
  303. limit ${n}
  304. </select>
  305. <!--根据条件获取最新n条近期问题视频-->
  306. <select id="getTopNPblmVido" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  307. select * from gw_com_file A LEFT JOIN bis_insp_pblm B ON A.biz_id=B.pblm_id
  308. where A.biz_id is not null
  309. and A.FILE_EXT IN ('mp4','MP4','3gp','m4a','MP3','mp3','avi')
  310. AND B.OBJ_NAME IS NOT NULL
  311. AND B.obj_ad_code like CONCAT(#{adCode}, '%')
  312. order by create_date desc
  313. limit ${n}
  314. </select>
  315. <!--根据条件获取最新n条稽察问题数据-->
  316. <select id="getTopTacPlam" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  317. select A.*,C.OJB_NM OBJ_NAME from gw_com_file A LEFT JOIN TAC_PBLM_INFO B ON A.biz_id=B.ID
  318. left join TAC_INSP_YEAR_BATCH_OBJ C on B.OBJ_ID=C.ID
  319. where A.biz_id is not null
  320. and FILE_EXT IN ('jpg','JPG','PNG','png')
  321. AND B.PROVINCE =#{province}
  322. AND C.OJB_NM IS NOT NULL
  323. order by A.create_date desc
  324. limit ${n}
  325. </select>
  326. <!--根据条件获取最新n条稽察问题数据-->
  327. <select id="getTopTacPlamVideo" resultType="cn.com.goldenwater.dcproj.model.GwComFile">
  328. select A.*,C.OJB_NM OBJ_NAME from gw_com_file A LEFT JOIN TAC_PBLM_INFO B ON A.biz_id=B.ID
  329. left join TAC_INSP_YEAR_BATCH_OBJ C on B.OBJ_ID=C.ID
  330. where A.biz_id is not null
  331. AND B.PROVINCE =#{province}
  332. and A.FILE_EXT IN ('mp4','MP4','3gp','m4a','MP3','mp3','avi')
  333. AND C.OJB_NM IS NOT NULL
  334. order by create_date desc
  335. limit ${n}
  336. </select>
  337. </mapper>