com.gitee.sunchenbin.mybatis.actable.manager.common.BaseMysqlCRUDManagerImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mybatis-enhance-actable Show documentation
Show all versions of mybatis-enhance-actable Show documentation
A.CTable is a Maven project based on Spring and Mybatis, which enhances the function of Mybatis
package com.gitee.sunchenbin.mybatis.actable.manager.common;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.gitee.sunchenbin.mybatis.actable.utils.ColumnUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.command.PageResultCommand;
import com.gitee.sunchenbin.mybatis.actable.command.SaveOrUpdateDataCommand;
import com.gitee.sunchenbin.mybatis.actable.dao.common.BaseMysqlCRUDMapper;
/**
* 已经废弃请勿使用有bug
*/
@Transactional
@Service("baseMysqlCRUDManager")
@Deprecated
public class BaseMysqlCRUDManagerImpl implements BaseMysqlCRUDManager{
private static final Logger log = LoggerFactory.getLogger(BaseMysqlCRUDManagerImpl.class);
private static final String KEYFIELDMAP = "keyFieldMap";
@Autowired
private BaseMysqlCRUDMapper baseMysqlCRUDMapper;
@Override
public Integer save(T obj){
boolean isSave = true;
Table tableName = obj.getClass().getAnnotation(Table.class);
if ((tableName == null) || (tableName.name() == null || tableName.name() == "")) {
log.error("必须使用model中的对象!");
return null;
}
Field[] declaredFields = getAllFields(obj);
Map