Merge branch 'master' of 10.10.14.250:huanghai/dsMin

master
zhangjun 5 years ago
commit 2ee0f0ab24

@ -1,25 +1,28 @@
提交运行git push时报错提示Permission denied (publickey)...
https://blog.csdn.net/wyp_comeon/article/details/91388107
# 在E:\Work\dsMin\下右键Git Bash ,然后在窗口中执行
ssh-keygen -t rsa -C "10402852@qq.com"
然后三个回车搞定。
ssh -v git@10.10.6.203
ssh-agent -s
ssh-agent bash
ssh-add /c/Users/Administrator/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
上述命令执行后id_rsa.pub文件内容将输出到终端复制里面的密钥内容一般是以ssh-rsa 开头以gitee账号的注册邮箱结尾的全部复制下来
ssh -T git@10.10.6.203
git pull
git fetch
提交运行git push时报错提示Permission denied (publickey)...
https://blog.csdn.net/wyp_comeon/article/details/91388107
# 在E:\Work\dsMin\下右键Git Bash ,然后在窗口中执行
ssh-keygen -t rsa -C "10402852@qq.com"
然后三个回车搞定。
ssh -v git@10.10.6.203
ssh-agent -s
ssh-agent bash
ssh-add /c/Users/Administrator/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
上述命令执行后id_rsa.pub文件内容将输出到终端复制里面的密钥内容一般是以ssh-rsa 开头以gitee账号的注册邮箱结尾的全部复制下来
ssh -T git@10.10.6.203
git pull
git fetch
git config --global core.autocrlf false
git config --global core.autocrlf false

@ -57,7 +57,7 @@ const BlueCell = "C200"
const YellowCell = "D200"
//整数最大值
const IntMax = 9999999
const Int32Max = 2147483647
//操作CODE
const ActionInsert = "INSERT"

