ResourceRespositoryMapper.xml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. <result column="tenant_id_" property="tenantId"/>
  20. </resultMap>
  21. <!-- 全查询 -->
  22. <select id="findAll" resultMap="ResourceRespository">
  23. SELECT * FROM resource_respository where tenant_id_ = #{tenantId}
  24. </select>
  25. <!-- 向数据库增加一条记录 -->
  26. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ResourceRespository" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  27. INSERT INTO resource_respository (id_,name_,url_,order_,subject_id_,level_,parent_id_,del_flag_,create_time_,update_time_,tenant_id_)
  28. VALUES(#{id},#{name},#{url},#{order},#{subjectId},#{level},#{parentId},#{delFlag},now(),now(),#{tenantId})
  29. </insert>
  30. <!-- 分页查询 -->
  31. <select id="queryPage" resultMap="ResourceRespository" parameterType="map">
  32. SELECT * FROM resource_respository
  33. <where>
  34. del_flag_ != 1 and tenant_id_ = #{tenantId}
  35. <if test="search != null">
  36. AND name_ LIKE CONCAT('%',#{search},'%')
  37. </if>
  38. </where>
  39. <include refid="global.limit"/>
  40. </select>
  41. <!-- 查询当前表的总记录数 -->
  42. <select id="queryCount" resultType="int">
  43. SELECT COUNT(id_) FROM resource_respository
  44. <where>
  45. del_flag_ != 1 and tenant_id_ = #{tenantId}
  46. <if test="search != null">
  47. AND name_ LIKE CONCAT('%',#{search},'%')
  48. </if>
  49. </where>
  50. </select>
  51. <select id="findList" resultMap="ResourceRespository">
  52. SELECT * FROM resource_respository
  53. <where>
  54. tenant_id_ = #{tenantId}
  55. <if test="delFlag != null">
  56. AND del_flag_ = #{delFlag}
  57. </if>
  58. <if test="parentId != null">
  59. AND parent_id_ = #{parentId}
  60. </if>
  61. <if test="subjectId != null">
  62. AND (subject_id_ = #{subjectId} OR subject_id_ IS NULL)
  63. </if>
  64. </where>
  65. ORDER BY order_ ASC
  66. </select>
  67. </mapper>