CompanyVoiceMapper.xml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.CompanyVoiceMapper">
  6. <resultMap type="CompanyVoice" id="CompanyVoiceResult">
  7. <result property="voiceId" column="voice_id" />
  8. <result property="companyId" column="company_id" />
  9. <result property="times" column="times" />
  10. <result property="totalTimes" column="total_times" />
  11. </resultMap>
  12. <sql id="selectCompanyVoiceVo">
  13. select voice_id, company_id, times, total_times from company_voice
  14. </sql>
  15. <select id="selectCompanyVoiceList" parameterType="CompanyVoice" resultMap="CompanyVoiceResult">
  16. <include refid="selectCompanyVoiceVo"/>
  17. <where>
  18. <if test="companyId != null "> and company_id = #{companyId}</if>
  19. <if test="times != null "> and times = #{times}</if>
  20. <if test="totalTimes != null "> and total_times = #{totalTimes}</if>
  21. </where>
  22. </select>
  23. <select id="selectCompanyVoiceById" parameterType="Long" resultMap="CompanyVoiceResult">
  24. <include refid="selectCompanyVoiceVo"/>
  25. where voice_id = #{voiceId}
  26. </select>
  27. <insert id="insertCompanyVoice" parameterType="CompanyVoice" useGeneratedKeys="true" keyProperty="voiceId">
  28. insert into company_voice
  29. <trim prefix="(" suffix=")" suffixOverrides=",">
  30. <if test="companyId != null">company_id,</if>
  31. <if test="times != null">times,</if>
  32. <if test="totalTimes != null">total_times,</if>
  33. </trim>
  34. <trim prefix="values (" suffix=")" suffixOverrides=",">
  35. <if test="companyId != null">#{companyId},</if>
  36. <if test="times != null">#{times},</if>
  37. <if test="totalTimes != null">#{totalTimes},</if>
  38. </trim>
  39. </insert>
  40. <update id="updateCompanyVoice" parameterType="CompanyVoice">
  41. update company_voice
  42. <trim prefix="SET" suffixOverrides=",">
  43. <if test="companyId != null">company_id = #{companyId},</if>
  44. <if test="times != null">times = #{times},</if>
  45. <if test="totalTimes != null">total_times = #{totalTimes},</if>
  46. </trim>
  47. where voice_id = #{voiceId}
  48. </update>
  49. <delete id="deleteCompanyVoiceById" parameterType="Long">
  50. delete from company_voice where voice_id = #{voiceId}
  51. </delete>
  52. <delete id="deleteCompanyVoiceByIds" parameterType="String">
  53. delete from company_voice where voice_id in
  54. <foreach item="voiceId" collection="array" open="(" separator="," close=")">
  55. #{voiceId}
  56. </foreach>
  57. </delete>
  58. </mapper>