HelpCenterCatalogMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.keao.edu.cms.dal.dao.HelpCenterCatalogDao">
  4. <resultMap id="HelpCenterCatalog" type="com.keao.edu.cms.dal.entity.HelpCenterCatalog">
  5. <id column="id_" property="id" jdbcType="INTEGER" />
  6. <result column="parent_id_" property="parentId" jdbcType="INTEGER" />
  7. <result column="name_" property="text" jdbcType="VARCHAR" />
  8. <result column="description_" property="description" jdbcType="VARCHAR" />
  9. <result column="create_on_" property="createOn" jdbcType="TIMESTAMP" />
  10. <result column="modify_on_" property="modifyOn" jdbcType="TIMESTAMP" />
  11. <result column="order_" property="order" jdbcType="INTEGER" />
  12. <result column="status_" property="status" jdbcType="INTEGER" />
  13. </resultMap>
  14. <sql id="Base_Column_List">
  15. id_, parent_id_, name_, description_, create_on_, modify_on_, order_,status_
  16. </sql>
  17. <select id="get" resultMap="HelpCenterCatalog" parameterType="java.lang.Integer">
  18. select
  19. <include refid="Base_Column_List" />
  20. from help_center_catalog
  21. where id_ = #{id,jdbcType=INTEGER}
  22. </select>
  23. <select id="queryPage" parameterType="map" resultMap="HelpCenterCatalog">
  24. select
  25. <include refid="Base_Column_List" />
  26. from
  27. help_center_catalog
  28. order by order_ asc
  29. </select>
  30. <select id="queryByParentId" parameterType="map" resultMap="HelpCenterCatalog">
  31. select
  32. <include refid="Base_Column_List" />
  33. from
  34. help_center_catalog
  35. where 1 = 1
  36. <if test="parentId != null">
  37. and parent_id_= #{parentId,jdbcType=INTEGER}
  38. </if>
  39. <if test="status != null">
  40. and status_ = #{status,jdbcType=INTEGER}
  41. </if>
  42. order by order_ desc
  43. </select>
  44. <delete id="delete" parameterType="java.lang.Integer">
  45. delete from help_center_catalog
  46. where id_ = #{id,jdbcType=INTEGER}
  47. </delete>
  48. <delete id="batchDelete" parameterType="String">
  49. delete from help_center_catalog
  50. where id_ in #{ids}
  51. </delete>
  52. <insert id="insert" parameterType="com.keao.edu.cms.dal.entity.HelpCenterCatalog">
  53. insert into help_center_catalog (id_, parent_id_, name_,
  54. description_, create_on_, modify_on_,
  55. order_,status_)
  56. values (#{id,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER},
  57. #{text,jdbcType=VARCHAR},
  58. #{description,jdbcType=VARCHAR}, #{createOn,jdbcType=TIMESTAMP}, #{modifyOn,jdbcType=TIMESTAMP},
  59. #{order,jdbcType=INTEGER},#{status,jdbcType=INTEGER})
  60. </insert>
  61. <update id="update" parameterType="com.keao.edu.cms.dal.entity.HelpCenterCatalog">
  62. update help_center_catalog
  63. <set>
  64. <if test="parentId != null">
  65. parent_id_ = #{parentId,jdbcType=INTEGER},
  66. </if>
  67. <if test="text != null">
  68. name_ = #{text,jdbcType=VARCHAR},
  69. </if>
  70. <if test="description != null">
  71. description_ = #{description,jdbcType=VARCHAR},
  72. </if>
  73. <if test="createOn != null">
  74. create_on_ = #{createOn,jdbcType=TIMESTAMP},
  75. </if>
  76. <if test="modifyOn != null">
  77. modify_on_ = #{modifyOn,jdbcType=TIMESTAMP},
  78. </if>
  79. <if test="order != null">
  80. order_ = #{order,jdbcType=INTEGER},
  81. </if>
  82. <if test="status != null">
  83. status_ = #{status,jdbcType=INTEGER},
  84. </if>
  85. </set>
  86. where id_ = #{id,jdbcType=INTEGER}
  87. </update>
  88. </mapper>