VarItemMapper.xml
2.95 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
70
71
72
73
74
75
76
77
78
79
<?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.runsa.portal.base.dao.VarItemMapper" >
<resultMap id="BaseResultMap" type="cn.runsa.portal.base.entity.VarItem" >
<id column="vaiId" property="id" />
<result column="vaId" property="vaId" />
<result column="vaiCode" property="code" />
<result column="vaiName" property="name" />
<result column="vaiGroup" property="group" />
<result column="vaiParent" property="parent" />
<result column="vaiSort" property="sort" />
<result column="ptRemark" property="remark" />
<result column="ptRemark1" property="remark1" />
<result column="ptRemark2" property="remark2" />
<result column="ptRemark3" property="remark3" />
<result column="vaiCodeExt" property="codeext" />
</resultMap>
<select id="selectByCode" resultMap="BaseResultMap">
select t1.*
from mtVarItem t1
inner join mtVariable t2 on t1.vaId=t2.vaId and t2.vaCode=#{vaCode}
<if test="platId > 0">
and (t2.vaType=1 or (t2.vaType=2 and t2.vaId in (select vaId from mtVarPlatform where plId = #{platId})))
</if>
order by t1.vaiSort asc
</select>
<select id="selectListByVarId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select * from mtVarItem where vaiId in (6,7) and vaId=#{vaId}
</select>
<insert id="insertList" parameterType="java.util.List">
insert into mtVarItem(vaId,vaiCode,vaiName,vaiGroup,vaiParent
,ptRemark,ptRemark1,ptRemark2,ptRemark3,vaiSort)
values
<foreach collection="list" item="item" separator="," >
(#{item.vaId},#{item.code},#{item.name},#{item.group},#{item.parent},#{item.remark},
#{item.remark1},#{item.remark2},#{item.remark3},#{item.sort})
</foreach>
</insert>
<update id="update" parameterType="cn.runsa.portal.base.entity.VarItem">
update mtVarItem
<set>
vaiCode=#{code},
<if test="name!=null and name!=''">
vaiName=#{name},
</if>
<if test="group!=null and group!=''">
vaiGroup=#{group},
</if>
<if test="parent!=null and parent!=''">
vaiParent=#{parent},
</if>
<if test="sort!=null">
vaiSort=#{sort},
</if>
<if test="remark!=null and remark!=''">
ptRemark=#{remark},
</if>
<if test="remark1!=null and remark1!=''">
ptRemark1=#{remark1},
</if>
<if test="remark2!=null and remark2!=''">
ptRemark2=#{remark2},
</if>
<if test="remark3!=null and remark3!=''">
ptRemark3=#{remark3},
</if>
</set>
where vaiId = #{id}
</update>
<delete id="deleteByVarId" parameterType="java.lang.Integer">
delete from mtVarItem where vaId = #{vaId}
</delete>
<select id="selectVarItemByVarId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select * from mtVarItem where vaId=#{vaId}
</select>
<delete id="deleteByVaiId" parameterType="java.lang.Integer">
delete from mtVarItem where vaiId = #{vaiId}
</delete>
</mapper>