io.github.nichetoolkit.mybatis.MybatisAutoLogicMark Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mybatis-toolkit-starter Show documentation
Show all versions of mybatis-toolkit-starter Show documentation
mybatis toolkit starter project for Spring Boot
package io.github.nichetoolkit.mybatis;
import io.github.nichetoolkit.rest.RestException;
import io.github.nichetoolkit.rest.identity.IdentityUtils;
import io.github.nichetoolkit.rice.DefaultLogicMark;
import io.github.nichetoolkit.rice.configure.RiceServiceProperties;
import org.springframework.stereotype.Component;
/**
* MybatisAutoLogicMark
* The mybatis auto logic mark class.
* @author Cyan ([email protected])
* @see io.github.nichetoolkit.rice.DefaultLogicMark
* @see org.springframework.stereotype.Component
* @since Jdk1.8
*/
@Component
public class MybatisAutoLogicMark extends DefaultLogicMark {
/**
* MybatisAutoLogicMark
* Instantiates a new mybatis auto logic mark.
* @param serviceProperties {@link io.github.nichetoolkit.rice.configure.RiceServiceProperties} The service properties parameter is RiceServiceProperties
type.
* @see io.github.nichetoolkit.rice.configure.RiceServiceProperties
*/
public MybatisAutoLogicMark(RiceServiceProperties serviceProperties) {
super(serviceProperties);
}
@Override
public Object getAutoMark() throws RestException {
Object autoMark;
switch (this.autoMark) {
case DATETIME:
autoMark = "now()";
break;
case VERSION:
autoMark = System.currentTimeMillis();
break;
case IDENTITY:
default:
autoMark = IdentityUtils.valueOfString();
break;
}
return autoMark;
}
@Override
public Object getAutoUnmark() throws RestException {
return null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy