CompetenceMapper.xml 3.08 KB
<?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="com.bjivt.entity.showtime.Competence">

  <select id="getCompetenceByParentId"  resultType="com.bjivt.entity.showtime.Competence" >
    select * from tbl_competence  where parentId= #{parentId}  AND enabled=1 order by indexNum asc
  </select>
   <select id="findCompetence"  parameterType="com.bjivt.entity.showtime.Competence"  resultType="com.bjivt.entity.showtime.Competence" >
      select * from tbl_competence 
      <trim prefix="where" prefixOverrides="and |or">  
       <if test="parentId != null">  
           parentId = #{parentId}  
       </if>  
       <if test="type != null">  
           and type = #{type}  
       </if>  
        <if test="url != null">  
            and url like "%"#{url}"%"  
        </if>
          AND enabled=1
    </trim>
      order by indexNum asc
  </select>
    <select id="findCompetenceByIds"  resultType="com.bjivt.entity.showtime.Competence">
    select * from tbl_competence  where 1=1  AND enabled=1
        <foreach item="id" index="index" collection="list" open=" and id in (" separator="," close=")">  
            #{id}  
        </foreach>  
  </select>
   <select id="getCompetence"  resultType="com.bjivt.entity.showtime.Competence" >
    select * from tbl_competence  where id= #{id}  AND enabled=1
  </select>
  <select id="getParentCompetence"  resultType="com.bjivt.entity.showtime.Competence" >
    select * from tbl_competence where parentId= #{id}  AND enabled=1
  </select>
  <insert id="insertCompetence" parameterType="com.bjivt.entity.showtime.Competence" useGeneratedKeys="true"  keyProperty="id">      
	insert into tbl_competence   
	( name, type, url,parentId, indexNum,createDate,createTime,operatorId,systemTag,validataLevel)   
	values   
	( #{name}, #{type}, #{url}, #{parentId},#{indexNum}, #{createDate}, #{createTime}, #{operatorId}, #{systemTag}, #{validataLevel})   
 </insert> 
   <update id="updateCompetence" parameterType="com.bjivt.entity.showtime.Competence">      
	update tbl_competence set   
        name = #{name}, type = #{type}, url = #{url},parentId = #{parentId}, indexNum = #{indexNum},operatorId = #{operatorId},systemTag = #{systemTag},validataLevel = #{validataLevel}
	where id =  #{id} 
 </update>
 <delete id="deleteCompetence" parameterType="java.lang.Integer">
    delete from tbl_competence where id = #{competenceId}
 </delete> 
   <!-- 通过父节点及序号得到对应当前节点集合 -->  
  <select id="getCompetencesByMap"  parameterType="java.util.Map" resultType="com.bjivt.entity.showtime.Competence" >
    select * from tbl_competence  where parentId= #{parentId} 
    <if test="mark==1">
    	and indexNum &gt;= #{original}
    </if>
    <if test="mark==2">
    	and indexNum &gt; #{original} and indexNum &lt;= #{ne} 
    </if>
    <if test="mark==3">
    	and indexNum &lt; #{original} and indexNum &gt;= #{ne} 
    </if>
    <if test="mark==4">
    	and indexNum &gt; #{original} 
    </if>
    and id != #{cId}  AND enabled=1
  </select>  
</mapper>