CompanyProfitLogsMapper.xml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.company.mapper.CompanyProfitLogsMapper">
  6. <resultMap type="CompanyProfitLogs" id="CompanyProfitLogsResult">
  7. <result property="logsId" column="logs_id" />
  8. <result property="profitId" column="profit_id" />
  9. <result property="title" column="title" />
  10. <result property="reason" column="reason" />
  11. <result property="createTime" column="create_time" />
  12. </resultMap>
  13. <sql id="selectCompanyProfitLogsVo">
  14. select logs_id, profit_id, title, reason, create_time from company_profit_logs
  15. </sql>
  16. <select id="selectCompanyProfitLogsList" parameterType="CompanyProfitLogs" resultMap="CompanyProfitLogsResult">
  17. <include refid="selectCompanyProfitLogsVo"/>
  18. <where>
  19. <if test="profitId != null "> and profit_id = #{profitId}</if>
  20. <if test="title != null and title != ''"> and title = #{title}</if>
  21. <if test="reason != null and reason != ''"> and reason = #{reason}</if>
  22. </where>
  23. order by logs_id desc
  24. </select>
  25. <select id="selectCompanyProfitLogsById" parameterType="Long" resultMap="CompanyProfitLogsResult">
  26. <include refid="selectCompanyProfitLogsVo"/>
  27. where logs_id = #{logsId}
  28. </select>
  29. <insert id="insertCompanyProfitLogs" parameterType="CompanyProfitLogs" useGeneratedKeys="true" keyProperty="logsId">
  30. insert into company_profit_logs
  31. <trim prefix="(" suffix=")" suffixOverrides=",">
  32. <if test="profitId != null">profit_id,</if>
  33. <if test="title != null">title,</if>
  34. <if test="reason != null">reason,</if>
  35. <if test="createTime != null">create_time,</if>
  36. </trim>
  37. <trim prefix="values (" suffix=")" suffixOverrides=",">
  38. <if test="profitId != null">#{profitId},</if>
  39. <if test="title != null">#{title},</if>
  40. <if test="reason != null">#{reason},</if>
  41. <if test="createTime != null">#{createTime},</if>
  42. </trim>
  43. </insert>
  44. <update id="updateCompanyProfitLogs" parameterType="CompanyProfitLogs">
  45. update company_profit_logs
  46. <trim prefix="SET" suffixOverrides=",">
  47. <if test="profitId != null">profit_id = #{profitId},</if>
  48. <if test="title != null">title = #{title},</if>
  49. <if test="reason != null">reason = #{reason},</if>
  50. <if test="createTime != null">create_time = #{createTime},</if>
  51. </trim>
  52. where logs_id = #{logsId}
  53. </update>
  54. <delete id="deleteCompanyProfitLogsById" parameterType="Long">
  55. delete from company_profit_logs where logs_id = #{logsId}
  56. </delete>
  57. <delete id="deleteCompanyProfitLogsByIds" parameterType="String">
  58. delete from company_profit_logs where logs_id in
  59. <foreach item="logsId" collection="array" open="(" separator="," close=")">
  60. #{logsId}
  61. </foreach>
  62. </delete>
  63. </mapper>