BusGlkgMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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.BusGlkgMapper">
  5. <resultMap id="BaseResultMap" type="com.railway.business.baseinfo.domain.BusGlkg">
  6. <result column="id" property="id"/>
  7. <result column="dept_id" property="deptId"/>
  8. <result column="dept_name" property="deptName"/>
  9. <result column="line_id" property="lineId"/>
  10. <result column="line_name" property="lineName"/>
  11. <result column="station_id" property="stationId"/>
  12. <result column="station_name" property="stationName"/>
  13. <result column="xingbie" property="xingbie"/>
  14. <result column="xingbie_text" property="xingbieText"/>
  15. <result column="pillar_code" property="pillarCode"/>
  16. <result column="marker" property="marker"/>
  17. <result column="kgbh" property="kgbh"/>
  18. <result column="sccj" property="sccj"/>
  19. <result column="kgxh" property="kgxh"/>
  20. <result column="del_flag" property="delFlag"/>
  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. </resultMap>
  26. <sql id="Base_Column_List">
  27. t.id,
  28. v.dept_id,
  29. v.dept_name,
  30. v.line_id,
  31. v.line_name,
  32. v.station_name as station_name,
  33. t.station_id,
  34. t.xingbie,
  35. t.pillar_code,
  36. t.marker,
  37. t.kgbh,
  38. t.sccj,
  39. t.kgxh,
  40. t.del_flag,
  41. t.create_by,
  42. t.create_time,
  43. t.update_by,
  44. t.update_time
  45. </sql>
  46. <insert id="insert" parameterType="com.railway.business.baseinfo.domain.BusGlkg">
  47. <selectKey keyProperty="id" order="BEFORE" resultType="String">
  48. select replace(uuid(), '-', '') from dual
  49. </selectKey>
  50. INSERT INTO base_glkg
  51. <trim prefix="(" suffix=")" suffixOverrides=",">
  52. <if test='null != stationId'>
  53. station_id,
  54. </if>
  55. <if test='null != xingbie'>
  56. xingbie,
  57. </if>
  58. <if test='null != pillarCode'>
  59. pillar_code,
  60. </if>
  61. <if test='null != marker'>
  62. marker,
  63. </if>
  64. <if test='null != kgbh'>
  65. kgbh,
  66. </if>
  67. <if test='null != sccj'>
  68. sccj,
  69. </if>
  70. <if test='null != kgxh'>
  71. kgxh,
  72. </if>
  73. <if test='null != delFlag'>
  74. del_flag,
  75. </if>
  76. <if test='null != createBy'>
  77. create_by,
  78. </if>
  79. <if test='null != createTime'>
  80. create_time,
  81. </if>
  82. <if test='null != updateBy'>
  83. update_by,
  84. </if>
  85. <if test='null != updateTime'>
  86. update_time
  87. </if>
  88. </trim>
  89. <trim prefix="values (" suffix=")" suffixOverrides=",">
  90. <if test='null != stationId'>
  91. #{stationId},
  92. </if>
  93. <if test='null != xingbie'>
  94. #{xingbie},
  95. </if>
  96. <if test='null != pillarCode'>
  97. #{pillarCode},
  98. </if>
  99. <if test='null != marker'>
  100. #{marker},
  101. </if>
  102. <if test='null != kgbh'>
  103. #{kgbh},
  104. </if>
  105. <if test='null != sccj'>
  106. #{sccj},
  107. </if>
  108. <if test='null != kgxh'>
  109. #{kgxh},
  110. </if>
  111. <if test='null != delFlag'>
  112. #{delFlag},
  113. </if>
  114. <if test='null != createBy'>
  115. #{createBy},
  116. </if>
  117. <if test='null != createTime'>
  118. #{createTime},
  119. </if>
  120. <if test='null != updateBy'>
  121. #{updateBy},
  122. </if>
  123. <if test='null != updateTime'>
  124. #{updateTime}
  125. </if>
  126. </trim>
  127. </insert>
  128. <delete id="delete">
  129. UPDATE base_glkg
  130. set del_flag='1'
  131. WHERE id = #{id}
  132. </delete>
  133. <update id="update" parameterType="com.railway.business.baseinfo.domain.BusGlkg">
  134. UPDATE base_glkg
  135. <set>
  136. <if test='null != stationId'>station_id = #{stationId},</if>
  137. <if test='null != xingbie'>xingbie = #{xingbie},</if>
  138. <if test='null != pillarCode'>pillar_code = #{pillarCode},</if>
  139. <if test='null != marker'>marker = #{marker},</if>
  140. <if test='null != kgbh'>kgbh = #{kgbh},</if>
  141. <if test='null != sccj'>sccj = #{sccj},</if>
  142. <if test='null != kgxh'>kgxh = #{kgxh},</if>
  143. <if test='null != delFlag'>del_flag = #{delFlag},</if>
  144. <if test='null != updateBy'>update_by = #{updateBy},</if>
  145. <if test='null != updateTime'>update_time = #{updateTime}</if>
  146. </set>
  147. WHERE id = #{id}
  148. </update>
  149. <select id="getInfo" resultMap="BaseResultMap">
  150. SELECT
  151. <include refid="Base_Column_List"/>, dict.dict_label as xingbie_text
  152. FROM base_glkg t
  153. LEFT JOIN v_station v on t.station_id = v.station_id
  154. LEFT JOIN sys_dict_data dict ON (t.xingbie = dict.dict_value AND dict.dict_type = 'xingbie')
  155. WHERE t.del_flag='0' and t.id = #{id}
  156. </select>
  157. <select id="getList" resultMap="BaseResultMap">
  158. SELECT
  159. <include refid="Base_Column_List"/>, dict.dict_label as xingbie_text
  160. FROM base_glkg t
  161. LEFT JOIN v_station v on t.station_id = v.station_id
  162. LEFT JOIN sys_dict_data dict ON (t.xingbie = dict.dict_value AND dict.dict_type = 'xingbie')
  163. <where>
  164. t.del_flag='0'
  165. <if test="deptId!=null and deptId!=''">
  166. and v.dept_id=#{deptId}
  167. </if>
  168. <if test="lineId!=null and lineId!=''">
  169. and v.line_id=#{lineId}
  170. </if>
  171. <if test="stationId!=null and stationId!=''">
  172. and t.station_id=#{stationId}
  173. </if>
  174. <if test="xingbie!=null and xingbie!=''">
  175. and t.xingbie=#{xingbie}
  176. </if>
  177. <if test="pillarCode!=null and pillarCode!=''">
  178. and t.pillar_code=#{pillarCode}
  179. </if>
  180. <if test="marker!=null and marker!=''">
  181. and t.marker=#{marker}
  182. </if>
  183. <if test="kgbh!=null and kgbh!=''">
  184. and t.kgbh=#{kgbh}
  185. </if>
  186. <if test="sccj!=null and sccj!=''">
  187. and t.sccj=#{sccj}
  188. </if>
  189. <if test="kgxh!=null and kgxh!=''">
  190. and t.kgxh=#{kgxh}
  191. </if>
  192. <if test="delFlag!=null and delFlag!=''">
  193. and t.del_flag=#{delFlag}
  194. </if>
  195. <if test="createBy!=null and createBy!=''">
  196. and t.create_by=#{createBy}
  197. </if>
  198. <if test="createTime!=null and createTime!=''">
  199. and t.create_time=#{createTime}
  200. </if>
  201. <if test="updateBy!=null and updateBy!=''">
  202. and t.update_by=#{updateBy}
  203. </if>
  204. <if test="updateTime!=null and updateTime!=''">
  205. and t.update_time=#{updateTime}
  206. </if>
  207. </where>
  208. order by t.create_time desc
  209. </select>
  210. </mapper>