When vue.js axios sends a request, the parameters include dto and how to connect with a flag, backend?

1.vue.js uses axios to send requests to the background. The passing parameters include an object, and a string.
object to the background with javaBean, and String to the background with String.

2. The foreground code is as follows:

data() {
    return {
        sCompanyData: {
            id: undefined,
            zhName: "",
            usName: "",
            socialCreditCode: "",
            organisationNo: "",
            registerNo: ""
        },
        flag: "declare"
    };
},

methods: {
    sCompanySave() {
        this.$refs["childrenForm"].validate(valid => {
            // 
            if (valid) {
                axios.post("/htrt/compManager/sCompanySave", {
                        dto: this.sCompanyData,
                        flag: flag
                        }).then(resp => {
                        if (resp.data.success == false) {
                            this.$alert(resp.data.errorMsg, "", {
                                confirmButtonText: "",
                                callback: action => {}
                            });
                        } else {
                            this.sCompanyFormVisible = false;
                            this.$refs["childrenForm"].resetFields();
                            this.getList();
                        }
                    })
                    .catch(err => {
                        console.log(
                            "" + err.status + "," + err.statusText
                        );
                    });
            } else {
                console.log("error submit!!");
                return false;
            }
        });
    }
}

clipboard.png

3. The background java controller is as follows:

@RequestMapping(value = "sCompanySave")
 @ResponseBody
public JsonResponse<CompanyManagementDto> sCompanySave(@RequestBody Map<String,Object>paraMap) {

4. The question is how to deal with the paraMap,
problem in controller in paraMap.get ("dto"). What I can see with the code is also a map, but the forced conversion to map has not been successful.
ask students if you have encountered this problem.

Mar.22,2021

whether you want to receive a request from Content-Type: application/x-www-form-urlencoded . If so, you can use qs in
axios.post to transfer data


.

my colleague gave me another idea yesterday. Send it up, the backend can receive it, and dto automatically parses javaBean, flag and receives it to string.

                            axios.post(
                                "/htrt/compManager/sCompanySave?flag=" +"declare",
                                this.sCompanyData
                            )
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb240f-46e3e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb240f-46e3e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?