From e59c153a1ad51c60379cbb2775d8bc135de22f15 Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Thu, 9 Jul 2020 13:38:06 +0800 Subject: [PATCH] 'commit' --- .../BaseClass/BaseClassDao/BaseClassDao.go | 6 +++--- .../BaseGlobal/BaseGlobalDao/BaseGlobalDao.go | 2 +- .../BaseOrganizationDao/BaseOrganizationDao.go | 8 ++++---- .../BasePurview/BasePurviewDao/BasePurviewDao.go | 6 +++--- .../BaseRolePersonDao/BaseRolePersonDao.go | 4 ++-- .../BaseStudent/BaseStudentDao/BaseStudentDao.go | 4 ++-- .../BaseTeacher/BaseTeacherDao/BaseTeacherDao.go | 4 ++-- .../RpcService/GovArea/GovAreaDao/GovAreaDao.go | 2 +- .../RpcService/SysDict/SysDictDao/SysDictDao.go | 14 +++++++------- .../SysLoginpersonDao/SysLoginpersonDao.go | 8 ++++---- dsBaseRpc/Utils/SqlKit/SqlKit.go | 2 +- 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go index d3ec163a..b3395dea 100644 --- a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go +++ b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go @@ -93,7 +93,7 @@ func PageBaseClass(in *BaseClassProto.QueryArg) ([]map[string]interface{}, int32 return nil, 0, err } //调用多查询字段通用方法 - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } @@ -117,7 +117,7 @@ func GetStage(schoolId string) ([]map[string]interface{}, int32, error) { if err != nil { return nil, 0, err } - return SqlKit.Query(sql) + return SqlKit.QueryForPk(sql) } /** @@ -145,5 +145,5 @@ func GetRxnf(schoolId string, stageId string) ([]map[string]interface{}, int32, if err != nil { return nil, 0, err } - return SqlKit.Query(sql) + return SqlKit.QueryForPk(sql) } diff --git a/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalDao/BaseGlobalDao.go b/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalDao/BaseGlobalDao.go index 64c44f78..834076e6 100644 --- a/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalDao/BaseGlobalDao.go +++ b/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalDao/BaseGlobalDao.go @@ -45,6 +45,6 @@ func PageBaseGlobal(in *BaseGlobalProto.QueryArg) ([]map[string]interface{}, int } //获取拼接完成的SQL语句 sql, _ := myBuilder.OrderBy("global_id asc").Limit(limit, offset).ToBoundSQL() - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } diff --git a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go index f5aa282c..0c521b9a 100644 --- a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go +++ b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go @@ -165,7 +165,7 @@ func PageBaseOrganization(in *BaseOrganizationProto.QueryArg) ([]map[string]inte //关键字查询 sql, _ := myBuilder.Limit(limit, offset).ToBoundSQL() //通过SQL获取带缓存的数据 - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) //修改密码的显示项目 SysLoginpersonDao.FillPwd(&list) return list, count, err @@ -298,7 +298,7 @@ func GetBureauOrgTree(BureauId string) ([]map[string]interface{}, int32, error) myBuilder.Where(builder.Eq{"b_use": 1}).And(builder.Eq{"bureau_id": BureauId}).OrderBy("parent_id,sort_id") //通过SQL获取带缓存的数据 sql, _ := myBuilder.ToBoundSQL() - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } @@ -311,7 +311,7 @@ func GetOrgManager(Ids []string) ([]map[string]interface{}, int32, error) { And(builder.In("t1.org_id", Ids)) //通过SQL获取数据 sql, _ := myBuilder.ToBoundSQL() - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } @@ -426,7 +426,7 @@ func GetChildOrg(orgId string) ([]map[string]interface{}, int32, error) { if err != nil { return nil, 0, err } - return SqlKit.Query(sql) + return SqlKit.QueryForPk(sql) } /** diff --git a/dsBaseRpc/RpcService/BasePurview/BasePurviewDao/BasePurviewDao.go b/dsBaseRpc/RpcService/BasePurview/BasePurviewDao/BasePurviewDao.go index 32de6b59..18dbb012 100644 --- a/dsBaseRpc/RpcService/BasePurview/BasePurviewDao/BasePurviewDao.go +++ b/dsBaseRpc/RpcService/BasePurview/BasePurviewDao/BasePurviewDao.go @@ -67,7 +67,7 @@ func UpdateBasePurview(model models.TBasePurview, ForceUpdateFields []string) (i func GetRoleInfoByPersonId(personId string) ([]map[string]interface{}, error) { var myBuilder = builder.Dialect(builder.MYSQL).Select("id").From("t_base_role_person") sql, _ := myBuilder.Where(builder.Eq{"person_id": personId}).ToBoundSQL() - list, _, err := SqlKit.Query(sql) + list, _, err := SqlKit.QueryForPk(sql) return list, err } @@ -75,7 +75,7 @@ func GetRoleInfoByPersonId(personId string) ([]map[string]interface{}, error) { func GetPurviewByRoleArray(roleArray []string) ([]map[string]interface{}, error) { var myBuilder = builder.Dialect(builder.MYSQL).Select("id").From("t_base_purview_role") sql, _ := myBuilder.Where(builder.In("role_id", roleArray)).ToBoundSQL() - list, _, err := SqlKit.Query(sql) + list, _, err := SqlKit.QueryForPk(sql) return list, err } @@ -105,5 +105,5 @@ func PageBasePurview(in *BasePurviewProto.QueryArg) ([]map[string]interface{}, i //获取拼接完成的SQL语句 sql, _ := myBuilder.OrderBy("sort_id asc").Limit(limit, offset).ToBoundSQL() //通过SQL获取带缓存的数据 - return SqlKit.Query(sql) + return SqlKit.QueryForPk(sql) } diff --git a/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonDao/BaseRolePersonDao.go b/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonDao/BaseRolePersonDao.go index 49dd4b1a..cd7094ef 100644 --- a/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonDao/BaseRolePersonDao.go +++ b/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonDao/BaseRolePersonDao.go @@ -56,7 +56,7 @@ func PageBaseRolePerson(in *BaseRolePersonProto.QueryArg) ([]map[string]interfac sql, _ := myBuilder.OrderBy("id asc").ToBoundSQL() //分页 myBuilder.Limit(limit, offset) - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } @@ -254,7 +254,7 @@ func ConvertRoleIntIdsToGuidIds(idIntArray []string) ([]string, error) { if err != nil { return nil, err } - list, _, err := SqlKit.Query(sql) + list, _, err := SqlKit.QueryForPk(sql) if err != nil { return nil, err } diff --git a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go index d9c7f474..f62e3479 100644 --- a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go +++ b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go @@ -98,7 +98,7 @@ func PageBaseStudent(in *BaseStudentProto.QueryArg) ([]map[string]interface{}, i if err != nil { return nil, 0, err } - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) //对于教师是不是修改过帐号进行判断 SysLoginpersonService.FillPwdIsChange(&list) //返回结果 @@ -149,7 +149,7 @@ func ExportStudentAccountInfoExcel(in *BaseStudentProto.ModelArg) ([]map[string] if err != nil { return nil, 0, err } - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } diff --git a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go index f9687a6c..a944f45a 100644 --- a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go +++ b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go @@ -126,7 +126,7 @@ func PageBaseTeacher(in *BaseTeacherProto.QueryArg) ([]map[string]interface{}, i if err != nil { return nil, 0, err } - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) //扩展登录信息 FillLoginInfo(&list) //对于教师是不是修改过帐号进行判断 @@ -212,7 +212,7 @@ func ExportTeacherAccountInfoExcel(in *BaseTeacherProto.ModelArg) ([]map[string] if err != nil { return nil, 0, err } - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } diff --git a/dsBaseRpc/RpcService/GovArea/GovAreaDao/GovAreaDao.go b/dsBaseRpc/RpcService/GovArea/GovAreaDao/GovAreaDao.go index 22be3ae7..32ca5183 100644 --- a/dsBaseRpc/RpcService/GovArea/GovAreaDao/GovAreaDao.go +++ b/dsBaseRpc/RpcService/GovArea/GovAreaDao/GovAreaDao.go @@ -41,7 +41,7 @@ func PageGovArea(in *GovAreaProto.QueryArg) (bool, string, int32, []map[string]i //获取拼接完成的SQL语句 sql, _ := myBuilder.OrderBy("area_code asc").Limit(limit,offset).ToBoundSQL() - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) if err != nil { //记录到错误日志 LogUtil.Error(ErrorConst.SqlQueryError, "执行PageGovArea时发生严重错误:"+err.Error()) diff --git a/dsBaseRpc/RpcService/SysDict/SysDictDao/SysDictDao.go b/dsBaseRpc/RpcService/SysDict/SysDictDao/SysDictDao.go index f0cd96d3..fea2f80a 100644 --- a/dsBaseRpc/RpcService/SysDict/SysDictDao/SysDictDao.go +++ b/dsBaseRpc/RpcService/SysDict/SysDictDao/SysDictDao.go @@ -28,7 +28,7 @@ func PageSysDict(in *SysDictProto.QueryArg) ([]map[string]interface{}, int32, er myBuilder.Where(builder.Eq{"b_use": 1}) //获取拼接完成的SQL语句 sql, _ := myBuilder.OrderBy("sort_id asc").Limit(limit, offset).ToBoundSQL() - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } @@ -43,7 +43,7 @@ func PageSysDictMultipleDictCode(dictKind string, codeAry []string) ([]map[strin myBuilder.Where(builder.Eq{"b_use": 1}) //获取拼接完成的SQL语句 sql, _ := myBuilder.OrderBy("sort_id asc").ToBoundSQL() - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } @@ -55,7 +55,7 @@ func GetStage() ([]map[string]interface{}, int32, error) { if err != nil { return nil, 0, err } - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } @@ -70,7 +70,7 @@ func GetSubject(in *SysDictProto.GetSubjectArg) ([]map[string]interface{}, int32 if err != nil { return nil, 0, err } - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } @@ -82,7 +82,7 @@ func GetMultipleDict(in *SysDictProto.GetMultipleDictArg) ([]map[string]interfac if err != nil { return nil, 0, err } - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } @@ -94,7 +94,7 @@ func GetStageName(in *SysDictProto.GetStageNameArg) ([]map[string]interface{}, i if err != nil { return nil, 0, err } - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } @@ -106,6 +106,6 @@ func GetSubjectName(in *SysDictProto.GetSubjectNameArg) ([]map[string]interface{ if err != nil { return nil, 0, err } - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) return list, count, err } diff --git a/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonDao/SysLoginpersonDao.go b/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonDao/SysLoginpersonDao.go index b00baa7c..490a439d 100644 --- a/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonDao/SysLoginpersonDao.go +++ b/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonDao/SysLoginpersonDao.go @@ -129,7 +129,7 @@ func PageSysLoginPerson(in *SysLoginpersonProto.QueryArg) ([]map[string]interfac if err != nil { fmt.Println(err.Error()) } - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) //处理一下是不是原始密码的问题 FillPwd(&list) return list, count, err @@ -160,7 +160,7 @@ func PageAreaManager(in *SysLoginpersonProto.AreaManagerArg) ([]map[string]inter And(builder.In("t1.role_id", []string{Const.ProvinceManager, Const.CityManager, Const.DistrictManager})). And(builder.In("t1.rule_id", areaCodes)).Limit(limit, offset) sql, _ = myBuilder.ToBoundSQL() - list, count, err := SqlKit.Query(sql) + list, count, err := SqlKit.QueryForPk(sql) //处理一下是不是原始密码的问题 FillPwd(&list) return list, count, err @@ -253,7 +253,7 @@ func GetBureauIdsByPersonIds(personIds []string) ([]map[string]interface{}, stri if err != nil { return nil, Const.DataBaseActionError, err } - _list, _, err := SqlKit.Query(sql) + _list, _, err := SqlKit.QueryForPk(sql) if err != nil { return nil, Const.DataBaseActionError, err } @@ -291,7 +291,7 @@ func GetBureauIdsByPersonIds(personIds []string) ([]map[string]interface{}, stri if err != nil { return nil, Const.DataBaseActionError, err } - list, _, err := SqlKit.Query(sql) + list, _, err := SqlKit.QueryForPk(sql) return list, Const.SuccessDataBaseAction, nil } diff --git a/dsBaseRpc/Utils/SqlKit/SqlKit.go b/dsBaseRpc/Utils/SqlKit/SqlKit.go index 58dc3ef7..0043a946 100644 --- a/dsBaseRpc/Utils/SqlKit/SqlKit.go +++ b/dsBaseRpc/Utils/SqlKit/SqlKit.go @@ -207,7 +207,7 @@ func isDistinctSql(sql string) bool { 作者:黄海 时间:2020-06-10 */ -func Query(sql string) ([]map[string]interface{}, int32, error) { +func QueryForPk(sql string) ([]map[string]interface{}, int32, error) { if isMultiFieldSql(sql) || isDistinctSql(sql) { return pageSql(sql) } else {