BasePreventForeignMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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.baseinfo.mapper.BasePreventForeignMapper">
  5. <resultMap id="BaseResultMap" type="com.railway.business.baseinfo.domain.BasePreventForeign">
  6. <result column="id" property="id"/>
  7. <result column="piecewise" property="piecewise"/>
  8. <result column="dept_id" property="deptId"/>
  9. <result column="dept_name" property="deptName"/>
  10. <result column="line_id" property="lineId"/>
  11. <result column="line_name" property="lineName"/>
  12. <result column="xingbie" property="xingbie"/>
  13. <result column="xingbie_text" property="xingbieText"/>
  14. <result column="station_id" property="stationId"/>
  15. <result column="station_name" property="stationName"/>
  16. <result column="pillar_code" property="pillarCode"/>
  17. <result column="marker" property="marker"/>
  18. <result column="risk_source" property="riskSource"/>
  19. <result column="measures" property="measures"/>
  20. <result column="remark" property="remark"/>
  21. <result column="del_flag" property="delFlag"/>
  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. </resultMap>
  27. <sql id="Base_Column_List">
  28. t.id,
  29. t.piecewise,
  30. v.dept_id,
  31. v.dept_name,
  32. v.line_id,
  33. v.line_name,
  34. t.xingbie,
  35. v.station_id,
  36. v.station_name,
  37. t.pillar_code,
  38. t.marker,
  39. t.risk_source,
  40. t.measures,
  41. t.remark,
  42. t.del_flag,
  43. t.create_by,
  44. t.create_time,
  45. t.update_by,
  46. t.update_time
  47. </sql>
  48. <insert id="insert" parameterType="com.railway.business.baseinfo.domain.BasePreventForeign">
  49. <selectKey keyProperty="id" order="BEFORE" resultType="String">
  50. select replace(uuid(), '-', '') from dual
  51. </selectKey>
  52. INSERT INTO base_prevent_foreign
  53. <trim prefix="(" suffix=")" suffixOverrides=",">
  54. <if test ='null != piecewise'>
  55. piecewise,
  56. </if>
  57. <if test ='null != deptId'>
  58. dept_id,
  59. </if>
  60. <if test ='null != deptName'>
  61. dept_name,
  62. </if>
  63. <if test ='null != lineId'>
  64. line_id,
  65. </if>
  66. <if test ='null != lineName'>
  67. line_name,
  68. </if>
  69. <if test ='null != xingbie'>
  70. xingbie,
  71. </if>
  72. <if test ='null != stationId'>
  73. station_id,
  74. </if>
  75. <if test ='null != stationName'>
  76. station_name,
  77. </if>
  78. <if test ='null != pillarCode'>
  79. pillar_code,
  80. </if>
  81. <if test ='null != marker'>
  82. marker,
  83. </if>
  84. <if test ='null != riskSource'>
  85. risk_source,
  86. </if>
  87. <if test ='null != measures'>
  88. measures,
  89. </if>
  90. <if test ='null != remark'>
  91. remark,
  92. </if>
  93. <if test ='null != delFlag'>
  94. del_flag,
  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 != updateBy'>
  103. update_by,
  104. </if>
  105. <if test ='null != updateTime'>
  106. update_time
  107. </if>
  108. </trim>
  109. <trim prefix="values (" suffix=")" suffixOverrides=",">
  110. <if test ='null != piecewise'>
  111. #{piecewise},
  112. </if>
  113. <if test ='null != deptId'>
  114. #{deptId},
  115. </if>
  116. <if test ='null != deptName'>
  117. #{deptName},
  118. </if>
  119. <if test ='null != lineId'>
  120. #{lineId},
  121. </if>
  122. <if test ='null != lineName'>
  123. #{lineName},
  124. </if>
  125. <if test ='null != xingbie'>
  126. #{xingbie},
  127. </if>
  128. <if test ='null != stationId'>
  129. #{stationId},
  130. </if>
  131. <if test ='null != stationName'>
  132. #{stationName},
  133. </if>
  134. <if test ='null != pillarCode'>
  135. #{pillarCode},
  136. </if>
  137. <if test ='null != marker'>
  138. #{marker},
  139. </if>
  140. <if test ='null != riskSource'>
  141. #{riskSource},
  142. </if>
  143. <if test ='null != measures'>
  144. #{measures},
  145. </if>
  146. <if test ='null != remark'>
  147. #{remark},
  148. </if>
  149. <if test ='null != delFlag'>
  150. #{delFlag},
  151. </if>
  152. <if test ='null != createBy'>
  153. #{createBy},
  154. </if>
  155. <if test ='null != createTime'>
  156. #{createTime},
  157. </if>
  158. <if test ='null != updateBy'>
  159. #{updateBy},
  160. </if>
  161. <if test ='null != updateTime'>
  162. #{updateTime}
  163. </if>
  164. </trim>
  165. </insert>
  166. <delete id="delete">
  167. UPDATE base_prevent_foreign
  168. set del_flag='1'
  169. WHERE id = #{id}
  170. </delete>
  171. <update id="update" parameterType="com.railway.business.baseinfo.domain.BasePreventForeign">
  172. UPDATE base_prevent_foreign
  173. <set>
  174. <if test ='null != piecewise'>piecewise = #{piecewise},</if>
  175. <if test ='null != deptId'>dept_id = #{deptId},</if>
  176. <if test ='null != deptName'>dept_name = #{deptName},</if>
  177. <if test ='null != lineId'>line_id = #{lineId},</if>
  178. <if test ='null != lineName'>line_name = #{lineName},</if>
  179. <if test ='null != xingbie'>xingbie = #{xingbie},</if>
  180. <if test ='null != stationId'>station_id = #{stationId},</if>
  181. <if test ='null != stationName'>station_name = #{stationName},</if>
  182. <if test ='null != pillarCode'>pillar_code = #{pillarCode},</if>
  183. <if test ='null != marker'>marker = #{marker},</if>
  184. <if test ='null != riskSource'>risk_source = #{riskSource},</if>
  185. <if test ='null != measures'>measures = #{measures},</if>
  186. <if test ='null != remark'>remark = #{remark},</if>
  187. <if test ='null != delFlag'>del_flag = #{delFlag},</if>
  188. <if test ='null != createBy'>create_by = #{createBy},</if>
  189. <if test ='null != createTime'>create_time = #{createTime},</if>
  190. <if test ='null != updateBy'>update_by = #{updateBy},</if>
  191. <if test ='null != updateTime'>update_time = #{updateTime}</if>
  192. </set>
  193. WHERE id = #{id}
  194. </update>
  195. <select id="getInfo" resultMap="BaseResultMap">
  196. SELECT
  197. <include refid="Base_Column_List"/>, dict.dict_label as xingbie_text,dict1.dict_label as piecewiseText
  198. FROM base_prevent_foreign t
  199. LEFT JOIN v_station v on t.station_id = v.dept_station_id
  200. LEFT JOIN sys_dict_data dict ON (t.xingbie = dict.dict_value AND dict.dict_type = 'xingbie')
  201. LEFT JOIN sys_dict_data dict1 ON (t.piecewise = dict1.dict_value AND dict1.dict_type = 'piecewise')
  202. WHERE t.del_flag='0' and id = #{id}
  203. </select>
  204. <select id="getList" resultMap="BaseResultMap">
  205. SELECT
  206. <include refid="Base_Column_List"/>, dict.dict_label as xingbie_text,dict1.dict_label as piecewiseText
  207. FROM base_prevent_foreign t
  208. LEFT JOIN v_station v on t.station_id = v.dept_station_id
  209. LEFT JOIN sys_dict_data dict ON (t.xingbie = dict.dict_value AND dict.dict_type = 'xingbie')
  210. LEFT JOIN sys_dict_data dict1 ON (t.piecewise = dict1.dict_value AND dict1.dict_type = 'piecewise')
  211. <where>
  212. t.del_flag='0'
  213. <if test="piecewise!=null and piecewise!=''">
  214. and t.piecewise=#{piecewise}
  215. </if>
  216. <if test="deptId!=null and deptId!=''">
  217. and v.dept_id=#{deptId}
  218. </if>
  219. <if test="lineId!=null and lineId!=''">
  220. and t.line_id=#{lineId}
  221. </if>
  222. <if test="xingbie!=null and xingbie!=''">
  223. and t.xingbie=#{xingbie}
  224. </if>
  225. <if test="stationId!=null and stationId!=''">
  226. and v.station_id=#{stationId}
  227. </if>
  228. <if test="pillarCode!=null and pillarCode!=''">
  229. and t.pillar_code=#{pillarCode}
  230. </if>
  231. <if test="marker!=null and marker!=''">
  232. and t.marker=#{marker}
  233. </if>
  234. <if test="riskSource!=null and riskSource!=''">
  235. and t.risk_source=#{riskSource}
  236. </if>
  237. <if test="measures!=null and measures!=''">
  238. and t.measures=#{measures}
  239. </if>
  240. <if test="remark!=null and remark!=''">
  241. and t.remark=#{remark}
  242. </if>
  243. <if test="delFlag!=null and delFlag!=''">
  244. and t.del_flag=#{delFlag}
  245. </if>
  246. <if test="createBy!=null and createBy!=''">
  247. and t.create_by=#{createBy}
  248. </if>
  249. <if test="createTime!=null and createTime!=''">
  250. and t.create_time=#{createTime}
  251. </if>
  252. <if test="updateBy!=null and updateBy!=''">
  253. and t.update_by=#{updateBy}
  254. </if>
  255. <if test="updateTime!=null and updateTime!=''">
  256. and t.update_time=#{updateTime}
  257. </if>
  258. </where>
  259. </select>
  260. </mapper>