CompetenceMapper.xml
3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?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 >= #{original}
</if>
<if test="mark==2">
and indexNum > #{original} and indexNum <= #{ne}
</if>
<if test="mark==3">
and indexNum < #{original} and indexNum >= #{ne}
</if>
<if test="mark==4">
and indexNum > #{original}
</if>
and id != #{cId} AND enabled=1
</select>
</mapper>