EmailTemplateMappingMapper.xml 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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.simuwang.base.mapper.EmailTemplateMappingMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailTemplateMappingDO">
  5. <id column="id" property="id"/>
  6. <result column="template_id" property="templateId"/>
  7. <result column="title" property="title"/>
  8. <result column="email" property="email"/>
  9. <result column="company_name" property="companyName"/>
  10. <result column="description" property="description"/>
  11. <result column="status" property="status"/>
  12. <result column="isvalid" property="isvalid"/>
  13. <result column="creatorid" property="creatorId"/>
  14. <result column="createtime" property="createTime"/>
  15. <result column="updaterid" property="updaterId"/>
  16. <result column="updatetime" property="updateTime"/>
  17. <result column="template_name" property="templateName"/>
  18. </resultMap>
  19. <insert id="saveEmailTemplateMappingDO">
  20. insert into PPW_EMAIL.email_template_mapping(template_id,title,email,company_name,description,status,isvalid,creatorid,createtime,updaterid,updatetime)
  21. values
  22. (#{templateId},#{title},#{email},#{companyName},#{description},#{status},#{isvalid},#{creatorId},#{createTime},#{updaterId},#{updateTime})
  23. </insert>
  24. <update id="deleteTemplateSetting">
  25. update PPW_EMAIL.email_template_mapping set isvalid=0,updatetime=sysdate(),updaterid=#{userId}
  26. where isvalid=1 and id in
  27. <foreach item="id" collection="idList" open="(" separator="," close=")">
  28. #{id}
  29. </foreach>
  30. </update>
  31. <update id="updateEmailTemplateMappingDO">
  32. update PPW_EMAIL.email_template_mapping set template_id=#{templateId},title=#{title},email=#{email},company_name=#{companyName},
  33. description=#{description}, status=#{status},updatetime=#{updateTime},updaterid=#{updaterId}
  34. where isvalid=1 and id=#{id}
  35. </update>
  36. <select id="queryByEmail" resultType="com.simuwang.base.pojo.dos.EmailTemplateInfoDO">
  37. select t1.template_id as id,
  38. t2.direction as direction,
  39. t2.type as type,
  40. t2.start_index as startIndex,
  41. t2.end_index as endIndex
  42. from PPW_EMAIL.email_template_mapping t1
  43. join PPW_EMAIL.email_template_info t2 on t2.id = t1.template_id and t2.isvalid = 1 and t2.status = 1
  44. where t1.email = #{email}
  45. and t2.type = #{type}
  46. and t1.isvalid = 1
  47. and t2.status = 1
  48. </select>
  49. <select id="searchTemplateSettingList" resultMap="BaseResultMap">
  50. select mapping.id,mapping.template_id,mapping.title,mapping.email,mapping.company_name,mapping.description,mapping.status,
  51. t.name as template_name
  52. from PPW_EMAIL.email_template_mapping mapping
  53. join PPW_EMAIL.email_template_info t on t.id = mapping.template_id and t.isvalid = 1 and t.status = 1
  54. where mapping.isvalid=1
  55. <if test="title != null and title != ''">
  56. mapping.title like concat('%',#{title},'%')
  57. </if>
  58. <if test="email != null and email != ''">
  59. mapping.email like concat('%',#{email},'%')
  60. </if>
  61. <if test="companyName != null and companyName != ''">
  62. mapping.company_name like concat('%',#{companyName},'%')
  63. </if>
  64. <if test="templateName != null and templateName != ''">
  65. t.name like concat('%',#{templateName},'%')
  66. </if>
  67. <if test="status != null">
  68. mapping.status=#{status}
  69. </if>
  70. limit #{offset},#{pageSize}
  71. </select>
  72. <select id="countTemplateSettingList" resultType="java.lang.Long">
  73. select count(mapping.id)
  74. from PPW_EMAIL.email_template_mapping mapping
  75. join PPW_EMAIL.email_template_info t on t.id = mapping.template_id and t.isvalid = 1 and t.status = 1
  76. where mapping,isvalid=1
  77. <if test="title != null and title != ''">
  78. mapping.title like concat('%',#{title},'%')
  79. </if>
  80. <if test="email != null and email != ''">
  81. mapping.email like concat('%',#{email},'%')
  82. </if>
  83. <if test="companyName != null and companyName != ''">
  84. mapping.company_name like concat('%',#{companyName},'%')
  85. </if>
  86. <if test="templateName != null and templateName != ''">
  87. t.name like concat('%',#{templateName},'%')
  88. </if>
  89. <if test="status != null">
  90. mapping.status=#{status}
  91. </if>
  92. </select>
  93. </mapper>