CompanySmsCommonLogsMapper.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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.company.mapper.CompanySmsCommonLogsMapper">
  6. <resultMap type="CompanySmsCommonLogs" id="CompanySmsCommonLogsResult">
  7. <result property="logsId" column="logs_id" />
  8. <result property="companyId" column="company_id" />
  9. <result property="companyUserId" column="company_user_id" />
  10. <result property="recipientId" column="recipient_id" />
  11. <result property="recipientName" column="recipient_name" />
  12. <result property="sendType" column="send_type" />
  13. <result property="tempId" column="temp_id" />
  14. <result property="tempCode" column="temp_code" />
  15. <result property="phone" column="phone" />
  16. <result property="content" column="content" />
  17. <result property="createTime" column="create_time" />
  18. <result property="sendTime" column="send_time" />
  19. <result property="status" column="status" />
  20. <result property="mid" column="mid" />
  21. <result property="stat" column="stat" />
  22. <result property="replyContent" column="reply_content" />
  23. <result property="number" column="number" />
  24. <result property="type" column="type" />
  25. <result property="companyUserName" column="company_user_name" />
  26. </resultMap>
  27. <sql id="selectCompanySmsCommonLogsVo">
  28. select logs_id, company_id, company_user_id, recipient_id, recipient_name, send_type, temp_id, temp_code, phone, content, create_time, send_time, status, mid, stat, reply_content, number, type,company_user_name from company_sms_common_logs
  29. </sql>
  30. <select id="selectCompanySmsCommonLogsList" parameterType="CompanySmsCommonLogs" resultMap="CompanySmsCommonLogsResult">
  31. <include refid="selectCompanySmsCommonLogsVo"/>
  32. <where>
  33. <if test="companyId != null "> and company_id = #{companyId}</if>
  34. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  35. <if test="recipientId != null "> and recipient_id = #{recipientId}</if>
  36. <if test="recipientName != null "> and recipient_name like concat('%', #{recipientName}, '%')</if>
  37. <if test="sendType != null "> and send_type = #{sendType}</if>
  38. <if test="tempId != null "> and temp_id = #{tempId}</if>
  39. <if test="tempCode != null and tempCode != ''"> and temp_code = #{tempCode}</if>
  40. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  41. <if test="content != null and content != ''"> and content = #{content}</if>
  42. <if test="sendTime != null "> and send_time = #{sendTime}</if>
  43. <if test="status != null "> and status = #{status}</if>
  44. <if test="mid != null and mid != ''"> and mid = #{mid}</if>
  45. <if test="stat != null and stat != ''"> and stat = #{stat}</if>
  46. <if test="replyContent != null and replyContent != ''"> and reply_content = #{replyContent}</if>
  47. <if test="number != null "> and number = #{number}</if>
  48. <if test="type != null and type != ''"> and type = #{type}</if>
  49. <if test="companyUserName != null and companyUserName != ''"> and company_user_name = #{companyUserName}</if>
  50. <if test="beginTime != null and beginTime != '' "> and send_time &gt;= #{beginTime}</if>
  51. <if test="endTime != null and endTime != '' "> and send_time &lt; #{endTime}</if>
  52. <if test="isReply != null and isReply == 0 "> and content is not null</if>
  53. <if test="isReply != null and isReply == 1 "> and content is null</if>
  54. </where>
  55. order by logs_id desc
  56. </select>
  57. <select id="selectCompanySmsCommonLogsByLogsId" parameterType="Long" resultMap="CompanySmsCommonLogsResult">
  58. <include refid="selectCompanySmsCommonLogsVo"/>
  59. where logs_id = #{logsId}
  60. </select>
  61. <insert id="insertCompanySmsCommonLogs" parameterType="CompanySmsCommonLogs" useGeneratedKeys="true" keyProperty="logsId">
  62. insert into company_sms_common_logs
  63. <trim prefix="(" suffix=")" suffixOverrides=",">
  64. <if test="companyId != null">company_id,</if>
  65. <if test="companyUserId != null">company_user_id,</if>
  66. <if test="recipientId != null">recipient_id,</if>
  67. <if test="recipientName != null">recipient_name,</if>
  68. <if test="sendType != null">send_type,</if>
  69. <if test="tempId != null">temp_id,</if>
  70. <if test="tempCode != null">temp_code,</if>
  71. <if test="phone != null">phone,</if>
  72. <if test="content != null">content,</if>
  73. <if test="createTime != null">create_time,</if>
  74. <if test="sendTime != null">send_time,</if>
  75. <if test="status != null">status,</if>
  76. <if test="mid != null">mid,</if>
  77. <if test="stat != null">stat,</if>
  78. <if test="replyContent != null">reply_content,</if>
  79. <if test="number != null">number,</if>
  80. <if test="type != null">type,</if>
  81. <if test="companyUserName != null">company_user_name,</if>
  82. </trim>
  83. <trim prefix="values (" suffix=")" suffixOverrides=",">
  84. <if test="companyId != null">#{companyId},</if>
  85. <if test="companyUserId != null">#{companyUserId},</if>
  86. <if test="recipientId != null">#{recipientId},</if>
  87. <if test="recipientName != null">#{recipientName},</if>
  88. <if test="sendType != null">#{sendType},</if>
  89. <if test="tempId != null">#{tempId},</if>
  90. <if test="tempCode != null">#{tempCode},</if>
  91. <if test="phone != null">#{phone},</if>
  92. <if test="content != null">#{content},</if>
  93. <if test="createTime != null">#{createTime},</if>
  94. <if test="sendTime != null">#{sendTime},</if>
  95. <if test="status != null">#{status},</if>
  96. <if test="mid != null">#{mid},</if>
  97. <if test="stat != null">#{stat},</if>
  98. <if test="replyContent != null">#{replyContent},</if>
  99. <if test="number != null">#{number},</if>
  100. <if test="type != null">#{type},</if>
  101. <if test="companyUserName != null">#{companyUserName},</if>
  102. </trim>
  103. </insert>
  104. <update id="updateCompanySmsCommonLogs" parameterType="CompanySmsCommonLogs">
  105. update company_sms_common_logs
  106. <trim prefix="SET" suffixOverrides=",">
  107. <if test="companyId != null">company_id = #{companyId},</if>
  108. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  109. <if test="recipientId != null">recipient_id = #{recipientId},</if>
  110. <if test="recipientName != null">recipient_name = #{recipientName},</if>
  111. <if test="sendType != null">send_type = #{sendType},</if>
  112. <if test="tempId != null">temp_id = #{tempId},</if>
  113. <if test="tempCode != null">temp_code = #{tempCode},</if>
  114. <if test="phone != null">phone = #{phone},</if>
  115. <if test="content != null">content = #{content},</if>
  116. <if test="createTime != null">create_time = #{createTime},</if>
  117. <if test="sendTime != null">send_time = #{sendTime},</if>
  118. <if test="status != null">status = #{status},</if>
  119. <if test="mid != null">mid = #{mid},</if>
  120. <if test="stat != null">stat = #{stat},</if>
  121. <if test="replyContent != null">reply_content = #{replyContent},</if>
  122. <if test="number != null">number = #{number},</if>
  123. <if test="type != null">type = #{type},</if>
  124. <if test="companyUserName != null">company_user_name = #{companyUserName},</if>
  125. </trim>
  126. where logs_id = #{logsId}
  127. </update>
  128. <delete id="deleteCompanySmsCommonLogsByLogsId" parameterType="Long">
  129. delete from company_sms_common_logs where logs_id = #{logsId}
  130. </delete>
  131. <delete id="deleteCompanySmsCommonLogsByLogsIds" parameterType="String">
  132. delete from company_sms_common_logs where logs_id in
  133. <foreach item="logsId" collection="array" open="(" separator="," close=")">
  134. #{logsId}
  135. </foreach>
  136. </delete>
  137. </mapper>