| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="cn.com.goldenwater.dcproj.dao.TacSlbLawContentDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.TacSlbLawContent" id="tacSlbLawContentResultMap">
- <result property="id" column="ID"/>
- <result property="chapters" column="CHAPTERS"/>
- <result property="content" column="CONTENT"/>
- <result property="indexId" column="INDEX_ID"/>
- <result property="sort" column="SORT"/>
- <result property="sort2" column="SORT2"/>
- </resultMap>
-
- <sql id="table_columns">
- ID,
- CHAPTERS,
- CONTENT,
- INDEX_ID,SORT,SORT2
- </sql>
- <sql id="entity_properties">
- #{id},
- #{chapters},
- #{content},
- #{indexId},#{sort},#{sort2}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="chapters != null and chapters != ''">and CHAPTERS = #{chapters}</if>
- <if test="content != null and content != ''">and CONTENT = #{content}</if>
- <if test="indexId != null and indexId != ''">and INDEX_ID = #{indexId}</if>
- <if test="sort != null and sort != ''">and SORT = #{sort}</if>
- <if test="sort2 != null and sort2 != ''">and SORT2 = #{sort2}</if>
- </trim>
- </sql>
- <select id="get" resultMap="tacSlbLawContentResultMap" parameterType="String" >
- select <include refid="table_columns" /> from TAC_SLB_LAW_content where ID = #{id}
- </select>
- <select id="getBy" resultMap="tacSlbLawContentResultMap">
- select <include refid="table_columns" /> from TAC_SLB_LAW_content <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="tacSlbLawContentResultMap">
- select <include refid="table_columns" /> from TAC_SLB_LAW_content
- </select>
- <select id="findChapters" resultMap="tacSlbLawContentResultMap">
- select distinct CHAPTERS,sort,index_id from TAC_SLB_LAW_content X where 1=1
- <if test="indexId != null and indexId != ''">and INDEX_ID = #{indexId}</if>
- order by sort asc
- </select>
- <select id="findList" resultMap="tacSlbLawContentResultMap">
- select <include refid="table_columns" /> from TAC_SLB_LAW_content <include refid="page_where" />
- order by sort asc,sort2 asc
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from TAC_SLB_LAW_content <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawContent">
- insert into TAC_SLB_LAW_content( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from TAC_SLB_LAW_content where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawContent">
- delete from TAC_SLB_LAW_content <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update TAC_SLB_LAW_content set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawContent">
- update TAC_SLB_LAW_content
- <trim prefix="set" suffixOverrides=",">
- <if test="chapters != null and chapters != ''">CHAPTERS = #{chapters},</if>
- <if test="content != null and content != ''">CONTENT = #{content},</if>
- <if test="indexId != null and indexId != ''">INDEX_ID = #{indexId},</if>
- <if test="sort != null and sort != ''">SORT = #{sort},</if>
- <if test="sort2 != null and sort2 != ''">SORT2 = #{sort2},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawContent">
- update TAC_SLB_LAW_content
- <trim prefix="set" suffixOverrides=",">
- <if test="chapters != null and chapters != ''">CHAPTERS = #{chapters},</if>
- <if test="content != null and content != ''">CONTENT = #{content},</if>
- <if test="indexId != null and indexId != ''">INDEX_ID = #{indexId},</if>
- <if test="sort != null and sort != ''">SORT = #{sort},</if>
- <if test="sort2 != null and sort2 != ''">SORT2 = #{sort2},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- </mapper>
|