// Path: lolibox-server/src/main/java/io/loli/box/dao/ImgFileRepository.java
// public interface ImgFileRepository extends JpaRepository<ImgFile, Long> {
//     public ImgFile save(ImgFile file);
// 
//     int deleteByShortName(String name);
// 
//     ImgFile findByShortName(String name);
// 
//     @Transactional
//     @Modifying
//     @Query("update ImgFile u set u.delete=?2 where u.shortName=?1")
//     void updateDeleteByShortName(String name, boolean i);
// 
//     Page<ImgFile> findByUserIdOrderByCreateDateDesc(Long userId, Pageable pageable);
// 
//     @Query(value = "select f.* " +
//             "from img_file f " +
//             "left join user_accounts u " +
//             "on f.user_id = u.id " +
//             "where u.id = ?1 and f.deleted = ?2 " +
//             "order by f.create_date desc /*#pageable*/",
//             countQuery = "select count(f.*) " +
//                     "from img_file f " +
//                     "left join user_accounts u " +
//                     "on f.user_id = u.id " +
//                     "where u.id = ?1 and f.deleted = ?2 ", nativeQuery = true)
//     Page<ImgFile> findByUserIdAndDeleteOrderByCreateDate(Long userId, Boolean delete, Pageable pageable);
// 
//     List<ImgFile> findByGreenStatus(Integer greenStatus, Date from, Date end);
// 
// 
//     @Transactional
//     @Modifying
//     @Query("update ImgFile u set u.greenStatus=?1 where u.id=?2")
//     void updateGreenStatusById(Integer greenStatus, Long id);
// 
//     @Transactional
//     @Modifying
//     @Query("update ImgFile u set u.greenTaskId=?1 where u.id=?2")
//     void updateTaskIdById(String taskId, Long id);
// 
//     @Transactional
//     @Modifying
//     @Query("update ImgFile u set u.greenPoint=?1 where u.id=?2")
//     void updateGreenPointById(float checkResult, Long id);
// }


import io.loli.box.dao.ImgFileRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

package io.loli.box.green;



/**
 * Created by chocotan on 2016/8/6.
 */
@Configuration
@ConditionalOnProperty(name = "admin.green.enabled", havingValue = "aliyun")
public class AliGreenConfiguration {

    @Bean
    public GreenService greenService() {
        return new AliGreenService();
    }

    @Autowired

// Path: lolibox-server/src/main/java/io/loli/box/dao/ImgFileRepository.java
// public interface ImgFileRepository extends JpaRepository<ImgFile, Long> {
//     public ImgFile save(ImgFile file);
// 
//     int deleteByShortName(String name);
// 
//     ImgFile findByShortName(String name);
// 
//     @Transactional
//     @Modifying
//     @Query("update ImgFile u set u.delete=?2 where u.shortName=?1")
//     void updateDeleteByShortName(String name, boolean i);
// 
//     Page<ImgFile> findByUserIdOrderByCreateDateDesc(Long userId, Pageable pageable);
// 
//     @Query(value = "select f.* " +
//             "from img_file f " +
//             "left join user_accounts u " +
//             "on f.user_id = u.id " +
//             "where u.id = ?1 and f.deleted = ?2 " +
//             "order by f.create_date desc /*#pageable*/",
//             countQuery = "select count(f.*) " +
//                     "from img_file f " +
//                     "left join user_accounts u " +
//                     "on f.user_id = u.id " +
//                     "where u.id = ?1 and f.deleted = ?2 ", nativeQuery = true)
//     Page<ImgFile> findByUserIdAndDeleteOrderByCreateDate(Long userId, Boolean delete, Pageable pageable);
// 
//     List<ImgFile> findByGreenStatus(Integer greenStatus, Date from, Date end);
// 
// 
//     @Transactional
//     @Modifying
//     @Query("update ImgFile u set u.greenStatus=?1 where u.id=?2")
//     void updateGreenStatusById(Integer greenStatus, Long id);
// 
//     @Transactional
//     @Modifying
//     @Query("update ImgFile u set u.greenTaskId=?1 where u.id=?2")
//     void updateTaskIdById(String taskId, Long id);
// 
//     @Transactional
//     @Modifying
//     @Query("update ImgFile u set u.greenPoint=?1 where u.id=?2")
//     void updateGreenPointById(float checkResult, Long id);
// }


// Path: lolibox-server/src/main/java/io/loli/box/green/AliGreenConfiguration.java
import io.loli.box.dao.ImgFileRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

package io.loli.box.green;



/**
 * Created by chocotan on 2016/8/6.
 */
@Configuration
@ConditionalOnProperty(name = "admin.green.enabled", havingValue = "aliyun")
public class AliGreenConfiguration {

    @Bean
    public GreenService greenService() {
        return new AliGreenService();
    }

    @Autowired

    ImgFileRepository imgFileRepository;
