SettingMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.zhyc.xps.common.mapper.SettingMapper">
  4. <resultMap id="BaseResultMap" type="com.zhyc.xps.common.entity.Setting">
  5. <result column="setting_id" property="settingId" jdbcType="BIGINT" />
  6. <result column="setting_title" property="settingTitle" jdbcType="VARCHAR"/>
  7. <result column="setting_key" property="settingKey" jdbcType="VARCHAR"/>
  8. <result column="setting_value" property="settingValue" jdbcType="VARCHAR"/>
  9. <result column="setting_desc" property="settingDesc" jdbcType="VARCHAR"/>
  10. </resultMap>
  11. <sql id="Base_Column_List">
  12. setting_id,
  13. setting_title,
  14. setting_key,
  15. setting_value,
  16. setting_desc
  17. </sql>
  18. <!--基于ID查询-->
  19. <select id="getById" resultMap="BaseResultMap">
  20. SELECT
  21. <include refid="Base_Column_List"/>
  22. FROM setting
  23. WHERE 1 = 1
  24. <if test="settingId != null">
  25. AND setting_id = #{settingId ,jdbcType=BIGINT}
  26. </if>
  27. </select>
  28. <!--基于Key查询-->
  29. <select id="getByKey" resultMap="BaseResultMap">
  30. SELECT
  31. <include refid="Base_Column_List"/>
  32. FROM setting
  33. WHERE 1 = 1
  34. <if test="settingKey != null and settingKey !=''">
  35. AND setting_key = #{settingKey ,jdbcType=VARCHAR}
  36. </if>
  37. </select>
  38. <!--查询列表-->
  39. <select id="getByList" resultMap="BaseResultMap" parameterType="java.util.Map">
  40. SELECT
  41. <include refid="Base_Column_List"/>
  42. FROM setting
  43. WHERE 1 = 1
  44. <if test="keywords != null and keywords != ''">
  45. and setting_title like "%"#{keywords}"%"
  46. </if>
  47. </select>
  48. <!--分页查询-->
  49. <select id="getByPage" resultMap="BaseResultMap" parameterType="java.util.Map">
  50. SELECT
  51. <include refid="Base_Column_List"/>
  52. FROM setting
  53. WHERE 1 = 1
  54. <if test="keywords != null and keywords != ''">
  55. and setting_title like "%"#{keywords}"%"
  56. </if>
  57. </select>
  58. <!--新增-->
  59. <insert id="create" parameterType="com.zhyc.xps.common.entity.Setting">
  60. INSERT INTO setting
  61. <trim prefix="(" suffix=")" suffixOverrides=",">
  62. <if test="settingId != null">
  63. setting_id,
  64. </if>
  65. <if test="settingTitle != null and settingTitle !=''">
  66. setting_title,
  67. </if>
  68. <if test="settingKey != null and settingKey !=''">
  69. setting_key,
  70. </if>
  71. <if test="settingValue != null and settingValue !=''">
  72. setting_value,
  73. </if>
  74. <if test="settingDesc != null and settingDesc !=''">
  75. setting_desc,
  76. </if>
  77. </trim>
  78. <trim prefix="values (" suffix=")" suffixOverrides=",">
  79. <if test="settingId != null and settingId !=''">
  80. #{settingId ,jdbcType=BIGINT},
  81. </if>
  82. <if test="settingTitle != null and settingTitle !=''">
  83. #{settingTitle ,jdbcType=VARCHAR},
  84. </if>
  85. <if test="settingKey != null and settingKey !=''">
  86. #{settingKey ,jdbcType=VARCHAR},
  87. </if>
  88. <if test="settingValue != null and settingValue !=''">
  89. #{settingValue ,jdbcType=VARCHAR},
  90. </if>
  91. <if test="settingDesc != null and settingDesc !=''">
  92. #{settingDesc ,jdbcType=VARCHAR},
  93. </if>
  94. </trim>
  95. </insert>
  96. <!--更新-->
  97. <update id="update" parameterType="com.zhyc.xps.common.entity.Setting">
  98. UPDATE setting
  99. <trim suffixOverrides=",">
  100. <set>
  101. <if test="settingTitle != null and settingTitle != ''">
  102. setting_title = #{settingTitle, jdbcType=VARCHAR},
  103. </if>
  104. <if test="settingKey != null and settingKey !=''">
  105. setting_key = #{settingKey ,jdbcType=VARCHAR},
  106. </if>
  107. <if test="settingValue != null and settingValue !=''">
  108. setting_value = #{settingValue ,jdbcType=VARCHAR},
  109. </if>
  110. <if test="settingDesc != null and settingDesc != ''">
  111. setting_desc = #{settingDesc, jdbcType=VARCHAR},
  112. </if>
  113. </set>
  114. </trim>
  115. WHERE 1 = 1
  116. <if test="settingId != null">
  117. AND setting_id = #{settingId ,jdbcType=BIGINT}
  118. </if>
  119. </update>
  120. <!--删除-->
  121. <update id="delete" parameterType="java.util.Map">
  122. delete FROM setting
  123. WHERE 1 = 1
  124. <if test="settingId != null">
  125. AND setting_id = #{settingId ,jdbcType=BIGINT}
  126. </if>
  127. </update>
  128. </mapper>