@@ -128,3 +128,114 @@ private class MyBatisProviderStep extends TaintTracking::AdditionalValueStep {
128128 )
129129 }
130130}
131+
132+ /**
133+ * A MyBatis Mapper XML file.
134+ */
135+ class MyBatisMapperXmlFile extends XmlFile {
136+ MyBatisMapperXmlFile ( ) {
137+ count ( XmlElement e | e = this .getAChild ( ) ) = 1 and
138+ this .getAChild ( ) .getName ( ) = "mapper"
139+ }
140+ }
141+
142+ /**
143+ * An XML element in a `MyBatisMapperXMLFile`.
144+ */
145+ class MyBatisMapperXmlElement extends XmlElement {
146+ MyBatisMapperXmlElement ( ) { this .getFile ( ) instanceof MyBatisMapperXmlFile }
147+
148+ /**
149+ * Gets the value for this element, with leading and trailing whitespace trimmed.
150+ */
151+ string getValue ( ) { result = this .allCharactersString ( ) .trim ( ) }
152+
153+ /**
154+ * Gets the reference type bound to MyBatis Mapper XML File.
155+ */
156+ RefType getNamespaceRefType ( ) {
157+ result .getQualifiedName ( ) = this .getAttribute ( "namespace" ) .getValue ( )
158+ }
159+ }
160+
161+ /**
162+ * An MyBatis Mapper sql operation element.
163+ */
164+ abstract class MyBatisMapperSqlOperation extends MyBatisMapperXmlElement {
165+ /**
166+ * Gets the value of the `id` attribute of MyBatis Mapper sql operation element.
167+ */
168+ string getId ( ) { result = this .getAttribute ( "id" ) .getValue ( ) }
169+
170+ /**
171+ * Gets the `<include>` element in a `MyBatisMapperSqlOperation`.
172+ */
173+ MyBatisMapperInclude getInclude ( ) { result = this .getAChild * ( ) }
174+
175+ /**
176+ * Gets the method bound to MyBatis Mapper XML File.
177+ */
178+ Method getMapperMethod ( ) {
179+ result .getName ( ) = this .getId ( ) and
180+ result .getDeclaringType ( ) = this .getParent ( ) .( MyBatisMapperXmlElement ) .getNamespaceRefType ( )
181+ }
182+ }
183+
184+ /**
185+ * A `<insert>` element in a `MyBatisMapperSqlOperation`.
186+ */
187+ class MyBatisMapperInsert extends MyBatisMapperSqlOperation {
188+ MyBatisMapperInsert ( ) { this .getName ( ) = "insert" }
189+ }
190+
191+ /**
192+ * A `<update>` element in a `MyBatisMapperSqlOperation`.
193+ */
194+ class MyBatisMapperUpdate extends MyBatisMapperSqlOperation {
195+ MyBatisMapperUpdate ( ) { this .getName ( ) = "update" }
196+ }
197+
198+ /**
199+ * A `<delete>` element in a `MyBatisMapperSqlOperation`.
200+ */
201+ class MyBatisMapperDelete extends MyBatisMapperSqlOperation {
202+ MyBatisMapperDelete ( ) { this .getName ( ) = "delete" }
203+ }
204+
205+ /**
206+ * A `<select>` element in a `MyBatisMapperSqlOperation`.
207+ */
208+ class MyBatisMapperSelect extends MyBatisMapperSqlOperation {
209+ MyBatisMapperSelect ( ) { this .getName ( ) = "select" }
210+ }
211+
212+ /**
213+ * A `<sql>` element in a `MyBatisMapperXMLElement`.
214+ */
215+ class MyBatisMapperSql extends MyBatisMapperXmlElement {
216+ MyBatisMapperSql ( ) { this .getName ( ) = "sql" }
217+
218+ /**
219+ * Gets the value of the `id` attribute of this `<sql>`.
220+ */
221+ string getId ( ) { result = this .getAttribute ( "id" ) .getValue ( ) }
222+ }
223+
224+ /**
225+ * A `<include>` element in a `MyBatisMapperXMLElement`.
226+ */
227+ class MyBatisMapperInclude extends MyBatisMapperXmlElement {
228+ MyBatisMapperInclude ( ) { this .getName ( ) = "include" }
229+
230+ /**
231+ * Gets the value of the `refid` attribute of this `<include>`.
232+ */
233+ string getRefid ( ) { result = this .getAttribute ( "refid" ) .getValue ( ) }
234+ }
235+
236+ /**
237+ * A `<foreach>` element in a `MyBatisMapperXMLElement`.
238+ */
239+ class MyBatisMapperForeach extends MyBatisMapperXmlElement {
240+ MyBatisMapperForeach ( ) { this .getName ( ) = "foreach" }
241+ }
0 commit comments