SysConfigMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.simuwang.base.mapper.system.SysConfigMapper">
  6. <resultMap type="com.simuwang.base.pojo.dos.SysConfigDO" 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="creatorId" column="creatorid" />
  13. <result property="createTime" column="createtime" />
  14. <result property="updaterId" column="updaterid" />
  15. <result property="updateTime" column="updatetime" />
  16. <result property="isvalid" column="isvalid" />
  17. </resultMap>
  18. <sql id="selectConfigDo">
  19. select config_id, config_name, config_key, config_value, config_type, creatorid, createtime, updaterid, updatetime, remark,isvalid
  20. from PPW_EMAIL.sys_config
  21. </sql>
  22. <!-- 查询条件 -->
  23. <sql id="sqlwhereSearch">
  24. <where>
  25. isvalid=1
  26. <if test="configId !=null">
  27. and config_id = #{configId}
  28. </if>
  29. <if test="configKey !=null and configKey != ''">
  30. and config_key = #{configKey}
  31. </if>
  32. </where>
  33. </sql>
  34. <select id="selectConfig" parameterType="com.simuwang.base.pojo.dos.SysConfigDO" resultMap="SysConfigResult">
  35. <include refid="selectConfigDo"/>
  36. <include refid="sqlwhereSearch"/>
  37. </select>
  38. <select id="selectConfigList" resultMap="SysConfigResult">
  39. <include refid="selectConfigDo"/>
  40. <where>
  41. isvalid=1
  42. <if test="configName != null and configName != ''">
  43. AND config_name like concat('%', #{configName}, '%')
  44. </if>
  45. <if test="configKey != null and configKey != ''">
  46. AND config_key like concat('%', #{configKey}, '%')
  47. </if>
  48. </where>
  49. limit #{offset},#{pageSize}
  50. </select>
  51. <select id="selectConfigById" parameterType="Long" resultMap="SysConfigResult">
  52. <include refid="selectConfigDo"/>
  53. where config_id = #{configId} and isvalid =1
  54. </select>
  55. <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
  56. <include refid="selectConfigDo"/>
  57. where config_key = #{configKey} and isvalid =1 limit 1
  58. </select>
  59. <select id="selectConfigByKey" resultType="java.lang.String">
  60. </select>
  61. <select id="countConfigList" resultType="java.lang.Long">
  62. select count(1) from PPW_EMAIL.sys_config
  63. <where>
  64. isvalid=1
  65. <if test="configName != null and configName != ''">
  66. AND config_name like concat('%', #{configName}, '%')
  67. </if>
  68. <if test="configKey != null and configKey != ''">
  69. AND config_key like concat('%', #{configKey}, '%')
  70. </if>
  71. </where>
  72. </select>
  73. <insert id="insertConfig" parameterType="com.simuwang.base.pojo.dos.SysConfigDO">
  74. insert into sys_config (
  75. <if test="configName != null and configName != '' ">config_name,</if>
  76. <if test="configKey != null and configKey != '' ">config_key,</if>
  77. <if test="configValue != null and configValue != '' ">config_value,</if>
  78. <if test="configType != null and configType != '' ">config_type,</if>
  79. <if test="creatorId != null and creatorId != ''">creatorid,</if>
  80. <if test="updaterId != null and updaterId != ''">updaterid,</if>
  81. <if test="remark != null and remark != ''">remark,</if>
  82. isvalid,
  83. createtime,
  84. updatetime
  85. )values(
  86. <if test="configName != null and configName != ''">#{configName},</if>
  87. <if test="configKey != null and configKey != ''">#{configKey},</if>
  88. <if test="configValue != null and configValue != ''">#{configValue},</if>
  89. <if test="configType != null and configType != ''">#{configType},</if>
  90. <if test="creatorId != null and creatorId != ''">#{creatorId},</if>
  91. <if test="updaterId != null and updaterId != ''">#{updaterId},</if>
  92. <if test="remark != null and remark != ''">#{remark},</if>
  93. 1,
  94. sysdate(),
  95. sysdate()
  96. )
  97. </insert>
  98. <update id="updateConfig" parameterType="com.simuwang.base.pojo.dos.SysConfigDO">
  99. update sys_config
  100. <set>
  101. <if test="configName != null and configName != ''">config_name = #{configName},</if>
  102. <if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
  103. <if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
  104. <if test="configType != null and configType != ''">config_type = #{configType},</if>
  105. <if test="updaterId != null and updaterId != ''">updaterid = #{updaterId},</if>
  106. <if test="remark != null">remark = #{remark},</if>
  107. updatetime = sysdate()
  108. </set>
  109. where config_id = #{configId} and isvalid=1
  110. </update>
  111. <delete id="deleteConfigById" parameterType="Long">
  112. UPDATE sys_config SET isvalid=0 where config_id = #{configId}
  113. </delete>
  114. <delete id="deleteConfigByIds" parameterType="Long">
  115. UPDATE sys_config SET isvalid=0,updaterid=#{userId} where config_id in
  116. <foreach item="configId" collection="configIds" open="(" separator="," close=")">
  117. #{configId}
  118. </foreach>
  119. </delete>
  120. </mapper>