ShowBdycMapper.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.railway.business.bi.mapper.ShowBdycMapper">
  5. <resultMap id="BaseResultMap" type="com.railway.business.bi.domain.ShowBdyc">
  6. <result column="id" property="id"/>
  7. <result column="found_date" property="foundDate"/>
  8. <result column="line_name" property="lineName"/>
  9. <result column="station_name" property="stationName"/>
  10. <result column="qxsbmc" property="qxsbmc"/>
  11. <result column="yxbh" property="yxbh"/>
  12. <result column="qxdj" property="qxdj"/>
  13. <result column="qxnr" property="qxnr"/>
  14. <result column="reason" property="reason"/>
  15. <result column="zrbm" property="zrbm"/>
  16. <result column="sjgq" property="sjgq"/>
  17. <result column="rectify_result" property="rectifyResult"/>
  18. <result column="rectify_way" property="rectifyWay"/>
  19. <result column="rectify_date" property="rectifyDate"/>
  20. <result column="counted" property="counted"/>
  21. <result column="plan_date" property="planDate"/>
  22. <result column="create_by" property="createBy"/>
  23. <result column="create_time" property="createTime"/>
  24. <result column="update_by" property="updateBy"/>
  25. <result column="update_time" property="updateTime"/>
  26. <result column="file_id" property="fileId"/>
  27. <result column="del_flag" property="delFlag"/>
  28. </resultMap>
  29. <sql id="Base_Column_List">
  30. id,
  31. found_date,
  32. line_name,
  33. station_name,
  34. qxsbmc,
  35. yxbh,
  36. qxdj,
  37. qxnr,
  38. reason,
  39. zrbm,
  40. sjgq,
  41. rectify_result,
  42. rectify_way,
  43. rectify_date,
  44. counted,
  45. plan_date,
  46. create_by,
  47. create_time,
  48. update_by,
  49. update_time,
  50. del_flag,
  51. file_id
  52. </sql>
  53. <insert id="insert" parameterType="com.railway.business.bi.domain.ShowBdyc">
  54. INSERT INTO show_bdyc
  55. <trim prefix="(" suffix=")" suffixOverrides=",">
  56. <if test='null != foundDate'>
  57. found_date,
  58. </if>
  59. <if test='null != lineName'>
  60. line_name,
  61. </if>
  62. <if test='null != stationName'>
  63. station_name,
  64. </if>
  65. <if test='null != qxsbmc'>
  66. qxsbmc,
  67. </if>
  68. <if test='null != yxbh'>
  69. yxbh,
  70. </if>
  71. <if test='null != qxdj'>
  72. qxdj,
  73. </if>
  74. <if test='null != qxnr'>
  75. qxnr,
  76. </if>
  77. <if test='null != reason'>
  78. reason,
  79. </if>
  80. <if test='null != zrbm'>
  81. zrbm,
  82. </if>
  83. <if test='null != sjgq'>
  84. sjgq,
  85. </if>
  86. <if test='null != rectifyResult'>
  87. rectify_result,
  88. </if>
  89. <if test='null != rectifyWay'>
  90. rectify_way,
  91. </if>
  92. <if test='null != rectifyDate'>
  93. rectify_date,
  94. </if>
  95. <if test='null != counted'>
  96. counted,
  97. </if>
  98. <if test='null != planDate'>
  99. plan_date,
  100. </if>
  101. <if test='null != createBy'>
  102. create_by,
  103. </if>
  104. <if test='null != createTime'>
  105. create_time,
  106. </if>
  107. <if test='null != fileId'>
  108. file_id,
  109. </if>
  110. <if test='null != foundMode'>
  111. found_mode,
  112. </if>
  113. <if test='null != delFlag'>
  114. del_flag
  115. </if>
  116. </trim>
  117. <trim prefix="values (" suffix=")" suffixOverrides=",">
  118. <if test='null != foundDate'>
  119. #{foundDate},
  120. </if>
  121. <if test='null != lineName'>
  122. #{lineName},
  123. </if>
  124. <if test='null != stationName'>
  125. #{stationName},
  126. </if>
  127. <if test='null != qxsbmc'>
  128. #{qxsbmc},
  129. </if>
  130. <if test='null != yxbh'>
  131. #{yxbh},
  132. </if>
  133. <if test='null != qxdj'>
  134. #{qxdj},
  135. </if>
  136. <if test='null != qxnr'>
  137. #{qxnr},
  138. </if>
  139. <if test='null != reason'>
  140. #{reason},
  141. </if>
  142. <if test='null != zrbm'>
  143. #{zrbm},
  144. </if>
  145. <if test='null != sjgq'>
  146. #{sjgq},
  147. </if>
  148. <if test='null != rectifyResult'>
  149. #{rectifyResult},
  150. </if>
  151. <if test='null != rectifyWay'>
  152. #{rectifyWay},
  153. </if>
  154. <if test='null != rectifyDate'>
  155. #{rectifyDate},
  156. </if>
  157. <if test='null != counted'>
  158. #{counted},
  159. </if>
  160. <if test='null != planDate'>
  161. #{planDate},
  162. </if>
  163. <if test='null != createBy'>
  164. #{createBy},
  165. </if>
  166. <if test='null != createTime'>
  167. #{createTime},
  168. </if>
  169. <if test='null != fileId'>
  170. #{fileId},
  171. </if>
  172. <if test='null != foundMode'>
  173. #{foundMode},
  174. </if>
  175. <if test='null != delFlag'>
  176. #{delFlag}
  177. </if>
  178. </trim>
  179. </insert>
  180. <delete id="delete">
  181. UPDATE show_bdyc
  182. set del_flag='1'
  183. WHERE id = #{id}
  184. </delete>
  185. <update id="update" parameterType="com.railway.business.bi.domain.ShowBdyc">
  186. UPDATE show_bdyc
  187. <set>
  188. <if test='null != foundDate'>found_date = #{foundDate},</if>
  189. <if test='null != lineName'>line_name = #{lineName},</if>
  190. <if test='null != stationName'>station_name = #{stationName},</if>
  191. <if test='null != qxsbmc'>qxsbmc = #{qxsbmc},</if>
  192. <if test='null != yxbh'>yxbh = #{yxbh},</if>
  193. <if test='null != qxdj'>qxdj = #{qxdj},</if>
  194. <if test='null != qxnr'>qxnr = #{qxnr},</if>
  195. <if test='null != reason'>reason = #{reason},</if>
  196. <if test='null != zrbm'>zrbm = #{zrbm},</if>
  197. <if test='null != sjgq'>sjgq = #{sjgq},</if>
  198. <if test='null != rectifyResult'>rectify_result = #{rectifyResult},</if>
  199. <if test='null != rectifyWay'>rectify_way = #{rectifyWay},</if>
  200. <if test='null != rectifyDate'>rectify_date = #{rectifyDate},</if>
  201. <if test='null != counted'>counted = #{counted},</if>
  202. <if test='null != planDate'>plan_date = #{planDate},</if>
  203. <if test='null != updateBy'>update_by = #{updateBy},</if>
  204. <if test='null != updateTime'>update_time = #{updateTime},</if>
  205. <if test='null != fileId'>file_id = #{fileId},</if>
  206. <if test='null != delFlag'>del_flag = #{delFlag}</if>
  207. </set>
  208. WHERE id = #{id}
  209. </update>
  210. <select id="getInfo" resultMap="BaseResultMap">
  211. SELECT
  212. <include refid="Base_Column_List"/>
  213. FROM show_bdyc
  214. WHERE del_flag='0' and id = #{id}
  215. </select>
  216. <select id="getList" resultMap="BaseResultMap">
  217. SELECT
  218. <include refid="Base_Column_List"/>
  219. FROM show_bdyc
  220. <where>
  221. del_flag='0'
  222. and file_id = (select max(id) from show_file where data_type='yctj' and imp_result = '1')
  223. <if test="gravity!=null and gravity!=''">
  224. and qxdj=(select dict_label from sys_dict_data where dict_type='dlycyzx' and
  225. dict_value=#{gravity})
  226. </if>
  227. <if test="ssgq!=null and ssgq!=''">
  228. and sjgq=(select dict_label from sys_dict_data where dict_type='dlyc_sygq' and
  229. dict_value=#{ssgq})
  230. </if>
  231. <if test="lineName!=null and lineName!=''">
  232. and line_name like concat('%', #{lineName}, '%')
  233. </if>
  234. <if test="zrbm!=null and zrbm!=''">
  235. and zrbm like concat('%', #{zrbm}, '%')
  236. </if>
  237. <if test="rectifyResult!=null and rectifyResult!=''">
  238. and rectify_result =
  239. (select dict_label from sys_dict_data where dict_type='bdyc_clqk' and
  240. dict_value=#{rectifyResult})
  241. </if>
  242. <if test="foundMode!=null and foundMode!=''">
  243. and found_mode=#{foundMode}
  244. </if>
  245. </where>
  246. </select>
  247. <select id="getLineList" resultType="java.lang.String">
  248. SELECT distinct line_name
  249. FROM show_bdyc
  250. <where>
  251. del_flag='0'
  252. and file_id = (select max(id) from show_file where data_type='yctj' and imp_result = '1')
  253. and found_mode=#{foundMode}
  254. </where>
  255. </select>
  256. <select id="totalByDay" resultType="com.railway.business.bi.domain.dto.DlycDTO">
  257. select t1.dict_label as gq,
  258. t1.dict_value as gqCode,
  259. sum(yj) as dj1,
  260. sum(ej) as dj2,
  261. sum(sj) as dj3
  262. from (select sjgq,
  263. case when qxdj = '一级' then 1 else 0 end as yj,
  264. case when qxdj = '二级' then 1 else 0 end as ej,
  265. case when qxdj = '三级' then 1 else 0 end as sj
  266. from show_bdyc
  267. where del_flag = '0'
  268. <!-- and found_date = #{date} -->
  269. and rectify_result='未处理'
  270. and file_id =
  271. (select max(id) from show_file where data_type = 'yctj' and imp_result = '1')
  272. and sjgq is not null) x
  273. right join sys_dict_data t1 on x.sjgq = t1.dict_label
  274. where t1.dict_type = 'dlyc_sygq'
  275. group by t1.dict_label
  276. </select>
  277. <resultMap id="TotalResultMap" type="com.railway.business.bi.domain.vo.YcxxTotalVO">
  278. <result column="gravity" property="gravity"/>
  279. <result column="data" property="data"/>
  280. </resultMap>
  281. <select id="getTotal" resultMap="TotalResultMap">
  282. SELECT qxdj gravity, count(*) data
  283. FROM show_bdyc
  284. where del_flag = '0'
  285. and rectify_result='未处理'
  286. and file_id = (select max(id) from show_file where data_type = 'yctj' and imp_result = '1')
  287. group by qxdj;
  288. </select>
  289. </mapper>