@ -100,7 +100,7 @@ func PageBaseClass(in *BaseClassProto.QueryArg) ([]map[string]interface{}, int32
//根据学校ID获取学部(学段)信息
func GetStage(schoolId string) ([]map[string]interface{}, int32, error) {
//1、获取办学类型
list := SqlKit.QueryListMapByIds([]string{schoolId}, "t_base_organization")
list := SqlKit.QueryByIds([]string{schoolId}, "t_base_organization")
if list == nil || len(list) == 0 {
return nil, 0, errors.New("无法找到此学校id。")
}

@ -24,7 +24,7 @@ func (s *Rpc) GetBaseClass(ctx context.Context, in *BaseClassProto.ModelArg) (*B
//rpc响应
var reply BaseClassProto.Reply
//通用获取单条
list := SqlKit.QueryListMapByIds([]string{in.ClassId}, "t_base_class")
list := SqlKit.QueryByIds([]string{in.ClassId}, "t_base_class")
//将结果序列化
reply.Success = true
reply.Count = 1
@ -38,7 +38,7 @@ func (s *Rpc) AddBaseClass(ctx context.Context, in *BaseClassProto.ModelArg) (*B
//rpc响应
var reply BaseClassProto.Reply
//检查单位号是不是存在
list := SqlKit.QueryListMapByIds([]string{in.BureauId}, "t_base_organization")
list := SqlKit.QueryByIds([]string{in.BureauId}, "t_base_organization")
if list == nil || len(list) == 0 {
reply.Success = false
reply.Message = "输入的学校编号不存在,无法创建班级!"

@ -18,7 +18,7 @@ func (s *Rpc) GetBaseGlobal(ctx context.Context, in *BaseGlobalProto.ModelArg) (
//rpc响应
var reply BaseGlobalProto.Reply
//通用获取单条
list := SqlKit.QueryListMapByIds([]string{in.GlobalId}, "t_base_global")
list := SqlKit.QueryByIds([]string{in.GlobalId}, "t_base_global")
//将结果序列化
reply.Success = true
reply.Count = 1

@ -265,7 +265,7 @@ func GetChildSchoolCount(mainSchoolId string) (int64, error) {
2020-06-03
*/
func GetBureauAdministrativeDivision(BureauId string) (string, string, string, string, string, error) {
list := SqlKit.QueryListMapByIds([]string{BureauId}, "t_base_organization")
list := SqlKit.QueryByIds([]string{BureauId}, "t_base_organization")
if len(list) > 0 {
return list[0]["area_code"].(string), list[0]["province_code"].(string), list[0]["city_code"].(string), list[0]["district_code"].(string),
list[0]["main_school_id"].(string), nil
@ -280,7 +280,7 @@ func GetBureauAdministrativeDivision(BureauId string) (string, string, string, s
2020-06-03
*/
func GetMultipleBaseOrganization(Ids []string) ([]map[string]interface{}, int32, error) {
list := SqlKit.QueryListMapByIds(Ids, "t_base_organization")
list := SqlKit.QueryByIds(Ids, "t_base_organization")
return list, int32(len(list)), nil
}

@ -21,6 +21,7 @@ import (
"dsBaseRpc/Utils/PinYinUtil"
"dsBaseRpc/Utils/SqlKit"
"dsBaseRpc/models"
"errors"
)
type Rpc struct{} //服务对象
@ -30,7 +31,7 @@ func (s *Rpc) GetBaseOrganization(ctx context.Context, in *BaseOrganizationProto
//rpc响应
var reply BaseOrganizationProto.Reply
//使用通用方法获取单条记录
list := SqlKit.QueryListMapByIds([]string{in.OrgId}, "t_base_organization")
list := SqlKit.QueryByIds([]string{in.OrgId}, "t_base_organization")
//将结果序列化
reply.Success = true
@ -373,9 +374,13 @@ func (s *Rpc) UpdateBaseOrganization(ctx context.Context, in *BaseOrganizationPr
//普通学校
model.MainSchoolType = 1
//查看它有没有父校?
list := SqlKit.QueryListMapByIds([]string{in.OrgId}, "t_base_organization")
list := SqlKit.QueryByIds([]string{in.OrgId}, "t_base_organization")
if list == nil || len(list) == 0 {
reply.Success = false
reply.Message = "没有找到此OrgId!"
return &reply, err
}
mainSchoolId := list[0]["main_school_id"]
if mainSchoolId != "" {
//如果有父校父校ID是不是还有其它孩子
count, err := BaseOrganizationDao.GetChildSchoolCount(mainSchoolId.(string))
@ -596,7 +601,10 @@ func (s *Rpc) GetOrgManager(ctx context.Context, in *BaseOrganizationProto.Multi
*/
func UpdateManager(bureauId string, bUse int32) error {
//使用通用方法获取单条记录
list := SqlKit.QueryListMapByIds([]string{bureauId}, "t_base_organization")
list := SqlKit.QueryByIds([]string{bureauId}, "t_base_organization")
if list == nil || len(list) == 0 {
return errors.New("无法找到指定的单位ID")
}
bureauName := list[0]["org_name"].(string)
orgType := int32(list[0]["org_type"].(float64))
//组织机构类型 1教育局 2学校 3部门 4院 5系 6专业 7教辅单位,8:大学区

@ -5,6 +5,7 @@ import (
"dsBaseRpc/Utils/DbUtil"
"dsBaseRpc/Utils/SqlKit"
"dsBaseRpc/models"
"errors"
)
//操作数据库的变量
@ -22,7 +23,10 @@ func UpdateOrgManager(OrgId string, OrgManagerIds []string) error {
//2、后插入
//部门所在的单位
list := SqlKit.QueryListMapByIds([]string{OrgId}, "t_base_organization")
list := SqlKit.QueryByIds([]string{OrgId}, "t_base_organization")
if list == nil || len(list) == 0 {
return errors.New("无法找到指定的OrgId")
}
BureauId := list[0]["bureau_id"].(string)
//事务声明

@ -20,7 +20,7 @@ func (s *Rpc) GetBasePurview(ctx context.Context, in *BasePurviewProto.ModelArg)
//统一返回的结构体
var reply BasePurviewProto.Reply
//通用获取单条
list := SqlKit.QueryListMapByIds([]string{in.PurviewId}, "t_base_purview")
list := SqlKit.QueryByIds([]string{in.PurviewId}, "t_base_purview")
//将结果序列化
reply.Success = true
reply.Count = 1

@ -20,7 +20,7 @@ func (s *Rpc) GetBaseRolePerson(ctx context.Context, in *BaseRolePersonProto.Mod
//rpc响应
var reply BaseRolePersonProto.Reply
//通用获取单条
list := SqlKit.QueryListMapByIds([]string{in.Id}, "t_base_role_person")
list := SqlKit.QueryByIds([]string{in.Id}, "t_base_role_person")
//将结果序列化
reply.Success = true
reply.Count = 1
@ -269,7 +269,7 @@ func (s *Rpc) CheckDataPrivilege(ctx context.Context, in *BaseRolePersonProto.Ch
orgIds := in.OrgId
if len(orgIds) > 0 {
found = true
l2 := SqlKit.QueryListMapByIds(orgIds, "t_base_organization")
l2 := SqlKit.QueryByIds(orgIds, "t_base_organization")
if l2 == nil {
reply.Success = false
reply.Message = "传入的单位或部门ID没有找到!"
@ -296,7 +296,7 @@ func (s *Rpc) CheckDataPrivilege(ctx context.Context, in *BaseRolePersonProto.Ch
classIds := in.ClassId
if len(classIds) > 0 {
found = true
listClass := SqlKit.QueryListMapByIds(classIds, "t_base_class")
listClass := SqlKit.QueryByIds(classIds, "t_base_class")
if listClass == nil {
reply.Success = false
reply.Message = "传入的班级ID没有找到!"

@ -27,7 +27,7 @@ func (s *Rpc) GetBaseStudent(ctx context.Context, in *BaseStudentProto.ModelArg)
//rpc响应
var reply BaseStudentProto.Reply
//通用获取单条
list := SqlKit.QueryListMapByIds([]string{in.PersonId}, "t_base_student")
list := SqlKit.QueryByIds([]string{in.PersonId}, "t_base_student")
//将结果序列化
reply.Success = true
reply.Count = 1
@ -102,7 +102,7 @@ func (s *Rpc) AddBaseStudent(ctx context.Context, in *BaseStudentProto.ModelArg)
model.BUse = 1
//状态码
model.StateId = 1
list := SqlKit.QueryListMapByIds([]string{in.ClassId}, "t_base_class")
list := SqlKit.QueryByIds([]string{in.ClassId}, "t_base_class")
if list == nil || len(list) == 0 {
reply.Success = false
reply.Message = "没有找到对应的班级!"
@ -282,7 +282,7 @@ func (s *Rpc) UpdateBaseStudent(ctx context.Context, in *BaseStudentProto.ModelA
//残疾标志 0不是 1
model.Cjbz = in.Cjbz
//查找此学生所在的班级
list := SqlKit.QueryListMapByIds([]string{in.PersonId}, "t_base_student")
list := SqlKit.QueryByIds([]string{in.PersonId}, "t_base_student")
if list == nil || len(list) == 0 {
reply.Success = false
reply.Message = "没有找到对应的学生!"

@ -101,7 +101,7 @@ func PageBaseTeacher(in *BaseTeacherProto.QueryArg) ([]map[string]interface{}, i
From("t_base_teacher as t1").
LeftJoin("t_base_teacher_org as t2", "t1.person_id=t2.person_id")
//所在单位ID
list := SqlKit.QueryListMapByIds([]string{in.OrgId}, "t_base_organization")
list := SqlKit.QueryByIds([]string{in.OrgId}, "t_base_organization")
if list == nil {
return nil, 0, errors.New("没有找到此单位编码!")
}

@ -30,7 +30,7 @@ func (s *Rpc) GetBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg)
//rpc响应
var reply BaseTeacherProto.Reply
//通用获取单条
list := SqlKit.QueryListMapByIds([]string{in.PersonId}, "t_base_teacher")
list := SqlKit.QueryByIds([]string{in.PersonId}, "t_base_teacher")
//将结果序列化
reply.Success = true
@ -151,7 +151,7 @@ func (s *Rpc) AddBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg)
//排序号
model.SortId = int32(BaseTeacherDao.GetMaxSortId(in.OrgId)) + 1
//主单位与主部门
list := SqlKit.QueryListMapByIds([]string{in.OrgId}, "t_base_organization")
list := SqlKit.QueryByIds([]string{in.OrgId}, "t_base_organization")
if list == nil || len(list) == 0 {
reply.Success = false
reply.Message = "没有找到指定的组织机构ID"

@ -25,7 +25,7 @@ func (s *Rpc) GetGovArea(ctx context.Context, in *GovAreaProto.ModelArg) (*GovAr
return &reply, nil
}
//通用获取单条
list := SqlKit.QueryListMapByIds([]string{in.AreaCode}, "t_gov_area")
list := SqlKit.QueryByIds([]string{in.AreaCode}, "t_gov_area")
//将结果序列化
reply.Success = true
reply.Count = 1

@ -19,7 +19,7 @@ func (s *Rpc) GetSysDict(ctx context.Context, in *SysDictProto.ModelArg) (*SysDi
//统一返回的结构体
var reply SysDictProto.Reply
//通用获取单条
list := SqlKit.QueryListMapByIds([]string{CommonUtil.ConvertInt32ToString(in.DictId)}, "t_sys_dict")
list := SqlKit.QueryByIds([]string{CommonUtil.ConvertInt32ToString(in.DictId)}, "t_sys_dict")
//将结果序列化
reply.Success = true
reply.Count = 1

@ -9,6 +9,7 @@ import (
"dsBaseRpc/Utils/RedisUtil"
"dsBaseRpc/Utils/SqlKit"
"dsBaseRpc/models"
"errors"
"fmt"
"github.com/xormplus/builder"
)
@ -125,7 +126,7 @@ func PageSysLoginPerson(in *SysLoginpersonProto.QueryArg) ([]map[string]interfac
myBuilder.OrderBy("t3.sort_id").OrderBy("t3.org_type").OrderBy("t3.id_int")
//获取拼接完成的SQL语句
sql, err := myBuilder.Limit(limit, offset).ToBoundSQL()
if err!=nil{
if err != nil {
fmt.Println(err.Error())
}
list, count, err := SqlKit.Query(sql)
@ -241,6 +242,10 @@ func EnableDisableAccount(personIds []string, bUse int) error {
//根据登录信息表,获取人员与单位的关系信息
func GetBureauIdsByPersonIds(personIds []string) ([]map[string]interface{}, string, error) {
//如果没有正确传入参数
if len(personIds) == 0 {
return nil, Const.DataBaseActionError, errors.New("没有正确传入人员ID数组")
}
//一组人员肯定是同一个身份ID
myBuilder := builder.Dialect(builder.MYSQL).Select("identity_id").From("t_sys_loginperson").
Where(builder.Eq{"person_id": personIds[0]})

@ -21,7 +21,7 @@ func (s *Rpc) GetSysLoginperson(ctx context.Context, in *SysLoginpersonProto.Mod
//rpc响应
var reply SysLoginpersonProto.Reply
//通用获取单条
list := SqlKit.QueryListMapByIds([]string{in.Id}, "t_sys_loginperson")
list := SqlKit.QueryByIds([]string{in.Id}, "t_sys_loginperson")
//将结果序列化
reply.Success = true
reply.Count = 1
@ -184,7 +184,7 @@ func (s *Rpc) PageSysLoginpersonExcel(ctx context.Context, in *SysLoginpersonPro
//重新设置长度和显示的页
in.Page = 1
in.Limit = Const.IntMax
in.Limit = Const.Int32Max
list, _, err := SysLoginpersonDao.PageSysLoginPerson(in)
//错误处理

@ -1,9 +0,0 @@
package Test
import (
"testing"
)
func TestGetSysDict(t *testing.T) {
}

@ -8,7 +8,7 @@ import (
func main(){
var ClassId="1"
list := SqlKit.QueryListMapByIds([]string{ClassId}, "t_base_class")
list := SqlKit.QueryByIds([]string{ClassId}, "t_base_class")
list2:=make([]map[string]interface{},0)
fmt.Println(list)
fmt.Println(list2)

@ -1,56 +0,0 @@
package Test
import (
"flag"
"testing"
)
var (
addr = flag.String("addr", "localhost:8972", "server address")
)
func TestBaseRpcGateWay(t *testing.T) {
//cc := &codec.MsgpackCodec{}
////提交的参数
////准备计算的参数
//args := &RpcService.DmStageArgs{
// Limit: 1000,
// Offset: 0,
//}
////定义返回的变量
//reply := &RpcService.Reply{}
//data, _ := cc.Encode(args)
//// request
//req, err := http.NewRequest("POST", "http://10.10.6.200:8001/", bytes.NewReader(data))
//if err != nil {
// fmt.Println("failed to create request: ", err)
// return
//}
//
//// 设置header
//h := req.Header
//h.Set(gateway.XMessageID, "10000")
//h.Set(gateway.XMessageType, "0")
//h.Set(gateway.XSerializeType, "3")
//h.Set(gateway.XServicePath, "Base")
//h.Set(gateway.XServiceMethod, "GetStageList")
//
//// 发送http请求
//// http请求===>rpcx请求===>rpcx服务===>返回rpcx结果===>转换为http的response===>输出到client
//res, err := http.DefaultClient.Do(req)
//if err != nil {
// fmt.Println("failed to call: ", err)
//}
//defer res.Body.Close()
//// 获取结果
//replyData, err := ioutil.ReadAll(res.Body)
//if err != nil {
// fmt.Println("failed to read response: ", err)
//}
//// 解码
//err = cc.Decode(replyData, reply)
//if err != nil {
// fmt.Println("failed to decode reply: ", err)
//}
//fmt.Println(reply.List)
}

@ -1,20 +0,0 @@
package Test
import (
"dsBaseRpc/Utils/IdCardUtil"
"fmt"
"testing"
)
func TestIdCard(t *testing.T) {
//待验证的身份证号
idCard:="222301197710110018"
//开始检查
isValid, birthday, xb := IdCardUtil.GetIdCardNoInfo(idCard)
if !isValid{
fmt.Println("身份证号不合法!")
} else {
// isMale:true---->男
fmt.Printf("birthday=%s, xb=%s \n", birthday, xb)
}
}

@ -1,30 +0,0 @@
package Test
import (
"dsBaseRpc/Utils/CommonUtil"
"dsBaseRpc/Utils/DbUtil"
"fmt"
"strings"
"testing"
)
func TestSqlIn(t *testing.T) {
//方式1:传入字符串数组
idAry := []string{"1", "2", "3"}
ids := strings.Join(idAry, "','")
sqlRaw := fmt.Sprintf(`SELECT * FROM table WHERE id IN ('%s')`, ids)
fmt.Println(sqlRaw)
//方式2:传入整数数组
nums := []int{11, 12, 13}
ids = strings.Join(CommonUtil.ConvertIntegerArrayToStringArray(nums), "','")
sqlRaw = fmt.Sprintf(`select * from t_dm_subject where subject_id in ('%s')`, ids)
fmt.Println(sqlRaw)
var db = DbUtil.Engine
list, err := db.SQL(sqlRaw).Query().List()
if err != nil {
fmt.Println(err)
}
fmt.Println(list)
}

@ -43,9 +43,10 @@ func DeleteIds(tableName string, ids []string) error {
2020-02-05
*/
func QueryListMapByIds(ids []string, tableName string) []map[string]interface{} {
func QueryByIds(ids []string, tableName string) []map[string]interface{} {
return getListByIds(ids, GetBean(tableName))
}
func getListByIds(ids []string, m Selector) []map[string]interface{} {
//1、第一步从缓存读取
list, notExistsIds := batchReadRedis(ids, m.RedisPrefix)

@ -31,7 +31,6 @@ require (
github.com/go-xorm/cmd/xorm v0.0.0-20190426080617-f87981e709a1 // indirect
github.com/go-xorm/xorm v0.7.9 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/goinggo/mapstructure v0.0.0-20140717182941-194205d9b4a9 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.4.0
github.com/google/uuid v1.1.1 // indirect

Loading…
Cancel
Save