SysConfigMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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.system.mapper.SysConfigMapper">
  6. <resultMap type="SysConfig" id="SysConfigResult">
  7. <id property="configId" column="config_id" />
  8. <result property="configName" column="config_name" />
  9. <result property="configKey" column="config_key" />
  10. <result property="configValue" column="config_value" />
  11. <result property="configType" column="config_type" />
  12. <result property="createBy" column="create_by" />
  13. <result property="createTime" column="create_time" />
  14. <result property="updateBy" column="update_by" />
  15. <result property="updateTime" column="update_time" />
  16. </resultMap>
  17. <sql id="selectConfigVo">
  18. select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
  19. from sys_config
  20. </sql>
  21. <!-- 查询条件 -->
  22. <sql id="sqlwhereSearch">
  23. <where>
  24. <if test="configId !=null">
  25. and config_id = #{configId}
  26. </if>
  27. <if test="configKey !=null and configKey != ''">
  28. and config_key = #{configKey}
  29. </if>
  30. </where>
  31. </sql>
  32. <select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
  33. <include refid="selectConfigVo"/>
  34. <include refid="sqlwhereSearch"/>
  35. </select>
  36. <select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
  37. <include refid="selectConfigVo"/>
  38. <where>
  39. <if test="configName != null and configName != ''">
  40. AND config_name like concat(concat('%',#{configName}),'%')
  41. </if>
  42. <if test="configType != null and configType != ''">
  43. AND config_type = #{configType}
  44. </if>
  45. <if test="configKey != null and configKey != ''">
  46. AND config_key like concat(concat('%',#{configKey}),'%')
  47. </if>
  48. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  49. and create_time &gt;= to_date(#{params.beginTime},'yyyy-MM-dd HH24:mi:ss')
  50. </if>
  51. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  52. and create_time &lt;= to_date(#{params.endTime},'yyyy-MM-dd HH24:mi:ss')
  53. </if>
  54. </where>
  55. </select>
  56. <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
  57. <include refid="selectConfigVo"/>
  58. where config_key = #{configKey} and rownum <![CDATA[ <= ]]> 1
  59. </select>
  60. <insert id="insertConfig" parameterType="SysConfig">
  61. <selectKey keyProperty="configId" resultType="long" order="BEFORE">
  62. SELECT seq_sys_config.NEXTVAL as configId FROM DUAL
  63. </selectKey>
  64. insert into sys_config (
  65. <if test="configId != null and configId != 0 ">config_id,</if>
  66. <if test="configName != null and configName != '' ">config_name,</if>
  67. <if test="configKey != null and configKey != '' ">config_key,</if>
  68. <if test="configValue != null and configValue != '' ">config_value,</if>
  69. <if test="configType != null and configType != '' ">config_type,</if>
  70. <if test="createBy != null and createBy != ''">create_by,</if>
  71. <if test="remark != null and remark != ''">remark,</if>
  72. create_time
  73. )values(
  74. <if test="configId != null and configId != 0 ">#{configId},</if>
  75. <if test="configName != null and configName != ''">#{configName},</if>
  76. <if test="configKey != null and configKey != ''">#{configKey},</if>
  77. <if test="configValue != null and configValue != ''">#{configValue},</if>
  78. <if test="configType != null and configType != ''">#{configType},</if>
  79. <if test="createBy != null and createBy != ''">#{createBy},</if>
  80. <if test="remark != null and remark != ''">#{remark},</if>
  81. sysdate
  82. )
  83. </insert>
  84. <update id="updateConfig" parameterType="SysConfig">
  85. update sys_config
  86. <set>
  87. <if test="configName != null and configName != ''">config_name = #{configName},</if>
  88. <if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
  89. <if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
  90. <if test="configType != null and configType != ''">config_type = #{configType},</if>
  91. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  92. <if test="remark != null">remark = #{remark},</if>
  93. update_time = sysdate
  94. </set>
  95. where config_id = #{configId}
  96. </update>
  97. <delete id="deleteConfigById" parameterType="Long">
  98. delete from sys_config where config_id = #{configId}
  99. </delete>
  100. <delete id="deleteConfigByIds" parameterType="String">
  101. delete from sys_config where config_id in
  102. <foreach item="configId" collection="array" open="(" separator="," close=")">
  103. #{configId}
  104. </foreach>
  105. </delete>
  106. </mapper>