package com.ruoyi.system.entity;

import com.alibaba.fastjson2.JSON;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.core.domain.BaseEntity;

import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.core.type.TypeReference;


/**
 * 通用实体
 *
 * @author hanzihang
 * @date 2023/7/19 4:05 PM
 */
public class CommonEntity extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 基本参数Map（例如tableName，pagesize。。。）
     */
    private Map<String, Object> basicMap;

    /**
     * 查询条件Map （查询当前表的条件字段k/v）
     */
    private Map<String, Object> queryMap;

    /**
     * 条件Map（例如修改时前端回传的唯一id标识，删除同理）
     */
    private Map<String, Object> conditionMap;

    /**
     * 回传Map（得到结果返回前端）
     */
    private Map<String, Object> resultMap;

    /**
     * 通用Map(新增时，修改时存放字段k/v)
     */
    private Map<String, Object> commMap;

    /**
     * 新增map
     */
    private List<Map<String, String>> addListMap;

    /**
     * excelMap
     */
    private String execlMap;

    public List<Map<String, String>> getAddListMap() {
        return addListMap;
    }

    public void setAddListMap(List<Map<String, String>> addListMap) {
        this.addListMap = addListMap;
    }

    @Override
    public String toString() {
        return "CommonEntity{" +
                "basicMap=" + basicMap +
                ", queryMap=" + queryMap +
                ", conditionMap=" + conditionMap +
                ", resultMap=" + resultMap +
                ", commMap=" + commMap +
                ", addListMap=" + addListMap +
                ", execlMap=" + execlMap +
                '}';
    }

    public CommonEntity(Map<String, Object> basicMap, Map<String, Object> queryMap, Map<String, Object> conditionMap, Map<String, Object> resultMap, Map<String, Object> commMap, List<Map<String, String>> addListMap, String execlMap) {
        this.basicMap = basicMap;
        this.queryMap = queryMap;
        this.conditionMap = conditionMap;
        this.resultMap = resultMap;
        this.commMap = commMap;
        this.addListMap = addListMap;
        this.execlMap = execlMap;
    }

    public CommonEntity() {
    }


    public Map<String, Object> getBasicMap() {
        return basicMap;
    }

    public void setBasicMap(Map<String, Object> basicMap) {
        this.basicMap = basicMap;
    }

    public Map<String, Object> getQueryMap() {
        return queryMap;
    }

    public void setQueryMap(Map<String, Object> queryMap) {
        this.queryMap = queryMap;
    }

    public Map<String, Object> getConditionMap() {
        return conditionMap;
    }

    public void setConditionMap(Map<String, Object> conditionMap) {
        this.conditionMap = conditionMap;
    }

    public Map<String, Object> getResultMap() {
        return resultMap;
    }

    public void setResultMap(Map<String, Object> resultMap) {
        this.resultMap = resultMap;
    }

    public Map<String, Object> getCommMap() {
        return commMap;
    }

    public void setCommMap(Map<String, Object> commMap) {
        this.commMap = commMap;
    }

    public String getExeclMap() {
        return execlMap;
    }

    public void setExeclMap(String execlMap) {
        this.execlMap = execlMap;
    }


    /**
     * org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
     * Field error in object 'commonEntity' on field 'execlMap': rejected value
     * [[{"address":"主1","name":"主1","id":1},{"address":"主2","name":"主2","id":2}]];
     * codes [typeMismatch.commonEntity.execlMap,typeMismatch.execlMap,typeMismatch.java.util.List,typeMismatch];
     * arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [commonEntity.execlMap,execlMap];
     * arguments []; default message [execlMap]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.List' for property 'execlMap';
     * nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'java.util.Map' for property 'execlMap[0]': no matching editors or conversion strategy found]
     */
}