package com.xjrsoft.module.form.service.impl;

import cn.hutool.db.Entity;
import com.xjrsoft.XjrSoftApplication;
import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;


/**
 * @author dzx
 * @date 2024/8/8
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = XjrSoftApplication.class)
class FormExecuteServiceImplTest {

    @Test
    void test(){
        Map<String, Object> toSaveFormData = new HashMap<>();
        toSaveFormData.put("shen_qing_ri_qi4752", "2024-08-08 11:20:54");
        toSaveFormData.put("user_id", "14954803038533");
        toSaveFormData.put("total_amount", "29131");
        toSaveFormData.put("application_department", "1684107782861680030");
        toSaveFormData.put("status", "0");
        String tableName = "wf_subscription";

        Entity where = Entity.create(tableName).set("id", "1821405513673912320");
        where.putAll(toSaveFormData);
        Entity findwhere = Entity.create(tableName);
        findwhere.putAll(where);
        findwhere.putAll(toSaveFormData);
        Map<String, Object> objectMap = SqlRunnerAdapter.db().dynamicSelectOne(tableName, findwhere);
        Boolean isUpdate = false;
        if(objectMap == null){
            isUpdate = true;
        }
        System.out.println("isUpdate:" + isUpdate);
    }
}