TCntrMapper.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.shipping.mapper.TCntrMapper">
  6. <resultMap type="TCntr" id="TCntrResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fType" column="f_type"/>
  9. <result property="fNo" column="f_no"/>
  10. <result property="fName" column="f_name"/>
  11. <result property="fEname" column="f_ename"/>
  12. <result property="fUncode" column="f_uncode"/>
  13. <result property="fTeu" column="f_teu"/>
  14. <result property="fCbm" column="f_cbm"/>
  15. <result property="fWeight" column="f_weight"/>
  16. <result property="fCntrsize" column="f_cntrsize"/>
  17. <result property="fStatus" column="f_status"/>
  18. <result property="createBy" column="create_by"/>
  19. <result property="createTime" column="create_time"/>
  20. <result property="updateBy" column="update_by"/>
  21. <result property="updateTime" column="update_time"/>
  22. <result property="remark" column="remark"/>
  23. </resultMap>
  24. <sql id="selectTCntrVo">
  25. select f_id, f_type, f_no, f_name, f_ename, f_uncode, f_teu, f_cbm, f_weight, f_cntrsize, CASE WHEN f_status = 'T' THEN '正常' ELSE '停用' END AS f_status, create_by, create_time, update_by, update_time, remark from t_cntr
  26. </sql>
  27. <select id="selectTCntrList" parameterType="TCntr" resultMap="TCntrResult">
  28. SELECT
  29. f_id,
  30. f_type,
  31. s.dict_label typeName,
  32. f_no,
  33. f_name,
  34. f_ename,
  35. f_uncode,
  36. f_teu,
  37. f_cbm,
  38. f_weight,
  39. f_cntrsize,
  40. CASE
  41. WHEN f_status = 'T' THEN
  42. '正常' ELSE '停用'
  43. END AS f_status,
  44. create_by,
  45. create_time,
  46. update_by,
  47. update_time,
  48. remark
  49. FROM
  50. t_cntr t
  51. LEFT JOIN ( SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'f_type' ) s ON t.f_type =
  52. s.dict_value
  53. <where>
  54. t.f_status = 'T'
  55. <if test="fType != null ">and t.f_type = #{fType}</if>
  56. <if test="fNo != null and fNo != ''">and t.f_no = like concat('%', #{fNo}, '%')</if>
  57. <if test="fName != null and fName != ''">and t.f_name like concat('%', #{fName}, '%')</if>
  58. <if test="fEname != null and fEname != ''">and t.f_ename like concat('%', #{fEname}, '%')</if>
  59. <if test="fUncode != null and fUncode != ''">and t.f_uncode = #{fUncode}</if>
  60. <if test="fTeu != null ">and t.f_teu = #{fTeu}</if>
  61. <if test="fCbm != null ">and t.f_cbm = #{fCbm}</if>
  62. <if test="fWeight != null ">and t.f_weight = #{fWeight}</if>
  63. <if test="fCntrsize != null ">and t.f_cntrsize = #{fCntrsize}</if>
  64. <if test="fStatus != null and fStatus != ''">and t.f_status = #{fStatus}</if>
  65. <if test="createBy != null and createBy != ''">and t.create_by = #{createBy}</if>
  66. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  67. and t.create_time &gt;= #{cLoadDate[0]}
  68. </if>
  69. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  70. and t.create_time &lt;= #{cLoadDate[1]}
  71. </if>
  72. </where>
  73. ORDER BY CONVERT(t.f_name USING gbk) asc
  74. </select>
  75. <select id="selectTCntrById" parameterType="Long" resultMap="TCntrResult">
  76. <include refid="selectTCntrVo"/>
  77. where f_id = #{fId}
  78. </select>
  79. <insert id="insertTCntr" parameterType="TCntr">
  80. insert into t_cntr
  81. <trim prefix="(" suffix=")" suffixOverrides=",">
  82. <if test="fId != null">f_id,</if>
  83. <if test="fType != null">f_type,</if>
  84. <if test="fNo != null and fNo != ''">f_no,</if>
  85. <if test="fName != null and fName != ''">f_name,</if>
  86. <if test="fEname != null and fEname != ''">f_ename,</if>
  87. <if test="fUncode != null">f_uncode,</if>
  88. <if test="fTeu != null">f_teu,</if>
  89. <if test="fCbm != null">f_cbm,</if>
  90. <if test="fWeight != null">f_weight,</if>
  91. <if test="fCntrsize != null">f_cntrsize,</if>
  92. <if test="fStatus != null">f_status,</if>
  93. <if test="createBy != null">create_by,</if>
  94. <if test="createTime != null">create_time,</if>
  95. <if test="updateBy != null">update_by,</if>
  96. <if test="updateTime != null">update_time,</if>
  97. <if test="remark != null">remark,</if>
  98. </trim>
  99. <trim prefix="values (" suffix=")" suffixOverrides=",">
  100. <if test="fId != null">#{fId},</if>
  101. <if test="fType != null">#{fType},</if>
  102. <if test="fNo != null and fNo != ''">#{fNo},</if>
  103. <if test="fName != null and fName != ''">#{fName},</if>
  104. <if test="fEname != null and fEname != ''">#{fEname},</if>
  105. <if test="fUncode != null">#{fUncode},</if>
  106. <if test="fTeu != null">#{fTeu},</if>
  107. <if test="fCbm != null">#{fCbm},</if>
  108. <if test="fWeight != null">#{fWeight},</if>
  109. <if test="fCntrsize != null">#{fCntrsize},</if>
  110. <if test="fStatus != null">#{fStatus},</if>
  111. <if test="createBy != null">#{createBy},</if>
  112. <if test="createTime != null">#{createTime},</if>
  113. <if test="updateBy != null">#{updateBy},</if>
  114. <if test="updateTime != null">#{updateTime},</if>
  115. <if test="remark != null">#{remark},</if>
  116. </trim>
  117. </insert>
  118. <update id="updateTCntr" parameterType="TCntr">
  119. update t_cntr
  120. <trim prefix="SET" suffixOverrides=",">
  121. <if test="fType != null">f_type = #{fType},</if>
  122. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  123. <if test="fName != null and fName != ''">f_name = #{fName},</if>
  124. <if test="fEname != null and fEname != ''">f_ename = #{fEname},</if>
  125. <if test="fUncode != null">f_uncode = #{fUncode},</if>
  126. <if test="fTeu != null">f_teu = #{fTeu},</if>
  127. <if test="fCbm != null">f_cbm = #{fCbm},</if>
  128. <if test="fWeight != null">f_weight = #{fWeight},</if>
  129. <if test="fCntrsize != null">f_cntrsize = #{fCntrsize},</if>
  130. <if test="fStatus != null">f_status = #{fStatus},</if>
  131. <if test="createBy != null">create_by = #{createBy},</if>
  132. <if test="createTime != null">create_time = #{createTime},</if>
  133. <if test="updateBy != null">update_by = #{updateBy},</if>
  134. <if test="updateTime != null">update_time = #{updateTime},</if>
  135. <if test="remark != null">remark = #{remark},</if>
  136. </trim>
  137. where f_id = #{fId}
  138. </update>
  139. <delete id="deleteTCntrById" parameterType="Long">
  140. delete from t_cntr where f_id = #{fId}
  141. </delete>
  142. <delete id="deleteTCntrByIds" parameterType="String">
  143. delete from t_cntr where f_id in
  144. <foreach item="fId" collection="array" open="(" separator="," close=")">
  145. #{fId}
  146. </foreach>
  147. </delete>
  148. <select id="selectRcntrName" parameterType="TCntr" resultType="map">
  149. SELECT
  150. f_id as fId,
  151. f_no as fNo
  152. FROM
  153. t_cntr
  154. <where>
  155. f_status = 'T'
  156. <if test="fNo != null and fNo != ''">and f_no like concat('%', #{fNo}, '%')</if>
  157. </where>
  158. ORDER BY CONVERT(f_name USING gbk) asc
  159. </select>
  160. <select id="selectTCntrFNo" resultType="string">
  161. SELECT DISTINCT
  162. f_no
  163. FROM
  164. t_cntr
  165. where f_status = 'T'
  166. ORDER BY CONVERT(f_name USING gbk) asc
  167. </select>
  168. <select id="selectRcntrFId" parameterType="TCntr" resultType="long">
  169. SELECT
  170. f_id as fId
  171. FROM
  172. t_cntr
  173. where f_no = #{fNo}
  174. and f_status = 'T'
  175. ORDER BY CONVERT(f_name USING gbk) asc
  176. </select>
  177. <select id="selectTcnrFno" parameterType="object" resultMap="TCntrResult">
  178. SELECT
  179. f_id,
  180. f_no
  181. FROM
  182. t_cntr
  183. WHERE
  184. f_no = #{fNo}
  185. </select>
  186. <select id="selectTcnrFName" parameterType="object" resultMap="TCntrResult">
  187. SELECT
  188. f_id,
  189. f_no
  190. FROM
  191. t_cntr
  192. WHERE
  193. f_name = #{fName}
  194. </select>
  195. </mapper>