All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.viiyue.plugins.mybatis.condition.Condition Maven / Gradle / Ivy

Go to download

Mybatis generic mapper plugin for solving most basic operations, simplifying sql syntax and improving dynamic execution efficiency

There is a newer version: 1.3.7
Show newest version
/**
 * Copyright (C) 2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.viiyue.plugins.mybatis.condition;

import com.greenpineyu.fel.FelEngine;
import com.viiyue.plugins.mybatis.template.TemplateEngine;

/**
 * 

Conditional wrapper object for example *

This class will be parsed by fel-engine template syntax * *

 * // $ is the calling parameter of mybatis
 * // example is an instance of Condition.wrap(Example)
 * {{$.example.columns}} -> id, name, ...
 * {{$.example.updates}} -> id = #{id}, name = #{name}, ...
 * {{$.example.where}} -> where id = #{id} and name = #{name} and logically_delete = selectValue
 * {{$.example.where(true)}} -> where id = #{id} and name = #{name} and logically_delete = deletedValue
 * {{$.example.where(false)}} -> where id = #{id} and name = #{name}
 * 
* * @author tangxbai * @since 1.1.0 * @see FelEngine * @see TemplateEngine */ public final class Condition { public final Example example; private Condition( Example example ) { this.example = example; } public static Condition wrap( Example example ) { return new Condition( example.build() ); } public String columns() { return example.getQueryPart(); } public String updates() { return example.getModifyPart(); } public String where() { return example.getWherePart(); } public String where( boolean isLogicallyDelete ) { return example.getWherePart( isLogicallyDelete, true ); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy