YsEntityBudgetMapper.xml
7.79 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?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.chinagas.modules.system.mapper.YsEntityBudgetMapper">
<resultMap type="com.chinagas.modules.system.entity.YsEntityBudget" id="YsEntityBudgetResult">
<result property="id" column="ID" />
<result property="plateId" column="PLATE_ID" />
<result property="plate" column="PLATE" />
<result property="regionId" column="REGION_ID" />
<result property="region" column="REGION" />
<result property="eMGroupId" column="E_M_Group_ID" />
<result property="eMGroup" column="E_M_Group" />
<result property="entity" column="ENTITY" />
<result property="entityName" column="ENTITY_NAME" />
<result property="aEntityId" column="A_ENTITY_ID" />
<result property="aEntityName" column="A_ENTITY_NAME" />
<result property="status" column="status" />
</resultMap>
<sql id="selectYsEntityBudgetVo">
select ID, PLATE_ID, PLATE, REGION_ID, REGION, E_M_Group_ID, E_M_Group, ENTITY, ENTITY_NAME, A_ENTITY_ID, A_ENTITY_NAME, status from ys_entity_budget
</sql>
<sql id="selectYsEntityBudgetVo1">
select distinct(ENTITY) ID, PLATE_ID, PLATE, REGION_ID, REGION, E_M_Group_ID, E_M_Group, ENTITY, ENTITY_NAME, A_ENTITY_ID, A_ENTITY_NAME, status from ys_entity_budget
</sql>
<select id="selectYsEntityBudgetList" parameterType="com.chinagas.modules.system.entity.YsEntityBudget" resultMap="YsEntityBudgetResult">
<include refid="selectYsEntityBudgetVo"/>
<where>
<if test="plateId != null "> and PLATE_ID = #{plateId}</if>
<if test="plate != null and plate != ''"> and PLATE = #{plate}</if>
<if test="regionId != null "> and REGION_ID = #{regionId}</if>
<if test="region != null and region != ''"> and REGION = #{region}</if>
<if test="eMGroupId != null "> and E_M_Group_ID = #{eMGroupId}</if>
<if test="eMGroup != null and eMGroup != ''"> and E_M_Group = #{eMGroup}</if>
<if test="entity != null "> and ENTITY = #{entity}</if>
<if test="entityName != null and entityName != ''"> and ENTITY_NAME like concat('%', #{entityName}, '%')</if>
<if test="aEntityId != null "> and A_ENTITY_ID = #{aEntityId}</if>
<if test="aEntityName != null and aEntityName != ''"> and A_ENTITY_NAME like concat('%', #{aEntityName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectYsEntityBudgetList1" parameterType="com.chinagas.modules.system.entity.YsEntityBudget" resultMap="YsEntityBudgetResult">
<include refid="selectYsEntityBudgetVo1"/>
<where>
<if test="plateId != null "> and PLATE_ID = #{plateId}</if>
<if test="plate != null and plate != ''"> and PLATE = #{plate}</if>
<if test="regionId != null "> and REGION_ID = #{regionId}</if>
<if test="region != null and region != ''"> and REGION = #{region}</if>
<if test="eMGroupId != null "> and E_M_Group_ID = #{eMGroupId}</if>
<if test="eMGroup != null and eMGroup != ''"> and E_M_Group = #{eMGroup}</if>
<if test="entity != null "> and ENTITY = #{entity}</if>
<if test="entityName != null and entityName != ''"> and ENTITY_NAME like concat('%', #{entityName}, '%')</if>
<if test="aEntityId != null "> and A_ENTITY_ID = #{aEntityId}</if>
<if test="aEntityName != null and aEntityName != ''"> and A_ENTITY_NAME like concat('%', #{aEntityName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectYsEntityBudgetById" parameterType="Long" resultMap="YsEntityBudgetResult">
<include refid="selectYsEntityBudgetVo"/>
where ID = #{id}
</select>
<insert id="insertYsEntityBudget" parameterType="com.chinagas.modules.system.entity.YsEntityBudget">
insert into ys_entity_budget
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">ID,</if>
<if test="plateId != null">PLATE_ID,</if>
<if test="plate != null and plate != ''">PLATE,</if>
<if test="regionId != null">REGION_ID,</if>
<if test="region != null and region != ''">REGION,</if>
<if test="eMGroupId != null">E_M_Group_ID,</if>
<if test="eMGroup != null and eMGroup != ''">E_M_Group,</if>
<if test="entity != null">ENTITY,</if>
<if test="entityName != null and entityName != ''">ENTITY_NAME,</if>
<if test="aEntityId != null">A_ENTITY_ID,</if>
<if test="aEntityName != null and aEntityName != ''">A_ENTITY_NAME,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="plateId != null">#{plateId},</if>
<if test="plate != null and plate != ''">#{plate},</if>
<if test="regionId != null">#{regionId},</if>
<if test="region != null and region != ''">#{region},</if>
<if test="eMGroupId != null">#{eMGroupId},</if>
<if test="eMGroup != null and eMGroup != ''">#{eMGroup},</if>
<if test="entity != null">#{entity},</if>
<if test="entityName != null and entityName != ''">#{entityName},</if>
<if test="aEntityId != null">#{aEntityId},</if>
<if test="aEntityName != null and aEntityName != ''">#{aEntityName},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateYsEntityBudget" parameterType="com.chinagas.modules.system.entity.YsEntityBudget">
update ys_entity_budget
<trim prefix="SET" suffixOverrides=",">
<if test="plateId != null">PLATE_ID = #{plateId},</if>
<if test="plate != null and plate != ''">PLATE = #{plate},</if>
<if test="regionId != null">REGION_ID = #{regionId},</if>
<if test="region != null and region != ''">REGION = #{region},</if>
<if test="eMGroupId != null">E_M_Group_ID = #{eMGroupId},</if>
<if test="eMGroup != null and eMGroup != ''">E_M_Group = #{eMGroup},</if>
<if test="entity != null">ENTITY = #{entity},</if>
<if test="entityName != null and entityName != ''">ENTITY_NAME = #{entityName},</if>
<if test="aEntityId != null">A_ENTITY_ID = #{aEntityId},</if>
<if test="aEntityName != null and aEntityName != ''">A_ENTITY_NAME = #{aEntityName},</if>
<if test="status != null">status = #{status},</if>
</trim>
where ID = #{id}
</update>
<delete id="deleteYsEntityBudgetById" parameterType="Long">
delete from ys_entity_budget where ID = #{id}
</delete>
<delete id="deleteYsEntityBudgetByIds" parameterType="String">
delete from ys_entity_budget where ID in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectYsEntityBudgetByEntity" parameterType="Long" resultMap="YsEntityBudgetResult">
<include refid="selectYsEntityBudgetVo"/>
where ENTITY = #{entity}
</select>
<select id="selectYsAccounting" parameterType="Long" resultMap="YsEntityBudgetResult">
<include refid="selectYsEntityBudgetVo"/>
where ENTITY in
<foreach collection="array" item="longs" index="index" open="(" close=")" separator=",">
#{longs}
</foreach>
</select>
</mapper>