AdSourceMapper.xml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ytpm.dao.AdSourceMapper">
  4. <insert id="insertOne">
  5. insert into yt_app_ad_source
  6. (
  7. ad_source_id,
  8. name,
  9. placement_id,
  10. type,
  11. mix_format,
  12. enabled
  13. )
  14. values
  15. (
  16. #{adSourceId},
  17. #{name},
  18. #{placementId},
  19. #{type},
  20. #{mixFormat},
  21. #{enabled}
  22. )
  23. </insert>
  24. <update id="update">
  25. update yt_app_ad_source
  26. <set>
  27. <if test="name !=null">
  28. name = #{name},
  29. </if>
  30. <if test="placementId !=null">
  31. placement_id = #{placementId},
  32. </if>
  33. <if test="type !=null">
  34. type = #{type},
  35. </if>
  36. <if test="mixFormat !=null">
  37. mix_format = #{mixFormat},
  38. </if>
  39. <if test="enabled !=null">
  40. enabled = #{enabled},
  41. </if>
  42. </set>
  43. where ad_source_id = #{adSourceId}
  44. </update>
  45. <select id="adSourceList" resultType="com.ytpm.agent.view.AgentAdSourceView">
  46. select
  47. ad_source_id, name, type, mix_format,placement_id
  48. from yt_app_ad_source
  49. <where>
  50. <if test="placementId != null">
  51. placement_id=#{placementId}
  52. </if>
  53. <if test="name != null and name != ''">
  54. AND name LIKE CONCAT('%', #{name}, '%')
  55. </if>
  56. and enabled=1
  57. </where>
  58. </select>
  59. </mapper>