diff --git a/cloud/dahua/src/test/java/com/example/dahua/Tester.java b/cloud/dahua/src/test/java/com/example/dahua/Tester.java new file mode 100644 index 0000000..80b5184 --- /dev/null +++ b/cloud/dahua/src/test/java/com/example/dahua/Tester.java @@ -0,0 +1,16 @@ +package com.example.dahua; + + +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +/** + * 单元测试继承该类即可 + */ +@RunWith(SpringRunner.class) +@SpringBootTest +public abstract class Tester {} + + + diff --git a/cloud/dahua/src/test/java/com/example/dahua/mapper/SearchMapperTest.java b/cloud/dahua/src/test/java/com/example/dahua/mapper/SearchMapperTest.java new file mode 100644 index 0000000..397f457 --- /dev/null +++ b/cloud/dahua/src/test/java/com/example/dahua/mapper/SearchMapperTest.java @@ -0,0 +1,64 @@ +package com.example.dahua.mapper; + +import com.alibaba.fastjson.JSON; +import com.example.dahua.Tester; +import com.example.dahua.bean.CheckIn; +import com.example.dahua.bean.ShortMsg; +import com.example.dahua.dao.UserDao; +import com.example.dahua.utils.DateUtils; +import com.example.dahua.xiananDao.SearchMapper; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; + +/** + * TODO + * + * @author xuquan + * @date 2020/11/11 12:13 + */ + +public class SearchMapperTest extends Tester { + + @Autowired + private SearchMapper searchMapper; + + @Autowired + private UserDao userDao; + + @Test + public void test(){ + //有效刷卡调考勤存储过程 + CheckIn checkIn = new CheckIn(); + checkIn.setDeviceId("1212"); + checkIn.setCardNo("24234"); + checkIn.setFunNo(8); + checkIn.setFlag(1); + checkIn.setCheckTime("2020-11-11 12:19:12"); + searchMapper.checkIn(checkIn); + System.out.println(JSON.toJSON(checkIn)); + } + + @Test + public void test2(){ + userDao.checkLeave("234232"); + System.out.println(JSON.toJSON(userDao.checkLeave("234232"))); + userDao.selectByParentMobile("234232"); + System.out.println(JSON.toJSON(userDao.checkLeave("234232"))); + userDao.checkLeave("234232"); + System.out.println(JSON.toJSON(userDao.checkLeave("234232"))); + } + + @Test + public void test3(){ + ShortMsg shortMsg = new ShortMsg(); + String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); + shortMsg.setTableName("smsNew" + tableSuffix); + shortMsg.setSchoolId(23); + shortMsg.setMobile("124124242"); + userDao.insertMessage(); + System.out.println(JSON.toJSON(userDao.checkLeave("234232"))); + + } +} -- libgit2 0.21.0