com.mycompany.geocoordinate.mappers.MySqlProvider.java Source code

Java tutorial

Introduction

Here is the source code for com.mycompany.geocoordinate.mappers.MySqlProvider.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.geocoordinate.mappers;

import org.apache.ibatis.jdbc.SQL;

/**
 *
 * @author andrey
 */
public class MySqlProvider {

    public String selectCoordinateForLineorCircle() {

        return new SQL() {

            {
                SELECT("*");
                FROM("GeoObject");
                WHERE("Coordinate=#{coordinate}");
            }

        }.toString();

    }

    public String insertCoordinateForLineorCircle() {

        return new SQL() {

            {
                INSERT_INTO("GeoObject");
                VALUES("IdType,Coordinate", "#{typeCircle},#{coordinate}");

            }

        }.toString();
    }

    public String insertCoordinateForLine() {

        return new SQL() {

            {
                INSERT_INTO("GeoObject");
                VALUES("IdType,coordinate", "#{typeLine},#{coordinate}");

            }

        }.toString();
    }

    public String insertCoordinateForPolygon() {

        return new SQL() {
            {
                INSERT_INTO("GeoObject");
                VALUES("IdType,Coordiante", "#{typePolygon},#{coordinate}");

            }

        }.toString();
    }

    public String loadCoorindateAndType() {

        return new SQL() {
            {
                SELECT("coordinate,IdType,ID");
                FROM("GeoObject");
                WHERE("IdType=#{ID}");

            }

        }.toString();
    }

}