AttMampuInfoDao.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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.AttMampuInfoDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttMampuInfo" id="attMampuInfoResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="nm" column="NM"/>
  7. <result property="pid" column="PID"/>
  8. <result property="lev" column="LEV"/>
  9. <result property="ord" column="ORD"/>
  10. <result property="regId" column="REG_ID"/>
  11. <result property="persId" column="PERS_ID"/>
  12. <result property="intm" jdbcType="TIMESTAMP" column="INTM"/>
  13. <result property="uptm" jdbcType="TIMESTAMP" column="UPTM"/>
  14. </resultMap>
  15. <sql id="table_columns">
  16. ID,
  17. NM,
  18. PID,
  19. LEV,
  20. ORD,
  21. REG_ID,
  22. PERS_ID,
  23. INTM,
  24. UPTM
  25. </sql>
  26. <sql id="entity_properties">
  27. #{id},
  28. #{nm},
  29. #{pid},
  30. #{lev},
  31. #{ord},
  32. #{regId},
  33. #{persId},
  34. #{intm},
  35. #{uptm}
  36. </sql>
  37. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  38. <sql id="page_where">
  39. <trim prefix="where" prefixOverrides="and | or ">
  40. <if test="nm != null and nm != ''">and NM = #{nm}</if>
  41. <if test="pid != null and pid != ''">and PID = #{pid}</if>
  42. <if test="lev != null and lev != ''">and LEV = #{lev}</if>
  43. <if test="ord != null and ord != ''">and ORD = #{ord}</if>
  44. <if test="regId != null and regId != ''">and REG_ID = #{regId}</if>
  45. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  46. <if test="intm != null">and INTM = #{intm}</if>
  47. <if test="uptm != null">and UPTM = #{uptm}</if>
  48. </trim>
  49. </sql>
  50. <select id="get" resultMap="attMampuInfoResultMap" parameterType="String">
  51. select
  52. <include refid="table_columns"/>
  53. from ATT_MAMPU_INFO where ID = #{id}
  54. </select>
  55. <select id="getBy" resultMap="attMampuInfoResultMap">
  56. select
  57. <include refid="table_columns"/>
  58. from ATT_MAMPU_INFO
  59. <include refid="page_where"/>
  60. </select>
  61. <select id="findAll" resultMap="attMampuInfoResultMap">
  62. select
  63. <include refid="table_columns"/>
  64. from ATT_MAMPU_INFO
  65. </select>
  66. <select id="findList" resultMap="attMampuInfoResultMap">
  67. select
  68. <include refid="table_columns"/>
  69. from ATT_MAMPU_INFO
  70. <include refid="page_where"/>
  71. </select>
  72. <select id="findByList" resultMap="attMampuInfoResultMap">
  73. select A.*,B.NM PIDNAME from ATT_MAMPU_INFO A LEFT JOIN ATT_MAMPU_INFO B ON A.PID=B.ID where 1=1
  74. <if test="nm != null and nm != ''">and A.NM = #{nm}</if>
  75. <if test="pid != null and pid != ''">and A.PID = #{pid}</if>
  76. <if test="lev != null and lev != ''">and A.LEV = #{lev}</if>
  77. <if test="regId != null and regId != ''">and A.REG_ID = #{regId}</if>
  78. order by a.intm,a.id
  79. </select>
  80. <select id="selectCount" resultType="int">
  81. select count(ID) from ATT_MAMPU_INFO
  82. <include refid="page_where"/>
  83. </select>
  84. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttMampuInfo">
  85. insert into ATT_MAMPU_INFO(
  86. <include refid="table_columns"/>
  87. )
  88. values (
  89. <include refid="entity_properties"/>
  90. )
  91. </insert>
  92. <delete id="delete" parameterType="java.lang.String">
  93. delete from ATT_MAMPU_INFO where ID = #{id}
  94. </delete>
  95. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttMampuInfo">
  96. delete from ATT_MAMPU_INFO
  97. <include refid="page_where"/>
  98. </delete>
  99. <update id="deleteInFlag" parameterType="java.lang.String">
  100. update ATT_MAMPU_INFO set flag_valid = 0 where ID = #{id}
  101. </update>
  102. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttMampuInfo">
  103. update ATT_MAMPU_INFO
  104. <trim prefix="set" suffixOverrides=",">
  105. <if test="nm != null and nm != ''">NM = #{nm},</if>
  106. <if test="pid != null and pid != ''">PID = #{pid},</if>
  107. <if test="lev != null and lev != ''">LEV = #{lev},</if>
  108. <if test="ord != null and ord != ''">ORD = #{ord},</if>
  109. <if test="regId != null and regId != ''">REG_ID = #{regId},</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. </trim>
  114. <where>ID = #{id}</where>
  115. </update>
  116. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttMampuInfo">
  117. update ATT_MAMPU_INFO
  118. <trim prefix="set" suffixOverrides=",">
  119. <if test="nm != null and nm != ''">NM = #{nm},</if>
  120. <if test="pid != null and pid != ''">PID = #{pid},</if>
  121. <if test="lev != null and lev != ''">LEV = #{lev},</if>
  122. <if test="ord != null and ord != ''">ORD = #{ord},</if>
  123. <if test="regId != null and regId != ''">REG_ID = #{regId},</if>
  124. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  125. <if test="intm != null">INTM = #{intm},</if>
  126. <if test="uptm != null">UPTM = #{uptm},</if>
  127. </trim>
  128. <include refid="page_where"/>
  129. </update>
  130. <!-- 其他自定义SQL -->
  131. <!--根据登记表id删除-->
  132. <delete id="deleteByRegId" parameterType="String">
  133. delete from ATT_MAMPU_INFO where reg_Id = #{id}
  134. </delete>
  135. <select id="getAttMampus" resultMap="attMampuInfoResultMap">
  136. select
  137. <include refid="table_columns"/>
  138. from ATT_MAMPU_INFO a where 1 = 1
  139. <if test="regId != null and regId != ''">
  140. and a.reg_id in (${regId})
  141. </if>
  142. <if test="lev != null and lev != ''">
  143. and a.lev = #{lev}
  144. </if>
  145. </select>
  146. </mapper>