CompanyVoicePackageMapper.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.CompanyVoicePackageMapper">
  6. <resultMap type="CompanyVoicePackage" id="CompanyVoicePackageResult">
  7. <result property="packageId" column="package_id" />
  8. <result property="packageName" column="package_name" />
  9. <result property="price" column="price" />
  10. <result property="times" column="times" />
  11. <result property="status" column="status" />
  12. <result property="expirePrice" column="expire_price" />
  13. <result property="remark" column="remark" />
  14. </resultMap>
  15. <sql id="selectCompanyVoicePackageVo">
  16. select package_id, package_name, price, times, status, expire_price, remark from company_voice_package
  17. </sql>
  18. <select id="selectCompanyVoicePackageList" parameterType="CompanyVoicePackage" resultMap="CompanyVoicePackageResult">
  19. <include refid="selectCompanyVoicePackageVo"/>
  20. <where>
  21. <if test="packageName != null and packageName != ''"> and package_name like concat('%', #{packageName}, '%')</if>
  22. <if test="price != null "> and price = #{price}</if>
  23. <if test="times != null "> and times = #{times}</if>
  24. <if test="status != null "> and status = #{status}</if>
  25. <if test="expirePrice != null "> and expire_price = #{expirePrice}</if>
  26. </where>
  27. </select>
  28. <select id="selectCompanyVoicePackageById" parameterType="Long" resultMap="CompanyVoicePackageResult">
  29. <include refid="selectCompanyVoicePackageVo"/>
  30. where package_id = #{packageId}
  31. </select>
  32. <insert id="insertCompanyVoicePackage" parameterType="CompanyVoicePackage" useGeneratedKeys="true" keyProperty="packageId">
  33. insert into company_voice_package
  34. <trim prefix="(" suffix=")" suffixOverrides=",">
  35. <if test="packageName != null">package_name,</if>
  36. <if test="price != null">price,</if>
  37. <if test="times != null">times,</if>
  38. <if test="status != null">status,</if>
  39. <if test="expirePrice != null">expire_price,</if>
  40. <if test="remark != null">remark,</if>
  41. </trim>
  42. <trim prefix="values (" suffix=")" suffixOverrides=",">
  43. <if test="packageName != null">#{packageName},</if>
  44. <if test="price != null">#{price},</if>
  45. <if test="times != null">#{times},</if>
  46. <if test="status != null">#{status},</if>
  47. <if test="expirePrice != null">#{expirePrice},</if>
  48. <if test="remark != null">#{remark},</if>
  49. </trim>
  50. </insert>
  51. <update id="updateCompanyVoicePackage" parameterType="CompanyVoicePackage">
  52. update company_voice_package
  53. <trim prefix="SET" suffixOverrides=",">
  54. <if test="packageName != null">package_name = #{packageName},</if>
  55. <if test="price != null">price = #{price},</if>
  56. <if test="times != null">times = #{times},</if>
  57. <if test="status != null">status = #{status},</if>
  58. <if test="expirePrice != null">expire_price = #{expirePrice},</if>
  59. <if test="remark != null">remark = #{remark},</if>
  60. </trim>
  61. where package_id = #{packageId}
  62. </update>
  63. <delete id="deleteCompanyVoicePackageById" parameterType="Long">
  64. delete from company_voice_package where package_id = #{packageId}
  65. </delete>
  66. <delete id="deleteCompanyVoicePackageByIds" parameterType="String">
  67. delete from company_voice_package where package_id in
  68. <foreach item="packageId" collection="array" open="(" separator="," close=")">
  69. #{packageId}
  70. </foreach>
  71. </delete>
  72. </mapper>