|
|
|
@ -97,8 +97,7 @@ func PageBaseTeacher(in *BaseTeacherProto.QueryArg) ([]map[string]interface{}, i
|
|
|
|
|
// 注意两个表关联时的on用法:
|
|
|
|
|
var myBuilder = builder.Dialect(builder.MYSQL).Select("t1.*").
|
|
|
|
|
From("t_base_teacher as t1").
|
|
|
|
|
LeftJoin("t_base_teacher_org as t2", "t1.person_id=t2.person_id").
|
|
|
|
|
OrderBy("t1.sort_id").OrderBy("t1.id_int")
|
|
|
|
|
OrderBy("t1.sort_id")
|
|
|
|
|
//所在单位ID
|
|
|
|
|
list := SqlKit.QueryByIds([]string{in.OrgId}, "t_base_organization")
|
|
|
|
|
if list == nil {
|
|
|
|
@ -107,10 +106,10 @@ func PageBaseTeacher(in *BaseTeacherProto.QueryArg) ([]map[string]interface{}, i
|
|
|
|
|
bureauId := list[0]["bureau_id"].(string)
|
|
|
|
|
if in.OrgId == bureauId {
|
|
|
|
|
//如果是单位ID
|
|
|
|
|
myBuilder.And(builder.Eq{"t2.bureau_id": in.OrgId}.Or(builder.Eq{"t1.bureau_id": in.OrgId}))
|
|
|
|
|
myBuilder.And(builder.Eq{"t1.bureau_id": in.OrgId})
|
|
|
|
|
} else {
|
|
|
|
|
//如果是部门ID
|
|
|
|
|
myBuilder.And(builder.Eq{"t2.org_id": in.OrgId}.Or(builder.Eq{"t1.org_id": in.OrgId}))
|
|
|
|
|
myBuilder.And(builder.Eq{"t1.org_id": in.OrgId})
|
|
|
|
|
}
|
|
|
|
|
//姓名模糊搜索
|
|
|
|
|
myBuilder.And(builder.Like{"t1.xm", in.Xm})
|
|
|
|
@ -354,7 +353,7 @@ func ExportTeacherInfoExcel(targetPath string, bureauId string, ExportExcelStatu
|
|
|
|
|
func ImportTeacherInfoExcel(excelPath string, bureauId string, actionPersonId string, actionIp string) (bool, string, error) {
|
|
|
|
|
//判断文件是不是存在
|
|
|
|
|
if !FileUtil.PathExists(excelPath) {
|
|
|
|
|
return false, "03", nil //03:文件没有找到
|
|
|
|
|
return false, "03", nil //03:文件没有找到
|
|
|
|
|
}
|
|
|
|
|
//模板是不是系统提供的
|
|
|
|
|
var templateSuccess = true
|
|
|
|
@ -380,7 +379,7 @@ func ImportTeacherInfoExcel(excelPath string, bureauId string, actionPersonId st
|
|
|
|
|
//1、对模板的合法性进行检查
|
|
|
|
|
templateSuccess = ExcelUtil.IsValidTemplate(excelPath, s1)
|
|
|
|
|
if !templateSuccess {
|
|
|
|
|
return false, "01", nil //01:不是系统提供的模板,无法完成导入!
|
|
|
|
|
return false, "01", nil //01:不是系统提供的模板,无法完成导入!
|
|
|
|
|
}
|
|
|
|
|
//2、对excel的合法性进行检查
|
|
|
|
|
excelSuccess = checkExcel(excelPath, s1, MapOrgName)
|
|
|
|
@ -393,7 +392,7 @@ func ImportTeacherInfoExcel(excelPath string, bureauId string, actionPersonId st
|
|
|
|
|
|
|
|
|
|
//两个有一个不成功,则提示
|
|
|
|
|
if !excelSuccess || !mysqlSuccess {
|
|
|
|
|
return false, "02", nil //02:在excel检测中,发现问题,请检查后重新上传!
|
|
|
|
|
return false, "02", nil //02:在excel检测中,发现问题,请检查后重新上传!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//4、获取所有单位的一些属性,用于一会维护人员信息时使用
|
|
|
|
@ -446,7 +445,7 @@ func readToTable(excelPath string, s1 ExcelUtil.TemplateStruct, MapOrgName map[s
|
|
|
|
|
//身份证件类型
|
|
|
|
|
m.Sfzjlxm = SysDictKit.MapDictKindChineseToCode["sfzjlxm_"+row[4]]
|
|
|
|
|
//身份证件号
|
|
|
|
|
m.Sfzjh =CommonUtil.CompressStr(row[5])
|
|
|
|
|
m.Sfzjh = CommonUtil.CompressStr(row[5])
|
|
|
|
|
//学历
|
|
|
|
|
m.Xlm = SysDictKit.MapDictKindChineseToCode["xlm_"+row[6]]
|
|
|
|
|
//学位
|
|
|
|
|