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
143
144
145
146
<?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.wise.sc.acquisition.business.mapper.TProcessesDrillingMapper">
<!-- 表和实体字段对照关系, 类似RestultMap -->
<sql id="TProcessesDrillingColumns">
a.Uid,
a.Manager,
a.Supervisor,
a.TechDepart,
a.Tabulator,
a.EquipmentID,
a.Driver,
a.StartTime,
a.EndTime,
a.WorkTime,
a.HoleBlastVolume,
a.Depth,
a.RowSpace,
a.HoleSpace,
a.Azimuth,
a.Inclination,
a.Aperture,
a.x,
a.y,
a.z,
a.BlastDate,
a.Operator,
a.Accepter,
a.Bz,
a.Tag
</sql>
<sql id="TProcessesBlastDesignHoleColumns">
b.StopeName,
b.StepName,
b.BlastAreaName,
b.BlastHoleID AS HoleId,
b.DrillingDate,
b.Depth AS DesignDepth,
b.RowSpace AS DesignRowSpace,
b.HoleSpace AS DesignHoleSpace,
b.Azimuth AS DesignAzimuth,
b.Inclination AS DesignInclination,
b.Aperture AS DesignAperture,
b.StepHeight,
</sql>
<sql id="TProcessesBlastdesignVolumeColumns">
d.BlastVolume,
d.DesignDate,
</sql>
<sql id="TProcessesBlastDesignHoleJoins">
left join T_Processes_BlastDesign_Hole b on a.Uid = b.Uid
</sql>
<sql id="TProcessesBlastDesignVolumeJoins">
left join T_Processes_BlastDesign_Volume d on b.StopeName=d.StopeName and b.StepName=d.StepName and b.BlastAreaName=d.BlastAreaName
</sql>
<update id="updateByDrillingDate">
UPDATE a
set
<if test="params.BlastDate != null">
a.BlastDate= #{params.BlastDate}
</if>
from T_Processes_Drilling a
INNER JOIN T_Processes_BlastDesign_Hole b
on a.Uid=b.Uid
<where>
b.DrillingDate=#{params.DrillingDate}
</where>
</update>
<select id="getUidList" resultType="java.lang.String">
select tpd.Uid from T_Processes_Drilling tpd where tpd.BlastDate=#{blastDate}
</select>
<!-- 获取所有getPage列表 -->
<select id="getPage" resultType="cn.wise.sc.acquisition.business.model.vo.TProcessesDrillingVo">
SELECT
a.Uid,
a.Depth,
a.RowSpace,
a.HoleSpace,
a.HoleBlastVolume,
a.BlastDate,
b.BlastHoleID AS HoleId,
b.Depth AS DesignDepth,
b.RowSpace AS DesignRowSpace,
b.HoleSpace AS DesignHoleSpace,
b.StepHeight
FROM T_Processes_Drilling a
<include refid="TProcessesBlastDesignHoleJoins"/>
<include refid="TProcessesBlastDesignVolumeJoins"/>
<where>
${ew.sqlSegment}
</where>
</select>
<!-- 获取所有getPage列表 -->
<select id="getByQuery" resultType="cn.wise.sc.acquisition.business.model.vo.TProcessesDrillingVo">
SELECT
<include refid="TProcessesBlastDesignHoleColumns"/>
<include refid="TProcessesBlastdesignVolumeColumns"/>
<include refid="TProcessesDrillingColumns"/>
FROM T_Processes_Drilling a
<include refid="TProcessesBlastDesignHoleJoins"/>
<include refid="TProcessesBlastDesignVolumeJoins"/>
<where>
${ew.sqlSegment}
</where>
</select>
<!-- 根据条件求和某字段 -->
<select id="getSumByCondition" resultType="Double">
SELECT
sum(${condition})
FROM T_Processes_Drilling a
<include refid="TProcessesBlastDesignHoleJoins"/>
<where>
${ew.sqlSegment}
</where>
</select>
</mapper>