package com.changhong.autoform.service.data.impl; import java.util.List; import java.util.Map; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.changhong.autoform.core.spring.SpringContext; import com.changhong.autoform.entity.FormData; import com.changhong.autoform.entity.SelectForm; import com.changhong.autoform.entity.page.PageResult; import com.changhong.autoform.mapper.data.DataMapper; import com.changhong.autoform.service.data.DataService; @Service("dataService") public class DataServiceImpl implements DataService { @Override public int insertData(FormData formData) { return getDataMapper() .insertData(formData); } @Override public int deleteData(FormData formData) { return getDataMapper() .deleteDate(formData); } @Override public int updateData(FormData formData) { return getDataMapper() .updateDate(formData); } @Override public List> selectAll(SelectForm selectForm) { return getDataMapper() .selectAll(selectForm); } @Override public PageResult> selectPage(SelectForm selectForm) { // TODO 查询分页数据 return getDataMapper() .selectPage(selectForm); } @Override public Map selectOne(SelectForm selectForm) { return getDataMapper() .selectOne(selectForm); } private DataMapper getDataMapper(){ return SpringContext.getBean(DataMapper.class, (key)->{ return !key.equals("simpleDataMapper"); }); } @Override public String getUserName(SelectForm selectForm) { return getDataMapper() .getUserName(selectForm); } @Override public Integer impInstertDatas(List formDataList) { formDataList.stream().forEach(o->getDataMapper() .insertData(o)); return 1; } }