CompanySmsMapper.xml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.CompanySmsMapper">
  6. <resultMap type="CompanySms" id="CompanySmsResult">
  7. <result property="smsId" column="sms_id" />
  8. <result property="companyId" column="company_id" />
  9. <result property="remainSmsCount" column="remain_sms_count" />
  10. <result property="totalSmsCount" column="total_sms_count" />
  11. </resultMap>
  12. <sql id="selectCompanySmsVo">
  13. select sms_id, company_id, remain_sms_count, total_sms_count from company_sms
  14. </sql>
  15. <select id="selectCompanySmsById" parameterType="Long" resultMap="CompanySmsResult">
  16. <include refid="selectCompanySmsVo"/>
  17. where sms_id = #{smsId}
  18. </select>
  19. <insert id="insertCompanySms" parameterType="CompanySms" useGeneratedKeys="true" keyProperty="smsId">
  20. insert into company_sms
  21. <trim prefix="(" suffix=")" suffixOverrides=",">
  22. <if test="companyId != null">company_id,</if>
  23. <if test="remainSmsCount != null">remain_sms_count,</if>
  24. <if test="totalSmsCount != null">total_sms_count,</if>
  25. </trim>
  26. <trim prefix="values (" suffix=")" suffixOverrides=",">
  27. <if test="companyId != null">#{companyId},</if>
  28. <if test="remainSmsCount != null">#{remainSmsCount},</if>
  29. <if test="totalSmsCount != null">#{totalSmsCount},</if>
  30. </trim>
  31. </insert>
  32. <update id="updateCompanySms" parameterType="CompanySms">
  33. update company_sms
  34. <trim prefix="SET" suffixOverrides=",">
  35. <if test="companyId != null">company_id = #{companyId},</if>
  36. <if test="remainSmsCount != null">remain_sms_count = #{remainSmsCount},</if>
  37. <if test="totalSmsCount != null">total_sms_count = #{totalSmsCount},</if>
  38. </trim>
  39. where sms_id = #{smsId}
  40. </update>
  41. <delete id="deleteCompanySmsById" parameterType="Long">
  42. delete from company_sms where sms_id = #{smsId}
  43. </delete>
  44. <delete id="deleteCompanySmsByIds" parameterType="String">
  45. delete from company_sms where sms_id in
  46. <foreach item="smsId" collection="array" open="(" separator="," close=")">
  47. #{smsId}
  48. </foreach>
  49. </delete>
  50. </mapper>