StationBalanceChangeMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.yijia.station.mapper.StationBalanceChangeMapper">
  6. <resultMap type="StationBalanceChange" id="StationBalanceChangeResult">
  7. <result property="id" column="id" />
  8. <result property="stationId" column="station_id" />
  9. <result property="orderNo" column="order_no" />
  10. <result property="type" column="type" />
  11. <result property="amt" column="amt" />
  12. <result property="createTime" column="create_time" />
  13. <result property="createBy" column="create_by" />
  14. <result property="createName" column="create_name" />
  15. <result property="stationName" column="station_name" />
  16. <result property="nowAmt" column="now_amt" />
  17. </resultMap>
  18. <sql id="selectStationBalanceChangeVo">
  19. select c.id, c.station_id, c.order_no, c.type, c.amt, c.create_time, c.create_by,dept_name as station_name,u.nick_name as create_name,c.now_amt
  20. from station_balance_change c
  21. left join sys_dept d on c.station_id = d.dept_id
  22. left join sys_user u on c.create_by =u.user_id
  23. </sql>
  24. <select id="selectStationBalanceChangeList" parameterType="StationBalanceChange" resultMap="StationBalanceChangeResult">
  25. <include refid="selectStationBalanceChangeVo"/>
  26. <where>
  27. <if test="stationId != null "> and station_id = #{stationId}</if>
  28. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  29. <if test="type != null and type != ''"> and type = #{type}</if>
  30. <if test="amt != null "> and amt = #{amt}</if>
  31. <if test="stationIdList != null ">
  32. and station_id in
  33. <foreach item="item" index="index" collection="stationIdList"
  34. open="(" separator="," close=")">
  35. #{item}
  36. </foreach>
  37. </if>
  38. </where>
  39. order by id desc
  40. </select>
  41. <select id="selectStationBalanceChangeById" parameterType="Long" resultMap="StationBalanceChangeResult">
  42. <include refid="selectStationBalanceChangeVo"/>
  43. where id = #{id}
  44. </select>
  45. <insert id="insertStationBalanceChange" parameterType="StationBalanceChange" useGeneratedKeys="true" keyProperty="id">
  46. insert into station_balance_change
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="stationId != null">station_id,</if>
  49. <if test="orderNo != null">order_no,</if>
  50. <if test="type != null and type != ''">type,</if>
  51. <if test="amt != null">amt,</if>
  52. <if test="createTime != null">create_time,</if>
  53. <if test="createBy != null and createBy != ''">create_by,</if>
  54. <if test="nowAmt != null and nowAmt != ''">now_amt,</if>
  55. </trim>
  56. <trim prefix="values (" suffix=")" suffixOverrides=",">
  57. <if test="stationId != null">#{stationId},</if>
  58. <if test="orderNo != null">#{orderNo},</if>
  59. <if test="type != null and type != ''">#{type},</if>
  60. <if test="amt != null">#{amt},</if>
  61. <if test="createTime != null">#{createTime},</if>
  62. <if test="createBy != null and createBy != ''">#{createBy},</if>
  63. <if test="nowAmt != null and nowAmt != ''">#{nowAmt},</if>
  64. </trim>
  65. </insert>
  66. <update id="updateStationBalanceChange" parameterType="StationBalanceChange">
  67. update station_balance_change
  68. <trim prefix="SET" suffixOverrides=",">
  69. <if test="stationId != null">station_id = #{stationId},</if>
  70. <if test="orderNo != null">order_no = #{orderNo},</if>
  71. <if test="type != null and type != ''">type = #{type},</if>
  72. <if test="amt != null">amt = #{amt},</if>
  73. <if test="createTime != null">create_time = #{createTime},</if>
  74. <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
  75. </trim>
  76. where id = #{id}
  77. </update>
  78. <delete id="deleteStationBalanceChangeById" parameterType="Long">
  79. delete from station_balance_change where id = #{id}
  80. </delete>
  81. <delete id="deleteStationBalanceChangeByIds" parameterType="String">
  82. delete from station_balance_change where id in
  83. <foreach item="id" collection="array" open="(" separator="," close=")">
  84. #{id}
  85. </foreach>
  86. </delete>
  87. </mapper>