ResourceRespositoryMapper.xml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. <!--
  4. 这个文件是自动生成的。
  5. 不要修改此文件。所有改动将在下次重新自动生成时丢失。
  6. -->
  7. <mapper namespace="com.ym.mec.biz.dal.dao.ResourceRespositoryDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.ResourceRespository" id="ResourceRespository">
  9. <result column="id_" property="id" />
  10. <result column="name_" property="name" />
  11. <result column="url_" property="url" />
  12. <result column="order_" property="order" />
  13. <result column="subject_id_" property="subjectId" />
  14. <result column="level_" property="level" />
  15. <result column="parent_id_" property="parentId" />
  16. <result column="del_flag_" property="delFlag" />
  17. <result column="create_time_" property="createTime" />
  18. <result column="update_time_" property="updateTime" />
  19. </resultMap>
  20. <!-- 全查询 -->
  21. <select id="findAll" resultMap="ResourceRespository">
  22. SELECT * FROM resource_respository
  23. </select>
  24. <!-- 向数据库增加一条记录 -->
  25. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ResourceRespository" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  26. INSERT INTO resource_respository (id_,name_,url_,order_,subject_id_,level_,parent_id_,del_flag_,create_time_,update_time_)
  27. VALUES(#{id},#{name},#{url},#{order},#{subjectId},#{level},#{parentId},#{delFlag},now(),now())
  28. </insert>
  29. <!-- 分页查询 -->
  30. <select id="queryPage" resultMap="ResourceRespository" parameterType="map">
  31. SELECT * FROM resource_respository
  32. <where>
  33. del_flag_ != 1
  34. <if test="search != null">
  35. AND name_ LIKE CONCAT('%',#{search},'%')
  36. </if>
  37. </where>
  38. <include refid="global.limit"/>
  39. </select>
  40. <!-- 查询当前表的总记录数 -->
  41. <select id="queryCount" resultType="int">
  42. SELECT COUNT(id_) FROM resource_respository
  43. <where>
  44. del_flag_ != 1
  45. <if test="search != null">
  46. AND name_ LIKE CONCAT('%',#{search},'%')
  47. </if>
  48. </where>
  49. </select>
  50. <select id="findList" resultMap="ResourceRespository">
  51. SELECT * FROM resource_respository
  52. <where>
  53. <if test="delFlag != null">
  54. AND del_flag_ = #{delFlag}
  55. </if>
  56. <if test="parentId != null">
  57. AND parent_id_ = #{parentId}
  58. </if>
  59. <if test="subjectId != null">
  60. AND (subject_id_ = #{subjectId} OR subject_id_ IS NULL)
  61. </if>
  62. </where>
  63. ORDER BY order_ ASC
  64. </select>
  65. </mapper>