package org.linlinjava.jz.admin;


import org.junit.Test;
import org.junit.runner.RunWith;
import org.linlinjava.jz.db.domain.JzBuiltList;
import org.linlinjava.jz.db.service.JzBuiltListService;
import org.linlinjava.jz.db.service.JzCampaignFilterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.time.LocalDateTime;
import java.util.List;

@WebAppConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class campaignTest {
    @Autowired
    private JzBuiltListService builtListService;

    @Test
    public void runSql() {
        List<JzBuiltList> builtListList= builtListService.runSql("select id as customerId,id from customer_client",3);

        //if(builtListList.size()>0){
         //   builtListService.runInsertBatch(builtListList);
        //}
        for(JzBuiltList builtList:builtListList){
            builtList.setAssignedTime(LocalDateTime.now());
            builtList.setUserId(10);
        }
        builtListService.runUpdateBuiltBatch(builtListList);
    }

    @Autowired
    private JzCampaignFilterService filterService;
    @Test
    public void setFilterService(){
        Object obj=filterService.text("1=1");
        if(obj!=null){

        }
    }
}
