StationBalanceChangeMapper.xml 4.3 KB

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