FsUserIntegralLogsMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.fs.his.mapper.FsUserIntegralLogsMapper">
  6. <resultMap type="FsUserIntegralLogs" id="FsUserIntegralLogsResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="logType" column="log_type" />
  10. <result property="integral" column="integral" />
  11. <result property="balance" column="balance" />
  12. <result property="businessId" column="business_id" />
  13. <result property="createTime" column="create_time" />
  14. <result property="businessType" column="business_type" />
  15. <result property="status" column="status" />
  16. </resultMap>
  17. <sql id="selectFsUserIntegralLogsVo">
  18. select id, user_id,status, log_type,business_type, integral, balance, business_id, create_time from fs_user_integral_logs
  19. </sql>
  20. <select id="selectFsUserIntegralLogsList" parameterType="FsUserIntegralLogs" resultMap="FsUserIntegralLogsResult">
  21. <include refid="selectFsUserIntegralLogsVo"/>
  22. <where>
  23. <if test="userId != null "> and user_id = #{userId}</if>
  24. <if test="logType != null and logType != ''"> and log_type = #{logType}</if>
  25. <if test="integral != null "> and integral = #{integral}</if>
  26. <if test="balance != null "> and balance = #{balance}</if>
  27. <if test="businessId != null and businessId != ''"> and business_id = #{businessId}</if>
  28. <if test="createTime != null "> and create_time = #{createTime}</if>
  29. <if test="businessType != null "> and business_type = #{businessType}</if>
  30. </where>
  31. </select>
  32. <select id="selectFsUserIntegralLogsById" parameterType="Long" resultMap="FsUserIntegralLogsResult">
  33. <include refid="selectFsUserIntegralLogsVo"/>
  34. where id = #{id}
  35. </select>
  36. <select id="selectFsUserIntegralLogsByUserIdAndLogType" resultType="com.fs.his.domain.FsUserIntegralLogs">
  37. select * from fs_user_integral_logs where log_type=#{logType} and user_id = #{userId}
  38. <if test="date != null">
  39. <![CDATA[
  40. and create_time >= #{date} and create_time < date_add(#{date}, interval 1 day)
  41. ]]>
  42. </if>
  43. </select>
  44. <insert id="insertFsUserIntegralLogs" parameterType="FsUserIntegralLogs" useGeneratedKeys="true" keyProperty="id">
  45. insert into fs_user_integral_logs
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="userId != null">user_id,</if>
  48. <if test="logType != null">log_type,</if>
  49. <if test="integral != null">integral,</if>
  50. <if test="balance != null">balance,</if>
  51. <if test="businessId != null">business_id,</if>
  52. <if test="createTime != null">create_time,</if>
  53. <if test="businessType != null">business_type,</if>
  54. <if test="status != null">status,</if>
  55. </trim>
  56. <trim prefix="values (" suffix=")" suffixOverrides=",">
  57. <if test="userId != null">#{userId},</if>
  58. <if test="logType != null">#{logType},</if>
  59. <if test="integral != null">#{integral},</if>
  60. <if test="balance != null">#{balance},</if>
  61. <if test="businessId != null">#{businessId},</if>
  62. <if test="createTime != null">#{createTime},</if>
  63. <if test="businessType != null">#{businessType},</if>
  64. <if test="status != null">#{status},</if>
  65. </trim>
  66. </insert>
  67. <update id="updateFsUserIntegralLogs" parameterType="FsUserIntegralLogs">
  68. update fs_user_integral_logs
  69. <trim prefix="SET" suffixOverrides=",">
  70. <if test="userId != null">user_id = #{userId},</if>
  71. <if test="logType != null">log_type = #{logType},</if>
  72. <if test="integral != null">integral = #{integral},</if>
  73. <if test="balance != null">balance = #{balance},</if>
  74. <if test="businessId != null">business_id = #{businessId},</if>
  75. <if test="createTime != null">create_time = #{createTime},</if>
  76. <if test="businessType != null">business_type = #{businessType},</if>
  77. <if test="status != null">status = #{status},</if>
  78. </trim>
  79. where id = #{id}
  80. </update>
  81. <delete id="deleteFsUserIntegralLogsById" parameterType="Long">
  82. delete from fs_user_integral_logs where id = #{id}
  83. </delete>
  84. <delete id="deleteFsUserIntegralLogsByIds" parameterType="String">
  85. delete from fs_user_integral_logs where id in
  86. <foreach item="id" collection="array" open="(" separator="," close=")">
  87. #{id}
  88. </foreach>
  89. </delete>
  90. </mapper>