master
huanghai 5 years ago
parent ce00aac158
commit f89a4bb5c5

@ -7,7 +7,7 @@ pwd = DsideaL147258369
[distribute] #发布功能的配置
ip = server.dsmin.com
port = 26611
port = 22
user = root
pwd = dsideal
remotePath = /usr/local/dsMin/dsBaseRpc/
@ -32,7 +32,7 @@ KafkaAddress = server.dsmin.com:9092
# 数据汇集的地址
[dataExchange]
host = http://10.10.14.239:9009
host = http://10.10.14.186:9009
exchangeUrl = /v1/dataex/DataexSet
SystemAuthUrl = /v1/dataex/SystemAuth
SystemId = BASE_GO

@ -2,19 +2,19 @@
wget -c https://studygolang.com/dl/golang/go1.14.6.linux-amd64.tar.gz
tar -C /usr/local/ -zxvf go1.14.6.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile.d/go.sh
echo "export PATH=$PATH:/home/user/go/bin" >> /etc/profile.d/go.sh
echo "export PATH=$PATH:/root/go/bin" >> /etc/profile.d/go.sh
echo "export PATH=$PATH:/usr/local/go/bin:/home/user/go/bin" >> /etc/profile.d/go.sh
source /etc/profile.d/go.sh
mkdir -p ~/home/user/go
echo "export GOPATH=/home/user/go" >> /etc/profile.d/gopath.sh
#设置代理
echo "export GO111MODULE=on" >> /etc/profile.d/gopath.sh
echo "export GOPROXY=https://goproxy.cn,direct" >> /etc/profile.d/gopath.sh
source /etc/profile.d/gopath.sh
chmod +x /etc/profile.d/*.sh
echo $GOPATH
#设置代理
go env -w GOPROXY=https://goproxy.cn,direct
# 下载dlv
yum install git -y
@ -23,6 +23,7 @@ go get github.com/go-delve/delve/cmd/dlv
# Goland配置方法
https://www.jianshu.com/p/e74e940a64d9
cd /usr/local/dsMin/dsBaseRpc
dlv --listen=:2345 --headless=true --api-version=2 exec ./dsBaseRpc
# 构建

@ -2,6 +2,7 @@ package BaseClassDao
import (
"dsBaseRpc/RpcService/BaseClass/BaseClassProto"
"dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao"
"dsBaseRpc/Utils/CommonUtil"
"dsBaseRpc/Utils/DbUtil"
"dsBaseRpc/Utils/SqlKit"
@ -76,6 +77,29 @@ func UpdateBaseClass(model models.TBaseClass, ForceUpdateFields []string) (int64
return affected, err
}
/**
2020-07-27
*/
func ExistClass(orgId string) (bool, error) {
var sql string
if BaseOrganizationDao.IsBuMen(orgId) {
sql = `select count(*) as c from t_base_class where b_use=1 and org_id=?`
} else {
sql = `select count(*) as c from t_base_class where b_use=1 and bureau_id=?`
}
list, err := db.SQL(sql).Query().List()
if err != nil {
return false, err
}
if list[0]["c"].(int64) > 0 {
return false, nil
} else {
return true, nil
}
}
//分页查询
func PageBaseClass(in *BaseClassProto.QueryArg) ([]map[string]interface{}, int32, error) {
//接收传入参数

@ -5,7 +5,6 @@ import (
"dsBaseRpc/Const"
"dsBaseRpc/Const/ErrorConst"
"dsBaseRpc/RpcService/BaseClass/BaseClassDao"
"dsBaseRpc/RpcService/BaseClass/BaseClassProto"
"dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao"
"dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationProto"
"dsBaseRpc/RpcService/BaseOrganizationManager/BaseOrganizationManagerDao"
@ -309,18 +308,14 @@ func (s *Rpc) DeleteBaseOrganization(ctx context.Context, in *BaseOrganizationPr
return &reply, err
}
//判断是不是有可用的班级
var inClass BaseClassProto.QueryArg
inClass.BureauId = in.Ids[i]
inClass.Page = 1
inClass.Limit = 1
_, count, err = BaseClassDao.PageBaseClass(&inClass)
exist, err := BaseClassDao.ExistClass(in.Ids[i])
if err != nil {
LogUtil.Error(ErrorConst.SqlUpdateError, "执行PageBaseClass时发生严重错误"+err.Error())
LogUtil.Error(ErrorConst.SqlUpdateError, "执行ExistClass时发生严重错误"+err.Error())
reply.Success = false
reply.Message = Const.DataBaseActionError
return &reply, err
}
if count > 0 {
if exist {
reply.Success = false
//判断是单位还是部门
if BaseOrganizationDao.IsBuMen(inTeacher.OrgId) {

Loading…
Cancel
Save