TacSlbLawContentDao.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.TacSlbLawContentDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacSlbLawContent" id="tacSlbLawContentResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="chapters" column="CHAPTERS"/>
  7. <result property="content" column="CONTENT"/>
  8. <result property="indexId" column="INDEX_ID"/>
  9. <result property="sort" column="SORT"/>
  10. <result property="sort2" column="SORT2"/>
  11. </resultMap>
  12. <sql id="table_columns">
  13. ID,
  14. CHAPTERS,
  15. CONTENT,
  16. INDEX_ID,SORT,SORT2
  17. </sql>
  18. <sql id="entity_properties">
  19. #{id},
  20. #{chapters},
  21. #{content},
  22. #{indexId},#{sort},#{sort2}
  23. </sql>
  24. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  25. <sql id="page_where">
  26. <trim prefix="where" prefixOverrides="and | or ">
  27. <if test="chapters != null and chapters != ''">and CHAPTERS = #{chapters}</if>
  28. <if test="content != null and content != ''">and CONTENT = #{content}</if>
  29. <if test="indexId != null and indexId != ''">and INDEX_ID = #{indexId}</if>
  30. <if test="sort != null and sort != ''">and SORT = #{sort}</if>
  31. <if test="sort2 != null and sort2 != ''">and SORT2 = #{sort2}</if>
  32. </trim>
  33. </sql>
  34. <select id="get" resultMap="tacSlbLawContentResultMap" parameterType="String" >
  35. select <include refid="table_columns" /> from TAC_SLB_LAW_content where ID = #{id}
  36. </select>
  37. <select id="getBy" resultMap="tacSlbLawContentResultMap">
  38. select <include refid="table_columns" /> from TAC_SLB_LAW_content <include refid="page_where" />
  39. </select>
  40. <select id="findAll" resultMap="tacSlbLawContentResultMap">
  41. select <include refid="table_columns" /> from TAC_SLB_LAW_content
  42. </select>
  43. <select id="findChapters" resultMap="tacSlbLawContentResultMap">
  44. select distinct CHAPTERS,sort,index_id from TAC_SLB_LAW_content X where 1=1
  45. <if test="indexId != null and indexId != ''">and INDEX_ID = #{indexId}</if>
  46. order by sort asc
  47. </select>
  48. <select id="findList" resultMap="tacSlbLawContentResultMap">
  49. select <include refid="table_columns" /> from TAC_SLB_LAW_content <include refid="page_where" />
  50. order by sort asc,sort2 asc
  51. </select>
  52. <select id="selectCount" resultType="int" >
  53. select count(ID) from TAC_SLB_LAW_content <include refid="page_where" />
  54. </select>
  55. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawContent">
  56. insert into TAC_SLB_LAW_content( <include refid="table_columns" /> )
  57. values ( <include refid="entity_properties" /> )
  58. </insert>
  59. <delete id="delete" parameterType="java.lang.String">
  60. delete from TAC_SLB_LAW_content where ID = #{id}
  61. </delete>
  62. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawContent">
  63. delete from TAC_SLB_LAW_content <include refid="page_where" />
  64. </delete>
  65. <update id="deleteInFlag" parameterType="java.lang.String">
  66. update TAC_SLB_LAW_content set flag_valid = 0 where ID = #{id}
  67. </update>
  68. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawContent">
  69. update TAC_SLB_LAW_content
  70. <trim prefix="set" suffixOverrides=",">
  71. <if test="chapters != null and chapters != ''">CHAPTERS = #{chapters},</if>
  72. <if test="content != null and content != ''">CONTENT = #{content},</if>
  73. <if test="indexId != null and indexId != ''">INDEX_ID = #{indexId},</if>
  74. <if test="sort != null and sort != ''">SORT = #{sort},</if>
  75. <if test="sort2 != null and sort2 != ''">SORT2 = #{sort2},</if>
  76. </trim>
  77. <where>ID = #{id}</where>
  78. </update>
  79. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawContent">
  80. update TAC_SLB_LAW_content
  81. <trim prefix="set" suffixOverrides=",">
  82. <if test="chapters != null and chapters != ''">CHAPTERS = #{chapters},</if>
  83. <if test="content != null and content != ''">CONTENT = #{content},</if>
  84. <if test="indexId != null and indexId != ''">INDEX_ID = #{indexId},</if>
  85. <if test="sort != null and sort != ''">SORT = #{sort},</if>
  86. <if test="sort2 != null and sort2 != ''">SORT2 = #{sort2},</if>
  87. </trim>
  88. <include refid="page_where" />
  89. </update>
  90. <!-- 其他自定义SQL -->
  91. </mapper>