SysConfigMapper.xml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.yonge.cooleshow.auth.dal.dao.SysConfigDao">
  4. <resultMap type="com.yonge.cooleshow.auth.api.entity.SysConfig" id="SysConfig">
  5. <result column="id_" property="id" />
  6. <result column="param_name_" property="paramName" />
  7. <result column="param_value_" property="paramValue" />
  8. <result column="description_" property="description" />
  9. <result column="create_on_" property="createOn" />
  10. <result column="modify_on_" property="modifyOn" />
  11. <result column="group_" property="group" />
  12. <result column="modify_by_" property="modifyBy" />
  13. </resultMap>
  14. <!-- 根据主键查询一条记录 -->
  15. <select id="get" resultMap="SysConfig">
  16. SELECT * FROM sys_config WHERE id_ = #{id}
  17. </select>
  18. <!-- 全查询 -->
  19. <select id="findAll" resultMap="SysConfig">
  20. SELECT * FROM sys_config where 1=1
  21. <if test="group != null">
  22. and group_ = #{group}
  23. </if>
  24. ORDER BY id_
  25. </select>
  26. <!-- 向数据库增加一条记录 -->
  27. <insert id="insert" parameterType="com.yonge.cooleshow.auth.api.entity.SysConfig"
  28. useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  29. <!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
  30. AS ID FROM DUAL </selectKey> -->
  31. INSERT INTO sys_config
  32. (id_,param_name_,param_value_,description_,create_on_,modify_on_,group_,modify_by_)
  33. VALUES(#{id},#{paramName},#{paramValue},#{description},#{createOn},#{modifyOn},#{group},#{modifyBy})
  34. </insert>
  35. <!-- 根据主键查询一条记录 -->
  36. <update id="update" parameterType="com.yonge.cooleshow.auth.api.entity.SysConfig">
  37. UPDATE sys_config
  38. <set>
  39. <if test="modifyOn != null">
  40. modify_on_ = #{modifyOn},
  41. </if>
  42. <if test="paramValue != null">
  43. param_value_ = #{paramValue},
  44. </if>
  45. <if test="description != null">
  46. description_ = #{description},
  47. </if>
  48. <if test="paramName != null">
  49. param_name_ = #{paramName},
  50. </if>
  51. <if test="group != null">
  52. group_ = #{group},
  53. </if>
  54. <if test="modifyBy != null">
  55. modify_by_ = #{modifyBy},
  56. </if>
  57. </set>
  58. WHERE id_ = #{id}
  59. </update>
  60. <!-- 根据主键删除一条记录 -->
  61. <delete id="delete">
  62. DELETE FROM sys_config WHERE id_ = #{id}
  63. </delete>
  64. <!-- 分页查询 -->
  65. <select id="queryPage" resultMap="SysConfig" parameterType="map">
  66. SELECT * FROM sys_config ORDER BY id_
  67. <include refid="global.limit" />
  68. </select>
  69. <!-- 查询当前表的总记录数 -->
  70. <select id="queryCount" resultType="int">
  71. SELECT COUNT(*) FROM sys_config
  72. </select>
  73. <select id="findByParamName" resultMap="SysConfig">
  74. SELECT * FROM sys_config WHERE param_name_ = #{paramName}
  75. </select>
  76. <select id="findConfigValue" resultType="java.lang.String">
  77. SELECT param_value_ FROM sys_config WHERE param_name_ = #{paramName}
  78. </select>
  79. </mapper>