FolderDao.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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="cn.com.goldenwater.dcproj.dao.FolderDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.Folder" id="folderResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="pid" column="PID"/>
  7. <result property="nm" column="NM"/>
  8. <result property="orgId" column="ORG_ID"/>
  9. <result property="persId" column="PERS_ID"/>
  10. <result property="intm" column="INTM"/>
  11. <result property="uptm" column="UPTM"/>
  12. <result property="dataStat" column="DATA_STAT"/>
  13. </resultMap>
  14. <sql id="table_columns">
  15. ID,
  16. PID,
  17. NM,
  18. ORG_ID,
  19. PERS_ID,
  20. INTM,
  21. UPTM,
  22. DATA_STAT
  23. </sql>
  24. <sql id="entity_properties">
  25. #{id},
  26. #{pid},
  27. #{nm},
  28. #{orgId},
  29. #{persId},
  30. #{intm},
  31. #{uptm},
  32. #{dataStat}
  33. </sql>
  34. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  35. <sql id="page_where">
  36. <trim prefix="where" prefixOverrides="and | or ">
  37. <if test="pid != null and pid != ''">and PID = #{pid}</if>
  38. <if test="nm != null and nm != ''">and NM = #{nm}</if>
  39. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  40. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  41. <if test="intm != null">and INTM = #{intm}</if>
  42. <if test="uptm != null">and UPTM = #{uptm}</if>
  43. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  44. and DATA_STAT='0'
  45. </trim>
  46. </sql>
  47. <select id="get" resultMap="folderResultMap" parameterType="String">
  48. select
  49. <include refid="table_columns"/>
  50. from GW_COM_FOLDER where ID = #{id}
  51. </select>
  52. <select id="getBy" resultMap="folderResultMap">
  53. select
  54. <include refid="table_columns"/>
  55. from GW_COM_FOLDER
  56. <include refid="page_where"/>
  57. </select>
  58. <select id="findAll" resultMap="folderResultMap">
  59. select
  60. <include refid="table_columns"/>
  61. from GW_COM_FOLDER
  62. </select>
  63. <select id="findList" resultMap="folderResultMap">
  64. select
  65. <include refid="table_columns"/>
  66. from GW_COM_FOLDER
  67. <include refid="page_where"/>
  68. </select>
  69. <select id="selectCount" resultType="int">
  70. select count(ID) from GW_COM_FOLDER
  71. <include refid="page_where"/>
  72. </select>
  73. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.Folder">
  74. insert into GW_COM_FOLDER(
  75. <include refid="table_columns"/>
  76. )
  77. values (
  78. <include refid="entity_properties"/>
  79. )
  80. </insert>
  81. <delete id="delete" parameterType="java.lang.String">
  82. update GW_COM_FOLDER set DATA_STAT='9' where ID = #{id}
  83. </delete>
  84. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.Folder">
  85. update GW_COM_FOLDER set DATA_STAT='9'
  86. <include refid="page_where"/>
  87. </delete>
  88. <update id="deleteInFlag" parameterType="java.lang.String">
  89. update GW_COM_FOLDER set DATA_STAT = '9' where ID = #{id}
  90. </update>
  91. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.Folder">
  92. update GW_COM_FOLDER
  93. <trim prefix="set" suffixOverrides=",">
  94. <if test="pid != null and pid != ''">PID = #{pid},</if>
  95. <if test="nm != null and nm != ''">NM = #{nm},</if>
  96. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  97. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  98. <if test="intm != null">INTM = #{intm},</if>
  99. <if test="uptm != null">UPTM = #{uptm},</if>
  100. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  101. </trim>
  102. <where>ID = #{id}</where>
  103. </update>
  104. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.Folder">
  105. update GW_COM_FOLDER
  106. <trim prefix="set" suffixOverrides=",">
  107. <if test="pid != null and pid != ''">PID = #{pid},</if>
  108. <if test="nm != null and nm != ''">NM = #{nm},</if>
  109. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  110. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  111. <if test="intm != null">INTM = #{intm},</if>
  112. <if test="uptm != null">UPTM = #{uptm},</if>
  113. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  114. </trim>
  115. <include refid="page_where"/>
  116. </update>
  117. <!-- 其他自定义SQL -->
  118. <select id="getNextNode" resultType="cn.com.goldenwater.dcproj.model.Folder">
  119. select
  120. <include refid="table_columns"/>
  121. from GW_COM_FOLDER where pid=#{id} and org_id=#{orgId} and data_stat='0'
  122. </select>
  123. </mapper>