ConfigMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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.juxiao.xchat.module.system.mapper.ConfigMapper">
  6. <resultMap type="com.juxiao.xchat.module.system.domain.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
  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="com.juxiao.xchat.module.system.domain.Config" resultMap="ConfigResult">
  33. <include refid="selectConfigVo"/>
  34. <include refid="sqlwhereSearch"/>
  35. </select>
  36. <select id="selectConfigList" parameterType="com.juxiao.xchat.module.system.domain.Config" resultMap="ConfigResult">
  37. <include refid="selectConfigVo"/>
  38. <where>
  39. <if test="configName != null and configName != ''">
  40. AND config_name like 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('%', #{configKey}, '%')
  47. </if>
  48. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  49. and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  50. </if>
  51. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  52. and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  53. </if>
  54. </where>
  55. </select>
  56. <select id="checkConfigKeyUnique" parameterType="java.lang.String" resultMap="ConfigResult">
  57. <include refid="selectConfigVo"/>
  58. where config_key = #{configKey}
  59. </select>
  60. <insert id="insertConfig" parameterType="com.juxiao.xchat.module.system.domain.Config">
  61. insert into sys_config (
  62. <if test="configName != null and configName != '' ">config_name,</if>
  63. <if test="configKey != null and configKey != '' ">config_key,</if>
  64. <if test="configValue != null and configValue != '' ">config_value,</if>
  65. <if test="configType != null and configType != '' ">config_type,</if>
  66. <if test="createBy != null and createBy != ''">create_by,</if>
  67. <if test="remark != null and remark != ''">remark,</if>
  68. create_time
  69. )values(
  70. <if test="configName != null and configName != ''">#{configName},</if>
  71. <if test="configKey != null and configKey != ''">#{configKey},</if>
  72. <if test="configValue != null and configValue != ''">#{configValue},</if>
  73. <if test="configType != null and configType != ''">#{configType},</if>
  74. <if test="createBy != null and createBy != ''">#{createBy},</if>
  75. <if test="remark != null and remark != ''">#{remark},</if>
  76. sysdate()
  77. )
  78. </insert>
  79. <update id="updateConfig" parameterType="com.juxiao.xchat.module.system.domain.Config">
  80. update sys_config
  81. <set>
  82. <if test="configName != null and configName != ''">config_name = #{configName},</if>
  83. <if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
  84. <if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
  85. <if test="configType != null and configType != ''">config_type = #{configType},</if>
  86. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  87. <if test="remark != null">remark = #{remark},</if>
  88. update_time = sysdate()
  89. </set>
  90. where config_id = #{configId}
  91. </update>
  92. <delete id="deleteConfigByIds" parameterType="java.lang.String">
  93. delete from sys_config where config_id in
  94. <foreach item="configId" collection="array" open="(" separator="," close=")">
  95. #{configId}
  96. </foreach>
  97. </delete>
  98. </mapper>