added BatchDelete action

This commit is contained in:
zhangwenjian committed 2020-05-05 12:25:17 +08:00
1 parent 38eed4a8fe
commit 77a4f183d5
9 files changed
+48 -21

No files matched your search

+3 -6
View File
@@ -144,12 +144,9 @@ func UpdateDictData(c *gin.Context) {
// @Router /api/v1/dict/data/{dictCode} [delete]
func DeleteDictData(c *gin.Context) {
var data models.DictData
id, err := tools.StringToInt(c.Param("dictCode"))
data.UpdateBy = tools.GetUserIdStr(c)
_, err = data.Delete(id)
IDS := tools.IdsStrToIdsIntGroup("dictCode", c)
result, err := data.BatchDelete(IDS)
tools.HasError(err, "修改失败", 500)
var res app.Response
res.Msg = "删除成功"
c.JSON(http.StatusOK, res.ReturnOK())
app.OK(c,result,"删除成功")
}
+3 -7
View File
@@ -71,7 +71,6 @@ func GetDictType(c *gin.Context) {
c.JSON(http.StatusOK, res.ReturnOK())
}
func GetDictTypeOptionSelect(c *gin.Context) {
var DictType models.DictType
DictType.DictName = c.Request.FormValue("dictName")
@@ -136,13 +135,10 @@ func UpdateDictType(c *gin.Context) {
// @Router /api/v1/dict/type/{dictId} [delete]
func DeleteDictType(c *gin.Context) {
var data models.DictType
id, err := tools.StringToInt(c.Param("dictId"))
data.UpdateBy = tools.GetUserIdStr(c)
_, err = data.Delete(id)
IDS := tools.IdsStrToIdsIntGroup("dictId", c)
result, err := data.BatchDelete(IDS)
tools.HasError(err, "修改失败", 500)
app.OK(c, result, "删除成功")
c.JSON(http.StatusOK, gin.H{
"code": 200,
"message": "删除成功",
})
}