|
@@ -17,7 +17,7 @@ import (
|
|
|
|
|
|
// 获得合同项目节
|
|
|
func (s *contractService) GetSecionTree(bidsectionId int, projectId int) *viewmodels.TreeSectionContract {
|
|
|
- dataList := s.treeContractDao.GetAll(bidsectionId, projectId)
|
|
|
+ dataList := s.treeContractDao.GetAll(bidsectionId, projectId, 0)
|
|
|
sectionList := s.makeSectionTreeView(dataList)
|
|
|
|
|
|
// Node := sectionRoot //父节点
|
|
@@ -28,7 +28,7 @@ func (s *contractService) GetSecionTree(bidsectionId int, projectId int) *viewmo
|
|
|
|
|
|
// 获得项目节树和孩子们下的合同数据
|
|
|
func (s *contractService) GetSectionTreeContract(attribution string, bidsectionId int, projectId int) []*viewmodels.Contracts {
|
|
|
- s.treeContractDao.GetAttribution(attribution, bidsectionId, projectId)
|
|
|
+ s.treeContractDao.GetAttribution(attribution, bidsectionId, projectId, 0)
|
|
|
return nil
|
|
|
}
|
|
|
|
|
@@ -81,7 +81,7 @@ func (s *contractService) SectionAdd(sectionData *viewmodels.TreeSectionContract
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- sectionFather := s.treeContractDao.Get(treeId, bidsectionId, projectId)
|
|
|
+ sectionFather := s.treeContractDao.Get(treeId, bidsectionId, projectId, 0)
|
|
|
if sectionFather.Id == 0 {
|
|
|
return errors.New("未找到合同项目节")
|
|
|
}
|
|
@@ -96,7 +96,7 @@ func (s *contractService) SectionAdd(sectionData *viewmodels.TreeSectionContract
|
|
|
|
|
|
// 2 获得最大序号
|
|
|
// 2-1 孩子节点
|
|
|
- childrenList := s.treeContractDao.GetChildren(treeId, bidsectionId, projectId)
|
|
|
+ childrenList := s.treeContractDao.GetChildren(treeId, bidsectionId, projectId, 0)
|
|
|
// 2-1 最大序号
|
|
|
serial := 1
|
|
|
if len(childrenList) != 0 {
|
|
@@ -134,7 +134,7 @@ func (s *contractService) SectionSave(sectionData *viewmodels.TreeSectionContrac
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- section := s.treeContractDao.Get(treeId, bidsectionId, projectId)
|
|
|
+ section := s.treeContractDao.Get(treeId, bidsectionId, projectId, 0)
|
|
|
if section.Id == 0 {
|
|
|
return errors.New("未找到合同项目节")
|
|
|
}
|
|
@@ -163,7 +163,7 @@ func (s *contractService) UpdateSerial(sectionData *viewmodels.TreeSectionContra
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- section := s.treeContractDao.Get(treeId, bidsectionId, projectId)
|
|
|
+ section := s.treeContractDao.Get(treeId, bidsectionId, projectId, 0)
|
|
|
if section.Id == 0 {
|
|
|
return errors.New("未找到合同项目节")
|
|
|
}
|
|
@@ -173,7 +173,7 @@ func (s *contractService) UpdateSerial(sectionData *viewmodels.TreeSectionContra
|
|
|
// return errors.New("请在项目节第三层开始编辑")
|
|
|
// }
|
|
|
|
|
|
- err = s.treeContractDao.UpdateSerial(section, sectionData.Serial)
|
|
|
+ err = s.treeContractDao.UpdateSerial(section, sectionData.Serial, 0)
|
|
|
if err != nil {
|
|
|
return errors.New("更新失败")
|
|
|
}
|
|
@@ -183,7 +183,7 @@ func (s *contractService) UpdateSerial(sectionData *viewmodels.TreeSectionContra
|
|
|
// 项目节删除
|
|
|
func (s *contractService) SectionDelete(treeId int, bidsectionId int, projectId int) error {
|
|
|
// 1.验证项目节ID
|
|
|
- section := s.treeContractDao.Get(treeId, bidsectionId, projectId)
|
|
|
+ section := s.treeContractDao.Get(treeId, bidsectionId, projectId, 0)
|
|
|
if section.Id == 0 {
|
|
|
return errors.New("未找到合同项目节")
|
|
|
}
|
|
@@ -212,7 +212,7 @@ func (s *contractService) MoveDepth(sectionData *viewmodels.TreeSectionContract,
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- section := s.treeContractDao.Get(treeId, bidsectionId, projectId)
|
|
|
+ section := s.treeContractDao.Get(treeId, bidsectionId, projectId, 0)
|
|
|
if section.Id == 0 {
|
|
|
return errors.New("未找到合同项目节")
|
|
|
}
|
|
@@ -230,7 +230,7 @@ func (s *contractService) MoveDepth(sectionData *viewmodels.TreeSectionContract,
|
|
|
elderBrother := &models.CmTreeContracts{}
|
|
|
if sectionData.Operation == "downDepth" {
|
|
|
// 获得前一个兄弟节点
|
|
|
- elderBrotherList := s.treeContractDao.GetElderBrother(section.Serial, section.Depth, section.ParentId, bidsectionId, projectId)
|
|
|
+ elderBrotherList := s.treeContractDao.GetElderBrother(section.Serial, section.Depth, section.ParentId, bidsectionId, projectId, 0)
|
|
|
if len(elderBrotherList) == 0 {
|
|
|
return errors.New("项目节不能降级")
|
|
|
}
|
|
@@ -249,7 +249,7 @@ func (s *contractService) MoveDepth(sectionData *viewmodels.TreeSectionContract,
|
|
|
}
|
|
|
|
|
|
// 4.执行升降级
|
|
|
- err = s.treeContractDao.MoveDepth(section, elderBrother, sectionData.Operation, bidsectionId, projectId)
|
|
|
+ err = s.treeContractDao.MoveDepth(section, elderBrother, sectionData.Operation, bidsectionId, projectId, 0)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -264,7 +264,7 @@ func (s *contractService) MoveSerial(sectionData *viewmodels.TreeSectionContract
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- section := s.treeContractDao.Get(treeId, bidsectionId, projectId)
|
|
|
+ section := s.treeContractDao.Get(treeId, bidsectionId, projectId, 0)
|
|
|
if section.Id == 0 {
|
|
|
return errors.New("未找到合同项目节")
|
|
|
}
|
|
@@ -282,14 +282,14 @@ func (s *contractService) MoveSerial(sectionData *viewmodels.TreeSectionContract
|
|
|
brother := &models.CmTreeContracts{}
|
|
|
if sectionData.Operation == "downSerial" {
|
|
|
// 获得下一个兄弟
|
|
|
- youngerBrotherList := s.treeContractDao.GetYoungerBrother(section.Serial, section.Depth, section.ParentId, bidsectionId, projectId)
|
|
|
+ youngerBrotherList := s.treeContractDao.GetYoungerBrother(section.Serial, section.Depth, section.ParentId, bidsectionId, projectId, 0)
|
|
|
if len(youngerBrotherList) == 0 {
|
|
|
return errors.New("项目节不能下移")
|
|
|
}
|
|
|
brother = &youngerBrotherList[0]
|
|
|
} else if sectionData.Operation == "upSerial" {
|
|
|
// 获得上一个兄弟
|
|
|
- elderBrotherList := s.treeContractDao.GetElderBrother(section.Serial, section.Depth, section.ParentId, bidsectionId, projectId)
|
|
|
+ elderBrotherList := s.treeContractDao.GetElderBrother(section.Serial, section.Depth, section.ParentId, bidsectionId, projectId, 0)
|
|
|
if len(elderBrotherList) == 0 {
|
|
|
return errors.New("项目节不能上移")
|
|
|
}
|
|
@@ -299,7 +299,7 @@ func (s *contractService) MoveSerial(sectionData *viewmodels.TreeSectionContract
|
|
|
}
|
|
|
|
|
|
// 4.执行升降级
|
|
|
- err = s.treeContractDao.MoveSerial(section, brother, sectionData.Operation, bidsectionId, projectId)
|
|
|
+ err = s.treeContractDao.MoveSerial(section, brother, sectionData.Operation, bidsectionId, projectId, 0)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|