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

com.javajy.api.mapper.BaseMapper Maven / Gradle / Ivy

The newest version!
package com.javajy.api.mapper;

import com.javajy.api.service.Entity;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface BaseMapper extends FRMapper {
    @Select({"SELECT * FROM FR_${tableName} WHERE 1=1 order by id limit ${startIndex},${pageSize}"})
    List getAll(@Param("tableName") String var1, @Param("startIndex") Integer var2, @Param("pageSize") Integer var3);

    @Select({"SELECT count(id) FROM FR_${tableName} WHERE 1=1"})
    Integer getAllCount(@Param("tableName") String var1);

     E selectPage(E var1, T var2);

    @Insert({"INSERT INTO FR_${entity.tableName}(${entity.columns}) values (${entity.values})"})
    @Options(
        useGeneratedKeys = true,
        keyProperty = "entity.id"
    )
    void save(@Param("entity") Entity var1);

    @Update({"UPDATE FR_${tableName} SET ${entity.columnsValues} WHERE 1=1"})
    void update(@Param("entity") Entity var1);

    @Select({"SELECT * FROM FR_${entity.tableName} WHERE 1=1 and ${entity.columnsValues} order by id limit ${entity.startIndex},${entity.pageSize}"})
    List getByCondition(@Param("entity") Entity var1);

    @Select({"SELECT count(id) FROM FR_${entity.tableName} WHERE 1=1 and ${entity.columnsValues} "})
    Integer getByConditionCount(Entity var1);

    @Update({"DELETE FROM FR_${tableName} WHERE ID=${entity.id}"})
    void delete(@Param("entity") Entity var1);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy