ConfigMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.system.config.mapper.ConfigMapper">
  6. <resultMap type="Config" id="ConfigResult">
  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 from sys_config
  19. </sql>
  20. <select id="selectConfigById" parameterType="Integer" resultMap="ConfigResult">
  21. <include refid="selectConfigVo"/>
  22. where config_id = #{configId}
  23. </select>
  24. <select id="selectConfigByKey" parameterType="String" resultMap="ConfigResult">
  25. <include refid="selectConfigVo"/>
  26. where config_key = #{configKey}
  27. </select>
  28. <select id="selectConfigList" parameterType="Config" resultMap="ConfigResult">
  29. <include refid="selectConfigVo"/>
  30. <where>
  31. <if test="configName != null and configName != ''">
  32. AND config_name like concat('%', #{configName}, '%')
  33. </if>
  34. <if test="configType != null and configType != ''">
  35. AND config_type = #{configType}
  36. </if>
  37. <if test="configKey != null and configKey != ''">
  38. AND config_key like concat('%', #{configKey}, '%')
  39. </if>
  40. <if test="params != null and params.beginTime != ''"><!-- 开始时间检索 -->
  41. and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  42. </if>
  43. <if test="params != null and params.endTime != ''"><!-- 结束时间检索 -->
  44. and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  45. </if>
  46. </where>
  47. </select>
  48. <insert id="insertConfig" parameterType="Config">
  49. insert into sys_config (
  50. <if test="configName != null and configName != '' ">config_name,</if>
  51. <if test="configKey != null and configKey != '' ">config_key,</if>
  52. <if test="configValue != null and configValue != '' ">config_value,</if>
  53. <if test="configType != null and configType != '' ">config_type,</if>
  54. <if test="createBy != null and createBy != ''">create_by,</if>
  55. <if test="remark != null and remark != ''">remark,</if>
  56. create_time
  57. )values(
  58. <if test="configName != null and configName != ''">#{configName},</if>
  59. <if test="configKey != null and configKey != ''">#{configKey},</if>
  60. <if test="configValue != null and configValue != ''">#{configValue},</if>
  61. <if test="configType != null and configType != ''">#{configType},</if>
  62. <if test="createBy != null and createBy != ''">#{createBy},</if>
  63. <if test="remark != null and remark != ''">#{remark},</if>
  64. sysdate()
  65. )
  66. </insert>
  67. <update id="updateConfig" parameterType="Config">
  68. update sys_config
  69. <set>
  70. <if test="configName != null and configName != ''">config_name = #{configName},</if>
  71. <if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
  72. <if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
  73. <if test="configType != null and configType != ''">config_type = #{configType},</if>
  74. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  75. <if test="remark != null and remark != ''">remark = #{remark},</if>
  76. update_time = sysdate()
  77. </set>
  78. where config_id = #{configId}
  79. </update>
  80. <delete id="deleteConfigById" parameterType="Integer">
  81. delete from sys_config where config_id = #{value}
  82. </delete>
  83. <delete id="deleteConfigByIds" parameterType="String">
  84. delete from sys_config where config_id in
  85. <foreach item="configId" collection="array" open="(" separator="," close=")">
  86. #{configId}
  87. </foreach>
  88. </delete>
  89. </mapper>