86133 | aaa3f5d | 2025-04-20 21:33:29 +0800 | [diff] [blame] | 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 | |
| 7 | <resultMap type="SysConfig" id="SysConfigResult"> |
| 8 | <id property="configId" column="config_id" /> |
| 9 | <result property="configName" column="config_name" /> |
| 10 | <result property="configKey" column="config_key" /> |
| 11 | <result property="configValue" column="config_value" /> |
| 12 | <result property="configType" column="config_type" /> |
| 13 | <result property="createBy" column="create_by" /> |
| 14 | <result property="createTime" column="create_time" /> |
| 15 | <result property="updateBy" column="update_by" /> |
| 16 | <result property="updateTime" column="update_time" /> |
| 17 | </resultMap> |
| 18 | |
| 19 | <sql id="selectConfigVo"> |
| 20 | select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark |
| 21 | from sys_config |
| 22 | </sql> |
| 23 | |
| 24 | <!-- 查询条件 --> |
| 25 | <sql id="sqlwhereSearch"> |
| 26 | <where> |
| 27 | <if test="configId !=null"> |
| 28 | and config_id = #{configId} |
| 29 | </if> |
| 30 | <if test="configKey !=null and configKey != ''"> |
| 31 | and config_key = #{configKey} |
| 32 | </if> |
| 33 | </where> |
| 34 | </sql> |
| 35 | |
| 36 | <select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult"> |
| 37 | <include refid="selectConfigVo"/> |
| 38 | <include refid="sqlwhereSearch"/> |
| 39 | </select> |
| 40 | |
| 41 | <select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult"> |
| 42 | <include refid="selectConfigVo"/> |
| 43 | <where> |
| 44 | <if test="configName != null and configName != ''"> |
| 45 | AND config_name like concat('%', #{configName}, '%') |
| 46 | </if> |
| 47 | <if test="configType != null and configType != ''"> |
| 48 | AND config_type = #{configType} |
| 49 | </if> |
| 50 | <if test="configKey != null and configKey != ''"> |
| 51 | AND config_key like concat('%', #{configKey}, '%') |
| 52 | </if> |
| 53 | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> |
| 54 | and date_format(create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d') |
| 55 | </if> |
| 56 | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
| 57 | and date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d') |
| 58 | </if> |
| 59 | </where> |
| 60 | </select> |
| 61 | |
| 62 | <select id="selectConfigById" parameterType="Long" resultMap="SysConfigResult"> |
| 63 | <include refid="selectConfigVo"/> |
| 64 | where config_id = #{configId} |
| 65 | </select> |
| 66 | |
| 67 | <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult"> |
| 68 | <include refid="selectConfigVo"/> |
| 69 | where config_key = #{configKey} limit 1 |
| 70 | </select> |
| 71 | |
| 72 | <insert id="insertConfig" parameterType="SysConfig"> |
| 73 | insert into sys_config ( |
| 74 | <if test="configName != null and configName != '' ">config_name,</if> |
| 75 | <if test="configKey != null and configKey != '' ">config_key,</if> |
| 76 | <if test="configValue != null and configValue != '' ">config_value,</if> |
| 77 | <if test="configType != null and configType != '' ">config_type,</if> |
| 78 | <if test="createBy != null and createBy != ''">create_by,</if> |
| 79 | <if test="remark != null and remark != ''">remark,</if> |
| 80 | create_time |
| 81 | )values( |
| 82 | <if test="configName != null and configName != ''">#{configName},</if> |
| 83 | <if test="configKey != null and configKey != ''">#{configKey},</if> |
| 84 | <if test="configValue != null and configValue != ''">#{configValue},</if> |
| 85 | <if test="configType != null and configType != ''">#{configType},</if> |
| 86 | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| 87 | <if test="remark != null and remark != ''">#{remark},</if> |
| 88 | sysdate() |
| 89 | ) |
| 90 | </insert> |
| 91 | |
| 92 | <update id="updateConfig" parameterType="SysConfig"> |
| 93 | update sys_config |
| 94 | <set> |
| 95 | <if test="configName != null and configName != ''">config_name = #{configName},</if> |
| 96 | <if test="configKey != null and configKey != ''">config_key = #{configKey},</if> |
| 97 | <if test="configValue != null and configValue != ''">config_value = #{configValue},</if> |
| 98 | <if test="configType != null and configType != ''">config_type = #{configType},</if> |
| 99 | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| 100 | <if test="remark != null">remark = #{remark},</if> |
| 101 | update_time = sysdate() |
| 102 | </set> |
| 103 | where config_id = #{configId} |
| 104 | </update> |
| 105 | |
| 106 | <delete id="deleteConfigById" parameterType="Long"> |
| 107 | delete from sys_config where config_id = #{configId} |
| 108 | </delete> |
| 109 | |
| 110 | <delete id="deleteConfigByIds" parameterType="Long"> |
| 111 | delete from sys_config where config_id in |
| 112 | <foreach item="configId" collection="array" open="(" separator="," close=")"> |
| 113 | #{configId} |
| 114 | </foreach> |
| 115 | </delete> |
| 116 | |
| 117 | </mapper> |