CompanyEmailConfigMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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.CompanyEmailConfigMapper">
  4. <insert id="saveCompanyEmailConfig">
  5. insert into company_email_config(
  6. <if test="companyId != null and companyId != ''">company_id,</if>
  7. <if test="companyName != null and companyName != ''">company_name,</if>
  8. <if test="email != null and email != ''">email,</if>
  9. <if test="openStatus != null">open_status,</if>
  10. <if test="remark != null and remark != ''">remark,</if>
  11. <if test="creatorId != null and creatorId != ''">creatorid,</if>
  12. <if test="updaterId != null and updaterId != ''">updaterId,</if>
  13. isvalid,
  14. createtime,
  15. updatetime
  16. )values(
  17. <if test="companyId != null and companyId != ''">#{companyId},</if>
  18. <if test="companyName != null and companyName != ''">#{companyName},</if>
  19. <if test="email != null and email != ''">#{email},</if>
  20. <if test="openStatus != null">#{openStatus},</if>
  21. <if test="remark != null and remark != ''">#{remark},</if>
  22. <if test="creatorId != null and creatorId != ''">#{creatorId},</if>
  23. <if test="updaterId != null and updaterId != ''">#{updaterId},</if>
  24. 1,
  25. now(),
  26. now()
  27. )
  28. </insert>
  29. <update id="updateCompanyEmailConfig">
  30. update company_email_config
  31. <set>
  32. <if test="companyId != null and companyId != ''">company_id=#{companyId},</if>
  33. <if test="companyName != null and companyName != ''">company_name=#{companyName},</if>
  34. <if test="email != null and email != ''">email=#{email},</if>
  35. <if test="openStatus != null">open_status=#{openStatus},</if>
  36. <if test="remark != null and remark != ''">remark=#{remark},</if>
  37. <if test="updaterId != null and updaterId != ''">updaterid=#{updaterId},</if>
  38. <if test="updateTime != null">updatetime=#{updateTime},</if>
  39. </set>
  40. where id = #{id} and isvalid=1
  41. </update>
  42. <update id="deleteCompanyEmailConfig">
  43. update company_email_config set isvalid =0,updatetime=now(),updaterid=#{updaterId} where id=#{id}
  44. </update>
  45. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.CompanyEmailConfigDO">
  46. <id column="id" property="id"/>
  47. <result column="company_id" property="companyId"/>
  48. <result column="company_name" property="companyName"/>
  49. <result column="email" property="email"/>
  50. <result column="open_status" property="openStatus"/>
  51. <result column="remark" property="remark"/>
  52. <result column="creatorid" property="creatorId"/>
  53. <result column="updaterid" property="updaterId"/>
  54. <result column="createtime" property="createTime"/>
  55. <result column="updatetime" property="updateTime"/>
  56. <result column="isvalid" property="isvalid"/>
  57. </resultMap>
  58. <sql id="selectCompanyEmailConfigDo">
  59. select id,company_id, company_name, email, open_status,remark, creatorid, createtime, updaterid, updatetime,isvalid
  60. from company_email_config
  61. </sql>
  62. <!-- 查询条件 -->
  63. <sql id="sqlwhereSearch">
  64. <where>
  65. isvalid=1
  66. <if test="id !=null">
  67. and id = #{id}
  68. </if>
  69. </where>
  70. </sql>
  71. <select id="selectCompanyEmailConfigById" resultMap="BaseResultMap">
  72. <include refid="selectCompanyEmailConfigDo"/>
  73. <include refid="sqlwhereSearch"/>
  74. </select>
  75. <select id="searchEmailByCompanyId" resultType="java.lang.String" parameterType="java.lang.String">
  76. select email from company_email_config where company_id = #{companyId} and isvalid =1
  77. </select>
  78. <resultMap id="BaseVOMap" type="com.simuwang.base.pojo.vo.CompanyEmailConfigVO">
  79. <id column="id" property="id"/>
  80. <result column="company_id" property="companyId"/>
  81. <result column="company_name" property="companyName"/>
  82. <result column="email" property="email"/>
  83. <result column="open_status" property="openStatus"/>
  84. <result column="remark" property="sendRemark"/>
  85. </resultMap>
  86. <select id="searchEmailConfig" resultMap="BaseVOMap">
  87. select id,company_id,company_name,email,open_status,remark from
  88. company_email_config where isvalid =1 and company_id=#{companyId}
  89. limit #{offset},#{pageSize}
  90. </select>
  91. <select id="countEmailConfig" resultType="java.lang.Long" parameterType="java.lang.String">
  92. select count(1) from company_email_config where isvalid =1 and company_id=#{companyId}
  93. </select>
  94. <select id="searchEmailConfigByCompanyId" resultMap="BaseVOMap">
  95. select id,company_id,company_name,email,open_status,remark from
  96. company_email_config where isvalid =1 and company_id=#{companyId}
  97. </select>
  98. <select id="selectEmailConfig" resultMap="BaseResultMap">
  99. select id,company_id,company_name,email,open_status,remark from
  100. company_email_config where isvalid =1 and company_id=#{companyId} and email=#{email} limit 1
  101. </select>
  102. <select id="getAllCompanyConfig" resultMap="BaseResultMap">
  103. select id,company_id,company_name,email,open_status,remark from
  104. company_email_config where isvalid =1 and open_status=1
  105. </select>
  106. <select id="selectCompanyEmailConfigByIdList" resultMap="BaseResultMap">
  107. select id,company_id,company_name,email,open_status,remark from
  108. company_email_config where isvalid =1 and open_status=1
  109. and id in
  110. <foreach item="id" collection="idList" open="(" separator="," close=")">
  111. #{id}
  112. </foreach>
  113. </select>
  114. </mapper>