AdUploadLogMapper.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.ad.mapper.AdUploadLogMapper">
  6. <resultMap type="AdUploadLog" id="AdUploadLogResult">
  7. <result property="id" column="id" />
  8. <result property="siteId" column="site_id" />
  9. <result property="type" column="type" />
  10. <result property="templateId" column="template_id" />
  11. <result property="accountId" column="account_id" />
  12. <result property="domainId" column="domain_id" />
  13. <result property="url" column="url" />
  14. <result property="uploadType" column="upload_type" />
  15. <result property="vid" column="vid" />
  16. </resultMap>
  17. <sql id="selectAdUploadLogVo">
  18. select * from ad_upload_log
  19. </sql>
  20. <select id="selectAdUploadLogList" parameterType="AdUploadLog" resultType="AdUploadLog">
  21. select a.*,b.name siteName,b.url siteUrl,c.name accountName from ad_upload_log a
  22. inner join ad_site b on a.site_id = b.id
  23. inner join ad_account c on a.account_id = c.id
  24. <where>
  25. <if test="siteId != null "> and a.site_id = #{siteId}</if>
  26. <if test="type != null "> and a.type = #{type}</if>
  27. <if test="templateId != null "> and a.template_id = #{templateId}</if>
  28. <if test="accountId != null "> and a.account_id = #{accountId}</if>
  29. <if test="domainId != null "> and a.domain_id = #{domainId}</if>
  30. <if test="url != null and url != ''"> and a.url = #{url}</if>
  31. <if test="uploadType != null and uploadType != ''"> and a.upload_type = #{uploadType}</if>
  32. <if test="vid != null and vid != ''"> and a.vid = #{vid}</if>
  33. <if test="startDate != null and endDate != null">
  34. AND date_format(a.create_time,'%Y-%m-%d') &gt;= #{startDate}
  35. AND date_format(a.create_time,'%Y-%m-%d') &lt;= #{endDate}
  36. </if>
  37. </where>
  38. order by a.create_time desc
  39. </select>
  40. <select id="selectAdUploadLogById" parameterType="Long" resultMap="AdUploadLogResult">
  41. <include refid="selectAdUploadLogVo"/>
  42. where id = #{id}
  43. </select>
  44. <insert id="insertAdUploadLog" parameterType="AdUploadLog" useGeneratedKeys="true" keyProperty="id">
  45. insert into ad_upload_log
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="siteId != null">site_id,</if>
  48. <if test="type != null">type,</if>
  49. <if test="templateId != null">template_id,</if>
  50. <if test="accountId != null">account_id,</if>
  51. <if test="domainId != null">domain_id,</if>
  52. <if test="url != null">url,</if>
  53. <if test="uploadType != null">upload_type,</if>
  54. <if test="vid != null">vid,</if>
  55. <if test="createTime != null">create_time,</if>
  56. </trim>
  57. <trim prefix="values (" suffix=")" suffixOverrides=",">
  58. <if test="siteId != null">#{siteId},</if>
  59. <if test="type != null">#{type},</if>
  60. <if test="templateId != null">#{templateId},</if>
  61. <if test="accountId != null">#{accountId},</if>
  62. <if test="domainId != null">#{domainId},</if>
  63. <if test="url != null">#{url},</if>
  64. <if test="uploadType != null">#{uploadType},</if>
  65. <if test="vid != null">#{vid},</if>
  66. <if test="createTime != null">#{createTime},</if>
  67. </trim>
  68. </insert>
  69. <update id="updateAdUploadLog" parameterType="AdUploadLog">
  70. update ad_upload_log
  71. <trim prefix="SET" suffixOverrides=",">
  72. <if test="siteId != null">site_id = #{siteId},</if>
  73. <if test="type != null">type = #{type},</if>
  74. <if test="templateId != null">template_id = #{templateId},</if>
  75. <if test="accountId != null">account_id = #{accountId},</if>
  76. <if test="domainId != null">domain_id = #{domainId},</if>
  77. <if test="url != null">url = #{url},</if>
  78. <if test="uploadType != null">upload_type = #{uploadType},</if>
  79. <if test="vid != null">vid = #{vid},</if>
  80. <if test="createTime != null">create_time = #{createTime},</if>
  81. </trim>
  82. where id = #{id}
  83. </update>
  84. <delete id="deleteAdUploadLogById" parameterType="Long">
  85. delete from ad_upload_log where id = #{id}
  86. </delete>
  87. <delete id="deleteAdUploadLogByIds" parameterType="String">
  88. delete from ad_upload_log where id in
  89. <foreach item="id" collection="array" open="(" separator="," close=")">
  90. #{id}
  91. </foreach>
  92. </delete>
  93. </mapper>