BisInspSwhsPblmDao.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.BisInspSwhsPblmDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspSwhsPblm" id="bisInspSwhsPblmResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="swhsId" column="SWHS_ID"/>
  7. <result property="swhsCode" column="SWHS_CODE"/>
  8. <result property="pblmDesc" column="PBLM_DESC"/>
  9. <result property="isRect" column="IS_RECT"/>
  10. <result property="inTm" column="IN_TM"/>
  11. <result property="upTm" column="UP_TM"/>
  12. </resultMap>
  13. <sql id="table_columns">
  14. ID,
  15. SWHS_ID,
  16. SWHS_CODE,
  17. PBLM_DESC,
  18. IS_RECT,
  19. IN_TM,
  20. UP_TM
  21. </sql>
  22. <sql id="entity_properties">
  23. #{id},
  24. #{swhsId},
  25. #{swhsCode},
  26. #{pblmDesc},
  27. #{isRect},
  28. #{inTm},
  29. #{upTm}
  30. </sql>
  31. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  32. <sql id="page_where">
  33. <trim prefix="where" prefixOverrides="and | or ">
  34. <if test="swhsId != null and swhsId != ''">and SWHS_ID = #{swhsId}</if>
  35. <if test="swhsCode != null and swhsCode != ''">and SWHS_CODE = #{swhsCode}</if>
  36. <if test="pblmDesc != null and pblmDesc != ''">and PBLM_DESC = #{pblmDesc}</if>
  37. <if test="isRect != null and isRect != ''">and IS_RECT = #{isRect}</if>
  38. <if test="inTm != null">and IN_TM = #{inTm}</if>
  39. <if test="upTm != null">and UP_TM = #{upTm}</if>
  40. </trim>
  41. </sql>
  42. <select id="get" resultMap="bisInspSwhsPblmResultMap" parameterType="String" >
  43. select <include refid="table_columns" /> from BIS_INSP_SWHS_PBLM where ID = #{id}
  44. </select>
  45. <select id="getBy" resultMap="bisInspSwhsPblmResultMap">
  46. select <include refid="table_columns" /> from BIS_INSP_SWHS_PBLM <include refid="page_where" />
  47. </select>
  48. <select id="findAll" resultMap="bisInspSwhsPblmResultMap">
  49. select <include refid="table_columns" /> from BIS_INSP_SWHS_PBLM
  50. </select>
  51. <select id="findList" resultMap="bisInspSwhsPblmResultMap">
  52. select <include refid="table_columns" /> from BIS_INSP_SWHS_PBLM <include refid="page_where" />
  53. </select>
  54. <select id="selectCount" resultType="int" >
  55. select count(ID) from BIS_INSP_SWHS_PBLM <include refid="page_where" />
  56. </select>
  57. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsPblm">
  58. insert into BIS_INSP_SWHS_PBLM( <include refid="table_columns" /> )
  59. values ( <include refid="entity_properties" /> )
  60. </insert>
  61. <delete id="delete" parameterType="java.lang.String">
  62. delete from BIS_INSP_SWHS_PBLM where ID = #{id}
  63. </delete>
  64. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsPblm">
  65. delete from BIS_INSP_SWHS_PBLM <include refid="page_where" />
  66. </delete>
  67. <update id="deleteInFlag" parameterType="java.lang.String">
  68. update BIS_INSP_SWHS_PBLM set flag_valid = 0 where ID = #{id}
  69. </update>
  70. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsPblm">
  71. update BIS_INSP_SWHS_PBLM
  72. <trim prefix="set" suffixOverrides=",">
  73. <if test="swhsId != null and swhsId != ''">SWHS_ID = #{swhsId},</if>
  74. <if test="swhsCode != null and swhsCode != ''">SWHS_CODE = #{swhsCode},</if>
  75. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  76. <if test="isRect != null and isRect != ''">IS_RECT = #{isRect},</if>
  77. <if test="inTm != null">IN_TM = #{inTm},</if>
  78. <if test="upTm != null">UP_TM = #{upTm},</if>
  79. </trim>
  80. <where>ID = #{id}</where>
  81. </update>
  82. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsPblm">
  83. update BIS_INSP_SWHS_PBLM
  84. <trim prefix="set" suffixOverrides=",">
  85. <if test="swhsId != null and swhsId != ''">SWHS_ID = #{swhsId},</if>
  86. <if test="swhsCode != null and swhsCode != ''">SWHS_CODE = #{swhsCode},</if>
  87. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  88. <if test="isRect != null and isRect != ''">IS_RECT = #{isRect},</if>
  89. <if test="inTm != null">IN_TM = #{inTm},</if>
  90. <if test="upTm != null">UP_TM = #{upTm},</if>
  91. </trim>
  92. <include refid="page_where" />
  93. </update>
  94. <!-- 其他自定义SQL -->
  95. <update id="updateShwsPblm" parameterType="java.util.List">
  96. <foreach collection="list" index="index" item="item" open="begin" close=";end;" separator=";">
  97. UPDATE BIS_INSP_SWHS_PBLM
  98. <set>
  99. IS_RECT = #{item.isRect}
  100. </set>
  101. <where>
  102. ID = #{item.id}
  103. </where>
  104. </foreach>
  105. </update>
  106. </mapper>