EmailTemplateInfoMapper.xml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.EmailTemplateInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailTemplateInfoDO">
  5. <id column="id" property="id"/>
  6. <result column="name" property="name"/>
  7. <result column="type" property="type"/>
  8. <result column="direction" property="direction"/>
  9. <result column="start_index" property="startIndex"/>
  10. <result column="end_index" property="endIndex"/>
  11. <result column="description" property="description"/>
  12. <result column="status" property="status"/>
  13. <result column="isvalid" property="isvalid"/>
  14. <result column="creatorid" property="creatorId"/>
  15. <result column="createtime" property="createTime"/>
  16. <result column="updaterid" property="updaterId"/>
  17. <result column="updatetime" property="updateTime"/>
  18. </resultMap>
  19. <insert id="saveTemplateInfo" useGeneratedKeys="true" keyProperty="id">
  20. insert into email_template_info(name,type,direction,start_index,end_index,description,status,isvalid,creatorid,createtime,updaterid,updatetime)
  21. values
  22. (#{name},#{type},#{direction},#{startIndex},#{endIndex},#{description},#{status},#{isvalid},#{creatorId},#{createTime},#{updaterId},#{updateTime})
  23. </insert>
  24. <update id="deleteTemplateList">
  25. update email_template_info set isvalid=0,updatetime=now(),updaterid=#{userId} where isvalid=1
  26. and id in
  27. <foreach item="id" collection="idList" open="(" separator="," close=")">
  28. #{id}
  29. </foreach>
  30. </update>
  31. <update id="updateTemplateInfo">
  32. update email_template_info set name=#{name},type=#{type},direction=#{direction},description=#{description},status=#{status},updatetime=#{updateTime},updaterid=#{updaterId}
  33. where id=#{id} and isvalid=1
  34. </update>
  35. <select id="searchTemplateList" resultMap="BaseResultMap">
  36. select id,name,type,direction,start_index,end_index,description,status,isvalid,creatorid,createtime,updaterid,updatetime
  37. from email_template_info where isvalid=1
  38. <if test="name != null and name !=''">
  39. and name like concat('%',#{name},'%')
  40. </if>
  41. <if test="keyword != null and keyword !=''">
  42. and name like concat('%',#{keyword},'%')
  43. </if>
  44. <if test="type != null">
  45. and type =#{type}
  46. </if>
  47. <if test="status != null">
  48. and status =#{status}
  49. </if>
  50. order by updatetime desc
  51. limit #{offset},#{pageSize}
  52. </select>
  53. <select id="countTemplateList" resultType="java.lang.Long">
  54. select count(1)
  55. from email_template_info where isvalid=1
  56. <if test="name != null and name !=''">
  57. and name like concat('%',#{name},'%')
  58. </if>
  59. <if test="keyword != null and keyword !=''">
  60. and name like concat('%',#{keyword},'%')
  61. </if>
  62. <if test="type != null">
  63. and type =#{type}
  64. </if>
  65. <if test="status != null">
  66. and status =#{status}
  67. </if>
  68. </select>
  69. <select id="searchTemplateById" resultMap="BaseResultMap">
  70. select id,name,type,direction,start_index,end_index,description,status,isvalid,creatorid,createtime,updaterid,updatetime
  71. from email_template_info where isvalid=1 and id=#{id}
  72. </select>
  73. <select id="searchTemplateByName" resultType="com.simuwang.base.pojo.dos.EmailTemplateInfoDO">
  74. select id,name,type,direction,start_index,end_index,description,status,isvalid,creatorid,createtime,updaterid,updatetime
  75. from email_template_info where isvalid=1 and name=#{name} limit 1
  76. </select>
  77. </mapper>