1、extends CrudRepository ,例如:
@Repository
public interface AmzDataStatisticRepository extends CrudRepository<AmzDataStatistic, Long> {
}
在Service注入AmzDataStatisticRepository 类即可调用
2、mybatis注解实现mapper
@Mapper
public interface IAmzFileDao {
@Select(" select * from AMZ_File where DATEDIFF(day,t2.upload_time,GETDATE())=0 and type = #{processStatus}")
List<AmzFile> findByRowDataByprocessStatus(@Param("processStatus") String processStatus);
}
在Service注入IAmzFileDao 类即可调用
3、直接注入JdbcTemplate
@Repository
public class JdbcTemplateDao implements IJdbcTemplateDao {
private static final Log logger = LogFactory.getLog(JdbcTemplateDao.class);
private static final SimpleDateFormat f=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
@Autowired