TrsDomainWordsMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.ruoyi.project.mapper.TrsDomainWordsMapper">
  6. <resultMap type="TrsDomainWords" id="TrsDomainWordsResult">
  7. <result property="id" column="id" />
  8. <result property="wrongWord" column="wrong_word" />
  9. <result property="domainType" column="domain_type" />
  10. <result property="dictType" column="dict_type" />
  11. <result property="flag" column="flag" />
  12. <result property="status" column="status" />
  13. <result property="time" column="time" />
  14. <result property="effectstart" column="effectstart" />
  15. <result property="effectend" column="effectend" />
  16. <result property="deptId" column="dept_id" />
  17. </resultMap>
  18. <sql id="selectTrsDomainWordsVo">
  19. select t.id, t.wrong_word, t.domain_type, t.dict_type, t.flag, t.status,t.time, t.effectstart, t.effectend,t.dept_id from trs_domain_words t
  20. </sql>
  21. <select id="selectTrsWordsListByErrorWord" parameterType="String" resultMap="TrsDomainWordsResult">
  22. <include refid="selectTrsDomainWordsVo"/>
  23. where wrong_word = #{errorWord}
  24. order by t.time desc
  25. </select>
  26. <select id="selectTrsDomainWordsList" parameterType="TrsDomainWords" resultMap="TrsDomainWordsResult">
  27. <include refid="selectTrsDomainWordsVo"/>
  28. <if test="params.dataScope != null and params.dataScope != ''">
  29. <!-- 添加部门表关联 -->
  30. LEFT JOIN sys_dept d ON t.dept_id = d.dept_id
  31. </if>
  32. <where>
  33. <if test="wrongWord != null and wrongWord != ''"> and wrong_word like concat('%', #{wrongWord}, '%')</if>
  34. <if test="domainType != null and domainType != ''"> and domain_type = #{domainType}</if>
  35. <if test="status != null and status != ''"> and t.status = #{status}</if>
  36. <if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and time between #{params.beginTime} and #{params.endTime}</if>
  37. <choose>
  38. <when test="deptId != null and deptId == 100">
  39. <!-- 教对部门可以看到所有数据 -->
  40. and (t.dept_id = 100 or t.dept_id = 0)
  41. </when>
  42. <otherwise>
  43. <!-- 数据范围过滤移动到where标签内 -->
  44. <if test="params.dataScope != null and params.dataScope != ''">
  45. ${params.dataScope}
  46. </if>
  47. </otherwise>
  48. </choose>
  49. </where>
  50. order by t.time desc
  51. </select>
  52. <select id="selectTrsDomainWordsById" parameterType="Long" resultMap="TrsDomainWordsResult">
  53. <include refid="selectTrsDomainWordsVo"/>
  54. where id = #{id}
  55. </select>
  56. <insert id="insertTrsDomainWords" parameterType="TrsDomainWords" useGeneratedKeys="true" keyProperty="id">
  57. insert into trs_domain_words
  58. <trim prefix="(" suffix=")" suffixOverrides=",">
  59. <if test="wrongWord != null and wrongWord != ''">wrong_word,</if>
  60. <if test="domainType != null">domain_type,</if>
  61. <if test="dictType != null">dict_type,</if>
  62. <if test="flag != null">flag,</if>
  63. <if test="status != null">status,</if>
  64. <if test="time != null">time,</if>
  65. <if test="effectstart != null">effectstart,</if>
  66. <if test="effectend != null">effectend,</if>
  67. <if test="deptId != null">dept_id,</if>
  68. </trim>
  69. <trim prefix="values (" suffix=")" suffixOverrides=",">
  70. <if test="wrongWord != null and wrongWord != ''">#{wrongWord},</if>
  71. <if test="domainType != null">#{domainType},</if>
  72. <if test="dictType != null">#{dictType},</if>
  73. <if test="flag != null">#{flag},</if>
  74. <if test="status != null">#{status},</if>
  75. <if test="time != null">#{time},</if>
  76. <if test="effectstart != null">#{effectstart},</if>
  77. <if test="effectend != null">#{effectend},</if>
  78. <if test="deptId != null">#{deptId},</if>
  79. </trim>
  80. </insert>
  81. <update id="updateTrsDomainWords" parameterType="TrsDomainWords">
  82. update trs_domain_words
  83. <trim prefix="SET" suffixOverrides=",">
  84. <if test="wrongWord != null and wrongWord != ''">wrong_word = #{wrongWord},</if>
  85. <if test="domainType != null">domain_type = #{domainType},</if>
  86. <if test="dictType != null">dict_type = #{dictType},</if>
  87. <if test="flag != null">flag = #{flag},</if>
  88. <if test="status != null">status = #{status},</if>
  89. <if test="time != null">time = #{time},</if>
  90. <if test="effectstart != null">effectstart = #{effectstart},</if>
  91. <if test="effectend != null">effectend = #{effectend},</if>
  92. <if test="deptId != null">dept_id = #{deptId},</if>
  93. </trim>
  94. where id = #{id}
  95. </update>
  96. <delete id="deleteTrsDomainWordsById" parameterType="Long">
  97. delete from trs_domain_words where id = #{id}
  98. </delete>
  99. <delete id="deleteTrsDomainWordsByIds" parameterType="String">
  100. delete from trs_domain_words where id in
  101. <foreach item="id" collection="array" open="(" separator="," close=")">
  102. #{id}
  103. </foreach>
  104. </delete>
  105. </mapper>