ShowDlycMapper.xml 9.3 KB

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