SensitiveWordMapper.xml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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.juxiao.xchat.module.xbd.mapper.operation.SensitiveWordMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.operation.SensitiveWord">
  5. <id column="id" property="id" jdbcType="INTEGER"/>
  6. <result column="sensitive_words" property="sensitiveWords" jdbcType="VARCHAR"/>
  7. <result column="admin_id" property="adminId" jdbcType="INTEGER"/>
  8. <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
  9. <result column="type" property="type" jdbcType="TINYINT"/>
  10. <result column="adminName" property="adminName" jdbcType="VARCHAR"/>
  11. </resultMap>
  12. <select id="listSensitiveWord" resultMap="BaseResultMap">
  13. select r.id, r.sensitive_words, r.admin_id, r.create_time, r.type,IFNULL(u.user_name,'未知') as adminName
  14. from room_sensitive_words r
  15. left join sys_user u on r.admin_id=u.user_id
  16. where 1 = 1
  17. <if test="searchText!=null and searchText!=''">
  18. AND r.sensitive_words like concat('%',#{searchText},'%')
  19. </if>
  20. <if test="type!=null and type!=''">
  21. AND r.type = #{type}
  22. </if>
  23. ORDER BY r.create_time desc
  24. </select>
  25. <delete id="deleteById" parameterType="java.lang.Integer">
  26. delete from room_sensitive_words
  27. where id = #{id,jdbcType=INTEGER}
  28. </delete>
  29. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.operation.SensitiveWord">
  30. REPLACE into room_sensitive_words ( sensitive_words, admin_id,
  31. create_time, type)
  32. values ( #{sensitiveWords,jdbcType=VARCHAR}, #{adminId,jdbcType=INTEGER},
  33. #{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=TINYINT})
  34. </insert>
  35. <insert id="batchInsert">
  36. REPLACE INTO room_sensitive_words ( sensitive_words, admin_id,
  37. create_time, type) values
  38. <foreach item='item' index='index' collection='sensitiveWordList' separator=','>
  39. (#{item.sensitiveWords,jdbcType=VARCHAR}, #{item.adminId,jdbcType=INTEGER},
  40. #{item.createTime,jdbcType=TIMESTAMP}, #{item.type,jdbcType=TINYINT})
  41. </foreach>
  42. </insert>
  43. </mapper>