BaseLineMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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.BaseLineMapper">
  5. <resultMap id="BaseResultMap" type="com.railway.business.baseinfo.domain.BaseLine">
  6. <result column="line_id" property="lineId"/>
  7. <result column="line_name" property="lineName"/>
  8. <result column="line_sddj" property="lineSddj"/>
  9. <result column="line_type" property="lineType"/>
  10. <result column="line_dj" property="lineDj"/>
  11. <result column="line_yylc" property="lineYylc"/>
  12. <result column="start_marker" property="startMarker"/>
  13. <result column="end_marker" property="endMarker"/>
  14. <result column="order_num" property="orderNum"/>
  15. <result column="del_flag" property="delFlag"/>
  16. <result column="create_by" property="createBy"/>
  17. <result column="create_time" property="createTime"/>
  18. <result column="update_by" property="updateBy"/>
  19. <result column="update_time" property="updateTime"/>
  20. </resultMap>
  21. <sql id="Base_Column_List">
  22. t.line_id,
  23. t.line_name,
  24. t.line_sddj,
  25. t.line_type,
  26. t.line_dj,
  27. t.line_yylc,
  28. t.start_marker,
  29. t.end_marker,
  30. t.order_num,
  31. t.del_flag,
  32. t.create_by,
  33. t.create_time,
  34. t.update_by,
  35. t.update_time
  36. </sql>
  37. <insert id="insert" parameterType="com.railway.business.baseinfo.domain.BaseLine">
  38. INSERT INTO base_line
  39. <trim prefix="(" suffix=")" suffixOverrides=",">
  40. <if test='null != lineName'>
  41. line_name,
  42. </if>
  43. <if test='null != lineSddj'>
  44. line_sddj,
  45. </if>
  46. <if test='null != lineType'>
  47. line_type,
  48. </if>
  49. <if test='null != lineDj'>
  50. line_dj,
  51. </if>
  52. <if test='null != lineYylc'>
  53. line_yylc,
  54. </if>
  55. <if test='null != startMarker'>
  56. start_marker,
  57. </if>
  58. <if test='null != endMarker'>
  59. end_marker,
  60. </if>
  61. <if test='null != orderNum'>
  62. order_num,
  63. </if>
  64. <if test='null != delFlag'>
  65. del_flag,
  66. </if>
  67. <if test='null != createBy'>
  68. create_by,
  69. </if>
  70. <if test='null != createTime'>
  71. create_time,
  72. </if>
  73. <if test='null != updateBy'>
  74. update_by,
  75. </if>
  76. <if test='null != updateTime'>
  77. update_time
  78. </if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides=",">
  81. <if test='null != lineName'>
  82. #{lineName},
  83. </if>
  84. <if test='null != lineSddj'>
  85. #{lineSddj},
  86. </if>
  87. <if test='null != lineType'>
  88. #{lineType},
  89. </if>
  90. <if test='null != lineDj'>
  91. #{lineDj},
  92. </if>
  93. <if test='null != lineYylc'>
  94. #{lineYylc},
  95. </if>
  96. <if test='null != startMarker'>
  97. #{startMarker},
  98. </if>
  99. <if test='null != endMarker'>
  100. #{endMarker},
  101. </if>
  102. <if test='null != orderNum'>
  103. #{orderNum},
  104. </if>
  105. <if test='null != delFlag'>
  106. #{delFlag},
  107. </if>
  108. <if test='null != createBy'>
  109. #{createBy},
  110. </if>
  111. <if test='null != createTime'>
  112. #{createTime},
  113. </if>
  114. <if test='null != updateBy'>
  115. #{updateBy},
  116. </if>
  117. <if test='null != updateTime'>
  118. #{updateTime}
  119. </if>
  120. </trim>
  121. </insert>
  122. <delete id="delete">
  123. UPDATE base_line
  124. set del_flag='1'
  125. WHERE line_id = #{lineId}
  126. </delete>
  127. <update id="update" parameterType="com.railway.business.baseinfo.domain.BaseLine">
  128. UPDATE base_line
  129. <set>
  130. <if test='null != lineName'>line_name = #{lineName},</if>
  131. <if test='null != lineSddj'>line_sddj = #{lineSddj},</if>
  132. <if test='null != lineType'>line_type = #{lineType},</if>
  133. <if test='null != lineDj'>line_dj = #{lineDj},</if>
  134. <if test='null != lineYylc'>line_yylc = #{lineYylc},</if>
  135. <if test='null != startMarker'>start_marker = #{startMarker},</if>
  136. <if test='null != endMarker'>end_marker = #{endMarker},</if>
  137. <if test='null != orderNum'>order_num = #{orderNum},</if>
  138. <if test='null != delFlag'>del_flag = #{delFlag},</if>
  139. <if test='null != updateBy'>update_by = #{updateBy},</if>
  140. <if test='null != updateTime'>update_time = #{updateTime}</if>
  141. </set>
  142. WHERE line_id = #{lineId}
  143. </update>
  144. <select id="getInfo" resultMap="BaseResultMap">
  145. SELECT
  146. <include refid="Base_Column_List"/>
  147. FROM base_line t
  148. WHERE t.del_flag='0' and t.line_id = #{lineId}
  149. </select>
  150. <select id="getList" resultMap="BaseResultMap">
  151. SELECT
  152. <include refid="Base_Column_List"/>
  153. FROM base_line t
  154. left join base_dept_line t1 on t.line_id = t1.line_id
  155. <where>
  156. t.del_flag='0'
  157. <if test="deptId!=null and deptId!=''">
  158. and t1.dept_id=#{deptId}
  159. </if>
  160. <if test="lineName!=null and lineName!=''">
  161. and t.line_name like concat('%', #{lineName}, '%')
  162. </if>
  163. </where>
  164. </select>
  165. <select id="getListByDeptId" resultMap="BaseResultMap">
  166. SELECT DISTINCT
  167. <include refid="Base_Column_List"/>
  168. FROM base_line t
  169. left join base_dept_line t1 on t.line_id = t1.line_id
  170. <where>
  171. t.del_flag='0'
  172. <if test="deptId!=null and deptId!=''">
  173. and t1.dept_id=#{deptId}
  174. </if>
  175. </where>
  176. </select>
  177. </mapper>