部分表改用软删除
parent
7684079f0e
commit
2ed82019f6
|
@ -192,7 +192,7 @@ func (this *PlanController) GetUndo(c *gin.Context) {
|
||||||
}()
|
}()
|
||||||
undos := []model.Undo{}
|
undos := []model.Undo{}
|
||||||
e := db.GetOrm().Model(&model.Undo{}).Find(&undos).Error
|
e := db.GetOrm().Model(&model.Undo{}).Find(&undos).Error
|
||||||
if nil != e{
|
if nil != e {
|
||||||
log.Print(e.Error())
|
log.Print(e.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ func (this *PlanController) DeleteUndo(c *gin.Context) {
|
||||||
sid := c.Param("id")
|
sid := c.Param("id")
|
||||||
id := db.Atoi(sid)
|
id := db.Atoi(sid)
|
||||||
e := db.GetOrm().Model(&model.Undo{}).Delete(&model.Undo{ID: int32(id)}).Error
|
e := db.GetOrm().Model(&model.Undo{}).Delete(&model.Undo{ID: int32(id)}).Error
|
||||||
if nil != e{
|
if nil != e {
|
||||||
log.Print(e.Error())
|
log.Print(e.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
12
main.go
12
main.go
|
@ -182,17 +182,17 @@ func main() {
|
||||||
api.POST("/plan_days", planController.PlanDay) // 获取本月有计划天数
|
api.POST("/plan_days", planController.PlanDay) // 获取本月有计划天数
|
||||||
api.GET("/plan_types", planController.Types)
|
api.GET("/plan_types", planController.Types)
|
||||||
|
|
||||||
api.PUT("/undo",planController.CreateUndo)
|
api.PUT("/undo", planController.CreateUndo)
|
||||||
api.POST("/undo",planController.UpdateUndo)
|
api.POST("/undo", planController.UpdateUndo)
|
||||||
api.GET("/undo",planController.GetUndo)
|
api.GET("/undo", planController.GetUndo)
|
||||||
api.DELETE("/undo/:id",planController.DeleteUndo)
|
api.DELETE("/undo/:id", planController.DeleteUndo)
|
||||||
}
|
}
|
||||||
|
|
||||||
openapi := r.Group("openapi")
|
openapi := r.Group("openapi")
|
||||||
{
|
{
|
||||||
openapi.POST("/diff")
|
openapi.POST("/diff")
|
||||||
openapi.POST("/ddl2orm",openapiController.DDL2ORM)
|
openapi.POST("/ddl2orm", openapiController.DDL2ORM)
|
||||||
openapi.POST("/ddl2markdown",openapiController.DDL2Markdown)
|
openapi.POST("/ddl2markdown", openapiController.DDL2Markdown)
|
||||||
|
|
||||||
}
|
}
|
||||||
e := r.Run(":" + strconv.Itoa(config.GetPort()))
|
e := r.Run(":" + strconv.Itoa(config.GetPort()))
|
||||||
|
|
|
@ -7,6 +7,9 @@ import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/jinzhu/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Plan struct {
|
type Plan struct {
|
||||||
|
@ -19,12 +22,15 @@ type Plan struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Undo struct {
|
type Undo struct {
|
||||||
|
model gorm.Model
|
||||||
ID int32 `json:"id" gorm:"column:id" sql:"id"`
|
ID int32 `json:"id" gorm:"column:id" sql:"id"`
|
||||||
Content string `json:"content" gorm:"column:content" sql:"content"`
|
Content string `json:"content" gorm:"column:content" sql:"content"`
|
||||||
SpendTime int32 `json:"spend_time" gorm:"column:spend_time" sql:"spend_time"`
|
SpendTime int32 `json:"spend_time" gorm:"column:spend_time" sql:"spend_time"`
|
||||||
Parent int32 `json:"parent" gorm:"column:parent" sql:"parent"`
|
Parent int32 `json:"parent" gorm:"column:parent" sql:"parent"`
|
||||||
Level int32 `json:"level" gorm:"column:level" sql:"level"`
|
Level int32 `json:"level" gorm:"column:level" sql:"level"`
|
||||||
Type int32 `json:"type" gorm:"column:type" sql:"type"`
|
Type int32 `json:"type" gorm:"column:type" sql:"type"`
|
||||||
|
Done int `json:"done" gorm:"done" sql:"done"`
|
||||||
|
DeletedAt *time.Time `json:"deleted_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlanType struct {
|
type PlanType struct {
|
||||||
|
|
Loading…
Reference in New Issue