
tk.mybatis.mapper.genid.GenId Maven / Gradle / Ivy
package tk.mybatis.mapper.genid;
/**
* 不提供具体的实现,这里提供一个思路。
*
* 在 Spring 集成环境中,可以通过配置静态方式获取 Spring 的 context 对象。
*
* 如果使用 vesta(https://gitee.com/robertleepeak/vesta-id-generator) 来生成 ID,假设已经提供了 vesta 的 idService。
*
* 那么可以在实现中获取该类,然后生成 Id 返回,示例代码如下:
*
*
* public class VestaGenId implement GenId {
* public Long genId(String table, String column){
* //ApplicationUtil.getBean 需要自己实现
* IdService idService = ApplicationUtil.getBean(IdService.class);
* return idService.genId();
* }
* }
*
*
* @author liuzh
*/
public interface GenId {
class NULL implements GenId {
@Override
public Object genId(String table, String column) {
throw new UnsupportedOperationException();
}
}
T genId(String table, String column);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy