【javaWeb】軟體工程課程設計後臺介面規範

Alearn_發表於2018-06-29

knowledge-sharing-system

知識分享系統

目錄

檔案

使用者建立檔案關係

1.顯示

url:http://localhost:8088/demo/user_createf_ile/list
type: post
//根據類別查該類別的所有檔案,直接用檔案資料—討論

request

    無引數pageNum,PageSize

response

success

    {
        "status": 0,
        "msg": "",
        "data": {
            "list" : [
                {
                    "user_id":"9512101",
                    "username" : "XX"
                    "gmt_create": "2019-09-09 23:22:11",
                    "down_count":  ,
                    "collect_count" :   ,
                    "like_count" :              
                },
                {
                    "user_id":"9512102",
                    "username" : "XX"
                    "gmt_create": "2019-09-09 23:22:11",
                    "down_count":  ,
                    "collect_count" :   ,
                    "like_count" :              
                }
            ]
        },
        "success" : true

    }

fail

    {
    "status": 1,
    "msg": "",
    "data" : null,
    "success" : false
    }

2.新增檔案

url:http://localhost:8088/demo/course_fileType/{user_id}
type: post
//根據類別查該類別的所有檔案,然後新增檔案

request

 user_name,user_id,file(檔案資訊)

response

success

    {
        "status": 0,
        "msg": "插入成功",
        "data": {},
        "success" : tru
    }

fail

    {
    "status": 1,
    "msg": "插入失敗",
    "data" : null,
    "success" : false
    }

使用者操作檔案關係

1.刪除檔案

url:http://localhost:8088/demo/course_fileType/{user_id}, {file_hash}
type: delete
//根據類別查該類別的所有檔案,然後新增檔案

request

 user_id,file_hash

response

success

    {
        "status": 0,
        "msg": "刪除成功",
        "data": {},
        "success" : true

    }

fail

    {
    "status": 1,
    "msg": "刪除失敗",
    "data" : null,
    "success" : false
    }

檔案和檔案類別

1.顯示

url:http://localhost:8088/demo/course_fileType/{file_type_id}
type: post
//根據類別查該類別的所有檔案,直接用檔案資料—討論

request

 file_type_id,
 pageNum,PageSize

response

success

    {
        "status": 0,
        "msg": "",
        "data": {
            "list" : [
                {
                    "file_name",

                }
            ]
        },
        "success" : true

    }

fail

    {
    "status": 1,
    "msg": "",
    "data" : null,
    "success" : false
    }

2.新增檔案

url:http://localhost:8088/demo/course_fileType/{file_type_id}
type: post
//根據類別查該類別的所有檔案,然後新增檔案

request

 file_type_id,file.(檔案資訊)

response

success

    {
        "status": 0,
        "msg": "",
        "data": {
            file_type_id,
            //檔案資訊
        },
        "success" : true

    }

fail

    {
    "status": 1,
    "msg": "",
    "data" : null,
    "success" : false
    }

3.刪除檔案

url:http://localhost:8088/demo/course_fileType/{file_hash}
type: delete

request

 file_type_id,file.(檔案資訊)

response

success

    {
        "status": 0,
        "msg": "",
        "data": {}
        "success" : true    
    }

fail

    {
        "status": 1,
        "msg": "",
        "data" : null,
        "success" : false
    }

4.修改檔案資訊

url:http://localhost:8088/demo/course_fileType/{file_type_id},{file_hash}
type: put

request

  修改的資訊

response

success

    {
        "status": 0,
        "msg": "",
        "data": {
            檔名,檔案點選次數,收藏次數(惡意修改而)
        }
        "success" : true    
    }

fail

    {
        "status": 1,
        "msg": "",
        "data" : null,
        "success" : false
    }

課程和檔案

1.課程和檔案重點內容列表資訊

url : http://localhost:8088/demo/manage/course_file/list
type : post
//要顯示的內容: 課程編號、課程名稱、該課程下存在的檔案資訊 (1 – n)
// 檔案資訊包括:檔名,檔案路徑、檔案型別

request

    引數資訊: file_name,courseName,fileType //此處到時候還需要討論
    pageNum,PageSize

response

success

{
    "status" : 0,
    "msg" : {},
    "data" : {
        //total為資料庫查詢的資料
        "total" : 5
        "list" : [
            {
                "course_id" : "020420",
                "course_name" : "C語言程式設計",
                "file_name" : "filename",
                "file_url" : "file_url"
                "file_type" : "file_type"
            },
            {
                "course_id" : "020460",
                "course_name" : "計算機組成原理",
                "file_name" : "filename",
                "file_url" : "file_url",
                "file_type" : "file_type"
        ],
        "pageNum": 1,
        "pageSize": 10,
        "size": 5,
        "startRow": 1,
        "endRow": 5,
        "pages": 1,
        "prePage": 0,
        "nextPage": 0,
        "isFirstPage": true,
        "isLastPage": true,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "navigatePages": 8,
        "navigatepageNums": [
            1
        ],
        "navigateFirstPage": 1,
        "navigateLastPage": 1,
        "firstPage": 1,
        "lastPage": 1   
        },
        "success" : true
    }
}

fail

{
    "status" : 0,
    "msg" : "查詢失敗",
    "data" : null,
    "success" : false
}

2.課程和檔案的新增

url : http://localhost:8088/demo/manage/course_file/
type : post
//課程和檔案新增處理:使用者上傳點選

request

        course_id, course_name, file,file_type    //程式生成hash值,路徑

response

success

    {
        "status" : 0,
        "msg" : "新增成功",
        "data" : {},
        "success" : true
    }

fail

    {
        "status" : 0,
        "msg" : "失敗",
        "data" : null,
        "success" : false
    }

3.課程和檔案刪除

//想法是查詢課程下所有檔案,刪除根據檔案的hash值
url : http://localhost:8088/demo/manage/course_file/{file_hash}
type : delete

request

file_hash

response

success

    {

        "status" : 0,
        "msg" : "刪除成功",
        "data" : {},
        "success" : true
    }

fail


    {
        "status" : 0,
        "msg" : "刪除失敗",
        "data" : null,
        "success" : false
    }

4.課程和檔案關係修改

url : http://localhost:8088/demo/manage/course_file/{course_id},{file_hash}
type : put

request

course_id,file_hash

response

success

    {
        "status" : 0,
        "msg" : "修改成功",
        "data" : {},
        "success" : true
    }

fail

    {
        "status" : 0,
        "msg" : "修改失敗",
        "data" : null,
        "success" : false
    }

學校

1.學校列表資訊

url:http://localhost:8088/demo/manage/school/list
type:post

request

pageNum,pageSize

response

success

    {
        "status": 0,
        "msg": null,
        "data" : {
             "total" : 5
             "list" : [
                 {
                     "school_Id" : 99991
                    "school_name" :  "湖北汽車工業學院"
                },
                {
                     "school_Id" : 99992
                    "school_name" :  "湖北商業學院"
                }
             ],
        "pageNum": 1,
        "pageSize": 10,
        "size": 5,
        "startRow": 1,
        "endRow": 5,
        "pages": 1,
        "prePage": 0,
        "nextPage": 0,
        "isFirstPage": true,
        "isLastPage": true,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "navigatePages": 8,
        "navigatepageNums": [
            1
        ],
        "navigateFirstPage": 1,
        "navigateLastPage": 1,
        "firstPage": 1,
        "lastPage": 1   
        },
        "success" : true
    }

2.刪除學校資訊

url : http://localhost:8088/demo/manage/school/{school_id}
type : delete

reqeust 無引數資訊 school_id可以為陣列

    無引數

response

success

 {
        "status" : 0,
        "msg" : "刪除成功",
        "data" : {},
        "success" : true
}

fail

{
        "status" : 0,
        "msg" : "刪除失敗",
        "data" : null,
        "success" : false
}

3.修改學校資訊

url : http://localhost:8088/demo/manage/school/{school_id}
type : put

request :

    school_name //注:由於school_id是主碼,所以為了保證主碼唯一性,只能修改學校名

response

success

 {
        "status" : 0,
        "msg" : "修改成功",
        "data" : {},
        "success" : true
 }

fail

{
        "status" : 0,
        "msg" : "修改失敗",
        "data" : {},
        "success" : false
}

4.新增學校記錄

url : http://localhost:8088/demo/manage/school/
*type : post

request

school_id, school_name

response

success

    {


    }

fail

    {

    }


1.使用者列表資訊

url:http://localhost:8088/demo/manage/user/list
type: post
//後臺請求學校列表資訊資料

request

 pageNum,pageSize

response

success

{
    "status": 0,
    "msg": null,
    "data": {
        "total": 5,
        "list": [
            {
                "userId": 2,
                "nickname": null,
                "username": "?",
                "password": "8C491AA8E35D13E9DFC7768B9B76829E",
                "email": null,
                "userSchool": null,
                "userNo": null,
                "userMajor": null,
                "integral": null,
                "gmtCreate": "2018-06-24 10:57:23"
            },
            {
                "userId": 5,
                "nickname": null,
                "username": "和21",
                "password": "8C491AA8E35D13E9DFC7768B9B76829E",
                "email": null,
                "userSchool": null,
                "userNo": null,
                "userMajor": null,
                "integral": null,
                "gmtCreate": "2018-06-27 11:42:03"
            },
            {
                "userId": 6,
                "nickname": null,
                "username": "和212",
                "password": "8C491AA8E35D13E9DFC7768B9B76829E",
                "email": null,
                "userSchool": null,
                "userNo": null,
                "userMajor": null,
                "integral": null,
                "gmtCreate": "2018-06-27 11:42:04"
            },
            {
                "userId": 7,
                "nickname": null,
                "username": "和2121",
                "password": "8C491AA8E35D13E9DFC7768B9B76829E",
                "email": null,
                "userSchool": null,
                "userNo": null,
                "userMajor": null,
                "integral": null,
                "gmtCreate": "2018-06-27 11:42:05"
            },
            {
                "userId": 8,
                "nickname": null,
                "username": "qqq",
                "password": "5240358412DC9CB103BA5BD40947D1A6",
                "email": null,
                "userSchool": null,
                "userNo": null,
                "userMajor": null,
                "integral": null,
                "gmtCreate": "2018-06-28 17:10:04"
            }
        ],
        "pageNum": 1,
        "pageSize": 10,
        "size": 5,
        "startRow": 1,
        "endRow": 5,
        "pages": 1,
        "prePage": 0,
        "nextPage": 0,
        "isFirstPage": true,
        "isLastPage": true,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "navigatePages": 8,
        "navigatepageNums": [
            1
        ],
        "navigateFirstPage": 1,
        "navigateLastPage": 1,
        "firstPage": 1,
        "lastPage": 1
    },
    "success": true
}

fail


2.刪除使用者

url:http://10.10.57.62:8088/demo/manage/user/{id}
type: delete

request id可為陣列 如: 01,02,02

 無引數

response

success

  {
    "status": 0,
    "msg": "刪除成功",
    "data": {},
    "success": true
   }

fail

{
    "status": 1,
    "msg": "刪除失敗",
    "data": null,
    "success": false
}

3.修改使用者

url:http://10.10.57.62:8088/demo/manage/user/{id}
type: put

request (只需要提交需要修改的資料)

 userId,nickname,username,password,email,userSchool,userNo,userMajor,integral

response

success

   {
    "status": 0,
    "msg": "修改成功",
    "data": {},
    "success": true
   }

fail 有很多種情況 具體再討論

{
    "status": 1,
    "msg": "刪除失敗",
    "data": null,
    "success": false
}

4.新增使用者

url:http://10.10.57.62:8088/demo/manage/user/
type: post

request

 userId,nickname,username,password,email,userSchool,userNo,userMajor,integral

response

success

   {
    "status": 0,
    "msg": "新增成功成功",
    "data": null,
    "success": true
   }

fail 有很多種情況 具體再討論

{
    "status": 1,
    "msg": "新增失敗",
    "data": null,
    "success": false
}

{
    "status": 1,
    "msg": "使用者名稱已存在",
    "data": null,
    "success": false
}

課程


1.課程列表資訊

url:http://localhost:8088/demo/manage/course/list
type: post

request

 pageNum,pageSize,majorName

response

success

{
    "status": 0,
    "msg": null,
    "data": {
        "total": 4,
        "list": [
            {
                "courseId": "011",
                "courseName": "計算機網路"
            },
            {
                "courseId": "012",
                "courseName": "軟體工程"
            },
            {
                "courseId": "013",
                "courseName": "作業系統"
            },
            {
                "courseId": "014",
                "courseName": "資料結構"
            }
        ],
        "pageNum": 1,
        "pageSize": 10,
        "size": 4,
        "startRow": 1,
        "endRow": 4,
        "pages": 1,
        "prePage": 0,
        "nextPage": 0,
        "isFirstPage": true,
        "isLastPage": true,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "navigatePages": 8,
        "navigatepageNums": [
            1
        ],
        "navigateFirstPage": 1,
        "navigateLastPage": 1,
        "firstPage": 1,
        "lastPage": 1
    },
    "success": true
}

fail


2.刪除課程

url:http://10.10.57.62:8088/demo/manage/course/{id}
type: delete

request id可為陣列 如: 01,02,02

 無引數

response

success

  {
    "status": 0,
    "msg": "刪除成功",
    "data": {},
    "success": true
   }

fail

{
    "status": 1,
    "msg": "刪除失敗",
    "data": null,
    "success": false
}

3.修改課程

url:http://10.10.57.62:8088/demo/manage/course/{id}
type: put

request (只需要提交需要修改的資料)

 courseId,courseName

response

success

   {
    "status": 0,
    "msg": "修改成功",
    "data": {},
    "success": true
   }

fail 有很多種情況 具體再討論

{
    "status": 1,
    "msg": "修改失敗",
    "data": null,
    "success": false
}

專業

url:http://localhost:8088/demo/manage/major/list
type: post

request

 pageNum,pageSize,majorName

response

success

{
    "status": 0,
    "msg": null,
    "data": {
        "total": 4,
        "list": [
            {
                "majorId": "10000",
                "majorName": "數學"
            },
            {
                "majorId": "10001",
                "majorName": "計算機"
            },
            {
                "majorId": "10002",
                "majorName": "英語"
            },
            {
                "courseId": "10003",
                "courseName": "物理"
            }
        ],
        "pageNum": 1,
        "pageSize": 10,
        "size": 4,
        "startRow": 1,
        "endRow": 4,
        "pages": 1,
        "prePage": 0,
        "nextPage": 0,
        "isFirstPage": true,
        "isLastPage": true,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "navigatePages": 8,
        "navigatepageNums": [
            1
        ],
        "navigateFirstPage": 1,
        "navigateLastPage": 1,
        "firstPage": 1,
        "lastPage": 1
    },
    "success": true
}

fail


2.刪除專業

url:http://10.10.57.62:8088/demo/manage/major/{major_id}
type: delete

request id可為陣列 如: 01,02,02

 無引數

response

success

  {
    "status": 0,
    "msg": "刪除成功",
    "data": {},
    "success": true
   }

fail

{
    "status": 1,
    "msg": "刪除失敗",
    "data": null,
    "success": false
}

3.修改專業

url:http://10.10.57.62:8088/demo/manage/course/{major_id}
type: put

request (只需要提交需要修改的資料)

 courseId,courseName

response

success

   {
    "status": 0,
    "msg": "修改成功",
    "data": {},
    "success": true
   }

fail 有很多種情況 具體再討論

{
    "status": 1,
    "msg": "修改失敗",
    "data": null,
    "success": false
}

5.模板

url:http://10.10.57.62:8088/demo/user/list
type: post

request

 無引數

response

success

{
    "status": 0,
    "msg": "",
    "data": {}
}

fail

{
"status": 1,
"msg": ""
}

相關文章