package com.engine.mzg.conn ;
import com.engine.mzg.util.RecruitUtil ;
import com.weaver.formmodel.data.model.Formfield ;
import org.apache.commons.lang3.StringUtils ;
import weaver.conn.RecordSet ;
import java.util.Map ;
/ * *
* @author : dxfeng
* @createTime : 2024 / 0 9 / 05
* @version : 1.0
* /
public class RecruitCommon {
/ * *
* 获 取 配 置
*
* @param key
* @return
* /
public static String getSettingValue ( String key ) {
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select pzz from uf_recruit_setting where pzx = ? " , key ) ;
if ( rs . next ( ) ) {
return rs . getString ( "pzz" ) ;
}
return "" ;
}
/ * *
* 获 取 配 置
*
* @param key
* @return
* /
public static String getSettingValue ( String key , Map < String , Formfield > fieldMap , Map < String , Object > paramsData ) {
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select pzz from uf_recruit_setting where pzx = ? " , key ) ;
String content = "" ;
if ( rs . next ( ) ) {
content = rs . getString ( "pzz" ) ;
}
if ( StringUtils . isNotBlank ( content ) ) {
content = RecruitUtil . getMsgReplaceStr ( content , fieldMap , paramsData ) ;
}
return content ;
}
/ * *
* 根 据 表 名 , 获 取 表 单 ID
*
* @param modeTable
* @return
* /
public static int getFormIdByTableName ( String modeTable ) {
int formId = - 1 ;
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select id from workflow_bill where tablename = ? " , modeTable ) ;
if ( rs . next ( ) ) {
formId = rs . getInt ( "id" ) ;
}
return formId ;
}
/ * *
* 根 据 建 模 表 名 , 获 取 建 模 ID
*
* @param modeTable
* @return
* /
public static int getModeIdByTableName ( String modeTable ) {
int formModeId = - 1 ;
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select id from modeinfo where formid =( select id from workflow_bill where tablename = ? ) and isdelete = 0 order by id" , modeTable ) ;
if ( rs . next ( ) ) {
formModeId = rs . getInt ( "id" ) ;
}
return formModeId ;
}
/ * *
* 获 取 表 单 下 拉 框 展 示 文 本
*
* @param formId 表 单 ID
* @param fieldName 字 段 明 湖 曾
* @param value 下 拉 框 值
* @return
* /
public static String getSelectName ( String formId , String fieldName , String value ) {
String cancelReason = "" ;
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select selectname from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? ) and selectvalue = ?" , formId , fieldName , value ) ;
if ( rs . next ( ) ) {
cancelReason = rs . getString ( "selectname" ) ;
}
return cancelReason ;
}
}