|
@@ -13,17 +13,21 @@ import (
|
|
|
)
|
|
|
|
|
|
type Project struct {
|
|
|
- Id string `form:"id" json:"id"`
|
|
|
- Code string `form:"code" json:"code"`
|
|
|
- Name string `form:"name" json:"name"`
|
|
|
- UserId string `form:"userId" json:"userId"`
|
|
|
- UserAccount string `form:"userAccount" json:"userAccount"`
|
|
|
- CategoryId string `form:"categoryId" json:"categoryId"`
|
|
|
- Category string `form:"category" json:"category"`
|
|
|
- StaffId string `form:"StaffId" json:"StaffId"`
|
|
|
- StaffName string `form:"staffName" json:"staffName"`
|
|
|
- CreateTime string `form:"createTime" json:"createTime"`
|
|
|
- Remark string `form:"remark" json:"remark"`
|
|
|
+ Id string `form:"id" json:"id"`
|
|
|
+ Code string `form:"code" json:"code"`
|
|
|
+ Name string `form:"name" json:"name"`
|
|
|
+ UserId string `form:"userId" json:"userId"`
|
|
|
+ UserAccount string `form:"userAccount" json:"userAccount"`
|
|
|
+ CategoryId string `form:"categoryId" json:"categoryId"`
|
|
|
+ Category string `form:"category" json:"category"`
|
|
|
+ StaffId string `form:"staffId" json:"staffId"`
|
|
|
+ StaffName string `form:"staffName" json:"staffName"`
|
|
|
+ CreateTime string `form:"createTime" json:"createTime"`
|
|
|
+ CreateName string `form:"createName" json:"createName"`
|
|
|
+ CreateCategory string `form:"createCategory" json:"createCategory"`
|
|
|
+ InsideCategoryId string `form:"insideCategoryId" json:"insideCategoryId"`
|
|
|
+ InsideCategory string `form:"insideCategory" json:"insideCategory"`
|
|
|
+ Remark string `form:"remark" json:"remark"`
|
|
|
}
|
|
|
type ProjectInfo struct {
|
|
|
ProjectName string `from:"project_name" json:"projectName"`
|
|
@@ -54,7 +58,6 @@ func (l Project) ValidateId() error {
|
|
|
|
|
|
func (l Project) ValidateAdd() error {
|
|
|
return validation.ValidateStruct(&l,
|
|
|
- // 字符的4倍
|
|
|
validation.Field(&l.Code, validation.Required.Error("项目编号不能为空")),
|
|
|
validation.Field(&l.Name, validation.Required.Error("项目名称不能为空")),
|
|
|
validation.Field(&l.Category, validation.Required.Error("办事处不能为空")),
|
|
@@ -64,6 +67,21 @@ func (l Project) ValidateAdd() error {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+func (l Project) ValidateSave() error {
|
|
|
+ return validation.ValidateStruct(&l,
|
|
|
+ validation.Field(&l.Id, validation.Required.Error("项目ID不能为空")),
|
|
|
+ validation.Field(&l.Name, validation.Required.Error("项目名称不能为空")),
|
|
|
+
|
|
|
+ validation.Field(&l.InsideCategoryId, validation.Required.Error("所在办事处ID不能为空")),
|
|
|
+ validation.Field(&l.InsideCategory, validation.Required.Error("所在办事处不能为空")),
|
|
|
+
|
|
|
+ validation.Field(&l.Category, validation.Required.Error("负责人办事处不能为空")),
|
|
|
+ validation.Field(&l.CategoryId, validation.Required.Error("负责人办事处ID不能为空")),
|
|
|
+ validation.Field(&l.StaffName, validation.Required.Error("负责人不能为空")),
|
|
|
+ validation.Field(&l.StaffId, validation.Required.Error("负责人ID不能为空")),
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
func (l Project) Validate() error {
|
|
|
return validation.ValidateStruct(&l,
|
|
|
// 字符的4倍
|