package com.poyee;

import com.tzy.PoyiApplication;
import com.tzy.common.config.QuerySql;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.teasoft.bee.osql.PreparedSql;
import org.teasoft.bee.osql.SuidRich;
import org.teasoft.honey.osql.core.Logger;


@Slf4j
@SpringBootTest(classes = PoyiApplication.class)
@RunWith(SpringRunner.class)
class LivingTest {


	@Autowired
	private SuidRich suidRich;
	@Autowired
	private PreparedSql preparedSql;

	@Test
	public void testQuerySqlRoom() {
		String sql="SELECT l.code,info.merchant_id FROM card_group_lives_config l LEFT JOIN card_group_info info on l.group_info_id=info.id \n" +
				"WHERE info.id=618 and del_flg=0";
		//String s = preparedSql.selectJson(sql);
		//System.out.println(s);

		String sql2 = QuerySql.getQuerySql("osql.example.entity.selectOrdersViaMap");
		Logger.info("getCustomSql:  " + sql2);
	}

	//@Test
	//public void testInsertRoomChat() {
	//	RoomChat roomChat = new RoomChat();
	//	roomChat.setRoomId(618L);
	//	roomChat.setNickName("yu2");
	//	roomChat.setMsg("test21");
	//	roomChat.setCreateTime(Timestamp.valueOf(LocalDateTime.now()));
	//	suidRich.insert(roomChat);
	//	System.out.println(roomChat.toString());
	//}
	//
	//@Test
	//public void testSelectRoomChat() {
	//
	//	RoomChat roomChat = new RoomChat();
	//	Condition beeCondition=new ConditionImpl();
	//	beeCondition.start(0).size(10)
	//			.op("createTime", Op.ge, Timestamp.valueOf("2022-03-01 15:40:00"))
	//			.op("createTime", Op.le, Timestamp.valueOf("2022-03-01 15:55:00"))
	//			//.between("createTime", Timestamp.valueOf("2022-03-01 15:30:00"),Timestamp.valueOf("2022-03-01 15:40:00"))
	//			.op("roomId", Op.eq,618L);
	//	List<RoomChat> list = suidRich.select(roomChat,beeCondition);
	//	System.out.println(list);
	//}





}
