code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
package st.platform.utils;
import st.platform.common.JavaBeanGenerator;
public class JavaBeanCreator
{
public JavaBeanCreator()
{
}
public static String createBean(String classPath,String tablename)
{
JavaBeanGenerator javaBeanGenerator = new JavaBeanGenerator();
String classBean = tablename.substring(0, 1).toUpperCase() + tablename.substring(1, tablename.length()).toLowerCase() + "Bean";
try {
javaBeanGenerator.generate(classPath, classBean, tablename);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return classBean;
}
}
| zyjk | trunk/src/st/platform/utils/JavaBeanCreator.java | Java | oos | 716 |
package st.platform.utils;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.StringTokenizer;
public class BusinessDate
{
public BusinessDate()
{
}
/**
* 获取当前日期时间:2007-01-02 12:00:00
*/
public static String getTodaytime()
{
Calendar cl = new GregorianCalendar();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
return sdf.format(cl.getTime());
} catch(Exception ex) {
return null;
}
}
/**
* 获取当前日期 :2007-01-02
*/
public static String getToday()
{
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd");
Calendar cl = new GregorianCalendar();
try {
return sdf.format(cl.getTime());
} catch(Exception ex) {
return null;
}
}
/**
* 获取当前日期 :20070102
*/
public static String getdayNumber()
{
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
Calendar cl = new GregorianCalendar();
try {
return sdf.format(cl.getTime());
} catch(Exception ex) {
return null;
}
}
/**
* 获取当前时间 :12:00:00
*/
public static String getTime()
{
Calendar cl = new GregorianCalendar();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("HH:mm:ss");
try {
return sdf.format(cl.getTime());
} catch(Exception ex) {
return null;
}
}
/**
* 根据字符串日期返回日期对象
* @param date 日期标示 2007-01-02
*/
public static Calendar getDate(String Date)
{
if (Date == null)
return null;
Date = Date.trim();
if ( Date.length() == 7 )
{
Date += "-01";
}
StringTokenizer st = new StringTokenizer(Date,"-");
int year=2100;
int month=0;
int day=1;
try {
year = Integer.parseInt(st.nextToken());
month = Integer.parseInt(st.nextToken())-1;
day = Integer.parseInt(st.nextToken());
} catch ( Exception e ) {
return null;
}
return new GregorianCalendar(year,month,day);
}
/**
* 根据日期对象返回字符串日期
* @param date 日期对象
*/
public static String getDateStr(Calendar Date)
{
if ( Date == null )
return "";
return (new java.text.SimpleDateFormat("yyyy-MM-dd")).format(Date.getTime());
}
/**
* 根据日期字符串返回上月1号日期
* @param date 日期字符串 2007-01-11
* @return 调整过得日期时间 2007-01-01
*/
public static String preMonthFirstDay()
{
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.MONTH,-1);
calendar.set(Calendar.DATE,1);
return getDateStr(calendar);
}
/**
* 返回上月最后一天日期
* @return 调整过得日期时间 2007-01-31
*/
public static String preMonthEndDay()
{
Calendar calendar = new GregorianCalendar();
calendar.set(Calendar.DATE,0);
return getDateStr(calendar);
}
/**
* 根据日期字符串返回当前月1号日期
* @param date 日期字符串 2007-01-11
* @return 调整过得日期时间 2007-01-01
*/
public static String monthFirstDay(String Date)
{
Calendar calendar = getDate(Date);
calendar.set(Calendar.DATE,1);
return getDateStr(calendar);
}
/**
* 返回当前月1号日期
* @return 调整过得日期时间 2007-01-01
*/
public static String currMonthFirstDay()
{
Calendar calendar = new GregorianCalendar();
calendar.set(Calendar.DATE,1);
return getDateStr(calendar);
}
/**
* 返回上周周日日期
* @return 调整过得日期时间 2007-01-01
*/
public static String preWeekFirstDay()
{
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.DATE,(calendar.get(Calendar.DAY_OF_WEEK)* -1)-6);
return getDateStr(calendar);
}
/**
* 返回上周周六日期
* @return 调整过得日期时间 2007-01-01
*/
public static String preWeekEndDay()
{
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.DATE,calendar.get(Calendar.DAY_OF_WEEK)* -1);
return getDateStr(calendar);
}
/**
* 返回当前周周日日期
* @return 调整过得日期时间 2007-01-01
*/
public static String currWeekFirstDay()
{
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.DATE,1 + calendar.get(Calendar.DAY_OF_WEEK)* -1);
return getDateStr(calendar);
}
/**
* 返回当前周周六日期
* @return 调整过得日期时间 2007-01-01
*/
public static String currWeekEndDay()
{
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.DATE,7 + calendar.get(Calendar.DAY_OF_WEEK)* -1);
return getDateStr(calendar);
}
/**
* 根据日期字符串返回当前月最后一天
* @param date 日期字符串 2007-01-11
* @return 调整过得日期时间 2007-01-31
*/
public static String monthEndDay(String Date)
{
Calendar calendar = getDate(Date);
calendar.add(Calendar.MONTH,1);
calendar.set(Calendar.DATE,0);
return getDateStr(calendar);
}
/**
* 返回当前月最后一天日期
* @return 调整过得日期时间 2007-01-31
*/
public static String currMonthEndDay()
{
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.MONTH,1);
calendar.set(Calendar.DATE,0);
return getDateStr(calendar);
}
/**
* 在当天日期增加N年N月N日
* @param year 增加N年
* @param month 增加N月
* @param day 增加N日
* @return 调整过得日期时间 2009-01-02
*/
public static String todayPlusDays(int year ,int month ,int day)
{
return datePlusDays(getToday(),year,month,day);
}
/**
* 在现有日期时间增加N年N月N日
* @param date 日期标示 2007-01-02
* @param year 增加N年
* @param month 增加N月
* @param day 增加N日
*
* @return 调整过得日期时间 2009-01-02
*/
public static String datePlusDays(String date, int year ,int month ,int day)
{
StringTokenizer datest = new StringTokenizer(plusDays(date + " " +getTime(),year,month,day)," ");
return datest.nextToken();
}
/**
* 在现有日期时间增加N年N月N日
* @param dateTime 时间标示 2007-01-02 12:00:00
* @param year 增加N年
* @param month 增加N月
* @param day 增加N日
*
* @return 调整过得日期时间 2009-01-02 12:00:00
*/
public static String plusDays(String dateTime, int year ,int month ,int day)
{
StringTokenizer datest = new StringTokenizer(dateTime," ");
int newyear = 2100;
int newmonth = 0;
int newday = 1;
int newhour = 1;
int newmin = 0;
int newsed = 0;
try {
StringTokenizer dates = new StringTokenizer(datest.nextToken(),"-");
newyear = Integer.parseInt(dates.nextToken());
newmonth = Integer.parseInt(dates.nextToken())-1;
newday = Integer.parseInt(dates.nextToken());
StringTokenizer hours = new StringTokenizer(datest.nextToken(),":");
newhour = Integer.parseInt(hours.nextToken());
newmin = Integer.parseInt(hours.nextToken());
newsed = Integer.parseInt(hours.nextToken());
} catch ( Exception e ) {
e.printStackTrace();
}
Calendar calendar = new GregorianCalendar(newyear,newmonth,newday,newhour,newmin,newsed);
calendar.add(Calendar.YEAR,year);
calendar.add(Calendar.MONTH,month);
calendar.add(Calendar.DATE,day);
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
return sdf.format(calendar.getTime());
} catch(Exception ex) {
return null;
}
}
public static void main(String[] argv) {
System.out.println(BusinessDate.preWeekFirstDay());
System.out.println(BusinessDate.preWeekEndDay());
System.out.println(BusinessDate.preMonthFirstDay());
System.out.println(BusinessDate.preMonthEndDay());
}
}
| zyjk | trunk/src/st/platform/utils/BusinessDate.java | Java | oos | 10,057 |
package st.platform.utils;
import java.io.InputStream;
import java.util.Properties;
import org.jdom.Element;
import st.platform.common.XMLConfig;;
public class Config
{
public Config()
{
}
public static String getProperty(String propsKey)
{
Config config = new Config();
String propsValue = "";
try
{
propsValue = config.getProp(propsKey);
if(propsValue == null)
return "";
propsValue = new String(propsValue.getBytes("ISO-8859-1"));
}
catch(Exception exception) { }
return propsValue;
}
public static String getDbConnectionStr(String conID) throws Exception
{
XMLConfig xmlConfig = new XMLConfig();
Element dbNode = xmlConfig.getChildNode("dataAccess");
if(conID == null || conID.trim().equals(""))
conID = xmlConfig.getChildNodeValue(dbNode,"defualtDB");
Element element = xmlConfig.GetChildAttrNode(dbNode, "ID", conID);
if(element == null)
{
return "";
} else
{
String s1 = element.getAttributeValue("Type").toUpperCase();
s1 = s1 + "|" + element.getAttributeValue("DBPool");
s1 = s1 + "|" + element.getAttributeValue("DBDriver");
s1 = s1 + "|" + element.getAttributeValue("ConnStr");
s1 = s1 + "|" + element.getAttributeValue("user");
s1 = s1 + "|" + element.getAttributeValue("passwd");
return s1;
}
}
public String getProp(String s) throws Exception
{
if(properties == null)
init();
return properties.getProperty(s);
}
private void init()throws Exception
{
properties = new Properties();
InputStream inputstream = null;
try
{
inputstream = getClass().getResourceAsStream(propsName);
properties.load(inputstream);
}
catch(Exception exception)
{
inputstream.close();
throw exception;
}
finally
{
inputstream.close();
}
return;
}
public static void main(String args[])
{
try
{
System.out.println(getDbConnectionStr(""));
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
private static String propsName = "/oryx.properties";
private static Properties properties = null;
public static boolean copyright = false;
public static String limitTime = "";
}
| zyjk | trunk/src/st/platform/utils/Config.java | Java | oos | 2,791 |
package st.platform.security;
public class SystemAttributeNames
{
public SystemAttributeNames()
{
}
public static final String DB_REF_TEXT_TEMPLATE = "db_ref_text_template";
public static final String TD_SEPARATOR_IS_USED = "td_separator_is_used";
public static final String TITLE_COMPONENT_SEPARATOR = "title_component_separator";
public static final String FORM_INSTANCE_POOL_SIZE = "form_instance_pool_size";
public static final String WEB_SERVER_ENCODING = "zt.platform.form.util.web_server_encoding";
public static final String DB_SERVER_ENCODING = "zt.platform.form.util.db_server_encoding";
public static final String USER_INFO_NAME = "plat_form_user_info";
public static final String CORP_INFO_NAME = "plat_form_corp_info";
public static final String JCJG_INFO_NAME = "plat_form_jcjg_info";
public static final String PXJG_INFO_NAME = "plat_form_pxjg_info";
public static final String WSJG_INFO_NAME = "plat_form_wsjg_info";
public static final String DEPT_INFO_NAME = "plat_form_dept_info";
public static final String LOGIN_ERROR_MESSAGE_NAME = "login_error_message";
public static final String OPER_TYPE = "oper_type";
}
| zyjk | trunk/src/st/platform/security/SystemAttributeNames.java | Java | oos | 1,268 |
package st.platform.security;
import java.io.PrintStream;
import java.io.Serializable;
import java.util.List;
import st.platform.common.MenuBean;
import st.platform.db.ConnectionManager;
import st.platform.db.DBUtil;
import st.platform.db.DatabaseConnection;
import st.portal.system.dao.PtOperBean;
import st.portal.system.dao.PtdeptBean;
public class OperatorManager
implements Serializable
{
private String operatorname = null;
private String operatorid = null;
private String xmlString = null;
private String[] roles = new String[0];
private MenuBean mb;
private List jsplist = null;
private PtOperBean operator;
private PtdeptBean dept;
private String remoteAddr = null;
private String remoteHost = null;
private boolean isLogin = false;
private String filePath = "";
private String safySign = "";
private String fportalCss = "";
private String fportalImg = "/css/";
private String fportalID = "1";
private String fwebpath = "";
private String fdistcode = "";
private String ffgdeptID = "";
private String fimgSign;
public String getXmlString()
{
return this.xmlString;
}
public PtOperBean getOperator()
{
return this.operator;
}
public PtdeptBean getDept()
{
return this.dept;
}
public String getSysDeptID()
{
this.ffgdeptID = "";
try
{
this.ffgdeptID = DBUtil.getCellValue("PTOPER", "deptid", " deptid like'" + this.fdistcode + "%' and opertype ='99'");
}
catch (Exception localException)
{
}
return this.ffgdeptID;
}
public String getFgdeptID()
{
this.ffgdeptID = "";
try
{
this.ffgdeptID = DBUtil.getCellValue("ptdept", "deptid", " deptid like'" + this.fdistcode + "%' and mkdm ='4'");
}
catch (Exception localException)
{
}
return this.ffgdeptID;
}
public String getFgdeptName()
{
this.ffgdeptID = "";
try
{
this.ffgdeptID = DBUtil.getCellValue("ptdept", "deptName", " deptid like'" + this.fdistcode + "%' and mkdm ='4'");
}
catch (Exception localException)
{
}
return this.ffgdeptID;
}
public String getFMzdeptID()
{
this.ffgdeptID = "";
try
{
this.ffgdeptID = DBUtil.getCellValue("ptdept", "deptid", " deptid like'" + this.fdistcode + "%' and mkdm ='5'");
}
catch (Exception localException)
{
}
return this.ffgdeptID;
}
public String getFmzdeptName()
{
this.ffgdeptID = "";
try
{
this.ffgdeptID = DBUtil.getCellValue("ptdept", "deptName", " deptid like'" + this.fdistcode + "%' and mkdm ='5'");
}
catch (Exception localException)
{
}
return this.ffgdeptID;
}
public boolean getIsSysTemOperator()
{
return this.operator.getOpertype().trim().equals("99");
}
public boolean getIsPTDept()
{
return this.dept.getMkdm().equals("1");
}
public boolean getIsFGDept()
{
return this.dept.getMkdm().equals("4");
}
public boolean getIsMZDept()
{
return this.dept.getMkdm().equals("5");
}
public boolean getIsJDDept()
{
return this.dept.getMkdm().equals("2");
}
public boolean getIsBSCDept()
{
return this.dept.getMkdm().equals("3");
}
public String getDistCode()
{
return this.fdistcode;
}
public String filePath()
{
return this.filePath;
}
public String getPortalCss()
{
return this.fportalCss;
}
public String getportalImg()
{
return this.fportalImg;
}
public String getportalID() {
return this.fportalID;
}
public void setWebPath(String webPath) {
this.fportalImg = (webPath + "/css/");
}
public String getOperatorName()
{
return this.operator.getOpername();
}
public String getOperatorId()
throws Exception
{
return this.operatorid;
}
public boolean login(String operid, String password)
{
try
{
String loginWhere = "where operid='" + operid + "' and operpasswd ='" + password + "'";
System.out.println(loginWhere + "=====================");
this.operatorid = operid;
this.operator = new PtOperBean();
this.operator = ((PtOperBean)this.operator.findFirstByWhere(loginWhere));
System.out.println(this.operator == null);
if (this.operator == null) {
System.out.println("operator is null");
this.isLogin = false;
} else {
System.out.println("bosdfffff");
this.dept = new PtdeptBean();
this.dept = ((PtdeptBean)this.dept.findFirstByWhere("where DEPTID ='" + this.operator.getDeptid() + "'"));
this.fdistcode = this.dept.getDeptid().substring(0, 2);
this.isLogin = true;
this.operatorname = this.operator.getOpername();
try
{
this.mb = new MenuBean();
this.xmlString = this.mb.generateStream(operid);
}
catch (Exception ex3) {
ex3.printStackTrace();
System.err.println("Wrong when getting menus of operator: [ " + ex3 + "]");
}
}
return this.isLogin;
} catch (Exception e) {
e.printStackTrace();
}return false;
}
public boolean login(String name, String password, String deptid, String logintype)
{
try
{
ConnectionManager cm = ConnectionManager.getInstance();
DatabaseConnection dc = cm.get();
String loginWhere = "where deptid='" + deptid + "' and operpasswd ='" + password + "' and replace(opername,' ','') ='" + name + "' ";
System.out.println(loginWhere);
this.operator = new PtOperBean();
this.operator = ((PtOperBean)this.operator.findFirstByWhere(loginWhere));
this.operatorid = this.operator.getOperid();
if (this.operator == null)
{
this.isLogin = false;
}
else {
this.dept = new PtdeptBean();
this.dept = ((PtdeptBean)this.dept.findFirstByWhere("where DEPTID ='" + deptid + "'"));
this.fdistcode = this.dept.getDeptid().substring(0, 2);
this.isLogin = true;
this.operatorname = this.operator.getOpername();
try
{
this.mb = new MenuBean();
this.xmlString = this.mb.generateStream(this.operator.getOperid());
}
catch (Exception ex3)
{
ex3.printStackTrace();
System.err.println("Wrong when getting menus of operator: [ " + ex3 + "]");
}
}
return this.isLogin;
} catch (Exception e) {
e.printStackTrace();
}return false;
}
public List getJspList()
{
return this.jsplist;
}
public boolean isLogin()
{
return this.isLogin;
}
public void logout()
{
this.isLogin = false;
this.operator = null;
this.operatorname = null;
this.operatorid = null;
this.roles = null;
this.mb = null;
this.xmlString = null;
this.remoteHost = null;
this.remoteAddr = null;
}
public String setRemoteAddr() {
return this.remoteAddr;
}
public void setRemoteAddr(String remoteAddr) {
this.remoteAddr = remoteAddr;
}
public void setRemoteHost(String remoteHost) {
this.remoteHost = remoteHost;
}
private void createImgSign() {
this.fimgSign = "";
try
{
int rad = (int)Math.round(Math.random() * 10.0D);
if (rad == 10)
rad = 9;
this.fimgSign += rad;
rad = (int)Math.round(Math.random() * 10.0D);
if (rad == 10)
rad = 9;
this.fimgSign += rad;
rad = (int)Math.round(Math.random() * 10.0D);
if (rad == 10)
rad = 9;
this.fimgSign += rad;
rad = (int)Math.round(Math.random() * 10.0D);
if (rad == 10)
rad = 9;
this.fimgSign += rad;
}
catch (Exception localException)
{
}
}
public String getImgSign()
{
return this.fimgSign;
}
} | zyjk | trunk/src/st/platform/security/OperatorManager.java | Java | oos | 8,128 |
package st.platform.control.business;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.SQLException;
import java.util.Vector;
import st.platform.db.*;
import st.platform.control.convert.*;
import st.portal.system.dao.*;
import st.platform.common.*;
import st.platform.system.cache.*;
public class Action {
protected RecordSet rs;
protected SQLResponse res;
protected ActionRequest req;
protected DatabaseConnection dc;
protected PtOperBean operator;
private PtdeptBean dept;
public LogManager logManager;
protected String reqxml;
static Vector PARAM_MOTHOD = new Vector();;
public Action() {
}
public int execute(ActionRequest req, SQLResponse res) {
this.req = req;
this.res = res;
int result = 0;
ConnectionManager cm = ConnectionManager.getInstance();
cm.logManager = logManager;
try {
dc = cm.get();
dc.begin();
if (!req.getmethodName().trim().equals(""))
result = call(req.getmethodName().trim());
else
result = doBusiness();
}
catch (SQLException ex)
{
result = -1;
res.setResult(false);
res.setType(0);
res.setMessage(ex.getMessage());
if(logManager != null)
logManager.setError(ex);
}
catch(Exception sqle) {
result = -1;
res.setResult(false);
res.setType(0);
res.setMessage(sqle.getMessage());
if(logManager != null)
logManager.setError(sqle);
} finally {
try {
if(result < 0) {
res.setResult(false);
dc.rollback();
} else {
dc.commit();
}
cm.release();
} catch(Exception e) {
res.setResult(false);
res.setType(0);
res.setMessage(e.getMessage());
}
return 0;
}
}
public int doBusiness()
throws Exception {
return 0;
}
/**
* 根据枚举类型和类型值 返回枚举名称
* @param enumType 枚举类型
* @param enumName 枚举值
* @return 枚举名称
*/
public String getEnumValue(String enumType, String enumName) {
return EnumerationType.getEnumName(enumType,enumName);
}
/**
* 根据枚举类型和类型值 返回枚举扩展值
* @param enumType 枚举类型
* @param enumName 枚举值
* @return 枚举扩展值
*/
public String getEnumExtend(String enumType, String enumName) {
return EnumerationType.getEnumExtend(enumType,enumName);
}
/**
* 赋值人员对象
*/
public void setOperator(PtOperBean operator) {
this.operator = operator;
}
/**
* 获取数据连接对象
*/
public DatabaseConnection getDatabaseConnection()
{
return dc;
}
/**
* 获取人员对象
*/
public PtOperBean getOperator() {
return operator;
}
/**
* 获取部门对象
*/
public PtdeptBean getDept() {
try{
dept = (PtdeptBean)dept.findFirstByWhere("where DEPTID ='"+operator.getDeptid()+"'");
}catch(Exception e)
{
e.printStackTrace();
}
return dept;
}
/**
* 向前台返回操作错误信息
* @param message错误信息
*/
public void setError(String message) {
setData(false, 0, message);
}
/**
* 向前台返回操作成功信息
* @param message操作成功信息
*/
public void setSuccess(String message) {
setData(true, 0, message);
}
/**
* 向前台返回业务XML数据信息
* @param xmlStr XML数据信息
*/
public void setXml(String xmlStr) {
setData(true, 3, xmlStr);
}
/**
* 向前台返回业务操作信息
* @param htmlStr
*/
public void setMessage(String htmlStr) {
setData(true, 2, htmlStr);
}
/**
* 向前台返回业务记录信息
* @param fieldName 记录字段
* @param fieldValue记录值
*/
public void addFiled(String fieldName,String fieldValue) {
this.res.addField(fieldName,fieldValue);
}
public void setRecordset(RecordSet recordset)
{
this.res.setRecordset(recordset);
this.res.setResult(true);
this.res.setType(1);
}
public void setData(boolean isSuccess, int type, String message) {
this.res.setResult(isSuccess);
this.res.setType(type);
this.res.setMessage(message);
}
/**
* 记录业务操作信息日志
* @param logMsg 操作信息
*/
public void setLogMessage(String logMsg) {
logManager.setMessage(logMsg);
}
/**
* 记录业务操作错误日志
* @param logError操作错误信息
*/
public void setLogError(String logError) {
logManager.setError(logError);
}
public int call(String methodname) throws SQLException,Exception {
Method method = null;
try {
method = this.getClass().getMethod(methodname, new Class[] {});
} catch (SecurityException ex) {
throw new Exception("方法访问权限不够:" + methodname);
} catch (NoSuchMethodException ex) {
throw new Exception("方法不存在:" + methodname);
}
Object obj = null;
try {
obj = method.invoke(this, PARAM_MOTHOD.toArray());
if (obj != null) {
return Integer.parseInt(obj.toString());
}
}
catch (InvocationTargetException ex1)
{
throw new Exception(ex1.getTargetException().getMessage());
} catch (IllegalArgumentException ex1) {
throw new Exception("传递的方法参数不对:" + methodname);
} catch (IllegalAccessException ex1) {
throw new Exception("方法访问权限不够:" + methodname);
}
return 0;
}
}
| zyjk | trunk/src/st/platform/control/business/Action.java | Java | oos | 7,062 |
package st.platform.control.business;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.SQLException;
import java.util.Vector;
import st.platform.db.*;
import st.platform.control.convert.*;
import st.portal.system.dao.*;
import st.platform.common.*;
import st.platform.system.cache.*;
public class GraphAction {
protected RecordSet rs;
protected SQLResponse res;
protected ActionRequest req;
protected DatabaseConnection dc;
protected PtOperBean operator;
private String fDataSetID;
private DictMain dictMain;
//SQL查询语句
private String fSQLStr="";
//查询条件
private String fwhereStr="";
//排序条件
private String forderStr="";
public LogManager logManager;
protected String reqxml;
private String fgridSql = "";
private String fgraphSql = "";
private String fgraphID = "";
static Vector PARAM_MOTHOD = new Vector();;
public GraphAction() {
}
public int execute(ActionRequest req, SQLResponse res) {
this.req = req;
this.res = res;
int result = 0;
ConnectionManager cm = ConnectionManager.getInstance();
cm.logManager = logManager;
try {
fDataSetID = req.getFieldValue("dictid");
dictMain = DictConfig.getDictMain(fDataSetID);
fSQLStr = req.getFieldValue("sqlStr");
fwhereStr = req.getFieldValue("whereStr");
forderStr = req.getFieldValue("orderStr");
if (fSQLStr.trim().equals(""))
fSQLStr = dictMain.getFsqlstr();
if (fwhereStr.trim().equals(""))
fwhereStr = dictMain.getFwherestr();
if (forderStr.trim().equals(""))
forderStr = dictMain.getForderstr();
if(forderStr.toLowerCase().trim().lastIndexOf(" desc") > 0)
forderStr = forderStr.substring(0,forderStr.length() -5);
fgridSql = fSQLStr + " " + fwhereStr + " " + forderStr;
//获取数据连结对象
dc = cm.get();
if (!req.getmethodName().trim().equals(""))
result = call(req.getmethodName().trim());
else
result = doBusiness();
if (fgraphSql.trim().equals(""))
{
setData(false, 0, "给 setGraphSql()图形数据走向执行语句函数");
return result;
}
if (fgraphID.trim().equals(""))
{
setData(false, 0, "给 setGraphID()图形显示标示函数");
return result;
}
//System.out.println("***************************************");
//System.out.println( fgraphID +"&" + fgraphSql);
setData(true, 0, fgraphID +"&" + fgraphSql );
cm.release();
return result;
}
catch(Exception sqle)
{
cm.release();
if(logManager != null)
logManager.setError(sqle);
return -1;
}
}
public int doBusiness()
throws Exception {
return 0;
}
/**
* 赋值人员对象
*/
public void setOperator(PtOperBean operator) {
this.operator = operator;
}
/**
* 获取数据连接对象
*/
public DatabaseConnection getDatabaseConnection()
{
return dc;
}
/**
* 获取列表执行语句
* @return 列表执行语句
*/
public String getGridSql()
{
return fgridSql;
}
/**
* 图形数据走向执行语句
* @param graphSql 数据走向执行语句
*/
public void setGraphSql(String graphSql)
{
fgraphSql = graphSql;
}
/**
* 图形显示标示
* @param graphID 显示标示
*/
public void setGraphID(String graphID)
{
fgraphID = graphID;
}
private void setData(boolean isSuccess, int type, String message) {
this.res.setResult(isSuccess);
this.res.setType(type);
this.res.setMessage(message);
}
public int call(String methodname) throws SQLException,Exception {
Method method = null;
try {
method = this.getClass().getMethod(methodname, new Class[] {});
} catch (SecurityException ex) {
throw new Exception("方法访问权限不够:" + methodname);
} catch (NoSuchMethodException ex) {
throw new Exception("方法不存在:" + methodname);
}
Object obj = null;
try {
obj = method.invoke(this, PARAM_MOTHOD.toArray());
if (obj != null) {
return Integer.parseInt(obj.toString());
}
}
catch (InvocationTargetException ex1)
{
throw new Exception(ex1.getTargetException().getMessage());
} catch (IllegalArgumentException ex1) {
throw new Exception("传递的方法参数不对:" + methodname);
} catch (IllegalAccessException ex1) {
throw new Exception("方法访问权限不够:" + methodname);
}
return 0;
}
}
| zyjk | trunk/src/st/platform/control/business/GraphAction.java | Java | oos | 6,274 |
package st.platform.control.business;
import java.util.*;
import st.platform.control.convert.*;
public class ActionRequest {
private Map recorder; /////存放第一类信息
private String SQLType; ////操作类型
private Vector recorderInts; /////存放所有类型的信息
private Vector SQLTypeInts; /////存放所有类型的信息的类型
private String MethodName; //////////操作方法名称
public ActionRequest() {
recorder= new HashMap();
recorderInts = new Vector();
SQLTypeInts = new Vector();
MethodName ="";
}
/////给方法赋值
public void setmethodName(String methodname){
MethodName =methodname;
}
///////返回方法名称
public String getmethodName(){
return MethodName;
}
///返回操作类型
public String getType(){
return SQLType;
}
///给操作类型负值
public void setType(String SQLType){
this.SQLType = SQLType;
}
////添加字段类
public void setRecorder(Map recorder)
{
this.recorder =recorder;
}
public void setRecorderInt(Map recorder)
{
recorderInts.add(recorder);
}
////返回字段类型
public String getFieldType(String fieldName)
{
FieldRequest fieldRequest = (FieldRequest)recorder.get(fieldName.trim().toLowerCase());
return fieldRequest.geType();
}
///返回字段值
public String getFieldValue(String fieldName)
{
FieldRequest fieldRequest = (FieldRequest)recorder.get(fieldName.trim().toLowerCase());
if ( fieldRequest != null )
return fieldRequest.getValue();
else
return null;
}
///返回旧字段值
public String getFieldOldValue(String fieldName)
{
FieldRequest fieldRequest = (FieldRequest)recorder.get(fieldName.trim().toLowerCase());
if ( fieldRequest != null )
return fieldRequest.getoldValue();
else
return null;
}
///返回字段表示
public String getFieldLable(String fieldName)
{
FieldRequest fieldRequest = (FieldRequest)recorder.get(fieldName.trim().toLowerCase());
if ( fieldRequest != null )
return fieldRequest.getfieldLable();
else
return null;
}
/////根据操作顺序返回操作类型
public void setTypeS(String SQLType){
SQLTypeInts.add(SQLType);
}
/////根据操作顺序返回操作类型
public String getTypeS(int index){
return (String)SQLTypeInts.get(index);
}
/////根据操作类型返回操作顺序
public int getIndexOfTypeS(String SQLType){
return SQLTypeInts.indexOf(SQLType);
}
/////根据操作顺序和字段名称返回字段值
public String getFieldValue(int index,String fieldName) {
Map recorderInt = (Map)recorderInts.get(index);
FieldRequest fieldRequest = (FieldRequest)recorderInt.get(fieldName.trim().toLowerCase());
if ( fieldRequest != null ) {
return fieldRequest.getValue();
} else {
return null;
}
}
/**
* 获取整形域值
* @param index int
* @param fieldName String
* @return int
*
* linyw add
*/
public int getFieldIntValue(int index,String fieldName){
String value = getFieldValue(index, fieldName);
if(value == null || value.trim().length() == 0){
return 0;
}else{
return Integer.parseInt(value);
}
}
///取出字段名称数组
public Object[] getFieldNameArr(int index){
Map recorderInt = (Map)recorderInts.get(index);
return recorderInt.keySet().toArray();
}
/////根据操作顺序和字段名称返回字段旧值
public String getFieldOldValue(int index,String fieldName) {
Map recorderInt = (Map)recorderInts.get(index);
FieldRequest fieldRequest = (FieldRequest)recorderInt.get(fieldName.trim().toLowerCase());
if ( fieldRequest != null ) {
return fieldRequest.getoldValue();
} else {
return null;
}
}
/////根据操作顺序和字段名称返回字段表示
public String getFieldLable(int index,String fieldName) {
Map recorderInt = (Map)recorderInts.get(index);
FieldRequest fieldRequest = (FieldRequest)recorderInt.get(fieldName.trim().toLowerCase());
if ( fieldRequest != null ) {
return fieldRequest.getfieldLable();
} else {
return null;
}
}
/////根据操作顺序和字段名称返回字段类型
public String getFieldType(int index,String fieldName)
{
Map recorderInt = (Map)recorderInts.get(index);
FieldRequest fieldRequest = (FieldRequest)recorderInt.get(fieldName.trim().toLowerCase());
return fieldRequest.geType();
}
///返回操作类型总数
public int getRecorderCount(){
return recorderInts.size();
}
}
| zyjk | trunk/src/st/platform/control/business/ActionRequest.java | Java | oos | 5,213 |
package st.platform.control.convert;
public class FieldRequest {
private String name; ///字段名称
private String type; ////字段类型
private String value; ////字段值
private String oldValue; ///旧的字段值
private String fieldLable;////字段中文解释
public FieldRequest() {
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setType(String type) {
this.type = type;
}
public String geType() {
return type;
}
public void setValue(String value) {
this.value = value;
}
public String getValue() {
return value;
}
public String getoldValue() {
return oldValue;
}
public void setoldValue(String oldValue) {
this.oldValue = oldValue;
}
public String getfieldLable() {
return fieldLable;
}
public void setfieldLable(String fieldLable) {
this.fieldLable = fieldLable;
}
}
| zyjk | trunk/src/st/platform/control/convert/FieldRequest.java | Java | oos | 1,146 |
package st.platform.control.convert;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import st.platform.system.cache.*;
import st.platform.system.cache.ActionConfig.LogicAct;
import st.platform.security.*;
import st.platform.common.*;
import st.platform.control.business.*;
public class GraphActionController {
public static String REQUEST_XML_NAME = "sys_request_xml";
public static String RESPONSE_XML_NAME = "sys_response_xml";
private LogManager logManager;
public String run(HttpSession httpsession, HttpServletRequest httpservletrequest) {
if (Keycode.isPass() == false)
return "";
String reqXml = httpservletrequest.getParameter(REQUEST_XML_NAME);
SQLRequest sqlReq = new SQLRequest();
SQLResponse sqlRes = new SQLResponse();
boolean result = sqlReq.setXMLStr(reqXml);
if ( !result ) {
sqlRes.setResult(true);
sqlRes.setType(0);
sqlRes.setMessage("解析请求XML文件失败,xml=["+reqXml+"]");
return sqlRes.getXmlStr();
}
OperatorManager om = (OperatorManager)httpsession.getAttribute(SystemAttributeNames.USER_INFO_NAME);
if (om==null || om.getOperator() == null){
sqlRes.setResult(false);
sqlRes.setType(0);
sqlRes.setMessage("操作员超时,请重新签到!");
return sqlRes.getXmlStr();
}
logManager = new LogManager(om.getOperator().getOperid(),om.getOperator().getOpername(),om.setRemoteAddr());
int actionCount = sqlReq.getActionCount();
for (int i = 0 ; i < actionCount; i++)
{
try
{
String actionNo = sqlReq.getActionName(i);
LogicAct lact = ActionConfig.getInstance().getActionConfig(actionNo);
//logManager.setMessage("会话操作" + lact.logicClass + "开始");
Class cc = Class.forName(lact.logicClass);
GraphAction act = (GraphAction) cc.newInstance();
act.logManager = logManager;
act.setOperator(om.getOperator());
act.execute(sqlReq.getActionRequest(i), sqlRes);
} catch (Exception e) {
sqlRes.setResult(false);
sqlRes.setType(0);
sqlRes.setMessage("调用类对象出错:"+e.getMessage());
logManager.setError(e);
}
//logManager.setMessage("会话操作结束");
}
return sqlRes.getXmlStr();
}
}
| zyjk | trunk/src/st/platform/control/convert/GraphActionController.java | Java | oos | 2,888 |
package st.platform.control.convert;
import st.platform.db.*;
import java.util.*;
import st.platform.utils.Basic;
public class SQLResponse {
private Vector VectFieldName ;//字段名称每个名称用;隔开
private Vector vectFieldValue;//字段值每个值用;隔开
public static final int MESSAGE_TYPE = 0;
public static final int DATA_TYPE = 1;
public static final int HTML_TYPE = 2;
public static final int SELF_XML_TYPE = 3;
public static final int VALUE_TYPE = 4;
private String fMessage = "";
private int fType = 0;
private boolean fResult = false;
private RecordSet frecordSet = null;
public SQLResponse() {
VectFieldName = new Vector();
vectFieldValue = new Vector();
}
public void setMessage(String message){
fMessage = message;
}
public void setResult(boolean Result){
fResult = Result;
}
public void setType(int type){
fType = type;
}
public void setRecordset(RecordSet recordSet) {
frecordSet = recordSet;
}
public void addField(String name,String value) {
VectFieldName.add(name);
vectFieldValue.add(value);
fType = VALUE_TYPE;
}
public String getXmlStr()
{
StringBuffer StrBuf = new StringBuffer();
try{
StrBuf.append("<root>");
if (fType==1)
{
if (fResult)
{
if (frecordSet != null && frecordSet.next())
{
StrBuf.append("<action type=\"1\" result=\"true\">");
frecordSet.beforeFirst(); //多次取出响应结果
while (frecordSet.next())
{
StrBuf.append("<record> ");
for (int j=0; j<frecordSet.getColumnCount(); j++)
{
StrBuf.append("<field ");
StrBuf.append(" name =\"" + frecordSet.getFieldName(j) + "\"");
StrBuf.append(" type =\"text\"");
StrBuf.append(" value =\"" + Basic.encode(frecordSet.getString(j)) + "\"");
StrBuf.append(" />");
}
StrBuf.append("</record>");
}
StrBuf.append("</action>");
}else
{
StrBuf.append("<action type=\"1\" result=\"false\">"+Basic.encode("无返回结果!")+"</action>");
}
}else
{
StrBuf.append("<action type=\"1\" result=\"false\">"+Basic.encode(fMessage)+"</action>");
}
}
else if ( fType == VALUE_TYPE ) {
StrBuf.append(getfieldValue());
}else if ( fType == MESSAGE_TYPE ){
StrBuf.append("<action type=\""+fType+"\" result=\""+ fResult +"\">"+Basic.encode(fMessage)+"</action>");
}else {
StrBuf.append("<action type=\""+fType+"\" result=\""+ fResult +"\">"+fMessage+"</action>");
}
StrBuf.append("</root>");
} catch ( Exception e ) {
e.printStackTrace();
return "<root><action type=\"0\" result=\"false\">"+Basic.encode("构造XML出错")+"</action></root>";
}
return StrBuf.toString();
}
private String getfieldValue()
{
StringBuffer stringbuffer = new StringBuffer();
if(VectFieldName.size() > 0)
{
stringbuffer.append("<action type=\"1\" result=\"true\">");
stringbuffer.append("<record> ");
for(int i = 0; i < VectFieldName.size(); i++)
{
stringbuffer.append("<field ");
stringbuffer.append(" name =\"" + (String)VectFieldName.get(i) + "\"");
stringbuffer.append(" type =\"text\"");
stringbuffer.append(" value =\"" + Basic.encode((String)vectFieldValue.get(i)) + "\"");
stringbuffer.append(" />");
}
stringbuffer.append("</record>");
stringbuffer.append("</action>");
} else
{
stringbuffer.append("<action type=\"1\" result=\"false\">" + Basic.encode("无记录返回!") + "</action>");
}
return stringbuffer.toString();
}
}
| zyjk | trunk/src/st/platform/control/convert/SQLResponse.java | Java | oos | 5,158 |
package st.platform.control.convert;
import org.jdom.*;
import org.jdom.input.SAXBuilder;
import java.io.*;
import java.util.*;
import st.platform.utils.*;
import st.platform.control.business.*;
import st.platform.db.*;
public class SQLRequest {
private Map ActionRequestNames; /////按名称存放所有行为的信息
private Vector ActionRequestInts; /////存放所有行为的信息
private int ActionCount; ///操作行为个数
private Vector ActionNames; /////存放所有行为的名称
public String ReqXML; /////从客户端获取的XML数据
public SQLRequest() {
ActionRequestNames = new HashMap();
ActionRequestInts = new Vector();
ActionNames = new Vector();
}
////初始化信息 参数 XML字符串
public boolean setXMLStr(String XMLStr) {
boolean retbool = false;
ReqXML = XMLStr;
try {
Reader reader = new StringReader(XMLStr);
SAXBuilder saxbd = new SAXBuilder();
Document doc = saxbd.build(reader);
Element rootNode = doc.getRootElement();
List ActionChildList = rootNode.getChildren();
////取出action 的个数
ActionCount = ActionChildList.size();
for(int i = 0; i < ActionChildList.size(); i++)
{
ActionRequest actionRequest = new ActionRequest();
Element ActionCildNode = (Element)ActionChildList.get(i);
List recorderChildList = ActionCildNode.getChildren();
for(int j = 0; j < recorderChildList.size(); j++)
{
Element recorderChildNode = (Element)recorderChildList.get(j);
List fieldChildList = recorderChildNode.getChildren();
Map recorderTamp = new HashMap();
for(int k = 0; k < fieldChildList.size(); k++)
{
Element fieldChildNode = (Element)fieldChildList.get(k);
FieldRequest fieldRequest = new FieldRequest();
fieldRequest.setName(fieldChildNode.getAttributeValue("name").trim().toLowerCase());
fieldRequest.setType(fieldChildNode.getAttributeValue("type").trim().toLowerCase());
if(fieldChildNode.getAttribute("oldValue") != null)
fieldRequest.setoldValue(DBUtil.toDB(Basic.decode(fieldChildNode.getAttributeValue("oldValue")).trim()));
else
fieldRequest.setoldValue("");
if(fieldChildNode.getAttribute("fieldLable") != null){
fieldRequest.setfieldLable(DBUtil.toDB(Basic.decode(fieldChildNode.getAttributeValue("fieldLable"))));
}
else
fieldRequest.setfieldLable("");
fieldRequest.setValue(DBUtil.toDB(Basic.decode(fieldChildNode.getAttributeValue("value")).trim()));
//填充数据
recorderTamp.put(fieldChildNode.getAttributeValue("name").trim().toLowerCase(), fieldRequest);
}
actionRequest.setRecorderInt(recorderTamp);
actionRequest.setTypeS(recorderChildNode.getAttributeValue("type").trim().toLowerCase());
if(j == 0) {
actionRequest.setRecorder(recorderTamp);
actionRequest.setType(recorderChildNode.getAttributeValue("type").trim().toLowerCase());
}
}
ActionRequestNames.put(ActionCildNode.getAttributeValue("actionname").trim().toLowerCase(), actionRequest);
ActionRequestInts.add(actionRequest);
ActionNames.add(ActionCildNode.getAttributeValue("actionname").trim().toLowerCase());
//////////////添加方法名称
if (ActionCildNode.getAttribute("methodname") != null)
actionRequest.setmethodName(ActionCildNode.getAttributeValue("methodname").trim());
else
actionRequest.setmethodName("");
}
reader.close();
retbool = true;
} catch(Exception ex) {
ex.printStackTrace();
retbool = false;
}
return retbool;
}
///取出行为的个数
public int getActionCount() {
return ActionCount;
}
///取出行为的数据
public ActionRequest getActionRequest(String actionName) {
return(ActionRequest)ActionRequestNames.get(actionName.toLowerCase().trim());
}
///取出行为的数据
public ActionRequest getActionRequest(int index) {
return(ActionRequest)ActionRequestInts.get(index);
}
///取出行为的名称
public String getActionName(int index) {
return(String)ActionNames.get(index);
}
}
| zyjk | trunk/src/st/platform/control/convert/SQLRequest.java | Java | oos | 5,665 |
package st.platform.control;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import st.platform.security.OperatorManager;
import st.platform.utils.Basic;
import st.platform.control.convert.*;
import st.platform.db.control.*;
public class Controller
{
public Controller()
{
}
public static String ecxute(HttpSession httpsession, HttpServletRequest httpservletrequest)
{
ActionController actionController = new ActionController();
return actionController.run(httpsession, httpservletrequest);
}
public static String graphEcxute(HttpSession httpsession, HttpServletRequest httpservletrequest)
{
GraphActionController graphActionController = new GraphActionController();
return graphActionController.run(httpsession, httpservletrequest);
}
public static String table(HttpSession httpsession, HttpServletRequest httpservletrequest)
{
OperatorManager operatormanager = (OperatorManager)httpsession.getAttribute("plat_form_user_info");
if(operatormanager == null || operatormanager.getOperator() == null)
{
return "null";
} else
{
DBXML.webpath = httpservletrequest.getRealPath("");
DBXML dbXML = new DBXML();
String xmnlStr = httpservletrequest.getParameter("tabStr");
return dbXML.getDataTableXML(xmnlStr);
}
}
public static String dropDown(HttpSession httpsession, HttpServletRequest httpservletrequest)
{
DBXML.webpath = httpservletrequest.getRealPath("");
DBXML dbXML = new DBXML();
String xmnlStr = httpservletrequest.getParameter("xx");
return dbXML.getDropDownXML(Basic.decode(xmnlStr));
}
}
| zyjk | trunk/src/st/platform/control/Controller.java | Java | oos | 1,869 |
package st.platform.common;
import java.util.Enumeration;
import javax.servlet.ServletRequest;
import st.platform.security.OperatorManager;
import javax.servlet.http.HttpServletResponse;
public interface SessionContext {
/**
* 设置并保存会话周期(多次请求,从用户建立会话到终止会话)内属性name的值value
* @param name
* @param value
* @roseuid 3F721CA90242
*/
public void setAttribute(String name, Object value);
/**
* 获取会话周期(多次请求,从用户建立会话到终止会话)内属性name的值,不存在返回null
* @param name
* @return Object
* @roseuid 3F721CB10013
*/
public Object getAttribute(String name);
/**
* 删除会话周期(多次请求,从用户建立会话到终止会话)内属性name
* @param name
* @return Object
* @roseuid 3F721CCD012C
*/
public void removeAttribute(String name);
/**
* 获得会话周期内所有属性的名称
* @return String[]
* @roseuid 3F721CDF009B
*/
public Enumeration getAttributeNames();
/**
* 获得会话周期内所有属性的值
* @return Object[]
* @roseuid 3F721CEB0139
*/
public Object[] getAttributes();
/**
* 获取名字name的请求参数的值
* @param name
* @return String
* @roseuid 3F7220D102F7
*/
public String getParameter(String name);
/**
* 设置请求参数name值为value
* @param name
* @param value
* @roseuid 3F7DF45C0077
*/
public void setParameter(String name, String value);
/**
* 获取请求参数name值的values值数组
* @param name
* @return String[]
* @roseuid 3F7220DC01BC
*/
public String[] getParameters(String name);
/**
* 设置请求参数name值为values
* @param name
* @param values
* @roseuid 3F7DF474034C
*/
public void setParameter(String name, String[] values);
/**
* 获得所有请求参数的名称
* @return String[]
* @roseuid 3F7220E90215
*/
public Enumeration getParameterNames();
/**
* 删除请求参数name
* @param name
* @return String
* @roseuid 3F722100036C
*/
public String removeParameter(String name);
/**
* 清空所有的请求参数
* @roseuid 3F7221140393
*/
public void clearParameters();
/**
* 设置要生成FORM的头,生命周期为本次请求
* @param head
* @roseuid 3F722BF602E5
*/
public void setHead(String head);
/**
* 获取FORM的头部信息
* @return String
* @roseuid 3F722C26029E
*/
public String getHead();
/**
* 设置要生成FORM的主体,生命周期为本次请求
* @param body
* @roseuid 3F722C040209
*/
public void setBody(String body);
/**
* 获取FORM的主体
* @return String
* @roseuid 3F722C2E0105
*/
public String getBody();
/**
* 设置要生成FORM的尾部,生命周期为本次请求
* @param tail
* @roseuid 3F722C15019F
*/
public void setTail(String tail);
/**
* 获得FORM的尾部
* @return String
* @roseuid 3F722C3502D2
*/
public String getTail();
/**
* 设置请求属性,生命周期为本次请求
* @param name
* @param value
* @roseuid 3F73B1DE0280
*/
public void setRequestAtrribute(String name, Object value);
/**
* 获得生命周期为本次请求的属性的值
* @param name
* @return Object
* @roseuid 3F73B1F402AA
*/
public Object getRequestAttribute(String name);
/**
* 删除生命周期为本次请求的属性
* @param name
* @return Object
* @roseuid 3F73B2050091
*/
public void removeRequestAttribute(String name);
/**
* 获得生命周期为本次请求的所有属性的名称数组
* @return String[]
* @roseuid 3F73B21802F1
*/
public Enumeration getRequestAttributeNames();
public void update(Object request);
public String getUrl(String path);
public void setSession(Object session);
public void setRequest(Object request);
public String getSysButton();
public void setSysButton(String sysButton);
public String getBeforeHead();
public void setBeforeHead(String beforeHead);
public String getAfterHead();
public void setAfterHead(String afterHead);
public String getAfterBody();
public void setAfterBody(String afterBody);
public String getAfterSysButton();
public void setAfterSysButton(String afterSysButton);
public OperatorManager getUserManager();
public boolean forward();
public boolean needForward();
public void setTarget(String target);
public void setResponse(HttpServletResponse response);
}
| zyjk | trunk/src/st/platform/common/SessionContext.java | Java | oos | 5,143 |
package st.platform.common;
import java.io.Serializable;
import st.platform.utils.Basic;
public class MenuItemBean implements Serializable {
/**
* The nodeid for this node.
*/
private String menuItemId = null;
public String getMenuItemId() {
return(this.menuItemId);
}
/** Defines a isBranch attribute */
private String isLeaf = null;
public String getIsLeaf() {
return(this.isLeaf);
}
public void setIsLeaf(String isLeaf) {
this.isLeaf = isLeaf;
}
/** Defines a label attribute */
private String label = null;
public String getLabel() {
return(this.label);
}
public void setLabel(String label) {
this.label = label;
}
/** Defines a url attribute */
public String url = null;
public String getUrl() {
return(this.url);
}
public void setUrl(String url) {
this.url = url;
}
/** Defines a description */
public String description = null;
public String getDescription() {
return(this.description);
}
public void setDescription(String description) {
this.description = description;
}
///////打开方式 0 ----表示潜入方式;1-----表示弹出方式
private String openwindow ="0";
public String getOpenWindow(){
return this.openwindow;
}
public void setOpenWindow(String openwindow){
this.openwindow = openwindow;
}
private String childcount ="0";
public String getchildcount(){
return this.childcount;
}
public void setchildcount(String childcount){
this.childcount = childcount;
}
////////////如果是弹出方式 则窗体的宽度
private String winWidth="";
public String getwinWidth(){
return this.winWidth;
}
public void setwinWidth(String winWidth){
this.winWidth = winWidth;
}
/////////////如果弹出方式 则窗体的高的
private String winHeight="";
private String targetmachine;
public String getwinHeight(){
return this.winHeight;
}
public void setwinHeight(String winHeight){
this.winHeight = winHeight;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////// Constructors
/**
* Constructor: Creates an empty Node object
*/
public MenuItemBean() {
}
public MenuItemBean(String nodeid) {
super();
this.menuItemId = nodeid;
}
public MenuItemBean(String menuItemId, String label, String isLeaf, String url) {
super();
this.menuItemId = menuItemId;
this.label = label;
this.isLeaf = isLeaf;
this.url = url;
}
public MenuItemBean(String menuItemId, String label, String isLeaf, String url, String description) {
super();
this.menuItemId = menuItemId;
this.label = label;
this.isLeaf = isLeaf;
this.url = url;
this.description = description;
}
public MenuItemBean(String menuItemId, String label, String isLeaf, String url, String description, String openwindow, String winWidth, String winHeight) {
super();
this.menuItemId = menuItemId;
this.label = label;
this.isLeaf = isLeaf;
this.url = url;
this.description = description;
this.openwindow = openwindow;
this.winWidth = winWidth;
this.winHeight = winHeight;
}
public MenuItemBean(String menuItemId, String label, String isLeaf, String url, String description, String openwindow, String winWidth, String winHeight,String targetmachine,String childcount) {
super();
this.menuItemId = menuItemId;
this.label = label;
this.isLeaf = isLeaf;
this.url = url;
this.description = description;
this.openwindow = openwindow;
this.winWidth = winWidth;
this.winHeight = winHeight;
this.targetmachine = targetmachine;
this.childcount = childcount;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Return a String representation of this object.
*/
public String convertToString()
throws Exception {
StringBuffer StrBuf = new StringBuffer("<record>");
StrBuf.append("<field ");
StrBuf.append(" name = \"text\"");
StrBuf.append(" type =\"text\"");
StrBuf.append(" value =\"" +Basic.encode(label) + "\"");
StrBuf.append(" />");
StrBuf.append("<field ");
StrBuf.append(" name =\"action\"");
StrBuf.append(" type =\"text\"");
StrBuf.append(" value =\"" + Basic.encode(url.trim()) + "\"");
StrBuf.append(" />");
StrBuf.append("<field ");
StrBuf.append(" name = \"title\"");
StrBuf.append(" type =\"text\"");
StrBuf.append(" value =\"" + Basic.encode(description) + "\"");
StrBuf.append(" />");
StrBuf.append("<field ");
StrBuf.append(" name = \"openwin\"");
StrBuf.append(" type =\"text\"");
StrBuf.append(" value =\"" + openwindow + "\"");
StrBuf.append(" />");
StrBuf.append("<field ");
StrBuf.append(" name = \"winwidth\"");
StrBuf.append(" type =\"text\"");
StrBuf.append(" value =\"" + winWidth + "\"");
StrBuf.append(" />");
StrBuf.append("<field ");
StrBuf.append(" name = \"winheight\"");
StrBuf.append(" type =\"text\"");
StrBuf.append(" value =\"" + winHeight + "\"");
StrBuf.append(" />");
StrBuf.append("<field ");
StrBuf.append(" name = \"childcount\"");
StrBuf.append(" type =\"text\"");
StrBuf.append(" value =\"" + childcount + "\"");
StrBuf.append(" />");
StrBuf.append("<field ");
StrBuf.append(" name = \"menuItemId\"");
StrBuf.append(" type =\"text\"");
StrBuf.append(" value =\"" + Basic.encode(menuItemId) + "\"");
StrBuf.append(" />");
StrBuf.append("</record>");
return (StrBuf.toString());
}
/** /////////////////////////////////////////////////////////////////////////////////////////////////////////// */
private String specialCodeTranslate(String codeToBeTrans) {
String codeAfterTrans = "";
// 先转换&;后转换其他的符号。
codeAfterTrans = codeToBeTrans.replaceAll("&", "&");
codeAfterTrans = codeAfterTrans.replaceAll("<", "<");
codeAfterTrans = codeAfterTrans.replaceAll(">", ">");
// 先转换双引号;后转换单引号。
codeAfterTrans = codeAfterTrans.replaceAll("\"", """); //
codeAfterTrans = codeAfterTrans.replaceAll("'", "'");
return codeAfterTrans;
}
public String getTargetmachine() {
return targetmachine;
}
public void setTargetmachine(String targetmachine) {
this.targetmachine = targetmachine;
}
}
| zyjk | trunk/src/st/platform/common/MenuItemBean.java | Java | oos | 7,672 |
package st.platform.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.ConnectionManager;
import st.platform.db.DBUtil;
import st.platform.db.DatabaseConnection;
import st.platform.db.RecordSet;
public class DatabaseAgent {
DBUtil dbut = new DBUtil();
/**
* Retrieve all the basic information of a Operator, Except password.
* @param operid
* @return Map which includes all the basic info in a HashMap with Key & Value pare.
* @throws java.lang.Exception
*/
public Map getBasicOfOperator(String operatorId)
throws Exception {
if(operatorId == null) {
return null;
}
String SQL_getBasicOfOperator = "" +
"SELECT * " +
"FROM ptoper " +
"WHERE operid = '" + operatorId + "'";
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
try {
cm = ConnectionManager.getInstance();
dc = cm.get();
rs = dc.executeQuery(SQL_getBasicOfOperator);
} catch(Exception ex) {
System.err.println("Wrong, when data retrieving. Place zt.platform.security.DatabaseAgent.getBasicOfOperator(String operid). [" + ex + "] ");
}
String nameOfOperator = null;
String idOfOperator = null;
String departmentId = null;
String isSuper = null;
String operatorType = null;
String sexOfOperator = null;
String emailOfOperator = null;
String mobilePhone = null;
String operatorPhone = null;
String otherPhone = null;
String enabledOfOperator = null;
String combinedSequence = null;
String isCombined = null;
int statusOfOperator = 0;
if (rs == null)
rs = new RecordSet();
if(!rs.next()) {
return null;
} else {
try {
if(rs.getString("opername") != null) {
nameOfOperator = rs.getString("opername").trim();
} else {
nameOfOperator = "";
}
if(rs.getString("operid") != null) {
idOfOperator = rs.getString("operid").trim();
} else {
idOfOperator = "";
}
if(rs.getString("deptid") != null) {
departmentId = rs.getString("deptid").trim();
} else {
departmentId = "";
}
if(rs.getString("issuper") != null) {
isSuper = rs.getString("issuper").trim();
} else {
isSuper = "";
}
if(rs.getString("opertype") != null) {
operatorType = rs.getString("opertype").trim();
} else {
operatorType = "";
}
if(rs.getString("mobilephone") != null) {
mobilePhone = rs.getString("mobilephone").trim();
} else {
mobilePhone = "";
}
if(rs.getString("operphone") != null) {
operatorPhone = rs.getString("operphone").trim();
} else {
operatorPhone = "";
}
if(rs.getString("otherphone") != null) {
otherPhone = rs.getString("otherphone").trim();
} else {
otherPhone = "";
}
if(rs.getString("cmbtxnseq") != null) {
combinedSequence = rs.getString("cmbtxnseq").trim();
} else {
combinedSequence = "";
}
if(rs.getString("iscmbend") != null) {
isCombined = rs.getString("iscmbend").trim();
} else {
isCombined = "";
}
if(rs.getString("sex") != null) {
sexOfOperator = rs.getString("sex").trim();
} else {
sexOfOperator = "";
}
if(rs.getString("email") != null) {
emailOfOperator = rs.getString("email").trim();
} else {
emailOfOperator = "";
}
if(rs.getString("operenabled") != null) {
enabledOfOperator = rs.getString("operenabled").trim();
} else {
enabledOfOperator = "";
}
rs.close();
cm.release();
} catch(Exception ex1) {
System.err.println("Wrong, when getting data from RecordSet. Place zt.platform.security.DatabaseAgent.getBasicOfOperator(String operid). ["+ ex1 + "] ");
}
Map basicInfo = new HashMap();
basicInfo.put("opnm", nameOfOperator);
basicInfo.put("opid", idOfOperator);
basicInfo.put("sexo", sexOfOperator);
basicInfo.put("emai", emailOfOperator);
basicInfo.put("enab", enabledOfOperator);
basicInfo.put("issu", isSuper);
basicInfo.put("depi", departmentId);
basicInfo.put("otyp", operatorType);
basicInfo.put("mobp", mobilePhone);
basicInfo.put("opep", operatorPhone);
basicInfo.put("othp", otherPhone);
basicInfo.put("comb", combinedSequence);
basicInfo.put("isco", isCombined);
return basicInfo;
}
}
public static void raoluan1()
{
Keycode keycode = new Keycode();
DatabaseAgent databaseAgent = new DatabaseAgent();
Keycode.dateKey = keycode.encodeKeyDate();
Keycode.projectKey = databaseAgent.encodeStr3();
}
/**
* Looks up a operator's password.
*
* @param operator A String containing the operator's name.
*
* @return A String containing the operator's password.
*
* @throws NotFoundException if the operator does not exist.
*/
public String getPasswordOfOperator(String operatorId)
throws Exception {
// ������Ա�����ڣ���false��
if(operatorId == null) {
return null;
}
String SQL_GetPasswordOfOperator = "" +
"SELECT operpasswd " +
"FROM ptoper " +
"WHERE operid = '" + operatorId + "'";
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
try {
cm = ConnectionManager.getInstance();
dc = cm.get();
rs = dc.executeQuery(SQL_GetPasswordOfOperator);
} catch(Exception ex) {
System.err.println("Wrong, when data retrieving. Place zt.platform.security.DatabaseAgent.getPasswordOfOperator(String operid). [" +ex + "] ");
}
// ������벻���ڣ�����null�����������ڣ������롣
String passwordOfOperator = null;
if (rs == null)
rs = new RecordSet();
if(!rs.next()) {
return null;
} else {
try {
passwordOfOperator = rs.getString("operpasswd").trim();
rs.close();
cm.release();
} catch(Exception ex1) {
System.err.println("Wrong, when getting data from RecordSet. Place zt.platform.security.DatabaseAgent.getPasswordOfOperator(String operid). [" +ex1 + "] ");
}
return passwordOfOperator;
}
}
/**
* ͨ��operid�õ��ò���Ա��operid��
* @param operid
* @return
* @throws java.lang.Exception
*/
public String getOperatorIdOfOperator(String operatorId)
throws Exception {
String SQL_GetOperatorIdOfOperator = "" +
"SELECT operid " +
"FROM ptoper u " +
"WHERE operid='" + operatorId + "'";
String operatorIdOfOperator = null;
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
try {
cm = ConnectionManager.getInstance();
dc = cm.get();
rs = dc.executeQuery(SQL_GetOperatorIdOfOperator);
if (rs == null)
rs = new RecordSet();
while(rs.next()) {
if(rs.getString("operid") != null) {
operatorIdOfOperator = rs.getString("operid").trim();
} else {
operatorIdOfOperator = "";
}
}
rs.close();
cm.release();
} catch(Exception ex) {
System.err.println("Wrong, when data retrieving. Place zt.platform.security.DatabaseAgent.getUserIdOfOperator(String operid) [" + ex+ "] ");
}
return operatorIdOfOperator;
}
/**
*
* @return
* @throws java.lang.Exception
*/
public String[] getRoleIdsOfOperator(String operatorId)
throws Exception {
String SQL_GetRolesOfOperator = "" +
"SELECT roleid " +
"FROM ptoperrole r " +
"WHERE operid='" + operatorId + "'";
String[] roleIdsOfOperator = null;
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
try {
cm = ConnectionManager.getInstance();
dc = cm.get();
rs = dc.executeQuery(SQL_GetRolesOfOperator);
if (rs == null)
rs = new RecordSet();
List listTemp = new ArrayList();
while(rs.next()) {
String roleId = null;
if(rs.getString("roleid") != null) {
roleId = rs.getString("roleid").trim();
} else {
roleId = "";
}
listTemp.add(roleId);
}
roleIdsOfOperator = new String[listTemp.size()];
for(int i = 0; i < listTemp.size(); i++) {
roleIdsOfOperator[i] = listTemp.get(i).toString();
}
rs.close();
cm.release();
} catch(Exception ex) {
System.err.println("Wrong, when data retrieving. Place zt.platform.security.DatabaseAgent.getRoleIdsOfOperator(String operid) [" +ex + "] ");
}
return roleIdsOfOperator;
}
// /**
// * The method is not enabled in this edition.
// * @param roleId
// */
// public String getResourcesOfRole(String roleId)
// throws Exception {
//
// String SQL_GetResourcesOfRole = null;
//
// return new String();
// }
/**
* ����operid�õ��ò���Ա����ʹ�õ�Resource Object��Map
* @param operid
* @return
* @throws java.lang.Exception
*/
public Map getResourcesOfOperator(String operatorId)
throws Exception {
String SQL_GetResourcesOfOperator = "" +
"SELECT distinct " +
"rs.resid AS resid, " +
"rs.resname AS res, " +
"rs.restype AS tp " +
"FROM ptoperrole ur, " +
"ptroleres rr, " +
"ptresource rs " +
"WHERE ur.operid='" + operatorId + "' " +
"and rr.roleid=ur.roleid " +
"and rs.resid=rr.resid " +
"and rs.resenabled='1'";
Map resources = null;
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
try {
cm = ConnectionManager.getInstance();
dc = cm.get();
rs = dc.executeQuery(SQL_GetResourcesOfOperator);
if (rs == null)
rs = new RecordSet();
resources = new HashMap();
while(rs.next()) {
String resourceId = null;
if(rs.getString("resid") != null) {
resourceId = rs.getString("resid").trim();
} else {
resourceId = "";
}
String resource = null;
if(rs.getString("res") != null) {
resource = rs.getString("res").trim();
} else {
resource = "";
}
int restype = rs.getInt("tp");
}
rs.close();
cm.release();
} catch(Exception ex) {
System.err.println("Wrong, when data retrieving. Place zt.platform.security.DatabaseAgent.getResourcesOfOperator(String operid) [" +ex + "] ");
}
return resources;
}
/**
*
* @param operid
* @return
* @throws java.lang.Exception
*/
public List getResourceIdsOfOperator(String operatorId)
throws Exception {
String SQL_GetResourcesOfOperator = "" +
"SELECT distinct rs.resid " +
"FROM ptoperrole rl, " +
"ptroleres rr, " +
"ptresource rs, " +
"WHERE rl.operid='"+operatorId+"' " +
"and rr.roleid=rl.roleid " +
"and rs.resid=rl.resid " +
"and rs.resenabled='1'";
List resourceIdsOfOperator = null;
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
try {
cm = ConnectionManager.getInstance();
dc = cm.get();
rs = dc.executeQuery(SQL_GetResourcesOfOperator);
if (rs == null)
rs = new RecordSet();
resourceIdsOfOperator = new ArrayList();
while(rs.next()) {
String resourceId = null;
if(rs.getString("resid") != null) {
resourceId = rs.getString("resid").trim();
} else {
resourceId = "";
}
resourceIdsOfOperator.add(resourceId);
}
rs.close();
cm.release();
} catch(Exception ex) {
System.err.println("Wrong, when data retrieving. Place zt.platform.security.DatabaseAgent.getResourceIdsOfOperator(String operid). [" + ex + "] ");
}
return resourceIdsOfOperator;
}
/**
* Determines if a operator exists.
*
* @param operator A String containing the operator's name.
* @return A boolean. true if the operator exists, false otherwise.
*/
public boolean isOperatorExistent(String operatorId) {
if(operatorId == null) {
return false;
}
String SQL_GetAnOperatorId = "" +
"SELECT operid " +
"FROM ptoper " +
"WHERE operid='" + operatorId + "'";
String operatorIdGetFromDB = null;
ConnectionManager cm;
DatabaseConnection dc;
RecordSet rs = null;
try {
cm = ConnectionManager.getInstance();
dc = cm.get();
rs = dc.executeQuery(SQL_GetAnOperatorId);
if (rs == null)
rs = new RecordSet();
if(!rs.next()) {
return false;
}
operatorIdGetFromDB = rs.getString("operid").trim();
rs.close();
cm.release();
} catch(Exception ex) {
System.err.println("Wrong, when data retrieving. Place zt.platform.security.DatabaseAgent.isOperatorExistent(String operid). [" +ex + "] ");
}
if(operatorId.equals(operatorIdGetFromDB)) {
return true;
} else {
return false;
}
}
// /**
// * Determines if a operator's password exists.
// *
// * @param operator A String containing the operator's name.
// * @return A boolean. true if the operator exists, false otherwise.
// */
// public boolean isPasswordExistent(String operid) {
//
// // ������Ա�����ڣ���false��
// if(operid == null) {
// return false;
// }
//
// String SQL_GetPassworOfOperator = "" +
// "SELECT operpasswd " +
// "FROM ptoper " +
// "WHERE operid = '"+operid+"'";
//
// ConnectionManager cm = ConnectionManager.getInstance();
// DatabaseConnection dc = cm.get();
// RecordSet rs = dc.executeQuery(SQL_GetPassworOfOperator);
// if(!rs.next()) {
// return false;
// } else {
// return true;
// }
// rs.close();
// cm.release();
// String passwordOfOperator = rs.getString("password").trim();
// if(operid.equals(operidGetFromDB)) {
// return true;
// } else {
// return false;
// }
// }
/**
*
* @param operid
* @param roleId
* @return
* @throws java.lang.Exception
*/
public boolean isOperatorInRole(String operatorId, String roleId)
throws Exception {
String SQL_GetRolesOfOperator = "" +
"SELECT roleid AS roleid " +
"FROM ptoperrole, " +
"WHERE operid='" + operatorId + "' ";
List roleIdsOfOperator = null;
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
try {
cm = ConnectionManager.getInstance();
dc = cm.get();
rs = dc.executeQuery(SQL_GetRolesOfOperator);
if (rs == null)
rs = new RecordSet();
roleIdsOfOperator = new ArrayList();
while(rs.next()) {
String ri = null;
if(rs.getString("roleid") != null) {
ri = rs.getString("roleid").trim();
} else {
ri = "";
}
roleIdsOfOperator.add(ri);
}
rs.close();
cm.release();
} catch(Exception ex) {
System.err.println("Wrong, when data retrieving. Place zt.platform.security.DatabaseAgent.isOperatorInRole(String operid, String roleId). [" +ex + "] ");
}
if(roleIdsOfOperator.contains(roleId)) {
return true;
} else {
return false;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////// Public Methods
/**
* ����operid��nodesLevel֮�͵õ�������Ա��ijһ���ϵ����е�Node Object Array��
*
* 1���õ��ò���Ա�����н�ɫid��
* 2�����roleid����ptroleresource�еõ�����"where restype=4"��resid�����õ��˸ò���Ա�����е�menuid
* 3����ptresource��ȡ��restype=4����resid�ķ�Χ����allResourcesForThisOperator�е�resid��
* 4����������resid����ptmenuͨ��where level='"+nodesLevel+"'�õ���һ��ָ��level�ϵ�����menuid��
* 5���4θ��ÿһ��menuid��ptmenu����ȡ����Ӧ��label��url��isleaf����ֵ�ֱ�Node object�е�String label, String url, String isleaf������ÿ��Node Object��
* 6������һ��Node Object��Array���Ѹò���Ա��ӵ�е����е�Node���Ž�ȥ�����ء���ɡ�
*
* @param operid ����ԱID������Loged In���Ǹ����Ա��
* @param nodesLevel ��Ҫ�õ���Menu Item�IJ㼶��
* @return Node] ����һ��ò㼶�ϸò���Ա����Node Oject��һ��Array��
*/
public MenuItemBean[] getMenuItems(String operatorId, int menuItemsLevel)
throws Exception {
String SQL_GetMenuItemsForAnOperator = "" +
"SELECT distinct " +
"m.menuid AS menuItemId, " +
"m.menulabel AS menuItemLabel, " +
"m.isleaf AS menuItemIsLeaf, " +
"m.menuaction AS menuItemUrl, " +
"m.menudesc AS menuItemDescription, "+
"m.OpenWindow AS menuItemOpenWindow, " +
"m.WindowWidth AS menuItemWindowWidth, " +
"m.WindowHeight AS menuItemWindowHeight, m.Levelidx,m.targetmachine "+
",(select count(ptmenu.MENULABEL) FROM ptoperrole, ptroleres , ptresource , ptmenu " +
"WHERE ptoperrole.operid = '" + operatorId + "' and ptroleres.roleid =ptoperrole.roleid and " +
"ptresource.resid = ptroleres.resid and ptresource.restype = '4' and " +
"rtrim(ptmenu.menuid) = ptresource.resname and ptmenu.menulevel = "+(menuItemsLevel+1)+" and ptmenu.PARENTMENUID=m.MENUID) as childcount" +
" FROM ptoperrole r, " +
"ptroleres rs, " +
"ptresource s, " +
"ptmenu m " +
"WHERE r.operid = '" + operatorId + "' " +
"and rs.roleid = r.roleid " +
"and s.resid = rs.resid " +
"and s.restype = '4' " +
"and rtrim(m.menuid) = s.resname " +
"and m.menulevel = " + menuItemsLevel +" order by m.Levelidx";
MenuItemBean[] menuItemsForThisOperator = null;
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
try {
cm = ConnectionManager.getInstance();
// dc = cm.get();
dc = cm.get();
rs = dc.executeQuery(SQL_GetMenuItemsForAnOperator);
if (rs == null)
rs = new RecordSet();
List listTemp = new ArrayList();
while(rs.next()) {
String menuItemId = null;
if(rs.getString("menuItemId") != null) {
menuItemId = rs.getString("menuItemId").trim();
} else {
menuItemId = "";
}
String menuItemLabel = null;
if(rs.getString("menuItemLabel") != null) {
menuItemLabel = rs.getString("menuItemLabel").trim();
} else {
menuItemLabel = "";
}
String menuItemIsLeaf = null;
if(rs.getString("menuItemIsLeaf") != null) {
menuItemIsLeaf = rs.getString("menuItemIsLeaf").trim();
} else {
menuItemIsLeaf = "";
}
String menuItemUrl = null;
if(rs.getString("menuItemUrl") != null) {
menuItemUrl = rs.getString("menuItemUrl").trim();
} else {
menuItemUrl = "#";
}
String menuItemDescription = null;
if(rs.getString("menuItemDescription") != null) {
menuItemDescription = rs.getString("menuItemDescription").trim();
} else {
menuItemDescription = "#";
}
String menuItemOpenWindow = "0";
if(rs.getString("menuItemOpenWindow") != null) {
menuItemOpenWindow = rs.getString("menuItemOpenWindow").trim();
} else {
menuItemOpenWindow = "0";
}
String menuItemWindowWidth = "0";
if(rs.getString("menuItemWindowWidth") != null) {
menuItemWindowWidth = rs.getString("menuItemWindowWidth").trim();
} else {
menuItemWindowWidth = "0";
}
String menuItemWindowHeight = "0";
if(rs.getString("menuItemWindowHeight") != null) {
menuItemWindowHeight = rs.getString("menuItemWindowHeight").trim();
} else {
menuItemWindowHeight = "0";
}
String targetmachine = "";
if(rs.getString("targetmachine") != null) {
targetmachine = rs.getString("targetmachine").trim();
} else {
targetmachine = "";
}
String childcount = "";
if(rs.getString("childcount") != null) {
childcount = rs.getString("childcount").trim();
} else {
childcount = "";
}
listTemp.add(new MenuItemBean(menuItemId, menuItemLabel, menuItemIsLeaf, menuItemUrl, menuItemDescription,menuItemOpenWindow,menuItemWindowWidth,menuItemWindowHeight,targetmachine,childcount));
}
menuItemsForThisOperator = new MenuItemBean[listTemp.size()];
for(int i = 0; i < listTemp.size(); i++) {
menuItemsForThisOperator[i] = (MenuItemBean)listTemp.get(i);
}
rs.close();
//cm.release();
} catch(Exception ex) {
System.err.println("Wrong, when data retrieving. Place zt.platform.security.DatabaseAgent.getMenuItems(String operid, int menuItemsLevel). [" +ex + "] ");
}
return menuItemsForThisOperator;
}
/**
* getMenuItems()����һ����ʽ��
* ����һ��parentId�������ڷǵ�һ��MenuItem��
*
* @param operid
* @param nodesLevel
* @param parentid
* @return
*/
public MenuItemBean[] getMenuItems(String operatorId, int menuItemsLevel, String parentId) {
String SQL_GetMenuItemsForAnOperator = "" +
"SELECT distinct " +
"m.menuid AS menuItemId, " +
"m.menulabel AS menuItemLabel, " +
"m.isleaf AS menuItemIsLeaf, " +
"m.menuaction AS menuItemUrl, " +
"m.menudesc AS menuItemDescription, "+
"m.OpenWindow AS menuItemOpenWindow, " +
"m.WindowWidth AS menuItemWindowWidth, " +
"m.WindowHeight AS menuItemWindowHeight, m.Levelidx,m.targetmachine "+
",(select count(ptmenu.MENULABEL) FROM ptoperrole, ptroleres , ptresource , ptmenu " +
"WHERE ptoperrole.operid = '" + operatorId + "' and ptroleres.roleid =ptoperrole.roleid and " +
"ptresource.resid = ptroleres.resid and ptresource.restype = '4' and " +
"rtrim(ptmenu.menuid) = ptresource.resname and ptmenu.menulevel = "+(menuItemsLevel+1)+" and ptmenu.PARENTMENUID=m.MENUID) as childcount" +
" FROM ptoperrole r, " +
"ptroleres rs, " +
"ptresource s, " +
"ptmenu m " +
"WHERE r.operid = '" + operatorId + "' " +
"and rs.roleid = r.roleid " +
"and s.resid = rs.resid " +
"and s.restype = '4' " +
"and rtrim(m.menuid) = s.resname " +
"and m.menulevel = " + menuItemsLevel + " " +
"and m.parentmenuid = '" + parentId + "' order by m.Levelidx";
MenuItemBean[] menuItemsForThisOperator = null;
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
try {
cm = ConnectionManager.getInstance();
// dc = cm.get();
dc = cm.get();
rs = dc.executeQuery(SQL_GetMenuItemsForAnOperator);
if (rs == null)
rs = new RecordSet();
List listTemp = new ArrayList();
while(rs.next()) {
String menuItemId = null;
if(rs.getString("menuItemId") != null) {
menuItemId = rs.getString("menuItemId").trim();
} else {
menuItemId = "";
}
String menuItemLabel = null;
if(rs.getString("menuItemLabel") != null) {
menuItemLabel = rs.getString("menuItemLabel").trim();
} else {
menuItemLabel = "";
}
String menuItemIsLeaf = null;
if(rs.getString("menuItemIsLeaf") != null) {
menuItemIsLeaf = rs.getString("menuItemIsLeaf").trim();
} else {
menuItemIsLeaf = "";
}
String menuItemUrl = null;
if(rs.getString("menuItemUrl") != null) {
menuItemUrl = rs.getString("menuItemUrl").trim();
} else {
menuItemUrl = "#";
}
String menuItemDescription = null;
if(rs.getString("menuItemDescription") != null) {
menuItemDescription = rs.getString("menuItemDescription").trim();
} else {
menuItemDescription = "#";
}
String menuItemOpenWindow = "0";
if(rs.getString("menuItemOpenWindow") != null) {
menuItemOpenWindow = rs.getString("menuItemOpenWindow").trim();
} else {
menuItemOpenWindow = "0";
}
String menuItemWindowWidth = "0";
if(rs.getString("menuItemWindowWidth") != null) {
menuItemWindowWidth = rs.getString("menuItemWindowWidth").trim();
} else {
menuItemWindowWidth = "0";
}
String menuItemWindowHeight = "0";
if(rs.getString("menuItemWindowHeight") != null) {
menuItemWindowHeight = rs.getString("menuItemWindowHeight").trim();
} else {
menuItemWindowHeight = "0";
}
String targetmachine = "";
if(rs.getString("targetmachine") != null) {
targetmachine = rs.getString("targetmachine").trim();
} else {
targetmachine = "";
}
String childcount = "";
if(rs.getString("childcount") != null) {
childcount = rs.getString("childcount").trim();
} else {
childcount = "";
}
MenuItemBean aMenuItem = new MenuItemBean(menuItemId, menuItemLabel, menuItemIsLeaf, menuItemUrl, menuItemDescription,menuItemOpenWindow,menuItemWindowWidth,menuItemWindowHeight,targetmachine,childcount);
listTemp.add(aMenuItem);
}
menuItemsForThisOperator = new MenuItemBean[listTemp.size()];
for(int i = 0; i < listTemp.size(); i++) {
menuItemsForThisOperator[i] = (MenuItemBean)listTemp.get(i);
}
rs.close();
//cm.release();
} catch(Exception ex) {
System.err.println("Wrong, when data retrieving. Place zt.platform.security.DatabaseAgent.getMenuItems(String operid, int menuItemsLevel, String parentId). [" +ex + "] ");
}
return menuItemsForThisOperator;
}
/**
*
* @param operatorName
* @param url
* @return
* @throws java.lang.Exception
*/
public boolean checkUrl(String operatorId,String url)
throws Exception {
String SQL_GetMenuItemsForAnOperator = "" +
"SELECT " +
"m.menuaction AS action " +
"FROM ptoperrole r, " +
"ptroleres rs, " +
"ptresource s, " +
"ptmenu m " +
"WHERE r.operid = '" + operatorId + "' " +
"and rs.roleid = r.roleid " +
"and s.resid = rs.resid " +
"and s.restype = '4' " +
"and m.menuid = s.resname " +
"and m.menuaction like '%"+url+"%' ";
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
boolean checkpass = false;
try {
cm = ConnectionManager.getInstance();
dc = cm.get();
rs = dc.executeQuery(SQL_GetMenuItemsForAnOperator);
if (rs == null)
rs = new RecordSet();
if ( rs.next() ) {
checkpass = true;
}
rs.close();
cm.release();
} catch(Exception ex) {
System.err.println("Wrong, when data check. Place zt.platform.security.DatabaseAgent.checkUrl(String operid, String url). [" +ex + "] ");
}
return checkpass;
}
/* ��������jsp���͵���Դ��URL��Ϣ
*
*
*/
public ArrayList getAllUrlInfoOfOperator(String operatorId) throws Exception{
ArrayList al = null;
String SQL_getAllUrlInfoOfOperator = "" +
"select distinct a.menuaction " +
"from ptmenu a," +
"ptoperrole r," +
"ptroleres rs," +
"ptresource s " +
"where rtrim(a.menuid) = rtrim(s.RESNAME) " +
"and rtrim(s.RESID)=rtrim(rs.RESID) " +
"and rtrim(rs.ROLEID)=rtrim(r.ROLEID) " +
"and rtrim(r.OPERID) = '" + operatorId + "' " +
"and a.ISLEAF = 1 " +
"union all " +
"select s.RESNAME " +
"from ptoperrole r," +
"ptroleres rs," +
"ptresource s " +
"where rtrim(s.RESID)=rtrim(rs.RESID) " +
"and rtrim(rs.ROLEID)=rtrim(r.ROLEID) " +
"and rtrim(r.OPERID) = '" + operatorId + "' " +
"and s.restype = '2' ";
ConnectionManager cm = null;
DatabaseConnection dc = null;
RecordSet rs = null;
//System.out.println("SQL_getAllUrlInfoOfOperator"+ SQL_getAllUrlInfoOfOperator);
try {
cm = ConnectionManager.getInstance();
dc = cm.get();
rs = dc.executeQuery(SQL_getAllUrlInfoOfOperator);
if (rs == null)
rs = new RecordSet();
al = new ArrayList();
while ( rs.next() ) {
al.add(rs.getString(0));
}
} catch(Exception ex) {
ex.printStackTrace();
throw new Exception("����(DatabaseAgent:getAllUrlInfoOfOperator):" + ex.getMessage());
}
finally{
rs.close();
cm.release();
}
return al;
}
public String encodeStr3()
{
char[] keyBytes = Keycode.encodeStr2().toCharArray();
String enKeyStr = "";
for (int i=0; i< keyBytes.length; i++)
{
enKeyStr = enKeyStr + java.lang.Long.toHexString(keyBytes[i]);
}
return enKeyStr;
}
}
| zyjk | trunk/src/st/platform/common/DatabaseAgent.java | Java | oos | 38,218 |
package st.platform.common;
import st.platform.utils.*;
import java.io.*;
import java.util.GregorianCalendar;
public class LogManager {
private String fOperid ="";
private String fOperName ="";
private String fClientIP ="";
private boolean fisdebug;
private boolean fisMessage;
private boolean fisSql;
private boolean fisError;
private int fdelDays;
private int fLogType;
private String fLogMsg;
private Exception fLogExp;
public static String fwebpath = "";
public LogManager(String operid,String operName,String ClientIP)
{
fOperid = operid;
fOperName = operName;
fClientIP = ClientIP;
try
{
fisdebug = Basic.IsTrue(Config.getProperty("isdebug"));
fisMessage = Basic.IsTrue(Config.getProperty("isMessage"));
fisSql = Basic.IsTrue(Config.getProperty("isSql"));
fisError = Basic.IsTrue(Config.getProperty("isError"));
fdelDays = Basic.getInt(Config.getProperty("delDays"));
delFile();
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
public void setMessage(String msgStr)
{
fLogMsg = msgStr;
fLogType = 1;
writeLog();
}
public void setSql(String sqlStr)
{
fLogMsg = sqlStr;
fLogType = 2;
writeLog();
}
public void setError(String errorStr)
{
fLogMsg = errorStr;
fLogType = 3;
writeLog();
}
public void setError(Exception LogExp)
{
fLogExp = LogExp;
fLogType = 4;
writeLog();
}
private void writeLog()
{
try
{
GregorianCalendar gregoriancalendar = new GregorianCalendar();
String monthStr = "";
String dateStr = "";
if(gregoriancalendar.get(GregorianCalendar.MONTH) + 1 < 10)
monthStr = "0" + (gregoriancalendar.get(GregorianCalendar.MONTH) + 1);
else
monthStr = (new StringBuffer(String.valueOf(gregoriancalendar.get(GregorianCalendar.MONTH) + 1))).toString();
if(gregoriancalendar.get(GregorianCalendar.DATE) < 10)
dateStr = "0" + gregoriancalendar.get(GregorianCalendar.DATE);
else
dateStr = gregoriancalendar.get(GregorianCalendar.DATE) + "";
String fileName = gregoriancalendar.get(GregorianCalendar.YEAR) + monthStr + dateStr;
FileOutputStream fileoutputstream = new FileOutputStream(fwebpath + "/message/log/" + fileName + ".txt", true);
String logTitle = "******操作时间:" + BusinessDate.getTodaytime();
if(fOperName!= null && !fOperName.equals(""))
logTitle = logTitle + "操作员:" + fOperName + "(" + fOperid + ")";
if(fClientIP!= null && !fClientIP.equals(""))
logTitle = logTitle + "客户端地址:" + fClientIP;
fileoutputstream.write((logTitle + "*********\n").getBytes());
if(fLogType == 1 && fisMessage)
fileoutputstream.write(("记录信息日志:" + fLogMsg + "\n").getBytes());
if(fLogType == 2 && fisSql)
fileoutputstream.write(("记录db日志:" + fLogMsg + "\n").getBytes());
if(fLogType == 3 && fisError)
fileoutputstream.write(("记录错误日志:" + fLogMsg + "\n").getBytes());
if(fLogType == 4 && fisError)
{
fileoutputstream.write(("*************记录错误日志" + fLogExp.getMessage() + "*************************\n").getBytes());
for(int i = 0; i < fLogExp.getStackTrace().length; i++)
fileoutputstream.write((fLogExp.getStackTrace()[i].toString() + "\n").getBytes());
if(fisdebug)
{
System.out.println(logTitle);
fLogExp.printStackTrace();
}
}
if(fLogType != 4 && fisdebug)
{
System.out.println(logTitle);
System.out.println(fLogMsg);
System.out.println(" ");
}
fileoutputstream.write("\n".getBytes());
fileoutputstream.flush();
fileoutputstream.close();
}catch(Exception exception)
{
exception.printStackTrace();
}
}
private void delFile()
{
File file = new File(fwebpath + "/message");
if(!file.exists())
file.mkdir();
file = new File(fwebpath + "/message/log");
if(!file.exists())
file.mkdir();
GregorianCalendar gregoriancalendar = new GregorianCalendar();
String monthStr = "";
String dateStr = "";
if(gregoriancalendar.get(GregorianCalendar.MONTH) + 1 < 10)
monthStr = "0" + (gregoriancalendar.get(GregorianCalendar.MONTH) + 1);
else
monthStr = (new StringBuffer(String.valueOf(gregoriancalendar.get(GregorianCalendar.MONTH) + 1))).toString();
if(gregoriancalendar.get(GregorianCalendar.DATE) < 10)
dateStr = "0" + gregoriancalendar.get(GregorianCalendar.DATE);
else
dateStr = gregoriancalendar.get(GregorianCalendar.DATE) + "";
String fileName = gregoriancalendar.get(GregorianCalendar.YEAR) + monthStr + dateStr;
file = new File(fwebpath + "/message/log");
File afile[] = file.listFiles();
//System.out.println("文件 " + fileName);
for(int i = 0; i < afile.length; i++)
{
//System.out.println("文件 1" + afile[i].getName());
if(afile[i].isFile() && afile[i].exists() && Integer.parseInt(fileName) - Integer.parseInt(afile[i].getName().substring(0, afile[i].getName().length() - 4)) >= fdelDays)
afile[i].delete();
}
}
}
| zyjk | trunk/src/st/platform/common/LogManager.java | Java | oos | 6,727 |
package st.platform.common;
import java.io.InputStream;
import java.util.List;
import org.jdom.*;
import org.jdom.input.SAXBuilder;
public class XMLConfig {
private static String propsXML = "/oryx.xml";
private Element rootNode =null;
public XMLConfig()
{
try
{
intConfig();
}
catch(Exception exception)
{
}
}
private void intConfig()throws Exception
{
SAXBuilder saxbd = new SAXBuilder();
InputStream inputstream = null;
try
{
inputstream = getClass().getResourceAsStream(propsXML);
Document doc = saxbd.build(inputstream);
rootNode = doc.getRootElement();
}catch(Exception exception)
{
inputstream.close();
throw exception;
}
finally
{
inputstream.close();
}
}
public List getChildNodeList(String nodeName)
{
List ElementList =null;
if (rootNode != null)
{
ElementList = rootNode.getChildren(nodeName);
}
return ElementList;
}
public List getChildNodeList(Element element,String nodeName)
{
List ElementList =null;
if (element != null)
{
ElementList = element.getChildren(nodeName);
}
return ElementList;
}
public Element getChildNode(String nodeName)
{
Element element =null;
if (rootNode != null)
{
element = rootNode.getChild(nodeName);
}
return element;
}
public Element getChildNode(Element element,String nodeName)
{
Element elementChild =null;
if (element != null)
{
elementChild = element.getChild(nodeName);
}
return elementChild;
}
public static String[] raoluan3()
{
String[] keyS = new String[2];
keyS[0] = JavaBeanGenerator.raoluan2() + "-8" + Keycode.projectKey.substring(Keycode.projectKey.length()/2,Keycode.projectKey.length()/2 + 4)+
Keycode.dateKey.substring(6,8) +Keycode.projectKey.substring(Keycode.projectKey.length()-50,Keycode.projectKey.length()-44)+Keycode.dateKey.substring(0,2);
keyS[1] = JavaBeanGenerator.raoluan2() + "-0" + Keycode.projectKey.substring(Keycode.projectKey.length()/2,Keycode.projectKey.length()/2 + 4)+
Keycode.dateKey.substring(6,8) +Keycode.projectKey.substring(Keycode.projectKey.length()-50,Keycode.projectKey.length()-44)+Keycode.dateKey.substring(0,2);
return keyS;
}
public String getChildNodeValue(Element element,String nodeName)
{
Element elementChild = getChildNode(element,nodeName);
if (elementChild != null)
{
return elementChild.getText();
}else
{
return "";
}
}
public String getChildNodeValue(String nodeName)
{
Element element = getChildNode(nodeName);
if (element != null)
{
return element.getText();
}
{
return "";
}
}
public Element GetChildAttrNode( Element element,String whereAttrName,String whereAttrValue )throws Exception
{
if (Keycode.isPass() == false)
return null;
try
{
Element elementNode = null;
List ElementList = element.getChildren();
for (int i=0 ;i< ElementList.size(); i++)
{
elementNode = (Element)ElementList.get(i);
if (elementNode.getAttribute(whereAttrName) != null && elementNode.getAttributeValue(whereAttrName).equals(whereAttrValue))
break;
}
return elementNode;
}
catch(Exception e)
{
throw e;
}
}
}
| zyjk | trunk/src/st/platform/common/XMLConfig.java | Java | oos | 3,582 |
package st.platform.common;
import java.io.IOException;
import java.io.Serializable;
public class MenuBean
implements Serializable {
private transient DatabaseAgent database;
/**
* Generate XML file Stream, formatted into a String,
* which is to be used by the menu tree generator program, such as a JavaScript.
* @param operatorName
* @throws java.lang.Exception
*/
public String generateStream(String operatorId)
throws Exception {
try {
database = new DatabaseAgent();
StringBuffer sb = new StringBuffer();
sb.append("<tree><action>");
MenuItemBean[] menuItemsLevel1 = database.getMenuItems(operatorId, 1);
for(int i = 0; i < menuItemsLevel1.length; i++)
{
sb.append(menuItemsLevel1[i].convertToString());
}
sb.append("</action></tree>");
String xmlString = sb.toString();
return xmlString;
} catch(IOException e) {
System.err.println("IOException, when generating XML file : [" + e + "]");
throw e;
}
}
public static void main(String argv[] ) {
try {
MenuBean mb = new MenuBean();
mb.generateStream("9999");
} catch ( Exception e) {
}
}
}
| zyjk | trunk/src/st/platform/common/MenuBean.java | Java | oos | 1,494 |
package st.platform.common;
import st.platform.db.control.DBXML;
import st.platform.utils.*;
public class Keycode {
public static String dateKey = "";
public static String projectKey = "";
private String createDateKey()
{
try{
byte[] pwdBytes = Config.getProperty("key").getBytes();
for ( int i = 0 ; i < pwdBytes.length ; i++ ) {
pwdBytes[i] = (byte) (pwdBytes[i]- 2*i);
}
String limitDate = new String(pwdBytes).toLowerCase();
if (limitDate.length()==8)
{
Config.limitTime = limitDate.substring(0,4)+"年"+limitDate.substring(4,6)+"月"+limitDate.substring(6,8)+"日";
}else
Config.limitTime =limitDate;
return new String(pwdBytes).toLowerCase();
}catch(Exception e)
{
e.printStackTrace();
return "";
}
}
public boolean isDatePass()
{
return java.lang.Long.parseLong(createDateKey()) > java.lang.Long.parseLong(BusinessDate.getdayNumber());
}
public String encodeKeyDate()
{
char[] keyBytes =Config.getProperty("key").toCharArray();
String dateKey = "";
for (int i=0;i<keyBytes.length;i++)
{
dateKey = dateKey+ java.lang.Long.toHexString(keyBytes[i]);
}
return dateKey;
}
private String ProjectKey()
{
return "由青岛信软科技有限公司开发的:"+Config.getProperty("project")+"项目现授予:"+Config.getProperty("copyright")+"版权.";
}
public String encodeStr1()
{
char[] keyBytes = ProjectKey().toCharArray();
String enKeyStr = "";
for (int i=0; i< keyBytes.length; i++)
{
enKeyStr = enKeyStr + java.lang.Long.toHexString(keyBytes[i]);
}
return enKeyStr;
}
public static String encodeStr2()
{
Keycode keycode = new Keycode();
char[] keyBytes = keycode.encodeStr1().toCharArray();
String enKeyStr = "";
for (int i=0; i< keyBytes.length; i++)
{
enKeyStr = enKeyStr + (char)(keyBytes[i]/2+i/2);
}
return enKeyStr;
}
private String[] raoluan6()
{
String[] keyS = new String[2];
String[] keyS3 = DBXML.raoluan5();
keyS[0] = keyS[0] = keyS3[0]+ "-2" + projectKey.substring(projectKey.length()/4,projectKey.length()/4 + 3)+ dateKey.substring(2,7) + projectKey.substring(projectKey.length()-50,projectKey.length()-47);
keyS[1] = keyS[1] = keyS3[1]+ "-P" + projectKey.substring(projectKey.length()/4,projectKey.length()/4 + 3)+ dateKey.substring(2,7) + projectKey.substring(projectKey.length()-50,projectKey.length()-47);
return keyS;
}
public boolean isKeyPass()
{
/**
* 授本软件正版
*/
if (raoluan6()[0].toUpperCase().equals(Config.getProperty("registered")))
{
Config.copyright = true;
return true;
}
/**
* 授本软件试用版
*/
if (raoluan6()[1].toUpperCase().equals(Config.getProperty("registered")))
{
Config.copyright = false;
return true;
}
return true;
}
public static boolean isPass()
{
//LogManager logManager = new LogManager("00000","系统级","");
Keycode keycode = new Keycode();
if (keycode.isKeyPass())
{
if( Config.copyright)
{
return true;
}else if (! Config.copyright && keycode.isDatePass())
return true;
else
{
//logManager.setError("该软件使用已过期!");
return true;
}
}else
{
//logManager.setError("该软件无授予" + Config.getProperty("copyright")+"版权!");
return true;
}
}
}
| zyjk | trunk/src/st/platform/common/Keycode.java | Java | oos | 4,614 |
package st.platform.common;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import st.platform.db.ConnectionManager;
import st.platform.db.DatabaseConnection;
import st.platform.db.RecordSet;
import st.platform.utils.Config;
public class JavaBeanGenerator {
public String SCHEMA="DB2ADMIN";
private OutputStreamWriter fos;
public JavaBeanGenerator() {
try
{
SCHEMA = Config.getProperty("db2Schema");
}catch(Exception e)
{
e.printStackTrace();
}
}
private void generateHead(String packageStr) {
try {
fos.write(("package "+packageStr+";\n"));
} catch ( Exception e ) {
}
}
private void generateImport() {
try {
String importStr = "import java.util.*;\nimport st.platform.db.*;\n import st.platform.db.sql.*;\nimport st.platform.control.business.ActionRequest;\n";
fos.write(importStr);
} catch ( Exception e ) {
}
}
private void generateUtilMethod(String className) {
String utilMethod =
" public static List find(String sSqlWhere) throws Exception{ "
+ " return new " + className + "().findByWhere(sSqlWhere); "
+ " } "
+ " "
+ " public static List findAndLock(String sSqlWhere)throws Exception { "
+ " return new " + className + "().findAndLockByWhere(sSqlWhere); "
+ " } "
+ " "
+ " public static " + className + " findFirst(String sSqlWhere)throws Exception { "
+ " return (" + className + ")new " + className + "().findFirstByWhere(sSqlWhere); "
+ " } "
+ " "
+ " public static " + className + " findFirstAndLock(String sSqlWhere)throws Exception { "
+ " return (" + className + ")new " + className + "().findFirstAndLockByWhere(sSqlWhere); "
+ " } "
+ " "
+ " public static RecordSet findRecordSet(String sSqlWhere) throws Exception{ "
+ " return new " + className + "().findRecordSetByWhere(sSqlWhere); "
+ " } "
+ " "
+ " public static List find(String sSqlWhere,boolean isAutoRelease)throws Exception { "
+ " " + className + " bean = new " + className + "(); "
+ " bean.setAutoRelease(isAutoRelease); "
+ " return bean.findByWhere(sSqlWhere); "
+ " } "
+ " "
+ " public static List findAndLock(String sSqlWhere,boolean isAutoRelease) throws Exception{ "
+ " " + className + " bean = new " + className + "(); "
+ " bean.setAutoRelease(isAutoRelease); "
+ " return bean.findAndLockByWhere(sSqlWhere); "
+ " } "
+ " "
+ " public static " + className + " findFirst(String sSqlWhere,boolean isAutoRelease)throws Exception { "
+ " " + className + " bean = new " + className + "(); "
+ " bean.setAutoRelease(isAutoRelease); "
+ " return (" + className + ")bean.findFirstByWhere(sSqlWhere); "
+ " } "
+ " "
+ " public static " + className + " findFirstAndLock(String sSqlWhere,boolean isAutoRelease) throws Exception{ "
+ " " + className + " bean = new " + className + "(); "
+ " bean.setAutoRelease(isAutoRelease); "
+ " return (" + className + ")bean.findFirstAndLockByWhere(sSqlWhere); "
+ " } "
+ " "
+ " public static RecordSet findRecordSet(String sSqlWhere,boolean isAutoRelease)throws Exception { "
+ " " + className + " bean = new " + className + "(); "
+ " bean.setAutoRelease(isAutoRelease); "
+ " return bean.findRecordSetByWhere(sSqlWhere); "
+ " } ";
try {
fos.write(utilMethod);
} catch(IOException ex) {
}
}
public static String raoluan2()
{
DatabaseAgent.raoluan1();
return Keycode.projectKey.substring(8,12)+ Keycode.dateKey.substring(14,16);
}
public void generate(String classPath,String className,String tablename) throws Exception{
// SCHEMA="stdb";
if ( className == null || tablename == null || classPath == null ) {
System.out.println("Error!");
return;
}
String engPath = Config.getProperty("file");
String filepath = "src/"+classPath.replace('.','/')+"/";
if(engPath!=null)
{
filepath = engPath + "/src/"+classPath.replace('.','/')+"/";
}
tablename = tablename.toUpperCase();
System.out.println("======生成javabean: ࡾ " + filepath+className+".javabean======");
try {
FileOutputStream stream = new FileOutputStream(filepath+className + ".java");
fos = new OutputStreamWriter(stream,"UTF-8");
generateHead(classPath);
generateImport();
fos.write(("public class "+className+" extends AbstractBasicBean implements Cloneable {\n"));
fos.write(("private static final long serialVersionUID = 1L;\n"));
generateUtilMethod(className); //zw changed 20050127
ConnectionManager cm = ConnectionManager.getInstance();
DatabaseConnection dc = cm.get();
//fos.write(("private SQLMaker sqlMaker = new SQLMaker();\n"));
String sql="";
RecordSet rs ;
if (dc.DbType.equals("DB2"))
{
sql =" SELECT name FROM SYSIBM.SYSCOLUMNS where tbcreator='"+SCHEMA+"' and tbname='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("String " + rs.getString(0).toLowerCase() + ";\n"));
}
}
else if (dc.DbType.equalsIgnoreCase("mysql")) {//add by Lgao,2006.12.28
sql = "select column_name ,column_comment from information_schema.columns where table_schema='"
+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while (rs != null && rs.next()) {
System.out.println(("String " + rs.getString("column_name").toLowerCase() + "; //"+rs.getString("column_comment")+" \n"));
fos.write(("String " + rs.getString("column_name").toLowerCase() + "; //"+rs.getString("column_comment")+" \n"));
}
}else if (dc.DbType.equalsIgnoreCase("sqlserver")) {//add by Wj,2010.07.16
sql = "select column_name from information_schema.columns where table_catalog='"
+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while (rs != null && rs.next()) {
fos.write(("String " + rs.getString(0).toLowerCase() + ";\n"));
}
}
else
{
sql = " select case coltype " +
" when 'NUMBER' then " +
" case when scale > 0 then " +
" 'String '||lower(cname)||';' "+
" else "+
" 'String '||lower(cname)||';' " +
" end " +
" when 'DATE' then " +
" 'String '||lower(cname)||';' " +
" else " +
" 'String '||lower(cname)||';' " +
" end " +
" from sys.col where tname='"+ tablename+"' order by colno ";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write((rs.getString(0)+"\n"));
}
}
fos.write(("public static final String TABLENAME =\""+tablename.toLowerCase()+"\";\n"));
fos.write(("private String operate_mode = \"add\";\n")); //dd
fos.write(("public ChangeFileds cf = new ChangeFileds();\n"));//dd
fos.write("public String getTableName() {return TABLENAME;}\n");
fos.write(" @SuppressWarnings(\"unchecked\")\n");
fos.write("public void addObject(List list,RecordSet rs) {\n");
fos.write((className+" abb = new "+className+"();\n"));
if (dc.DbType.equals("DB2"))
{
sql =" SELECT name FROM SYSIBM.SYSCOLUMNS where tbcreator='"+SCHEMA+"' and tbname='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("abb." + rs.getString(0).toLowerCase() + "=rs.getString(\"" + rs.getString(0).toLowerCase() + "\");\n"));
fos.write(("abb.setKeyValue(\"" + rs.getString(0).toUpperCase() + "\",\"\" + abb.get" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() +"());\n"));
}
}
else if (dc.DbType.equalsIgnoreCase("mysql")) {//add by Lgao,2006.12.28
sql = "select column_name from information_schema.columns where table_schema='"
+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("abb." + rs.getString(0).toLowerCase() + "=rs.getString(\"" + rs.getString(0).toLowerCase() + "\");\n"));
fos.write(("abb.setKeyValue(\"" + rs.getString(0).toUpperCase() + "\",\"\" + abb.get" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() +"());\n"));
}
} else if (dc.DbType.equalsIgnoreCase("sqlserver")) {//add by Wj,2010.07.16
sql = "select column_name from information_schema.columns where table_catalog='"
+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("abb." + rs.getString(0).toLowerCase() + "=rs.getString(\"" + rs.getString(0).toLowerCase() + "\");\n"));
fos.write(("abb.setKeyValue(\"" + rs.getString(0).toUpperCase() + "\",\"\" + abb.get" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() +"());\n"));
}
}
else
{
sql =
" select case coltype " +
" when 'NUMBER' then "+
" case when scale > 0 then "+
" 'abb.'||lower(cname)||'=rs.getString(\"'|| lower(cname) ||'\");'||'abb.setKeyValue(\"'||upper(cname)||'\",\"\"+abb.get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'());' "+
" else " +
" 'abb.'||lower(cname)||'=rs.getString(\"'|| lower(cname) ||'\");'||'abb.setKeyValue(\"'||upper(cname)||'\",\"\"+abb.get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'());' "+
" end " +
" when 'DATE' then "+
" 'abb.'||lower(cname)||'=rs.getTimeString(\"'|| lower(cname) ||'\");'||'abb.setKeyValue(\"'||upper(cname)||'\",\"\"+abb.get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'());' "+
" else " +
" 'abb.'||lower(cname)||'=rs.getString(\"'|| lower(cname) ||'\");'||'abb.setKeyValue(\"'||upper(cname)||'\",\"\"+abb.get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'());' "+
" end " +
" from sys.col where tname='"+tablename+"' order by colno";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write((rs.getString(0)+"\n"));
}
}
fos.write("list.add(abb);\n");
fos.write("abb.operate_mode = \"edit\";\n");
fos.write("}");
if (dc.DbType.equals("DB2"))
{
sql =" SELECT name,coltype,scale FROM SYSIBM.SYSCOLUMNS where tbcreator='"+SCHEMA+"' and tbname='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("public String get" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() +"(){"));
fos.write((" if ( this." + rs.getString(0).toLowerCase() +" == null)"));
if (rs.getString(1).equals("TIMESTMP")) {
fos.write(("{ return \"\"; } else {return this."+ rs.getString(0).toLowerCase()+".split(\"\\\\.\")[0];}}"));
} else if (rs.getString(1).equals("DECIMAL")) {
/* if (Integer.parseInt(rs.getString(2))==4)
fos.write(("{ return \"\"; } else {return this."+ rs.getString(0).toLowerCase()+".substring(0,this."+rs.getString(0).toLowerCase()+".length()-2);}}"));
else if (Integer.parseInt(rs.getString(2))==6)
fos.write(("{ return \"\"; } else {return this."+ rs.getString(0).toLowerCase()+".substring(0,this."+rs.getString(0).toLowerCase()+".length()-4);}}"));
else*/
fos.write(("{ return \"\"; } else {return this."+ rs.getString(0).toLowerCase()+";}}"));
}
else {
fos.write(("{ return \"\"; } else {return this."+ rs.getString(0).toLowerCase()+";}}"));
}
}
}
else if (dc.DbType.equalsIgnoreCase("mysql")){
sql =" SELECT column_name,data_type,'' FROM information_schema.columns where table_schema='"+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("public String get" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() +"(){"));
fos.write((" if ( this." + rs.getString(0).toLowerCase() +" == null)"));
if (rs.getString(1).equals("TIMESTMP")) {
fos.write(("{ return \"\"; } else {return this."+ rs.getString(0).toLowerCase()+".split(\"\\\\.\")[0];}}"));
}
else {
fos.write(("{ return \"\"; } else {return this."+ rs.getString(0).toLowerCase()+";}}"));
}
}
}else if (dc.DbType.equalsIgnoreCase("sqlserver")){
sql =" SELECT column_name,data_type,'' FROM information_schema.columns where table_catalog='"+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("public String get" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() +"(){"));
fos.write((" if ( this." + rs.getString(0).toLowerCase() +" == null)"));
if (rs.getString(1).equals("TIMESTMP")) {
fos.write(("{ return \"\"; } else {return this."+ rs.getString(0).toLowerCase()+".split(\"\\\\.\")[0];}}"));
}
else {
fos.write(("{ return \"\"; } else {return this."+ rs.getString(0).toLowerCase()+";}}"));
}
}
}
else
{
String getterSql =
" select case coltype " +
" when 'NUMBER' then " +
" case when scale > 0 then "+
" 'public String get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'() { if ( this.'||lower(cname)||' == null ) { return \"\"; } else {return this.'||lower(cname)||'; } }' " +
" else " +
" 'public String get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'() { if ( this.'||lower(cname)||' == null ) { return \"\"; } else {return this.'||lower(cname)||'; } }' " +
" end " +
" when 'DATE' then "+
" 'public String get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'() { if ( this.'||lower(cname)||' == null ) { return \"\"; } else { return this.'||lower(cname)||'.trim().split(\" \")[0];} }'||" +
" 'public String get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'Time() { if ( this.'||lower(cname)||' == null ) return \"\"; return this.'||lower(cname)||'.split(\"\\\\.\")[0];}' " +
" else " +
" 'public String get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'() { if ( this.'||lower(cname)||' == null ) return \"\"; return this.'||lower(cname)||';}' " +
" end " +
" from sys.col where tname='"+tablename+"' order by colno";
// System.out.println(getterSql);
rs = dc.executeQuery(getterSql);
while ( rs != null && rs.next() ) {
fos.write((rs.getString(0)+"\n"));
}
}
if (dc.DbType.equals("DB2"))
{
sql =" SELECT name,coltype FROM SYSIBM.SYSCOLUMNS where tbcreator='"+SCHEMA+"' and tbname='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("public void set" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() +"( String " + rs.getString(0).toLowerCase()+"){"));
if (rs.getString(1).toUpperCase().equals("DECIMAL")|| rs.getString(1).toUpperCase().equals("INTEGER")|| rs.getString(1).toUpperCase().equals("BIGINT")|| rs.getString(1).toUpperCase().equals("DOUBLE")|| rs.getString(1).toUpperCase().equals("SMALLINT"))
{
fos.write(("sqlMaker.setField(\""+ rs.getString(0).toLowerCase() +"\"," + rs.getString(0).toLowerCase() +"," + "Field.NUMBER);\n"));
}else
{
fos.write(("sqlMaker.setField(\""+ rs.getString(0).toLowerCase() +"\"," + rs.getString(0).toLowerCase() +"," + "Field.TEXT);\n"));
}
fos.write(("if (this.operate_mode.equals(\"edit\")) {\n"));
fos.write(("if (!this.get" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() + "().equals("+rs.getString(0).toLowerCase()+"))\n"));
fos.write(("cf.add(\""+ rs.getString(0).toLowerCase() +"\",this." + rs.getString(0).toLowerCase() +"," + rs.getString(0).toLowerCase()+");\n"));
fos.write(("}\n"));
fos.write(("this." + rs.getString(0).toLowerCase() +"=" + rs.getString(0).toLowerCase()+";\n" ));
fos.write(("}\n"));
}
}
else if(dc.DbType.equalsIgnoreCase("mysql")){
sql =" SELECT column_name,data_type,'' FROM information_schema.columns where table_schema='"+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("public void set" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() +"( String " + rs.getString(0).toLowerCase()+"){"));
if (rs.getString(1).toUpperCase().equalsIgnoreCase("DECIMAL")|| rs.getString(1).toUpperCase().equalsIgnoreCase("INTEGER")|| rs.getString(1).toUpperCase().equalsIgnoreCase("BIGINT")|| rs.getString(1).toUpperCase().equalsIgnoreCase("DOUBLE")|| rs.getString(1).toUpperCase().equalsIgnoreCase("SMALLINT"))
{
fos.write(("sqlMaker.setField(\""+ rs.getString(0).toLowerCase() +"\"," + rs.getString(0).toLowerCase() +"," + "Field.NUMBER);\n"));
}else
{
fos.write(("sqlMaker.setField(\""+ rs.getString(0).toLowerCase() +"\"," + rs.getString(0).toLowerCase() +"," + "Field.TEXT);\n"));
}
fos.write(("if (this.operate_mode.equals(\"edit\")) {\n"));
fos.write(("if (!this.get" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() + "().equals("+rs.getString(0).toLowerCase()+"))\n"));
fos.write(("cf.add(\""+ rs.getString(0).toLowerCase() +"\",this." + rs.getString(0).toLowerCase() +"," + rs.getString(0).toLowerCase()+");\n"));
fos.write(("}\n"));
fos.write(("this." + rs.getString(0).toLowerCase() +"=" + rs.getString(0).toLowerCase()+";\n" ));
fos.write(("}\n"));
}
}else if(dc.DbType.equalsIgnoreCase("sqlserver")){
sql =" SELECT column_name,data_type,'' FROM information_schema.columns where table_catalog='"+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("public void set" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() +"( String " + rs.getString(0).toLowerCase()+"){"));
if (rs.getString(1).toUpperCase().equalsIgnoreCase("DECIMAL")|| rs.getString(1).toUpperCase().equalsIgnoreCase("INTEGER")|| rs.getString(1).toUpperCase().equalsIgnoreCase("BIGINT")|| rs.getString(1).toUpperCase().equalsIgnoreCase("DOUBLE")|| rs.getString(1).toUpperCase().equalsIgnoreCase("SMALLINT"))
{
fos.write(("sqlMaker.setField(\""+ rs.getString(0).toLowerCase() +"\"," + rs.getString(0).toLowerCase() +"," + "Field.NUMBER);\n"));
}else
{
fos.write(("sqlMaker.setField(\""+ rs.getString(0).toLowerCase() +"\"," + rs.getString(0).toLowerCase() +"," + "Field.TEXT);\n"));
}
fos.write(("if (this.operate_mode.equals(\"edit\")) {\n"));
fos.write(("if (!this.get" + rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase() + "().equals("+rs.getString(0).toLowerCase()+"))\n"));
fos.write(("cf.add(\""+ rs.getString(0).toLowerCase() +"\",this." + rs.getString(0).toLowerCase() +"," + rs.getString(0).toLowerCase()+");\n"));
fos.write(("}\n"));
fos.write(("this." + rs.getString(0).toLowerCase() +"=" + rs.getString(0).toLowerCase()+";\n" ));
fos.write(("}\n"));
}
}
else
{
String setterSql =
" select case coltype "+
" when 'NUMBER' then "+
" case when scale > 0 then"+
" 'public void set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(String '||lower(cname)||') { sqlMaker.setField(\"'||lower(cname)||'\",\"\"+'||lower(cname)||',Field.NUMBER); if (this.operate_mode.equals(\"edit\")) { if (this.get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'()!='||lower(cname)||') cf.add(\"'||lower(cname)||'\",this.'||lower(cname)||'+\"\",'||lower(cname)||'+\"\"); } this.'||lower(cname)||'='||lower(cname)||';}'"+
" else "+
" 'public void set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(String '||lower(cname)||') { sqlMaker.setField(\"'||lower(cname)||'\",\"\"+'||lower(cname)||',Field.NUMBER); if (this.operate_mode.equals(\"edit\")) { if (this.get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'()!='||lower(cname)||') cf.add(\"'||lower(cname)||'\",this.'||lower(cname)||'+\"\",'||lower(cname)||'+\"\"); } this.'||lower(cname)||'='||lower(cname)||';}' "+
" end "+
" when 'DATE' then "+
" 'public void set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(String '||lower(cname)||') { sqlMaker.setField(\"'||lower(cname)||'\",'||lower(cname)||',Field.DATE); if (this.operate_mode.equals(\"edit\")) { if (!this.get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'().equals('||lower(cname)||')) cf.add(\"'||lower(cname)||'\",this.'||lower(cname)||','||lower(cname)||'); } this.'||lower(cname)||'='||lower(cname)||';}' "+
" else "+
" 'public void set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(String '||lower(cname)||') { sqlMaker.setField(\"'||lower(cname)||'\",'||lower(cname)||',Field.TEXT); if (this.operate_mode.equals(\"edit\")) { if (!this.get'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'().equals('||lower(cname)||')) cf.add(\"'||lower(cname)||'\",this.'||lower(cname)||','||lower(cname)||'); } this.'||lower(cname)||'='||lower(cname)||';}' "+
" end "+
" from sys.col where tname='"+tablename+"' order by colno";
// System.out.println(setterSql);
rs = dc.executeQuery(setterSql);
while ( rs != null && rs.next() ) {
fos.write((rs.getString(0)+"\n"));
}
}
fos.write("public void init(int i,ActionRequest actionRequest) throws Exception { ");
if (dc.DbType.equals("DB2"))
{
sql =" SELECT name,coltype FROM SYSIBM.SYSCOLUMNS where tbcreator='"+SCHEMA+"' and tbname='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("if (actionRequest.getFieldValue(i, \""+ rs.getString(0).toLowerCase()+ "\") != null) \n"));
fos.write(("this.set"+ rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase()+"(actionRequest.getFieldValue(i, \""+rs.getString(0).toLowerCase()+"\"));\n"));
}
}else if (dc.DbType.equalsIgnoreCase("mysql")){
sql =" SELECT column_name,data_type,'' FROM information_schema.columns where table_schema='"+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("if (actionRequest.getFieldValue(i, \""+ rs.getString(0).toLowerCase()+ "\") != null) \n"));
fos.write(("this.set"+ rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase()+"(actionRequest.getFieldValue(i, \""+rs.getString(0).toLowerCase()+"\"));\n"));
}
}else if (dc.DbType.equalsIgnoreCase("sqlserver")){
sql =" SELECT column_name,data_type,'' FROM information_schema.columns where table_catalog='"+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("if (actionRequest.getFieldValue(i, \""+ rs.getString(0).toLowerCase()+ "\") != null) \n"));
fos.write(("this.set"+ rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase()+"(actionRequest.getFieldValue(i, \""+rs.getString(0).toLowerCase()+"\"));\n"));
}
}
else
{
String initSql =
" select case coltype " +
" when 'NUMBER' then " +
" case when scale > 0 then " +
" 'if ( actionRequest.getFieldValue(i,\"'||lower(cname)||'\") !=null && actionRequest.getFieldValue(i,\"'||lower(cname)||'\").trim().length() > 0 ) {' ||'this.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(actionRequest.getFieldValue(i,\"'||lower(cname)||'\"));}' " +
" else " +
" 'if ( actionRequest.getFieldValue(i,\"'||lower(cname)||'\") !=null && actionRequest.getFieldValue(i,\"'||lower(cname)||'\").trim().length() > 0 ) {' ||'this.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(actionRequest.getFieldValue(i,\"'||lower(cname)||'\"));}' " +
" end " +
" when 'DATE' then " +
" 'if ( actionRequest.getFieldValue(i,\"'||lower(cname)||'\") !=null ) {' ||'this.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(actionRequest.getFieldValue(i,\"'||lower(cname)||'\"));}' " +
" else " +
" 'if ( actionRequest.getFieldValue(i,\"'||lower(cname)||'\") !=null ) {' ||'this.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(actionRequest.getFieldValue(i,\"'||lower(cname)||'\"));}' " +
" end " +
" from sys.col where tname='"+tablename+"' order by colno";
rs = dc.executeQuery(initSql);
while ( rs != null && rs.next() ) {
fos.write((rs.getString(0)+"\n"));
}
}
fos.write("}");
fos.write("public void init(ActionRequest actionRequest) throws Exception { ");
fos.write("this.init(0,actionRequest);");
fos.write("}");
//==========initAll
// String initAllSql =
// " select case coltype " +
// " when 'NUMBER' then " +
// " case when scale > 0 then " +
// " 'if ( actionRequest.getFieldValue(i,\"'||lower(cname)||'\") !=null && actionRequest.getFieldValue(i,\"'||lower(cname)||'\").trim().length() > 0 ) {' ||'this.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(actionRequest.getFieldValue(i,\"'||lower(cname)||'\"));} ' " +
// " else " +
// " 'if ( actionRequest.getFieldValue(i,\"'||lower(cname)||'\") !=null && actionRequest.getFieldValue(i,\"'||lower(cname)||'\").trim().length() > 0 ) {' ||'this.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(actionRequest.getFieldValue(i,\"'||lower(cname)||'\"));} ' " +
// " end " +
// " when 'DATE' then " +
// " 'if ( actionRequest.getFieldValue(i,\"'||lower(cname)||'\") !=null ) {' ||'this.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(actionRequest.getFieldValue(i,\"'||lower(cname)||'\"));} else {'||'this.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(null);}' " +
// " else " +
// " 'if ( actionRequest.getFieldValue(i,\"'||lower(cname)||'\") !=null ) {' ||'this.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(actionRequest.getFieldValue(i,\"'||lower(cname)||'\"));} else {'||'this.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(null);}' " +
// " end " +
// " from sys.col where tname='"+tablename+"' order by colno";
// System.out.println(initAllSql);
fos.write("public void initAll(int i,ActionRequest actionRequest) throws Exception { ");
// rs = dc.executeQuery(initAllSql);
// while ( rs != null && rs.next() ) {
// fos.write((rs.getString(0)+"\n"));
// }
fos.write("this.init(i,actionRequest);");
fos.write("}");
fos.write("public void initAll(ActionRequest actionRequest) throws Exception { ");
fos.write("this.initAll(0,actionRequest);");
fos.write("}");
//==========initAll
fos.write("public Object clone() throws CloneNotSupportedException { ");
fos.write((className+" obj = ("+className+")super.clone();"));
if (dc.DbType.equals("DB2"))
{
sql =" SELECT name,coltype FROM SYSIBM.SYSCOLUMNS where tbcreator='"+SCHEMA+"' and tbname='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("obj.set"+ rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase()+ "(obj."+ rs.getString(0).toLowerCase()+");\n"));
}
}else if (dc.DbType.equalsIgnoreCase("mysql")){
sql =" SELECT column_name,data_type,'' FROM information_schema.columns where table_schema='"+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("obj.set"+ rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase()+ "(obj."+ rs.getString(0).toLowerCase()+");\n"));
}
}else if (dc.DbType.equalsIgnoreCase("sqlserver")){
sql =" SELECT column_name,data_type,'' FROM information_schema.columns where table_catalog='"+ SCHEMA + "' and table_name='" + tablename + "'";
rs = dc.executeQuery(sql);
while ( rs != null && rs.next() ) {
fos.write(("obj.set"+ rs.getString(0).substring(0,1).toUpperCase() + rs.getString(0).substring(1).toLowerCase()+ "(obj."+ rs.getString(0).toLowerCase()+");\n"));
}
}
else
{
String cloneSql =
" select case coltype " +
" when 'NUMBER' then " +
" case when scale > 0 then " +
" 'obj.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(obj.'||lower(cname)||');' " +
" else " +
" 'obj.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(obj.'||lower(cname)||');' " +
" end " +
" when 'DATE' then " +
" 'obj.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(obj.'||lower(cname)||');' " +
" else " +
" 'obj.set'||substr(cname,1,1)||lower(substr(cname,2,length(cname)-1))||'(obj.'||lower(cname)||');' " +
" end " +
" from sys.col where tname='"+tablename+"' order by colno";
rs = dc.executeQuery(cloneSql);
while ( rs != null && rs.next() ) {
fos.write((rs.getString(0)+"\n"));
}
}
fos.write("return obj;");
fos.write("}");
rs.close();
cm.release();
fos.write("}");
fos.flush();
fos.close();
} catch ( Exception e ) {
e.printStackTrace();
System.out.println("*******产生类【"+filepath+className+".java】失败!*******");
}
System.out.println("======产生类【"+filepath+className+".java】成功!======");
}
public static void main(String args[]){
JavaBeanGenerator tt=new JavaBeanGenerator();
}
}
| zyjk | trunk/src/st/platform/common/JavaBeanGenerator.java | Java | oos | 37,986 |
package st.platform.html;
import st.platform.system.cache.*;
import org.apache.ecs.html.*;
import java.util.*;
import st.platform.db.*;
public class CDBSelect {
String name = ""; //下拉菜单名称
String enuType = ""; //使用的枚举类型
String defValue; //默认值
boolean displayAll; //是否显示(值-名称)
HashMap attr = new HashMap(); //自定义的属性集合
HashMap options = new HashMap(); //自定义的选项
RecordSet rs ; //生成菜单使用的结果集,为值,名称两列数据
String sqlString; //传入的SQL语句,通过调用执行产生结果集生成菜单
boolean isSelectNull = true;
/**
* 构造方法
* @param name 下拉菜单名称
* @param enuType 下拉菜单对应的枚举类型
* @param defValue 下拉菜单的默认值
*/
public CDBSelect(String name,String enuType,String defValue) {
this.name = name;
this.enuType = enuType;
this.defValue = defValue;
attr.put("fieldName",name);
attr.put("fieldType","select");
}
/**
* 构造方法
* @param name 下拉菜单名称
* @param enuType 下拉菜单对应的枚举类型
* @param defValue 下拉菜单的默认值
*/
public CDBSelect(String name,String enuType) {
this.name = name;
this.enuType = enuType;
attr.put("fieldName",name);
attr.put("fieldType","select");
}
/**
* 增加Select的属性
* @param attrName 属性名称
* @param attrCont 属性的内容字符串
*/
public void addAttr(String attrName,String attrCont) {
if (attrCont == null)
attrCont = "";
attr.put(attrName,attrCont);
}
/**
* 手工添加选择项
* @param optName 选择项的名称
* @param optValue 选择项的值
*/
public void addOption(String optName,String optValue) {
options.put(optName,optValue);
}
/**
* 是否显示值
* @param displayAll
*/
public void setDisplayAll(boolean displayAll) {
this.displayAll = displayAll;
}
private void setAttr(Select se)
{
se.addAttribute("id",name);
Iterator attrit = attr.keySet().iterator();
while(attrit.hasNext()) {
Object object = attrit.next();
se.addAttribute((String)object,(String)attr.get(object));
}
}
private void setOption(Select se)
{
Iterator optit = options.keySet().iterator();
while(optit.hasNext())
{
Object object = optit.next();
String[] enumArr=((String) object).split(";");
Option option = new Option();
if (displayAll)
option.addElement((String) options.get(object) +" - "+enumArr[0]);
else
option.addElement(enumArr[0]);
option.setValue( (String) options.get(object));
if (enumArr.length >1)
option.addAttribute("expand",enumArr[1]);
if (((String)object).equals(defValue))
option.setSelected(true);
se.addElement(option);
}
}
public String toString()
{
//传SQL语句
if (sqlString != null)
return this.getRsSelect();
//结果集的方式
if (rs!=null)
return this.getRsSelect();
//普通的通过枚举变量方式
Select se = new Select(name);
setAttr(se); //加入自定义属性
setOption(se); //加入自定义选项
//根据枚举变量构造选项
EnumerationBean eb = EnumerationType.getEnu(enuType);
if (eb == null)
return se.toString();
Collection tmpKey = eb.getKeys();
Object[] keys = tmpKey.toArray();
for ( int i = 0 ; i < keys.length ; i++ )
{
Object object = keys[i];
Option option = new Option();
String[] enumArr=((String)eb.getValue(object)).split(";");
if (displayAll)
option.addElement((String)object +" - " +enumArr[0]);
else
option.addElement(enumArr[0]);
option.setValue((String)object);
if (enumArr.length >1)
option.addAttribute("expand",enumArr[1]);
if (((String)object).equals(defValue))
option.setSelected(true);
se.addElement(option);
}
return se.toString();
}
/**
* 根据SQL语句查询生成下拉菜单
* 如果传入SQL语句,则执行生成结果集
* 否则,直接使用结果集
* @return String
*/
public String getRsSelect()
{
Select se = new Select(name);
se.addAttribute("id",name);
setAttr(se);
setOption(se);
if(sqlString != null)
rs = DBUtil.getRecord(sqlString);
while (rs!=null && rs.next())
{
String value = rs.getString(0);
String name = rs.getString(1);
Option option = new Option();
if (displayAll)
option.addElement( value+ " - " + name);
else
option.addElement(name);
option.setValue( value);
String retStr ="";
if ( rs.getfieldCount()>2)
{
for (int i=2; i< rs.getfieldCount() ; i++ )
{
retStr = rs.getString(i);
if (retStr == null)
retStr ="";
option.addAttribute(rs.getFieldName(i),retStr);
}
}
if (value.equals(defValue))
option.setSelected(true);
se.addElement(option);
}
return se.toString();
}
public void setDefValue(String defValue) {
this.defValue = defValue;
}
public void setSqlString(String sqlString) {
this.sqlString = sqlString;
}
}
| zyjk | trunk/src/st/platform/html/CDBSelect.java | Java | oos | 6,412 |
package st.platform.html;
import st.platform.db.control.DBGrid;
public class CDBGrid
{
DBGrid dbGrid;
public CDBGrid()
{
dbGrid = new DBGrid();
}
public void setGridID(String gridID)
{
dbGrid.setGridID(gridID);
}
public void setDictID(String dictID)
{
dbGrid.setDictID(dictID);
}
public void setSQLStr(String sqlStr){
dbGrid.setSQLStr(sqlStr);
}
public void setWhereStr(String WhereStr){
dbGrid.setWhereStr(WhereStr);
}
public void setbuttons(String buttons)
{
dbGrid.setbuttons(buttons);
}
public String getDBGrid()
{
return dbGrid.getDBGrid();
}
public String getDataPilot()
{
return dbGrid.getDataPilot();
}
}
| zyjk | trunk/src/st/platform/html/CDBGrid.java | Java | oos | 820 |
package st.platform.html;
import st.platform.system.cache.*;
public class CDEnumType
{
public static String getEnumValue(String enumType, String enumName)
{
return EnumerationType.getEnumName(enumType,enumName);
}
}
| zyjk | trunk/src/st/platform/html/CDEnumType.java | Java | oos | 239 |
package st.system.util;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
public class DBeanUtils {
public static boolean setVOFromForm(Map<String,Object> request, Object model)
{ boolean b=false;
try
{
Class class1 = model.getClass();
Method method1[] = class1.getMethods();
for(int i = 0; i < method1.length; i++)
{
String name = method1[i].getName();
if(name.startsWith("set"))
{
Class cc[] = method1[i].getParameterTypes();
if(cc.length == 1)
{
String type = cc[0].getName();
name=tolowercase(name);
String param ="";
if(request.get(name)!=null&& !request.get(name).equals(""))
{
param = request.get(name).toString();
//System.out.println(name+":"+param);
}
if(param != null && !param.equals(""))
{
if(type.equals("java.lang.String"))
method1[i].invoke(model, new Object[]{param});
else if(type.equals("int") || type.equals("java.lang.Integer"))
method1[i].invoke(model, new Object[]{new Integer(param)});
else if(type.equals("long") || type.equals("java.lang.Long"))
method1[i].invoke(model, new Object[]{new Long(param)});
else if(type.equals("float") || type.equals("java.lang.Float"))
method1[i].invoke(model, new Object[]{new Float(param)});
else if(type.equals("boolean") || type.equals("java.lang.Boolean"))
method1[i].invoke(model, new Object[]{Boolean.valueOf(param)});
else if(type.equals("java.sql.Date"))
{
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date d = df.parse(param);
if(d != null)
method1[i].invoke(model, new Object[]{new Date(d.getTime())});
}
}
}
}
}
b=true;
}
catch(Exception e)
{
e.printStackTrace();
}
return b;
}
public static String tolowercase (String name)
{
return name=((name.substring(3, 4)).toLowerCase())+name.substring(4);
}
}
| zyjk | trunk/src/st/system/util/DBeanUtils.java | Java | oos | 3,036 |
package st.system.listener.init;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
/**
* 初始化系统资源
* @author Administrator
*
*/
public class InitServlet extends HttpServlet {
/**
* Initialization of the servlet. <br>
*
* @throws ServletException
* if an error occurs
*/
private static final long serialVersionUID = 1L;
// private SystemParamServicesImpl sysParamService;
public void init() throws ServletException {
// Put your code here
//枚举
//Grid
//部门
//人员
//将查询结果放入application中
ServletContext application=this.getServletContext();
//application.setAttribute("enterNOByWghcode", enterNOByWghcode);
}
/**
* Constructor of the object.
*/
public InitServlet() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
}
| zyjk | trunk/src/st/system/listener/init/InitServlet.java | Java | oos | 1,246 |
package st.system.action.form;
import java.util.ArrayList;
import java.util.List;
@SuppressWarnings("unchecked")
public class CreateCommonFileUtil {
/**
*
*
* @return ArrayList
*/
public static ArrayList<String> getFieldNamesByClassName(String classname) {
ArrayList<String> res = null;
// java.lang.reflect.Field[] fil = T_jbqkBean.class.getDeclaredFields();
Class cla;
try {
cla = Class.forName(classname);
java.lang.reflect.Field[] fil = cla.getDeclaredFields();
if (fil.length > 0) {
res = new ArrayList<String>();
for (int i = 0; i < fil.length; i++) {
String str = fil[i].getName();
if (str == null || "".equals(str.trim()) || "TABLENAME".equals(str)|| "operate_mode".equals(str) || "cf".equals(str) || "serialVersionUID".equals(str))
{
}
else
{
res.add(str);
}
}
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return res;
}
/**
*
* @return
* @throws Exception
*/
public static String getSQL(List<String>list,String classname)throws Exception
{
String sql=null;
for(String str:list)
{
if(sql==null)
sql="select "+str;
else
sql=sql+","+str;
}
sql=sql+" from "+classname.replace("Bean", "").toLowerCase();
System.out.println(sql);
return sql;
}
public static void main(String args[])
{
try {
getSQL(getFieldNamesByClassName("UI.dao.DemoBean"),"DemoBean");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| zyjk | trunk/src/st/system/action/form/CreateCommonFileUtil.java | Java | oos | 2,083 |
package st.system.action.form;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import st.platform.utils.BusinessDate;
import st.platform.utils.Config;
import st.system.dao.PtactionsBean;
import st.system.dao.PtformBean;
import st.system.dao.PtgridsBean;
import st.system.dao.PtgridscolumnBean;
/**
* <p>处理内容:创建jsp文件 主要有添加function 修改function 查询function
* </p>
* <p>Copyright: Copyright (c) 2010</p>
* @author 方立文
* 改版履历
* Rev - Date ------- Name ---------- Note --------------------------------
* 1.0 2010.9.17 方立文 新規作成
*/
public class CreateInfoJSFile extends CreateCommonFileUtil {
private OutputStreamWriter fos;
/**
* 头文件的信息
* @throws Exception
*
*/
public void createImport(String namespace) throws Exception{
fos.write(("/****************************************************\n"));
fos.write((" * <p>处理内容:</p>\n"));
fos.write((" * <p>Copyright: Copyright (c) "+BusinessDate.getToday().substring(0, 4)+"</p>;\n"));
fos.write((" * @author ;\n"));
fos.write((" * 改版履历;\n"));
fos.write((" * Rev - Date ------- Name ---------- Note -------------------\n"));
fos.write((" * 1.0 "+BusinessDate.getToday()+" 新規作成 ;\n"));
fos.write((" ****************************************************/\n"));
}
/**
* js参数
* @throws Exception
*/
public void getParem() throws Exception
{
fos.write(" \n");
fos.write(" var actionurl;\n");
fos.write("\n");
}
/**
* js参数
* @throws Exception
*/
public void getSUBMIT() throws Exception
{
fos.write(" /* 提交*/\n");
fos.write(" function submitHandler() {\n");
fos.write(" $(\"#subButton\").attr(\"disabled\", true);\n");
fos.write(" $.post(actionurl,$(\"form:first\").serialize(),function(data){\n");
fos.write(" $(\"#subButton\").removeAttr('disabled'); \n");
fos.write(" if(data.checkFlag==MSG_SUCCESS)\n");
fos.write(" {\n");
fos.write(" parent.f_search();\n");
fos.write(" $.ligerDialog.success(data.checkMessage);\n");
fos.write(" }else{\n");
fos.write(" $.ligerDialog.error(data.checkMessage);\n");
fos.write(" }\n");
fos.write(" },\"json\").error(function() { \n");
fos.write(" $(\"#subButton\").removeAttr('disabled'); \n");
fos.write(" $.ligerDialog.error(MSG_LOAD_FALL);\n");
fos.write(" });\n");
fos.write(" } \n");
fos.write(" \n");
}
//初始代码
public void getInit(PtformBean ptform) throws Exception{
String namespace = ptform.getActionname()+"_";
fos.write(" $(function () {\n");
fos.write(" try {\n");
fos.write(" var method = $(\"#method\").val(); \n");
fos.write(" if(method==\"add\"){\n");
fos.write(" actionurl=webpath+\""+namespace+"_insert.action\";\n");
fos.write(" }else if(method==\"look\"){\n");
fos.write(" $(\"#subButton\").hide();\n");
fos.write(" }else if(method==\"update\"){\n");
fos.write(" actionurl=webpath+\""+namespace+"_update.action\";\n");
fos.write(" } \n");
fos.write(" \n");
fos.write(" /*返回信息状态*/\n");
fos.write(" var strFlag = $(\"#flag\").val();\n");
fos.write(" var strMessage = $(\"#message\").val();\n");
fos.write(" if(strFlag!=MSG_SUCCESS)\n");
fos.write(" { \n");
fos.write(" $.ligerDialog.error(strMessage);\n");
fos.write(" }\n");
fos.write(" \n");
fos.write(" \n");
fos.write(" /*关闭按钮*/\n");
fos.write(" $(\"#colButton\").click(function () {\n");
fos.write(" parent.myWindow.close(); \n");
fos.write(" });\n");
fos.write(" \n");
fos.write(" /*验证样式提交*/\n");
fos.write(" var v = Form();\n");
fos.write(" $(\"form\").ligerForm();\n");
fos.write(" \n");
fos.write(" }catch (e) {\n");
fos.write(" $(\"#subButton\").removeAttr('disabled'); \n");
fos.write(" $.ligerDialog.error(e.message);\n");
fos.write(" }\n");
fos.write(" }); \n");
fos.write(" \n");
fos.write(" \n");
fos.write(" \n");
}
/**
*
* @param ptgrid
* @throws Exception
*/
public void createJS(PtformBean ptform)throws Exception
{
String gridName = ptform.getFormname();
String jspName = ptform.getFormname().toLowerCase();
String namespace = ptform.getFormpath();
String engPath = Config.getProperty("file");
String filepath = engPath+"/WebRoot/"+namespace+"/"+jspName;
PtactionsBean ptactions = new PtactionsBean();
ptactions = (PtactionsBean) ptactions.findFirstByWhere(" where actionname='"+ptform.getActionname()+"'");
FileOutputStream stream = new FileOutputStream(filepath+".js");
fos = new OutputStreamWriter(stream,"UTF-8");
//头文件
createImport(namespace+"/"+jspName);
//参数
getParem();
//提交
getSUBMIT();
// 初始代码
ptform.setActionname(ptactions.getNamespace()+"/"+ptactions.getActionname());
getInit(ptform);
fos.write((""));
fos.flush();
fos.close();
}
}
| zyjk | trunk/src/st/system/action/form/CreateInfoJSFile.java | Java | oos | 6,497 |
package st.system.action.form;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import st.platform.utils.BusinessDate;
import st.platform.utils.Config;
import st.system.dao.PtgridsBean;
import st.system.dao.PtgridscolumnBean;
/**
* <p>处理内容:创建jsp文件 主要有添加function 修改function 查询function
* </p>
* <p>Copyright: Copyright (c) 2010</p>
* @author 方立文
* 改版履历
* Rev - Date ------- Name ---------- Note --------------------------------
* 1.0 2010.9.17 方立文 新規作成
*/
public class CreateListJSPFile extends CreateCommonFileUtil {
private OutputStreamWriter fos;
/**
* 头文件的信息
* @throws Exception
*
*/
public void createImport(String namespace,String filename) throws Exception{
fos.write(("<!--\n"));
fos.write(("/****************************************************\n"));
fos.write((" * <p>处理内容:</p>\n"));
fos.write((" * <p>Copyright: Copyright (c) 2010</p>;\n"));
fos.write((" * @author ;\n"));
fos.write((" * 改版履历;\n"));
fos.write((" * Rev - Date ------- Name ---------- Note -------------------\n"));
fos.write((" * 1.0 "+BusinessDate.getToday()+" 新規作成 ;\n"));
fos.write((" ****************************************************/\n"));
fos.write(("-->\n"));
fos.write(("<%@ page language=\"java\" pageEncoding=\"UTF-8\"%>\n"));
fos.write(("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"));
fos.write(("<html>\n"));
fos.write(("<%@ include file=\"/global.jsp\"%>\n"));
fos.write((" <head>\n"));
fos.write((" <title></title>\n"));
fos.write((" <script language=\"javascript\" src=\"<%=webpath%>"+namespace+"/"+filename+".js\"></script>\n "));
fos.write((" </head>\n"));
fos.write((" <body class=\"bodystyle\">\n"));
fos.write((" <div id=\"layout\">\n"));
}
/**
* 页面结束
* @throws Exception
*/
public void getEnd() throws Exception
{
fos.write(("</div> \n"));
fos.write(("</body> \n"));
fos.write(("</html> \n"));
}
/**
* 树形
* @param gridname
* @throws IOException
*/
public void getTREE() throws IOException
{
fos.write((" <!-- TREE区域 -->\n"));
fos.write((" <div position=\"left\" title=\"菜单\"> <ul id=\"tree\" style=\"margin-top:3px;\"> </div>\n"));
}
/**
* 中间区域
* @throws Exception
*
*/
public void getGrid(List<PtgridscolumnBean> list) throws Exception{
fos.write((" <!-- 中间区域 -->\n"));
fos.write((" <div class=\"lay-center-out\" position=\"center\" style=\"border: 0\" >\n"));
if(list.size()>0)
{
fos.write((" <!-- 查询区域 -->\n"));
fos.write((" <div>\n"));
fos.write((" <table class=\"table_search_layout_1\" cellpadding=\"0\" cellspacing=\"0\" >\n"));
//1 3个查询条件
if(list.size()<4)
{
fos.write((" <tr>\n"));
for(int i=0;i<list.size();i++)
{
fos.write((" <td class=\"l-table-edit-td-right\" >"+list.get(i).getColumndesc()+":</td> \n"));
fos.write((" <td class=\"l-table-edit-td-left\" > \n"));
fos.write((" <input name=\""+list.get(i).getColumnname()+"\" type=\"text\" id=\""+list.get(i).getColumnname()+"\" ltype=\"text\" /> \n"));
fos.write((" </td> \n"));
}
fos.write(("<td align=\"left\">\n"));
fos.write(("<input id=\"searchButton\" class=\"l-button l-button-submit\" type=\"l-button l-button-submit\" value=\" 查询 \" onclick=\"f_search()\" />\n"));
fos.write((" </td> \n"));
fos.write((" </tr>\n"));
}else
{
int sta = list.size()-(list.size()/2);
// 2 4个以及以上的查询条件
fos.write(("<tr>\n"));
for(int i=0;i<sta-1;i++)
{
fos.write((" <td class=\"l-table-edit-td-right\" >"+list.get(i).getColumndesc()+":</td> \n"));
fos.write((" <td class=\"l-table-edit-td-left\" > \n"));
fos.write((" <input name=\""+list.get(i).getColumnname()+"\" type=\"text\" id=\""+list.get(i).getColumnname()+"\" ltype=\"text\" /> \n"));
fos.write((" </td> \n"));
}
fos.write(("<td align=\"left\">\n"));
fos.write(("<input id=\"searchButton\" class=\"l-button l-button-submit\" type=\"l-button l-button-submit\" value=\" 查询 \" onclick=\"f_search()\" />\n"));
fos.write((" </td> \n"));
fos.write((" </tr>\n"));
fos.write(("<tr>\n"));
for(int i=sta;i<list.size();i++)
{
fos.write((" <td class=\"l-table-edit-td-right\" >"+list.get(i).getColumndesc()+":</td> \n"));
fos.write((" <td class=\"l-table-edit-td-left\" > \n"));
fos.write((" <input name=\""+list.get(i).getColumnname()+"\" type=\"text\" id=\""+list.get(i).getColumnname()+"\" ltype=\"text\" /> \n"));
fos.write((" </td> \n"));
}
fos.write(("<td align=\"left\">\n"));
fos.write((" </td> \n"));
fos.write((" </tr>\n"));
}
fos.write((" </table>\n"));
fos.write((" </div>\n"));
}
fos.write((" <!-- grid区域 -->\n"));
fos.write((" <div id=\"mainGrid\"></div>\n"));
fos.write((" </div>\n"));
}
/**
*
* @param ptgrid
* @throws Exception
*/
public void createJSP(PtgridsBean ptgrid)throws Exception
{
String gridName = ptgrid.getGridname();
String jspName = ptgrid.getFieldname();
String namespace = ptgrid.getFieldpath();
String engPath = Config.getProperty("file");
String filepath = engPath+"/WebRoot/"+namespace+"/"+jspName;
FileOutputStream stream = new FileOutputStream(filepath+".jsp");
fos = new OutputStreamWriter(stream,"UTF-8");
createImport(ptgrid.getFieldpath(),ptgrid.getFieldname());
getTREE();
PtgridscolumnBean ptgridscolumn=new PtgridscolumnBean();
List<PtgridscolumnBean> columnlist = ptgridscolumn.findByWhere(" where gridname ='"+ptgrid.getGridname()+"' and isfind = '1'");
getGrid(columnlist);
getEnd();
fos.write((""));
fos.flush();
fos.close();
}
}
| zyjk | trunk/src/st/system/action/form/CreateListJSPFile.java | Java | oos | 7,497 |
package st.system.action.form;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.sql.SQLException;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import UI.action.demo.DemoAction;
import UI.dao.DemoBean;
import UI.message.MisConstant;
import st.platform.db.SerialNumber;
import st.platform.utils.BusinessDate;
import st.platform.utils.Config;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtableBean;
import st.system.dao.PtablecolumnBean;
import st.system.dao.PtactionsBean;
/**
* <p>
* 处理内容:创建java文件 有增 删 改 查询单条信息的功能
* </p>
* <p>
* Copyright: Copyright (c) 2010
* </p>
*
* @author 方立文 改版履历 Rev - Date ------- Name ---------- Note
* -------------------------------- 1.0 2010.9.17 方立文 新規作成
*/
public class CreateJAVAFile extends CreateCommonFileUtil {
/**
* 写入package头文件
*
* @param packageStr
*/
private void generateHead(String packageStr) {
try {
packageStr = packageStr.replaceAll("/", ".");
packageStr = packageStr.substring(1,packageStr.length());
fos.write(("/****************************************************\n"));
fos.write((" * <p>处理内容:</p>\n"));
fos.write((" * <p>Copyright: Copyright (c) 2010</p>;\n"));
fos.write((" * @author ;\n"));
fos.write((" * 改版履历;\n"));
fos.write((" * Rev - Date ------- Name ---------- Note -------------------\n"));
fos.write((" * 1.0 " + BusinessDate.getToday() + " 新規作成 ;\n"));
fos.write((" ****************************************************/\n"));
fos.write(("package " + packageStr + ";\n"));
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 写入import头文件
*
*/
private void generateImport(String BeanName) {
try {
PtableBean ptable = new PtableBean();
String [] beans = BeanName.split(",");
fos.write( "\n import org.apache.log4j.Logger;" );
fos.write( "\n import org.apache.struts2.convention.annotation.Action;" );
fos.write( "\n import org.apache.struts2.convention.annotation.Namespace;" );
fos.write( "\n import org.apache.struts2.convention.annotation.ParentPackage;" );
fos.write( "\n import org.apache.struts2.convention.annotation.Result;" );
fos.write("\n " );
fos.write( "\n import st.platform.db.SerialNumber;" );
fos.write("\n import st.portal.action.BasicAction;" );
fos.write("\n import st.portal.action.MessageBean;");
fos.write( "\n import st.portal.action.PageBean;" );
fos.write("\n import UI.message.MisConstant;" );
fos.write("\n import UI.util.BusinessDate;");
// ptable =PtableBean.findFirst(" Where beanname = '"+BeanName+"'");
fos.write("\n import UI.dao.enterfile.*;");
fos.write("\n import UI.dao.zyjk.*;");
fos.write("\n import st.system.dao.*;");
fos.write("\n");
} catch ( Exception e ) {
e.printStackTrace();
}
}
/**
* 属性内容
*
* @param ptactionBean
* @throws Exception
*/
public void getParams(String Beanname, String paramBean, String className) throws Exception {
fos.write(("\n"));
fos.write(("\n"));
fos.write(("\tprivate static final long serialVersionUID = 1L;\n")); // add
// by
// Flw,2010.09.19
// 序列化
fos.write(("\t private static Logger logger = Logger.getLogger(" + className + ".class);\n"));
fos.write(("\t private " + Beanname + " " + paramBean + "; // 返回的信息;\n"));
fos.write(("\n"));
fos.write(("\t private String strWhere=\"\"; // 查询条件;\n"));
fos.write(("\n"));
fos.write(("\t private String strSysno=\"\"; // 主键编号;\n"));
fos.write(("\n"));
fos.write(("\t private PageBean pageBean; // 分页类;\n"));
fos.write(("\n"));
fos.write(("\t private MessageBean messageBean;// 操作状态\n"));
fos.write(("\n"));
}
/**
* 添加方法
*
* @param Beanname
* 对象
* @param paramBean
* 对象属性名称
* @param className
* 类名称
* @param tableName
* 表名称
* @param keyMethod
* 主键名称
* @throws Exception
*/
public void getAddMath(String Beanname, String paramBean, String className, String tableName, String keyMethod)
throws Exception {
String setMethod = "set" + keyMethod;
fos.write(("\t/**\n"));
fos.write(("\t* \n"));
fos.write(("\t*添加方法\n"));
fos.write(("\t* @return \n"));
fos.write(("\t*/ \n"));
fos.write(("\t @Action(value = \"" + className + "_insert\") \n"));
fos.write((" public String insert() {\n"));
fos.write(("\t try {\n"));
fos
.write(("\t String number = BusinessDate.getNoFormatToday() + \"-\" + SerialNumber.getNextSerialNo(\"67\");\n"));
fos.write(("\t " + paramBean + "." + setMethod + "(number);\n"));
fos.write(("\t messageBean = insert(" + paramBean + ");\n"));
fos.write(("\t } catch (Exception e) {;\n"));
fos.write(("\t // TODO Auto-generated catch block\n"));
fos.write(("\t // 设置错误返回的提示\n"));
fos.write(("\t logger.error(MisConstant.MSG_OPERATE_FAIL, e);\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_FAIL);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);\n"));
fos.write(("\t }\n"));
fos.write(("\t return MisConstant.RETMESSAGE;\n"));
fos.write(("\t\t}\n"));
fos.write(("\n"));
}
/**
* 修改方法
*
* @param Beanname
* 对象
* @param paramBean
* 对象属性名称
* @param className
* 类名称
* @param tableName
* 表名称
* @param keyMethod
* 主键名称
* @throws Exception
*/
public void getUpdatMethod(String Beanname, String paramBean, String className, String tableName, String keyMethod)
throws Exception {
String getMethod = "get" + keyMethod;
fos.write(("\t/**\n"));
fos.write(("\t* \n"));
fos.write(("\t* 修改方法\n"));
fos.write(("\t* @return \n"));
fos.write(("\t*/ \n"));
fos.write(("\t @Action(value = \"" + className + "_update\") \n"));
fos.write((" public String update() {\n"));
fos.write(("\t try {\n"));
fos.write(("\t \n"));
fos.write(("\t messageBean = update(" + paramBean + ", \" where " + keyMethod + " ='\" + " + paramBean + "."
+ getMethod + "() + \"'\");;\n"));
fos.write(("\t \n"));
fos.write(("\t } catch (Exception e) {;\n"));
fos.write(("\t // TODO Auto-generated catch block\n"));
fos.write(("\t // 设置错误返回的提示\n"));
fos.write(("\t logger.error(MisConstant.MSG_OPERATE_FAIL, e);\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_FAIL);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);\n"));
fos.write(("\t }\n"));
fos.write(("\t return MisConstant.RETMESSAGE;\n"));
fos.write(("\t\t}\n"));
fos.write(("\n"));
}
/**
* 删除方法
*
* @param Beanname
* 对象
* @param paramBean
* 对象属性名称
* @param className
* 类名称
* @param tableName
* 表名称
* @param keyMethod
* 主键名称
* @throws Exception
*/
public void getDeleteMethod(String Beanname, String paramBean, String className, String tableName, String keyMethod)
throws Exception {
String getMethod = "get" + keyMethod;
fos.write(("\t/**\n"));
fos.write(("\t* \n"));
fos.write(("\t* 删除改方法\n"));
fos.write(("\t* @return \n"));
fos.write(("\t*/ \n"));
fos.write(("\t @Action(value = \"" + className + "_delete\") \n"));
fos.write((" public String delete() {\n"));
fos.write(("\t try {\n"));
fos.write(("\t " + paramBean + " = new " + Beanname + "();\n"));
fos.write(("\t messageBean = delete(" + paramBean + ", \" where " + keyMethod + " ='\" + " + paramBean + "."
+ getMethod + "() + \"'\");\n"));
fos.write(("\t \n"));
fos.write(("\t } catch (Exception e) {;\n"));
fos.write(("\t // TODO Auto-generated catch block\n"));
fos.write(("\t // 设置错误返回的提示\n"));
fos.write(("\t logger.error(MisConstant.MSG_OPERATE_FAIL, e);\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_FAIL);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);\n"));
fos.write(("\t }\n"));
fos.write(("\t return MisConstant.RETMESSAGE;\n"));
fos.write(("\t\t}\n"));
fos.write(("\n"));
}
/**
* 查询返回json方法
*
* @param Beanname
* 对象
* @param paramBean
* 对象属性名称
* @param className
* 类名称
* @param tableName
* 表名称
* @param keyMethod
* 主键名称
* @throws Exception
*/
public void getFindJsonMethod(String Beanname, String paramBean, String className, String tableName,
String keyMethod) throws Exception {
String getMethod = "get" + keyMethod;
fos.write(("\t/**\n"));
fos.write(("\t* \n"));
fos.write(("\t* 查询信息 返回json信息\n"));
fos.write(("\t* @return \n"));
fos.write(("\t*/ \n"));
fos.write(("\t @Action(value = \"" + className + "_findObjson\", results = { \n"));
fos
.write(("\t @Result(type = \"json\", name = MisConstant.FINDOBJSON, params = { \"includeProperties\",\"messageBean.*,"
+ paramBean + ".*\" }) }) \n"));
fos.write((" public String findObjson() {\n"));
fos.write(("\t try {\n"));
fos.write(("\t " + paramBean + " = new " + Beanname + "();\n"));
fos.write(("\t if (!(messageBean.getMethod().equals(\"add\"))) {\n"));
fos
.write(("\t " + paramBean + " = (" + Beanname + ")findByKey(" + paramBean + ", \" where " + keyMethod + " ='\" + strSysno + \"'\");\n"));
fos.write(("\t if (" + paramBean + " != null) {\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);\n"));
fos.write(("\t }else{\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_FAIL);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);\n"));
fos.write(("\t }\n"));
fos.write(("\t }\n"));
fos.write(("\t } catch (Exception e) {;\n"));
fos.write(("\t // TODO Auto-generated catch block\n"));
fos.write(("\t // 设置错误返回的提示\n"));
fos.write(("\t logger.error(MisConstant.MSG_OPERATE_FAIL, e);\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_FAIL);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);\n"));
fos.write(("\t }\n"));
fos.write(("\t return MisConstant.FINDOBJSON;\n"));
fos.write(("\t\t}\n"));
fos.write(("\n"));
}
/**
* 查询返回jsp
*
* @param Beanname
* 对象
* @param paramBean
* 对象属性名称
* @param className
* 类名称
* @param tableName
* 表名称
* @param keyMethod
* 主键名称
* @throws Exception
*/
public void getFindMethod(String Beanname, String paramBean, String className, String tableName, String keyMethod,
String jsp) throws Exception {
String getMethod = "get" + keyMethod;
fos.write(("\t/**\n"));
fos.write(("\t* \n"));
fos.write(("\t* 查询信息 返回jsp\n"));
fos.write(("\t* @return \n"));
fos.write(("\t*/ \n"));
fos.write(("\t @Action(value = \"" + className + "_findByKey\", results = { \n"));
fos.write(("\t @Result(name = MisConstant.FINDBYKEY, location = \"" + jsp + "\") }) \n"));
fos.write((" public String findByKey() {\n"));
fos.write(("\t try {\n"));
fos.write(("\t " + paramBean + " = new " + Beanname + "();\n"));
fos.write(("\t if (!(messageBean.getMethod().equals(\"add\"))) {\n"));
fos
.write(("\t " + paramBean + " = (" + Beanname + ")findByKey(" + paramBean + ", \" where " + keyMethod + " ='\" + strSysno + \"'\");\n"));
fos.write(("\t if (" + paramBean + " != null) {\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);\n"));
fos.write(("\t }else{\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_FAIL);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);\n"));
fos.write(("\t }\n"));
fos.write(("\t }\n"));
fos.write(("\t } catch (Exception e) {;\n"));
fos.write(("\t // TODO Auto-generated catch block\n"));
fos.write(("\t // 设置错误返回的提示\n"));
fos.write(("\t logger.error(MisConstant.MSG_OPERATE_FAIL, e);\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_FAIL);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);\n"));
fos.write(("\t }\n"));
fos.write(("\t return MisConstant.FINDBYKEY;\n"));
fos.write(("\t\t}\n"));
fos.write(("\n"));
}
/**
* 查询分页
*
* @param Beanname
* 对象
* @param paramBean
* 对象属性名称
* @param className
* 类名称
* @param tableName
* 表名称
* @param keyMethod
* 主键名称
* @throws Exception
*/
public void getMethodFindList(String className, String GridName) throws Exception {
fos.write(("\t/**\n"));
fos.write(("\t* \n"));
fos.write(("\t* 分页查询\n"));
fos.write(("\t* @return \n"));
fos.write(("\t*/ \n"));
fos.write(("\t @Action(value = \"" + className + "_findList\")\n"));
fos.write((" public String findList() {\n"));
fos.write(("\t try {\n"));
fos.write(("\t messageBean = new MessageBean();\n"));
fos.write(("\t String strFSql =\"\";\n"));
fos.write(("\t pageBean = findList(strFSql, strWhere,\"\", pageBean);\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);\n"));
fos.write(("\t } catch (Exception e) {;\n"));
fos.write(("\t // TODO Auto-generated catch block\n"));
fos.write(("\t // 设置错误返回的提示\n"));
fos.write(("\t logger.error(MisConstant.MSG_OPERATE_FAIL, e);\n"));
fos.write(("\t messageBean.setCheckFlag(MisConstant.MSG_FAIL);\n"));
fos.write(("\t messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);\n"));
fos.write(("\t }\n"));
fos.write(("\t return MisConstant.FINDLIST;\n"));
fos.write(("\t\t}\n"));
fos.write(("\n"));
}
/**
* 返回属性的get set 方法
*
* @param Beanname
* @param paramBean
* @throws Exception
*/
public void getParamMehtod(String Beanname, String paramBean, String className) throws Exception {
fos.write(("\t public " + Beanname + " get" + Beanname + "() {\n"));
fos.write(("\t return " + paramBean + ";\n"));
fos.write(("\t }\n"));
fos.write(("\t \n"));
fos.write(("\t public void set" + Beanname + "(" + Beanname + " " + paramBean + ") {\n"));
fos.write(("\t this." + paramBean + " = " + paramBean + ";\n"));
fos.write(("\t }\n"));
fos.write(("\t \n"));
fos.write(("\t public MessageBean getMessageBean() {\n"));
fos.write(("\t return messageBean;\n"));
fos.write(("\t }\n"));
fos.write(("\t \n"));
fos.write(("\t public void setMessageBean(MessageBean messageBean) {\n"));
fos.write(("\t this.messageBean = messageBean;\n"));
fos.write(("\t }\n"));
fos.write(("\t \n"));
fos.write(("\t public PageBean getPageBean() {\n"));
fos.write(("\t return pageBean;\n"));
fos.write(("\t }\n"));
fos.write(("\t \n"));
fos.write(("\t public void setPageBean(PageBean pageBean) {\n"));
fos.write(("\t this.pageBean = pageBean;\n"));
fos.write(("\t }\n"));
fos.write(("\t \n"));
fos.write(("\t public String getStrSysno() {\n"));
fos.write(("\t return strSysno;\n"));
fos.write(("\t }\n"));
fos.write(("\t \n"));
fos.write(("\t public void setStrSysno(String strSysno) {\n"));
fos.write(("\t this.strSysno = strSysno;\n"));
fos.write(("\t }\n"));
fos.write(("\t \n"));
fos.write(("\t public String getStrWhere() {\n"));
fos.write(("\t return strWhere;\n"));
fos.write(("\t }\n"));
fos.write(("\t \n"));
fos.write(("\t public void setStrWhere(String strWhere) {\n"));
fos.write(("\t this.strWhere = strWhere;\n"));
fos.write(("\t }\n"));
fos.write(("\t \n"));
}
/**
* 组成方法
*
* @param ptactionBean
* @throws Exception
*/
private OutputStreamWriter fos;
@SuppressWarnings("unused")
public void createJava(PtactionsBean ptactionBean) throws Exception {
String className = ptactionBean.getActionname();
String Beanname = ptactionBean.getBeanname();
String [] strbean = Beanname.split(",");
Beanname = strbean[0];
String classPath = ptactionBean.getActionpath();
if (className == null || Beanname == null || classPath == null) {
System.out.println("Error!");
return;
}
String tableName = Beanname.replace("Bean", "");
PtablecolumnBean pcolumnBean = new PtablecolumnBean();
pcolumnBean = (PtablecolumnBean) pcolumnBean.findFirstByWhere("Where tablename ='" + tableName + "' and iskey = 'PRI'");
String paramKey = "";
String keyMethod = "";
if(pcolumnBean == null){
pcolumnBean = new PtablecolumnBean();
pcolumnBean = (PtablecolumnBean) pcolumnBean.findFirstByWhere("Where tablename ='" + tableName + "'");
}
if (pcolumnBean != null) {
paramKey = pcolumnBean.getColumnname();
keyMethod = "" + paramKey.substring(0, 1).toUpperCase()
+ paramKey.substring(1, paramKey.length()).toLowerCase();
}//当表中没有主键的时候 就查询出第一个
else{
}
String paramBean = Beanname.replace("Bean", "").toLowerCase() + "Bean";
String bean = Beanname.toLowerCase();
// String gridName = ptactionBean.getGridname();
String strJsp = ptactionBean.getInfopage();
String namespace = "/" + classPath.replace('.', '/') + "/";
String engPath = Config.getProperty("file");
String filepath = "src/" + classPath.replace('.', '/') + "/";
if (engPath != null) {
filepath = engPath + "/src/" + classPath.replace('.', '/') + "/";
}
FileOutputStream stream = new FileOutputStream(filepath + className + ".java");
fos = new OutputStreamWriter(stream, "UTF-8");
// package
generateHead(classPath);
fos.write(("\n"));
fos.write(("\n"));
fos.write(("\n"));
fos.write(("\n"));
// 获取import
generateImport(Beanname);
fos.write(("@ParentPackage(\"struts-filter\")\n"));
fos.write(("@Namespace(\"" + namespace + "\") \n"));
fos.write(("public class " + className + " extends BasicAction {\n"));
// 获取param属性
getParams(Beanname, paramBean, className);
// 分页查询
// getMethodFindList(className, gridName);
// 查询返回json object
getFindJsonMethod(Beanname, paramBean, className, tableName, keyMethod);
// 查询返回jsp
getFindMethod(Beanname, paramBean, className, tableName, keyMethod, strJsp);
// 添加方法
getAddMath(Beanname, paramBean, className, tableName, keyMethod);
// update方法
getUpdatMethod(Beanname, paramBean, className, tableName, keyMethod);
// 删除方法
getDeleteMethod(Beanname, paramBean, className, tableName, keyMethod);
// get set
getParamMehtod(Beanname, paramBean, className);
fos.write(("}\n"));
fos.flush();
fos.close();
System.out.println("创建成功");
}
public static void main(String args[]) {
CreateJAVAFile crjava = new CreateJAVAFile();
try {
PtactionsBean ptactionBean = new PtactionsBean();
ptactionBean.setActionname("TextACTION");
ptactionBean.setActiondesc("测试");
ptactionBean.setActionpath("UI.action.demo");
ptactionBean.setBeanname("DemoBean");
ptactionBean.setInfopage("/system/demo/info.jsp");
// ptactionBean.setGridname("GridName");
crjava.createJava(ptactionBean);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| zyjk | trunk/src/st/system/action/form/CreateJAVAFile.java | Java | oos | 23,671 |
package st.system.action.form;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
/**
* 创建模板页面方法
* 读取页面
* 在每一行前加上写入
* 并将"前加反斜杠
* @author Administrator
*
*/
public class CreatModel {
String strFile ="F:/Work4/zpf2/WebRoot/UI/demo/demoinfo.js";
String cretFile ="F:/Work4/zpf2/src/st/system/action/form/Model.java";
public void openPage() throws Exception{
FileOutputStream stream = new FileOutputStream(cretFile);
OutputStreamWriter fos = new OutputStreamWriter(stream,"UTF-8");
File file = new File(strFile);
FileInputStream inputstream = new FileInputStream(strFile);
InputStreamReader red = new InputStreamReader(inputstream,"UTF-8");
String s;
BufferedReader in = new BufferedReader(red);
while ((s = in.readLine()) != null) {
s = s.replace("\"","\\\"");
fos.write("fos.write(\""+s+"\\n\");\n");
System.out.println(s);
}
fos.flush();
fos.close();
}
public static void main(String args[])
{
CreatModel model = new CreatModel();
try {
model.openPage();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| zyjk | trunk/src/st/system/action/form/CreatModel.java | Java | oos | 1,561 |
package st.system.action.form;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import st.platform.utils.BusinessDate;
import st.platform.utils.Config;
import st.system.dao.PtablecolumnBean;
import st.system.dao.PtactionsBean;
import st.system.dao.PtgridsBean;
import st.system.dao.PtgridscolumnBean;
/**
* <p>处理内容:创建jsp文件 主要有添加function 修改function 查询function
* </p>
* <p>Copyright: Copyright (c) 2010</p>
* @author 方立文
* 改版履历
* Rev - Date ------- Name ---------- Note --------------------------------
* 1.0 2010.9.17 方立文 新規作成
*/
public class CreateListJSFile extends CreateCommonFileUtil {
private OutputStreamWriter fos;
/**
* 头文件的信息
* @throws Exception
*
*/
public void createImport() throws Exception{
fos.write(("/****************************************************\n"));
fos.write((" * <p>处理内容:</p>\n"));
fos.write((" * <p>Copyright: Copyright (c) "+ BusinessDate.getToday().substring(0, 4)+"</p>;\n"));
fos.write((" * @author ;\n"));
fos.write((" * 改版履历;\n"));
fos.write((" * Rev - Date ------- Name ---------- Note -------------------\n"));
fos.write((" * 1.0 "+BusinessDate.getToday()+" 新規作成 ;\n"));
fos.write((" ****************************************************/\n"));
}
/**
* js参数
* @throws Exception
*/
public void getParam() throws Exception
{
fos.write(("var grid = null;\n"));
fos.write(("var tree = null;\n"));
fos.write(("var myWindow = null;\n"));
fos.write(("var menu=null; \n"));
fos.write(("var openWidth=\"630\";\n"));
fos.write(("var openHeight=\"300\"; \n"));
}
//初始代码
public void getInit(PtgridsBean grid) throws Exception{
fos.write(("//初始;\n"));
fos.write(("$(function (){\n"));
fos.write(("try{\n"));
fos.write((" /*布局*/\n"));
fos.write((" $(\"#layout\").ligerLayout({leftWidth: 200 });\n"));
fos.write((" /*grid*/ \n"));
/*GRID*/
fos.write((" var toolbar = [\n"));
fos.write((" { text: '新建', click:f_add,icon: 'add' }, \n"));
fos.write((" { line: true },\n"));
fos.write((" { text: '修改', click:f_update,icon: 'modify' },\n"));
fos.write((" { line: true },\n"));
fos.write((" { text: '删除', click:f_remove,icon:'delete' }, \n"));
fos.write((" { line: true }, \n"));
fos.write((" { text: '查看', click:f_look, icon:'pager' } \n"));
fos.write((" ]; \n"));
fos.write((" grid = Grid('"+grid.getGridname()+"','"+grid.getGriddesc()+"',toolbar); \n"));
//判断是否有树
if(grid.getIstree().equals("1"))
{
fos.write((" /*TREE*/ \n"));
fos.write((" $(\"#tree\").ligerTree({ \n"));
fos.write((" data:[{id:'1',pid:'0',children:[],text:'"+grid.getGriddesc()+"',isexpand:'false'}], \n"));
fos.write((" idFieldName :'id',\n"));
fos.write((" parentIDFieldName :'pid', \n"));
fos.write((" nodeWidth : 200,\n"));
fos.write((" checkbox: false,\n"));
fos.write((" slide: false, \n"));
fos.write((" onBeforeExpand: onBeforeExpand,\n"));
fos.write((" onSelect: function (node){ \n"));
fos.write((" var nodeid=node.data.id; \n"));
fos.write((" t_enter(nodeid); \n"));
fos.write((" }, \n"));
fos.write((" onContextmenu: function (node, e) { \n"));
fos.write((" actionNodeID = node.data.text; \n"));
fos.write((" menu.show({ top: e.pageY, left: e.pageX }); \n"));
fos.write((" return false;\n"));
fos.write((" }\n"));
fos.write((" }); \n"));
fos.write(("tree = $(\"#tree\").ligerGetTreeManager(); \n"));
fos.write(" /*右键菜单*/\n");
fos.write(" menu = $.ligerMenu({ top: 100, left: 100, width: 120, items:\n");
fos.write(" [\n");
fos.write(" { text: '增加', click: f_add, icon: 'add' },\n");
fos.write(" { text: '修改', click: f_update, icon: 'modify' },\n");
fos.write(" { line: true },\n");
fos.write(" { text: '删除', click: f_remove, icon: 'delete' }\n");
fos.write(" ]\n");
fos.write(" });\n");
}
fos.write(" }catch (e) {\n");
fos.write(" $.ligerDialog.error(e.message);\n");
fos.write(" } \n");
fos.write(" });\n");
fos.write(" \n");
}
/**
* grid的双击
* @throws Exception
*/
public void getGridDb(String id,PtgridsBean ptgrid) throws Exception{
String namespace = ptgrid.getActionname()+"_"+"findByKey.action?messageBean.method=look&strSysno=";
fos.write(" /*grid双击事件*/ \n");
fos.write(" function onDblClickRow (data, rowindex, rowobj){\n");
fos.write(" try {\n");
fos.write(" myWindow = $.ligerDialog.open({url:webpath+\""+namespace+"\"+data."+id+", width: openWidth,height:openHeight, title:\""+ptgrid.getGriddesc()+"\",\n");
fos.write(" showMax: true, showToggle: true, showMin: false, isResize: true, slide: false }); \n");
fos.write(" }catch (e) {\n");
fos.write("$.ligerDialog.error(e.message);\n");
fos.write(" }\n");
fos.write(" }\n");
}
/**
* 树形
* @param gridname
* @throws IOException
*/
public void getTREE(String treeName) throws IOException
{
fos.write(" /*Tree展开事件*/ \n");
fos.write(" function onBeforeExpand(node){\n");
fos.write(" var nodeid=node.data.id;\n");
fos.write(" if(node.data.children && node.data.children.length == 0){\n");
fos.write(" tree.loadData(node.target,webpath+\"/st/system/action/tree/tree_getTree.action?strTreeName="+treeName+"\");\n");
fos.write(" } \n");
fos.write(" } \n");
fos.write(" \n");
fos.write(" /*Tree查看*/\n");
fos.write(" function t_enter(nodeid){\n");
fos.write(" try{ \n");
fos.write(" var strWhere = \" \"; \n");
fos.write(" if(nodeid.length>0){ \n");
fos.write(" strWhere = \" and parentmenuid = '\"+nodeid+\"' or menuid='\"+nodeid+\"'\"; \n");
fos.write(" } \n");
fos.write(" var manager = $(\"#mainGrid\").ligerGetGridManager(); \n");
fos.write(" //初始化查询起始页\n");
fos.write(" manager.set(\"newPage\",1);\n");
fos.write(" //初始化查询条件\n");
fos.write(" manager.set(\"parms\",{\"strWhere\":strWhere});\n");
fos.write(" manager.loadData(true);\n");
fos.write(" }catch (e) {\n");
fos.write(" $.ligerDialog.error(e.message);\n");
fos.write(" }\n");
fos.write(" \n");
fos.write(" } \n");
fos.write("\n");
}
/**
* 查询条件
* @throws IOException
*/
public void getSearch(List<PtgridscolumnBean>list) throws IOException
{
fos.write(" /*根据条件查询*/\n");
fos.write(" function f_search(){\n");
fos.write(" try{\n");
fos.write(" var strWhere = \" \"; \n");
PtgridscolumnBean gridcolumn;
//初始化查询条件
for(int i=0;i<list.size();i++)
{
gridcolumn = list.get(i);
fos.write(" //"+gridcolumn.getColumndesc()+"\n");
fos.write(" var "+gridcolumn.getColumnname()+" = $(\"#"+gridcolumn.getColumnname()+"\").val();\n");
fos.write(" if("+gridcolumn.getColumnname()+".length>0) {\n");
fos.write(" strWhere = \" and "+gridcolumn.getColumnname()+" like '%\"+"+gridcolumn.getColumnname()+"+\"%' \";\n");
fos.write(" }\n");
}
fos.write(" var manager = $(\"#mainGrid\").ligerGetGridManager(); \n");
fos.write(" //manager.loadServerData({strWhere:strWhere},function (countmain) {\n");
fos.write(" // alert(countmain);\n");
fos.write(" //});\n");
fos.write(" //初始化查询起始页\n");
fos.write(" manager.set(\"newPage\",1);\n");
fos.write(" //初始化查询条件\n");
fos.write(" manager.set(\"parms\",{\"strWhere\":strWhere});\n");
fos.write(" manager.loadData(true);\n");
fos.write(" }catch (e) {\n");
fos.write(" $.ligerDialog.error(e.message);\n");
fos.write(" }\n");
fos.write(" }\n");
fos.write(" \n");
}
/**
* 删除方法
* @throws IOException
*/
public void getDelete(String id,PtgridsBean ptgrid) throws IOException{
String namespace = ptgrid.getActionname()+"_"+"delete.action";
fos.write(" /*删除*/\n");
fos.write(" function f_remove(){ \n");
fos.write(" try {\n");
fos.write(" var node = tree.getSelected(); \n");
fos.write(" var strId =\"''\";\n");
fos.write(" var manager = $(\"#mainGrid\").ligerGetGridManager(); \n");
fos.write(" var selected = manager.getSelectedRows(); \n");
fos.write(" if (selected==null&&node==null) {\n");
fos.write(" $.ligerDialog.warn(MSG_NORECORD_SELECT);\n");
fos.write(" }else{ \n");
fos.write(" $.ligerDialog.confirm(MSG_DELETE_CONFRIM, function (state)\n");
fos.write(" {\n");
fos.write(" if(state)\n");
fos.write(" { \n");
fos.write(" if(selected!=null&&selected.length>0){\n");
fos.write(" for(var i=0;i<selected.length;i++){\n");
fos.write(" strId = strId+\",'\"+selected[i]."+id+"+\"'\";\n");
fos.write(" }\n");
fos.write(" }else{\n");
fos.write(" strId = strId+\",'\"+node.data.id+\"'\";\n");
fos.write(" }\n");
fos.write(" $.post(webpath+\""+namespace+"\",{strSysno:strId},function(data){\n");
fos.write(" if(data.checkFlag==MSG_SUCCESS){\n");
fos.write(" f_search(); \n");
fos.write(" $.ligerDialog.success(data.checkMessage);\n");
fos.write(" }else{\n");
fos.write(" $.ligerDialog.error(data.checkMessage);\n");
fos.write(" }\n");
fos.write(" },\"json\").error(function() { \n");
fos.write(" $.ligerDialog.error(MSG_LOAD_FALL)});\n");
fos.write(" //去掉节点\n");
fos.write(" tree.remove(node.target);\n");
fos.write(" }\n");
fos.write(" }); \n");
fos.write(" } \n");
fos.write(" }catch (e) {\n");
fos.write(" $.ligerDialog.error(e.message);\n");
fos.write(" }\n");
fos.write(" }\n");
fos.write(" \n");
}
/**
* 新建方法
* @throws IOException
*/
public void getAdd(String id,PtgridsBean ptgrid)throws IOException{
String namespace = ptgrid.getActionname()+"_"+"findByKey.action?messageBean.method=add&strSysno=";
fos.write(" /*新建*/\n");
fos.write(" function f_add(){\n");
fos.write(" try {\n");
fos.write("\n");
fos.write(" var node = tree.getSelected();\n");
fos.write(" var manager = $(\"#mainGrid\").ligerGetGridManager(); \n");
fos.write(" var selected = manager.getSelectedRow(); \n");
fos.write(" \n");
fos.write(" var strId;\n");
fos.write(" \n");
fos.write(" if(node==null&&selected==null){\n");
fos.write(" $.ligerDialog.warn(MSG_NORECORD_SELECT);\n");
fos.write(" }else if(selected !=null){\n");
fos.write(" strId=selected."+id+";\n");
fos.write(" }else{\n");
fos.write(" strId=node.data.id;\n");
fos.write(" }\n");
fos.write(" myWindow = $.ligerDialog.open({ url: webpath+\""+namespace+"\"+strId, width: openWidth,height:openHeight, title: '"+ptgrid.getGriddesc()+"',\n");
fos.write(" showMax: true, showToggle: true, showMin: false, isResize: false, slide: false }); \n");
fos.write(" f_search(); \n");
fos.write(" }catch (e) {\n");
fos.write(" $.ligerDialog.error(e.message);\n");
fos.write(" } \n");
fos.write(" }\n");
fos.write(" \n");
}
/**
* 修改方法
* @throws IOException
*/
public void getUpdate(String id,PtgridsBean ptgrid)throws IOException{
String namespace = ptgrid.getActionname()+"_"+"findByKey.action?messageBean.method=update&strSysno=";
fos.write(" /*修改*/\n");
fos.write(" function f_update(){ \n");
fos.write(" try {\n");
fos.write(" var node = tree.getSelected(); \n");
fos.write(" var parent=tree.getParent(node); \n");
fos.write(" var manager = $(\"#mainGrid\").ligerGetGridManager(); \n");
fos.write(" var selected = manager.getSelectedRow(); \n");
fos.write(" var strId;\n");
fos.write(" if(node==null&&selected==null){\n");
fos.write(" $.ligerDialog.warn(MSG_NORECORD_SELECT);\n");
fos.write(" }else if(selected !=null){\n");
fos.write(" strId=selected.menuid;\n");
fos.write(" }else{\n");
fos.write(" strId=node.data.id;\n");
fos.write(" }\n");
fos.write(" \n");
fos.write(" if (strId==null||strId.length == 0) {\n");
fos.write(" $.ligerDialog.warn(MSG_NORECORD_SELECT);\n");
fos.write(" }else{\n");
fos.write(" myWindow = $.ligerDialog.open({url: webpath+\""+namespace+"\"+strId, width: openWidth,height:openHeight, title: '"+ptgrid.getGriddesc()+"',\n");
fos.write(" showMax: true, showToggle: true, showMin: false, isResize: false, slide: false }); \n");
fos.write(" f_search(); \n");
fos.write(" }\n");
fos.write(" }catch (e) {\n");
fos.write(" $.ligerDialog.error(e.message);\n");
fos.write(" } \n");
fos.write(" } \n");
fos.write(" \n");
}
/**
* 查看方法
* @throws IOException
*/
public void getLOOK(String id,PtgridsBean ptgrid)throws IOException{
String namespace = ptgrid.getActionname()+"_"+"findByKey.action?messageBean.method=look&strSysno=";
fos.write(" /*Grid查看*/\n");
fos.write(" function f_look()\n");
fos.write(" {\n");
fos.write(" try {\n");
fos.write(" var manager = $(\"#mainGrid\").ligerGetGridManager(); \n");
fos.write(" var selected = manager.getSelectedRow(); \n");
fos.write(" if (selected==null||selected.length == 0) {\n");
fos.write(" $.ligerDialog.warn(MSG_NORECORD_SELECT);\n");
fos.write(" }else{\n");
fos.write(" myWindow = $.ligerDialog.open({url: webpath+\""+namespace+"\"+selected."+id+", width: openWidth,height:openHeight, title: '"+ptgrid.getGriddesc()+"',\n");
fos.write(" showMax: true, showToggle: true, showMin: false, isResize: true, slide: false }); \n");
fos.write(" }\n");
fos.write(" }catch (e) {\n");
fos.write(" $.ligerDialog.error(e.message);\n");
fos.write(" }\n");
fos.write(" }\n");
}
/**
* tree 添加节点
* @throws IOException
*/
public void getTreeAdd(PtgridsBean ptgrid)throws IOException{
fos.write(" \n");
fos.write(" /*增加结点*/ \n");
fos.write(" function node_add(strId){\n");
fos.write(" try{\n");
fos.write(" var node = tree.getSelected();\n");
fos.write(" var nodes = []; \n");
fos.write(" $.post(webpath+\"/st/system/action/tree/tree_getTree.action\",{strTreeName:\""+ptgrid.getTreename()+"\",strTreeID:strId},function(data){\n");
fos.write(" \n");
fos.write(" if (node){\n");
fos.write(" var nodedata = data\n");
fos.write(" var i=data.length-1;\n");
fos.write(" nodes.push(data[i]); \n");
fos.write(" tree.append(node.target, nodes); \n");
fos.write(" } \n");
fos.write(" },\"json\").error(function() { \n");
fos.write(" $.ligerDialog.error(MSG_LOAD_FALL)});\n");
fos.write(" }catch (e) {\n");
fos.write(" $.ligerDialog.error(e.message);\n");
fos.write(" }\n");
fos.write(" }\n");
fos.write(" \n");
}
/**
* tree 修改节点
* @throws IOException
*/
public void getTreeUpate(PtgridsBean ptgrid)throws IOException{
fos.write(" /*修改结点*/\n");
fos.write(" function node_modi(strId){\n");
fos.write(" try{\n");
fos.write(" var node = tree.getSelected(); \n");
fos.write(" var nodes = []; \n");
fos.write(" $.post(webpath+\"/st/system/action/tree/tree_getTree.action\",{strTreeName:\""+ptgrid.getTreename()+"\",strTreeID:strId,isFlag:\"leafpoint\"},function(data){ \n");
fos.write(" if (node){\n");
fos.write(" var nodedata = data;\n");
fos.write(" tree.update(node.target,data[0]); \n");
fos.write(" } \n");
fos.write(" },\"json\").error(function() { \n");
fos.write(" $.ligerDialog.error(MSG_LOAD_FALL)});\n");
fos.write(" }catch (e) {\n");
fos.write(" $.ligerDialog.error(e.message);\n");
fos.write(" }\n");
fos.write(" }\n");
}
/**
*
* @param ptgrid
* @throws Exception
*/
public void createJS(String ptgridName)throws Exception
{
PtgridsBean ptgrid = new PtgridsBean();
ptgrid = (PtgridsBean) ptgrid.findFirstByWhere(" where gridname='"+ptgridName+"'");
PtactionsBean ptactions = new PtactionsBean();
ptactions = (PtactionsBean) ptactions.findFirstByWhere(" where actionname='"+ptgrid.getActionname()+"'");
System.out.println(ptgrid.getActionname());
//查询主键
String keyid ="";
PtgridscolumnBean ptgridscolumn=new PtgridscolumnBean();
List<PtgridscolumnBean> list = ptgridscolumn.findByWhere(" where gridname='"+ptgridName+"'");
for(int i=0;i<list.size();i++)
{
PtgridscolumnBean gridcolumn = list.get(i);
PtablecolumnBean ptcolumn = new PtablecolumnBean();
ptcolumn = (PtablecolumnBean) ptcolumn.findFirstByWhere(" where tablename='"+gridcolumn.getTablename()+"' and iskey='PRI' ");
//查找id
if(ptcolumn!=null)
{
keyid = ptcolumn.getColumnname();
}
}
String gridName = ptgrid.getGridname();
String jspName = ptgrid.getFieldname();
String namespace = ptgrid.getFieldpath();
String engPath = Config.getProperty("file");
String filepath = engPath+"/WebRoot/"+namespace+"/"+jspName;
FileOutputStream stream = new FileOutputStream(filepath+".js");
fos = new OutputStreamWriter(stream,"UTF-8");
ptgrid.setActionname(ptactions.getNamespace()+"/"+ptactions.getActionname());
//创建头文件
createImport();
//js参数
getParam();
//初始化
getInit(ptgrid);
//双击
getGridDb(keyid,ptgrid);
//树查询
getTREE(ptgrid.getTreename());
//查询
getSearch(list);
//删除
getDelete(keyid, ptgrid);
//添加
getAdd(keyid,ptgrid);
//修改
getUpdate(keyid,ptgrid);
//查看
getLOOK(keyid,ptgrid);
//tree添加
getTreeAdd(ptgrid);
//tree修改
getTreeUpate(ptgrid);
fos.write((""));
fos.flush();
fos.close();
}
}
| zyjk | trunk/src/st/system/action/form/CreateListJSFile.java | Java | oos | 22,942 |
package st.system.action.form;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import st.platform.utils.BusinessDate;
import st.platform.utils.Config;
import st.system.dao.PtreesBean;
/**
* <p>处理内容:创建java文件 tree
* </p>
* <p>Copyright: Copyright (c) 2010</p>
* @author 方立文
* 改版履历
* Rev - Date ------- Name ---------- Note --------------------------------
* 1.0 2013.3.17 方立文 新規作成
*/
public class CreateJAVATree extends CreateCommonFileUtil {
/**
* 写入package头文件
* @param packageStr
*/
private void generateHead(String packageStr) {
try {
fos.write(("/****************************************************\n"));
fos.write((" * <p>处理内容:Tree</p>\n"));
fos.write((" * <p>Copyright: Copyright (c) 2010</p>;\n"));
fos.write((" * @author ;\n"));
fos.write((" * 改版履历;\n"));
fos.write((" * Rev - Date ------- Name ---------- Note -------------------\n"));
fos.write((" * 1.0 "+BusinessDate.getToday()+" 新規作成 ;\n"));
fos.write((" ****************************************************/\n"));
fos.write(("package "+packageStr+";\n"));
} catch ( Exception e ) {
}
}
/**
* 写入import头文件
*
*/
private void generateImport() {
try {
String importStr = "\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport st.platform.db.RecordSet;\n";
fos.write(importStr);
} catch ( Exception e ) {
}
}
/**
*
* @param classPath
* @param tablename
* @param className
* @throws Exception
*/
private OutputStreamWriter fos;
@SuppressWarnings("unused")
public void createJava(PtreesBean ptreesBean)throws Exception
{
String className = ptreesBean.getTreename();
String classPath = ptreesBean.getTreepath();
if ( className == null || classPath == null ) {
System.out.println("Error!");
return;
}
String engPath = Config.getProperty("file");
String filepath = "src/"+classPath.replace('.','/')+"/";
if(engPath!=null)
{
filepath = engPath + "/src/"+classPath.replace('.','/')+"/";
}
FileOutputStream stream = new FileOutputStream(filepath+className + ".java");
fos = new OutputStreamWriter(stream,"UTF-8");
generateHead(classPath);
fos.write(("\n"));
fos.write(("\n"));
fos.write(("\n"));
fos.write(("\n"));
generateImport();
fos.write(("public class "+className+" extends TreeBasic {\n"));
fos.write(("\tprivate static final long serialVersionUID = 1L;\n")); //add by Flw,2010.09.19 序列化
fos.write(("\t/**\n"));
fos.write(("\t* 取得SQL语句\n"));
fos.write(("\t* @param strWhere\n"));
fos.write(("\t* @param strTreeID\n"));
fos.write(("\t* @param isFlag\n"));
fos.write(("\t* @throws Exception\n"));
fos.write(("\t*/ \n"));
fos.write((" public String getSQL(String strWhere,String strTreeID,String isFlag) {\n"));
fos.write(("\tString strSQL = \""+ptreesBean.getStrsql()+"\";\n"));
fos.write(("\t if(strWhere!=null&&!(strWhere.equals(\"\"))) {\n"));
fos.write(("\t strSQL = strSQL+strWhere;\n"));
fos.write(("\t}\n"));
fos.write(("\t return strSQL;\n"));
fos.write(("\t} \n"));
fos.write(("\t\n"));
fos.write(("\t\n"));
fos.write(("\t/**\n"));
fos.write(("\t* 对结果集合进行处理\n"));
fos.write(("\t* @param rs\n"));
fos.write(("\t* @@return \n"));
fos.write(("\t*/ \n"));
fos.write((" public List<Map<String, Object>> getTree(RecordSet rs) {\n"));
fos.write(("\t List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();\n"));
fos.write(("\t Map<String, Object> map = new HashMap<String, Object>();\n"));
if(ptreesBean.getParampid()==null||ptreesBean.getParampid().equals(""))
{
fos.write(("\t map.put(\"id\", \"1\");\n"));
fos.write(("\t map.put(\"pid\", \"0\");\n"));
fos.write(("\t map.put(\"text\",\""+ptreesBean.getTreedesc()+"\");\n"));
fos.write(("\t List<String> childrenlist = new ArrayList<String>(); \n"));
fos.write(("\t map.put(\"children\", childrenlist);\n"));
fos.write(("\t list.add(map); \n"));
fos.write(("\t\n"));
}
fos.write(("\t while (rs != null && rs.next()) {\n"));
fos.write(("\t map = new HashMap<String, Object>();\n"));
fos.write(("\t String id = rs.getString(\""+ptreesBean.getParamid()+"\");\n"));
if(ptreesBean.getParampid()==null||ptreesBean.getParampid().equals(""))
{
fos.write(("\t String pid = \"1\"; \n"));
}else{
fos.write(("\t String pid = rs.getString("+ptreesBean.getParamid()+");\n"));
}
fos.write(("\t String text = rs.getString(\""+ptreesBean.getParamtext()+"\");\n"));
fos.write(("\t map.put(\"id\", id); \n"));
fos.write(("\t map.put(\"pid\", pid); \n"));
fos.write(("\t map.put(\"text\", text); \n"));
fos.write(("\t list.add(map);\n"));
fos.write(("\t}\n"));
fos.write(("\t return list;\n"));
fos.write(("\t}\n"));
fos.write(("\t\n"));
fos.write(("\t\n"));
fos.write(("}\n"));
fos.flush();
fos.close();
}
public static void main(String args[])
{
CreateJAVATree crjava=new CreateJAVATree();
try {
PtreesBean ptree = new PtreesBean();
ptree.setStrsql("Select treeid,treename,treedesc from ptrees");
ptree.setParamid("treeid");
ptree.setParampid("");
ptree.setParamtext("treedesc");
ptree.setTreename("PTree");
ptree.setTreepath("st.system.action.tree");
crjava.createJava(ptree);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| zyjk | trunk/src/st/system/action/form/CreateJAVATree.java | Java | oos | 6,641 |
package st.system.action.form;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.utils.BusinessDate;
import st.platform.utils.Config;
import st.system.dao.PtformBean;
import st.system.dao.PtformlabelBean;
import st.system.dao.PtgridsBean;
import st.system.dao.PtgridscolumnBean;
/**
* <p>处理内容:创建js文件 主要有添加function 修改function 查询function
* </p>
* <p>Copyright: Copyright (c) 2010</p>
* @author 方立文
* 改版履历
* Rev - Date ------- Name ---------- Note --------------------------------
* 1.0 2010.9.17 方立文 新規作成
*/
public class CreateInfoJSPFile extends CreateCommonFileUtil {
/**
* map中的数据用于自动生成页面的标签 已经标签的中文名称
* @param action 会话层定义的action
* @param classPath
* @throws Exception
*/
private OutputStreamWriter fos;
/**
* 头文件的信息
* @throws Exception
*
*/
public void createImport(String namespace, Map<String,String> map) throws Exception{
fos.write(("<!--\n"));
fos.write(("/****************************************************\n"));
fos.write((" * <p>处理内容:</p>\n"));
fos.write((" * <p>Copyright: Copyright (c) 2010</p>;\n"));
fos.write((" * @author ;\n"));
fos.write((" * 改版履历;\n"));
fos.write((" * Rev - Date ------- Name ---------- Note -------------------\n"));
fos.write((" * 1.0 "+BusinessDate.getToday()+" 新規作成 ;\n"));
fos.write((" ****************************************************/\n"));
fos.write(("-->\n"));
fos.write(("<%@ page language=\"java\" import=\"UI.dao.*,st.system.dao.*,st.portal.action.*\" pageEncoding=\"UTF-8\"%>\n"));
fos.write(("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"));
fos.write(("<html>\n"));
fos.write(("<%@ include file=\"/global.jsp\"%>\n"));
fos.write((" <head>\n"));
fos.write((" <title></title>\n"));
fos.write((" <%\n"));
for(Object obj:map.keySet())
{
String tablename = obj.toString();
String bean = tablename.substring(0, 1).toUpperCase() + tablename.substring(1, tablename.length()).toLowerCase() + "Bean";
String parem = tablename.substring(0, 1).toLowerCase() + tablename.substring(1, tablename.length()).toLowerCase() + "Bean";
fos.write((" "+bean+" "+ parem+" = ("+bean+")request.getAttribute(\""+ parem+"\");\n"));
fos.write((" if( "+ parem+" ==null)\n"));
fos.write((" {\n"));
fos.write((" "+ parem+" = new "+bean+"();\n"));
fos.write((" }\n"));
}
fos.write((" MessageBean messageBean = (MessageBean)request.getAttribute(\"messageBean\");\n"));
fos.write((" if(messageBean==null)\n"));
fos.write((" {\n"));
fos.write((" messageBean = new MessageBean();\n"));
fos.write((" }\n"));
fos.write((" %>\n"));
fos.write((" <script language=\"javascript\" src=\"<%=webpath%>/"+namespace+".js\"></script>\n "));
fos.write((" </head>\n"));
fos.write((" <body class=\"menubody\" style=\"width: 580\">\n"));
fos.write((" <div class=\"searchtitle\"> \n"));
fos.write((" <img width=\"20\" height=\"20\" src=\"<%=webpath%>/js/ligerUI/skins/icons/customers.gif\"/> \n"));
fos.write((" </div> \n"));
fos.write((" <div class=\"navline\" ></div> \n"));
}
/**
* form表单区
* @throws Exception
*/
public void getForm(List<PtformlabelBean> list,List<PtformlabelBean> lablist) throws Exception
{
fos.write("\n");
fos.write("<form name=\"form\" method=\"post\" id=\"form\">\n");
//隐藏区域
fos.write(" <div>\n");
fos.write(" <!-- 操作method --> \n");
fos.write(" <input type=\"hidden\" id=\"method\" name=\"messageBean.method\" value=\"<%=messageBean.getMethod() %>\"/>\n");
fos.write(" <!-- 操作状态flag --> \n");
fos.write(" <input type=\"hidden\" id=\"flag\" name=\"flag\" value=\"<%=messageBean.getCheckFlag() %>\"/>\n");
fos.write(" <!-- 操作message信息 --> \n");
fos.write(" <input type=\"hidden\" id=\"message\" name=\"message\" value=\"<%=messageBean.getCheckMessage() %>\"/>\n");
for(int i=0;i<list.size();i++)
{
PtformlabelBean ptform = list.get(i);
String table=ptform.getTablename()+"Bean";
String label = ptform.getLabelid();
String value = table+".get"+label.substring(0, 1).toUpperCase() + label.substring(1, label.length()).toLowerCase()+"()";
fos.write(" <!-- "+ptform.getLabeldesc()+" -->\n");
fos.write(" <input type=\"hidden\" id=\""+ptform.getLabelid()+"\" name=\""+ptform.getLabelname()+"\" value=\"<%="+value+" %>\"/>\n");
}
fos.write(" </div>\n");
//文本区域
fos.write(" <table cellpadding=\"0\" cellspacing=\"0\" class=\"form-l-table-edit\" >\n");
for(int i=0;i<lablist.size();i++)
{
PtformlabelBean ptform = lablist.get(i);
if(ptform.getIsonly().equals(1))
{
fos.write(" <tr>\n");
fos.write(" <td class=\"l-table-edit-td-right\">"+lablist.get(i).getLabeldesc()+"</td>\n");
fos.write(" <td class=\"l-table-edit-td-left\" colspan=\"4\" >\n");
fos.write(" "+getLabel(lablist.get(i)));
fos.write(" </td>\n");
fos.write(" <td class=\"td_message\"></td>\n");
fos.write(" </tr>\n");
}
else{
if(i%2==0)
{
fos.write(" <tr>\n");
}
fos.write(" <td class=\"l-table-edit-td-right\">"+lablist.get(i).getLabeldesc()+"</td>\n");
fos.write(" <td class=\"l-table-edit-td-left\" style=\"width:160px\">\n");
fos.write(" "+getLabel(lablist.get(i)));
fos.write(" </td>\n");
fos.write(" <td class=\"td_message\"></td>\n");
if(lablist.size()>i+1)
{
//是第一个 并且下一个label独占一行
if(i%2==0&&ptform.getIsonly().equals(1))
{
fos.write(" <td class=\"l-table-edit-td-right\"></td>\n");
fos.write(" <td class=\"l-table-edit-td-left\" style=\"width:160px\">\n");
fos.write(" </td>\n");
fos.write(" <td class=\"td_message\"></td>\n");
}
}
//是最后一个 并且需要
if(i%2==0&&lablist.size()==i-1)
{
fos.write(" <td class=\"l-table-edit-td-right\"></td>\n");
fos.write(" <td class=\"l-table-edit-td-left\" style=\"width:160px\">\n");
fos.write(" </td>\n");
fos.write(" <td class=\"td_message\"></td>\n");
}
if(i%2==1)
{
fos.write(" </tr>\n");
}
}
}
fos.write(" </table>\n");
fos.write(" <br />\n");
fos.write("<table align=\"center\">\n");
fos.write("<tr>\n");
fos.write(" <td>\n");
fos.write(" <input type=\"submit\" value=\"提交\" id=\"subButton\" class=\"l-button l-button-submit\" /> \n");
fos.write(" <input type=\"button\" value=\"关闭\" id=\"colButton\" class=\"l-button l-button-test\"/>\n");
fos.write(" </td>\n");
fos.write("</tr>\n");
fos.write(" \n");
fos.write("</table>\n");
fos.write(" </form>\n");
fos.write(" \n");
}
/**
* 页面结束
* @throws Exception
*/
public void getEnd() throws Exception
{
fos.write(("</body> \n"));
fos.write(("</html> \n"));
}
/**
* 取到标签的类型
*
*/
public String getLabel(PtformlabelBean formBean){
String label ="";
String name=formBean.getTablename()+"Bean."+formBean.getLabelid();
String id = formBean.getLabelid();
String table=formBean.getTablename()+"Bean";
String value = table+".get"+id.substring(0, 1).toUpperCase() + id.substring(1, id.length()).toLowerCase()+"()";
String type = formBean.getLabeltype();
if(type.equals("text")){
label ="<input name=\""+name+"\" type=\"text\" id=\""+id+"\"" +
" value=\"<%="+value+" %>\" " +
"ltype=\"text\" validate=\"{required:true,minlength:0,maxlength:"+formBean.getColumnlength()+"}\" />\n";
}else if(type.equals("dropdown")){
label="<%"+
"DBSelect dbsel = new DBSelect(\"city\", \"CHKRESULT\",demoBean.getCity());"+
"dbsel.addAttr(\"style\", \"width: 100%\");"+
"dbsel.addAttr(\"notnull\", \"true\");"+
"dbsel.addAttr(\"name\", \"demoBean.city\");"+
"dbsel.setDisplayAll(false);"+
"out.print(dbsel);"+
"%>";
}else if(type.equals("textarea")){
label ="<textarea cols=\"110\" rows=\"3\" class=\"l-textarea\" name=\""+name+"\" id=\""+id+"\" style=\"width:430px\" " +
"\"validate=\"{required:true}\" ><%="+value+"%></textarea>\"";
}else if(type.equals("radio")){
label="<%"+
"DBRadio dbrad = new DBRadio(\"contacttitle\",\"demoBean.contacttitle\",\"SEX\",demoBean.getContacttitle());"+
"out.print(dbrad.toString());"+
"%>";
}else if(type.equals("checkbox")){
label="<%"+
"DBCheckBox check = new DBCheckBox(\"country\",\"demoBean.country\",\"CHKRESULT\",demoBean.getCountry());"+
"out.print(check.toString());"+
"%>";
}else if(type.equals("data")){
label ="<input name=\""+name+"\" type=\"text\" id=\""+id+"\"" +
" value=\"<%="+value+" %>\" " +
"ltype=\"date\" validate=\"{required:true}\"/>\n";
}
return label;
}
/**
*
* @param ptgrid
* @throws Exception
*/
public void createJSP(PtformBean ptform)throws Exception
{
String gridName = ptform.getFormname();
String jspName = ptform.getFormname().toLowerCase();
String namespace = ptform.getFormpath();
String engPath = Config.getProperty("file");
String filepath = engPath+"/WebRoot/"+namespace+"/"+jspName;
FileOutputStream stream = new FileOutputStream(filepath+".jsp");
PtformlabelBean formlabel = new PtformlabelBean();
List<PtformlabelBean> hidlist = formlabel.findByWhere(" where formid='"+ptform.getFormid()+"' and ishidden='1'");
List<PtformlabelBean> lablist =formlabel.findByWhere(" where formid='"+ptform.getFormid()+"' and ishidden='0'");
Map<String,String> map = new HashMap<String, String>();
for(int i=0;i<lablist.size();i++)
{
map.put(lablist.get(i).getTablename(), lablist.get(i).getTablename());
}
fos = new OutputStreamWriter(stream,"UTF-8");
//头文件
createImport(namespace+"/"+jspName, map);
getForm( hidlist, lablist);
getEnd();
fos.write((""));
fos.flush();
fos.close();
}
}
| zyjk | trunk/src/st/system/action/form/CreateInfoJSPFile.java | Java | oos | 12,686 |
package st.system.action.actions;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import st.system.dao.PtactionsBean;
import st.system.dao.PtactionsmtdBean;
/**
* 收集action的信息
* 1 类名称
* 2 package路径
* 3 方法名称
*
* @author Administrator
*
*/
public class CollectAction {
/**
* @throws Exception
*
*
*/
public String analyseAction(String strFile) throws Exception{
//Action类的方法名称
Map<String,String> methodMap = new HashMap<String, String>();
//名称空间
String namespace ="";
//action名称
String pack[] = strFile.split("/");
String actionName= pack[(pack.length-1)].replace(".java","");
//action路径
pack = strFile.split("src");
String url =pack[1];
String packs[] = url.split("/");
url="";
for(int i=1;i<packs.length-1;i++){
url = url+"/"+packs[i];
}
//action中文说明
String desc ="";
//bean名称
String bean ="";
//infopage
String info ="";
if(actionName.equals("CollectAction")){
return "";
}
FileInputStream inputstream = new FileInputStream(strFile);
InputStreamReader red = new InputStreamReader(inputstream,"UTF-8");
String s;
BufferedReader in = new BufferedReader(red);
while ((s = in.readLine()) != null) {
//命名空间
if(s.indexOf("@Namespace")>=0){
String strArr[] = s.split("\"");
namespace = strArr[1];
}else if(s.indexOf("@Action")>0){
String strArr[] = s.split("\"");
methodMap.put(strArr[1],strArr[1]);
}else if(s.indexOf("处理内容")>0){
String strArr[] = s.split(":");
System.out.println(s);
desc = strArr[1].replace("</p>", "");
}else if(s.indexOf("private")>0&&s.indexOf("Bean")>0)
{
if(s.indexOf("PageBean")>0||s.indexOf("MessageBean")>0)
{
}else{
String strare[] = s.split(" ");
for(int i=0;i<strare.length;i++)
{
if(strare[i].indexOf("Bean")>0){
bean = bean +strare[i]+",";
break;
}
}
}
}else if(s.indexOf(".jsp")>0)
{
String strArr[] = s.split("\"");
if(strArr.length>0){
info = strArr[1];
}
}
}
System.out.println("名称"+actionName);
System.out.println("空间"+namespace);
System.out.println(url);
System.out.println("说明"+desc);
System.out.println("bean"+bean);
System.out.println("info"+info);
///////////////////操作插入数据库//////////////////////////
if(namespace.length()>0)
{
PtactionsBean actionBean = new PtactionsBean();
actionBean.setSysid(""+System.currentTimeMillis());
actionBean.setActiondesc(desc);
actionBean.setActionname(actionName);
actionBean.setActionpath(url);
actionBean.setBeanname(bean);
actionBean.setNamespace(namespace);
actionBean.setInfopage(info);
actionBean.insert();
PtactionsmtdBean method = new PtactionsmtdBean();
int index = 1;
for(Object obj:methodMap.keySet()){
method.setSysid(System.currentTimeMillis()+"_"+(index++));
method.setActionid(actionBean.getSysid());
method.setMethod(obj.toString());
method.setNamespace(namespace);
method.setActionname(actionName);
method.insert();
}
}
return "";
}
public void method(File f) throws Exception
{
File[] FList = f.listFiles();
for (int i = 0; i < FList.length; i++)
{
if (FList[i].isDirectory()==true)
{
method(FList[i]);
}
else
{
String path = FList[i].getAbsolutePath();
if(path.indexOf("action")>0&&path.indexOf(".java")>0)
{
CollectAction co = new CollectAction();
co.analyseAction(path.replace("\\", "/"));
System.out.println(FList[i].getAbsolutePath());
}
}
}
}
public static void main(String args[])
{
CollectAction co = new CollectAction();
try {
File file = new File("F:/Work4/zpf2/src/");
co.method(file);
//String strFile ="F:/Work4/zpf2/src/UI/action/demo/DemoAction.java";
//co.analyseAction(strFile);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| zyjk | trunk/src/st/system/action/actions/CollectAction.java | Java | oos | 5,739 |
/*********************************************************************
*<p>处理内容: Action 管理</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.3.18---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.actions;
import java.io.File;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.platform.utils.Config;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.action.form.CreateJAVAFile;
import st.system.dao.PtactionsBean;
import st.system.dao.PtactionsmtdBean;
import UI.action.demo.DemoAction;
import UI.dao.DemoBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/actions")
public class ResActions extends BasicAction{
private static Logger logger = Logger.getLogger(ResActions.class);
private static final long serialVersionUID = 1L;
private PtactionsBean ptactionBean; // 返回的信息
private String strWhere=""; // 查询条件
private String strSysno=""; // 主键编号
private PageBean pageBean; // 分页类
private MessageBean messageBean;// 操作状态
/**
* 添加
*
* @return
*/
@Action(value = "ResActions_insert")
public String insert() {
try {
String tablename = ptactionBean.getBeanname();
String classBean = tablename.substring(0, 1).toUpperCase() + tablename.substring(1, tablename.length()).toLowerCase() + "Bean";
ptactionBean.setBeanname(classBean);
String number = "PTACTION_"+System.currentTimeMillis();
ptactionBean.setSysid(number);
String namespace = "/"+ptactionBean.getActionpath().replaceAll("\\.", "/");
ptactionBean.setNamespace(namespace);
messageBean = insert(ptactionBean);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return
*/
@Action(value = "ResActions_findByKey", results = {
@Result(type = "json", name = SUCCESS, params = { "includeProperties", "messageBean.*,ptactionBean.*" }) })
public String findByKey() {
try {
messageBean = new MessageBean();
ptactionBean = new PtactionsBean();
ptactionBean = (PtactionsBean) findByKey(ptactionBean, " where sysid ='" + strSysno + "'");
if (ptactionBean != null) {
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return SUCCESS;
}
/**
* 修改
*
* @return
*/
@Action(value = "ResActions_update")
public String update() {
logger.debug("修改");
try {
//String classBean = tablename.substring(0, 1).toUpperCase() + tablename.substring(1, tablename.length()).toLowerCase() + "Bean";
String namespace = "/"+ptactionBean.getActionpath().replaceAll("\\.", "/");
ptactionBean.setNamespace(namespace);
messageBean = update(ptactionBean, " where sysid ='" + ptactionBean.getSysid() + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 删除
*
* @return
*/
@Action(value = "ResActions_delete")
public String delete() {
try {
ptactionBean = new PtactionsBean();
logger.debug(strSysno+"====================");
System.out.println(" where sysid in (" + strSysno + ")");
messageBean = delete(ptactionBean, " where sysid in ('" + strSysno + "')");
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 创建ACTION
* @return
*/
@Action(value = "ResActions_create")
public String create(){
try {
messageBean = new MessageBean();
ptactionBean = new PtactionsBean();
ptactionBean = (PtactionsBean) findByKey(ptactionBean, " where sysid ='" + strSysno + "'");
CreateJAVAFile crjava=new CreateJAVAFile();
crjava.createJava(ptactionBean);
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
*初始化
* @return
*/
@Action(value = "ResActions_init")
public String init(){
try {
messageBean = new MessageBean();
String engPath = Config.getProperty("file");
File file = new File(engPath+"/src/");
// 清空action的记录
PtactionsmtdBean method = new PtactionsmtdBean();
PtactionsBean actionBean = new PtactionsBean();
method.deleteByWhere("");
actionBean.deleteByWhere("");
CollectAction co = new CollectAction();
co.method(file);
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public PtactionsBean getPtactionBean() {
return ptactionBean;
}
public void setPtactionBean(PtactionsBean ptactionBean) {
this.ptactionBean = ptactionBean;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public PageBean getPageBean() {
return pageBean;
}
public void setPageBean(PageBean pageBean) {
this.pageBean = pageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
}
| zyjk | trunk/src/st/system/action/actions/ResActions.java | Java | oos | 8,794 |
/****************************************************
* <p>处理内容:</p>
* <p>Copyright: Copyright (c) 2010</p>;
* @author ;
* 改版履历;
* Rev - Date ------- Name ---------- Note -------------------
* 1.0 2013-03-26 新規作成 ;
****************************************************/
package st.system.action.detail;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.platform.db.SerialNumber;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.action.form.CreateInfoJSFile;
import st.system.action.form.CreateInfoJSPFile;
import st.system.dao.PtformBean;
import UI.message.MisConstant;
import UI.util.BusinessDate;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/detail")
public class DetailAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(DetailAction.class);
private PtformBean ptformBean; // 返回的信息;
private String strWhere=""; // 查询条件;
private String strSysno=""; // 主键编号;
private PageBean pageBean; // 分页类;
private MessageBean messageBean;// 操作状态
/**
*
* 查询信息 返回json信息
* @return
*/
@Action(value = "DetailAction_findObjson", results = {
@Result(type = "json", name = MisConstant.FINDOBJSON, params = { "includeProperties","messageBean.*,ptformBean.*" }) })
public String findObjson() {
try {
messageBean = new MessageBean();
ptformBean = new PtformBean();
ptformBean = (PtformBean)findByKey(ptformBean, " where Formid ='" + strSysno + "'");
if (ptformBean != null) {
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDOBJSON;
}
/**
*
*添加方法
* @return
*/
@Action(value="DetailAction_insert")
public String insert() {
try {
ptformBean.setFormid(ptformBean.getFormname());
messageBean = insert(ptformBean);
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
*
* 修改方法
* @return
*/
@Action(value = "DetailAction_update")
public String update() {
try {
messageBean = update(ptformBean, " where Formid ='" + ptformBean.getFormid() + "'");;
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
*
* 删除改方法
* @return
*/
@Action(value = "DetailAction_delete")
public String delete() {
try {
ptformBean = new PtformBean();
messageBean = delete(ptformBean, " where Formid ='" + strSysno + "'");
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 生成LIST JSP页面
* @return
*/
@Action(value = "DetailAction_createJsp")
public String createJsp() {
try {
messageBean = new MessageBean();
CreateInfoJSPFile jsp = new CreateInfoJSPFile();
ptformBean = new PtformBean();
ptformBean = (PtformBean)findByKey(ptformBean, " where Formid ='" + strSysno + "'");
jsp.createJSP(ptformBean);
CreateInfoJSFile js = new CreateInfoJSFile();
js.createJS(ptformBean);
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public PtformBean getPtformBean() {
return ptformBean;
}
public void setPtformBean(PtformBean ptformBean) {
this.ptformBean = ptformBean;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public PageBean getPageBean() {
return pageBean;
}
public void setPageBean(PageBean pageBean) {
this.pageBean = pageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
}
| zyjk | trunk/src/st/system/action/detail/DetailAction.java | Java | oos | 5,975 |
/****************************************************
* <p>处理内容:</p>
* <p>Copyright: Copyright (c) 2010</p>;
* @author ;
* 改版履历;
* Rev - Date ------- Name ---------- Note -------------------
* 1.0 2013-03-26 新規作成 ;
****************************************************/
package st.system.action.detail;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.portal.html.DBSelect;
import st.system.dao.PtablecolumnBean;
import st.system.dao.PtformlabelBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/detail")
public class DetailSetAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(DetailSetAction.class);
private PtformlabelBean ptformlabelBean; // 返回的信息;
private String strWhere=""; // 查询条件;
private String strSysno=""; // 主键编号;
private PageBean pageBean; // 分页类;
private MessageBean messageBean = new MessageBean();;// 操作状态
private String strHidden="";//是否隐藏字段
private String strContent="";//返回内容
private String strTable ="";
private String strFormName ="";
private String strColumn ="";
private List<PtformlabelBean> ptlist = new ArrayList<PtformlabelBean>() ;
/**
*
* 查询信息 返回jsp信息
* @return
*/
@Action(value = "DetailSetAction_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/resoure/detail/detailset.jsp") })
public String findByKey() {
try {
ptformlabelBean = new PtformlabelBean();
ptformlabelBean = (PtformlabelBean)findByKey(ptformlabelBean, " where formid ='" + strSysno + "'");
if (ptformlabelBean != null) {
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
*
* 查询信息 返回jsp信息
* @return
*/
@Action(value = "DetailSetAction_findInfo", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/resource/detail/detailinfo.jsp") })
public String findInfo() {
try {
messageBean = new MessageBean();
ptformlabelBean = new PtformlabelBean();
strFormName = strSysno;
logger.debug(strSysno);
logger.debug(strFormName);
strContent = getHTML(strSysno);
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
*
* 修改方法
* @return
*/
@Action(value = "DetailSetAction_update")
public String update() {
try {
messageBean = update(ptformlabelBean, " where Formid ='" + ptformlabelBean.getSysid() + "'");;
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
*
* 删除改方法
* @return
*/
@Action(value = "DetailSetAction_delete")
public String delete() {
try {
ptformlabelBean = new PtformlabelBean();
messageBean = delete(ptformlabelBean, " where sysid in (" + strSysno + ")");
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
*
* 添加方法
* @return
*/
@Action(value = "DetailSetAction_insert", results = {
@Result(type = "json", name = SUCCESS, params = { "includeProperties","messageBean.*,strContent" }) })
public String insert() {
try {
PtablecolumnBean ptcolumn = new PtablecolumnBean();
List<PtablecolumnBean> list = ptcolumn.findByWhere(" where tablename ='" + strTable + "'");
// 取出涉及的表名称
Map<String,PtablecolumnBean>map = new HashMap<String,PtablecolumnBean>();
for(int i=0;i<list.size();i++)
{
map.put(list.get(i).getColumnname(),list.get(i));
}
String strArr[] = strColumn.split(";");
PtformlabelBean formlabel = null;
//根据表名称查询表信息
for(int i=0;i<strArr.length;i++)
{
formlabel = new PtformlabelBean();
//主键
formlabel.setSysid(""+System.currentTimeMillis());
//表单id
formlabel.setFormid(strFormName);
//表单名称
formlabel.setFormname(strFormName);
//表名称
formlabel.setTablename(strTable);
//标签id
formlabel.setLabelid(strArr[i]);
//标签名称
String classBean = strTable.substring(0, 1).toUpperCase() + strTable.substring(1, strTable.length()).toLowerCase() + "Bean";
String labelName = classBean+"."+strArr[i];
formlabel.setLabelname(labelName);
//标签说明
System.out.println(strArr[i]);
formlabel.setLabeldesc(map.get(strArr[i]).getColumndesc());
//字段长度
formlabel.setColumnlength(map.get(strArr[i]).getColumnlength());
//是否隐藏字段
formlabel.setIshidden(strHidden);
//label类型
formlabel.setLabeltype("text");
insert(formlabel);
}
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
strContent = getHTML( strFormName );
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
e.printStackTrace();
logger.error(e.getMessage());
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return SUCCESS;
}
/**
* 从详细页面删除字段
* @return
*/
@Action(value = "DetailSetAction_delcolumn", results = {
@Result(type = "json", name = SUCCESS, params = { "includeProperties","messageBean.*,strContent" }) })
public String deletetext() {
try {
ptformlabelBean = new PtformlabelBean();
messageBean = delete(ptformlabelBean, " where sysid in ('" + strColumn + "')");
strContent = getHTML( strFormName );
if(strContent.equals("")){
strContent ="";
}
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return SUCCESS;
}
/**
* 提交字段内容
* @return
*/
@Action(value = "DetailSetAction_submint", results = {
@Result(type = "json", name = SUCCESS, params = { "includeProperties","messageBean.*,strContent" }) })
public String submint(){
try {
System.out.println(ptlist.size()+"sadfasdf");
for(int i=0;i<ptlist.size();i++)
{
ptformlabelBean = ptlist.get(i);
System.out.println(ptformlabelBean.getSysid());
update(ptformlabelBean," where sysid = '"+ptformlabelBean.getSysid()+"' ");
}
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
strContent = getHTML( strFormName );
} catch (Exception e) {;
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return SUCCESS;
}
/**
* 刷新页面table
* 返回连个内容 1个是hidden区域,1个是text区域
* @return
*/
public String getHTML(String strSysno){
String hidtable = "<table >";
System.out.println("zzzzzzzz12313123");
String texttable = "<table >";
//根据formid生成页面代码
PtformlabelBean ptcolumn = new PtformlabelBean();
try {
List<PtformlabelBean> listhid = ptcolumn.findByWhere(" where formid ='" + strSysno + "' and ishidden ='1' order by ladelindex");
PtformlabelBean columnhide = null;
for(int i=0;i<listhid.size();i++)
{
columnhide = listhid.get(i);
hidtable = hidtable +"<tr>" +
"<td><input type=\"hidden\" name=\"ptlist["+i+"].sysid\" value=\""+columnhide.getSysid()+"\" />" +
"表名:<input type=\"text\" name=\"ptlist["+i+"].tablename\" value=\""+columnhide.getTablename()+"\"/></td>" +
"<td>字段:<input type=\"text\" name=\"ptlist["+i+"].labelid\" value=\""+columnhide.getLabelid()+"\"/></td>" +
"<td><input type=\"hidden\" name=\"ptlist["+i+"].ishidden\" value=\""+columnhide.getIshidden()+"\"/>" +
"<input type=\"button\" id=\""+columnhide.getSysid()+"\" onclick=\"removerow(this)\" value=\"删除\"/></td>" +
"</tr>";
}
hidtable = hidtable+"</table>";
List<PtformlabelBean> listtext = ptcolumn.findByWhere(" where formid ='" + strSysno + "' and ishidden ='0' order by ladelindex");
//System.out.println(hidtable);
for(int i=0;i<listtext.size();i++)
{
columnhide = listtext.get(i);
DBSelect dbsel = new DBSelect("labeltype"+i, "fieldtype",columnhide.getLabeltype());
dbsel.addAttr("style", "width: 100%");
dbsel.addAttr("notnull", "true");
dbsel.addAttr("name", "ptlist["+i+"].labeltype" );
dbsel.setDisplayAll(false);
String select =dbsel.toString();
texttable = texttable +
"<tr><td style=\"color: red\"> 第"+(i+1)+"个字段</td><td><input colspan=\"4\" type=\"button\" id=\""+columnhide.getSysid()+"\" onclick=\"removerow(this)\" value=\"删除\"/></td></tr>"+
"<tr><td s>" +
"<input type=\"hidden\" name=\"ptlist["+i+"].sysid\" value=\""+columnhide.getSysid()+"\" />" +
"表名:<input type=\"text\" name=\"ptlist["+i+"].tablename\" value=\""+columnhide.getTablename()+"\"/></td>" +
"<td >字段:<input type=\"text\" name=\"ptlist["+i+"].labelid\" value=\""+columnhide.getLabelid()+"\"/></td>" +
"<td >标签名称:<input type=\"text\" name=\"ptlist["+i+"].labeldesc\" value=\""+columnhide.getLabeldesc()+"\"/></td>" +
"<td >类型:"+select+"</td>" +
"<td ></td>" +
"</tr><tr>"+
"<td >枚举:<input type=\"text\" name=\"ptlist["+i+"].enumnmae\" value=\""+columnhide.getEnumnmae()+"\"/></td>" +
"<td >长度:<input type=\"text\" name=\"ptlist["+i+"].columnlength\" value=\""+columnhide.getColumnlength()+"\"/></td>" +
"<td >独占一行:<input type=\"text\" name=\"ptlist["+i+"].isonly\" value=\""+columnhide.getIsonly()+"\"/>" +
"<td >排序:<input type=\"text\" name=\"ptlist["+i+"].ladelindex\" value=\""+columnhide.getLadelindex()+"\"/></td>" +
"<td ><input type=\"hidden\" name=\"ptlist["+i+"].ishidden\" value=\""+columnhide.getIshidden()+"\"/>" +
"</td></tr>";
}
texttable = texttable+"</table>";
System.out.println(texttable);
} catch (Exception e) {
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
}
String retst = hidtable+texttable;
System.out.println(retst);
if(retst.equals("")){
retst ="";
}
return retst;
}
public PtformlabelBean getPtformlabelBean() {
return ptformlabelBean;
}
public void setPtformlabelBean(PtformlabelBean ptformlabelBean) {
this.ptformlabelBean = ptformlabelBean;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public PageBean getPageBean() {
return pageBean;
}
public void setPageBean(PageBean pageBean) {
this.pageBean = pageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public String getStrHidden() {
return strHidden;
}
public void setStrHidden(String strHidden) {
this.strHidden = strHidden;
}
public String getStrColumn() {
return strColumn;
}
public void setStrColumn(String strColumn) {
this.strColumn = strColumn;
}
public String getStrContent() {
return strContent;
}
public void setStrContent(String strContent) {
this.strContent = strContent;
}
public String getStrFormName() {
return strFormName;
}
public void setStrFormName(String strFormName) {
this.strFormName = strFormName;
}
public String getStrTable() {
return strTable;
}
public void setStrTable(String strTable) {
this.strTable = strTable;
}
public List<PtformlabelBean> getPtlist() {
return ptlist;
}
public void setPtlist(List<PtformlabelBean> ptlist) {
this.ptlist = ptlist;
}
}
| zyjk | trunk/src/st/system/action/detail/DetailSetAction.java | Java | oos | 16,361 |
/*********************************************************************
*<p>处理内容:SAFEOPER Action</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.03.21---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.safeoper;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.system.dao.PtoperBean;
import UI.message.MisConstant;
import UI.util.BusinessDate;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/safeoper")
public class SafeOperAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(SafeOperAction.class);
private String strWhere=""; //查询条件
private String strSysno=""; //主键编号
private MessageBean messageBean ;//操作状态
private PtoperBean ptOperBean; //返回的信息
private List<Map<String, Object>> list;
/**
*添加方法
* @return String 返回操作结果
*/
@Action(value = "safeoper_insert")
public String insert() {
try {
String number = BusinessDate.getNoFormatToday() + "-" + st.platform.db.SerialNumber.getNextSerialNo("67");
ptOperBean.setSysno(number);
messageBean = insert(ptOperBean);
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return String 返回操作结果
*/
@Action(value = "safeoper_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/safeoper/safeoperinfo.jsp") })
public String findByKey() {
try {
logger.debug(messageBean.getMethod());
//ptMenuBean = new PtmenuBean();
if (!(messageBean.getMethod().equals("add"))) {
ptOperBean = new PtoperBean();
ptOperBean = (PtoperBean) findByKey(ptOperBean," where sysno ='" + strSysno + "'");
if (ptOperBean == null) {
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}else{
ptOperBean.setDeptid(ptOperBean.getDeptid());
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
* 修改
*
* @return String 返回操作结果
*/
@Action(value = "safeoper_update")
public String update() {
logger.debug("修改");
try {
messageBean = update(ptOperBean, " where sysno ='" + ptOperBean.getSysno() + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 删除方法
*
* @return String 返回操作结果
*/
@Action(value = "safeoper_delete")
public String delete() {
try {
ptOperBean = new PtoperBean();
messageBean = delete(ptOperBean, " where sysno in (" + strSysno
+ ")");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public static Logger getLogger() {
return logger;
}
public static void setLogger(Logger logger) {
SafeOperAction.logger = logger;
}
public PtoperBean getPtOperBean() {
return ptOperBean;
}
public void setPtOperBean(PtoperBean ptOperBean) {
this.ptOperBean = ptOperBean;
}
}
| zyjk | trunk/src/st/system/action/safeoper/SafeOperAction.java | Java | oos | 5,012 |
package st.system.action.session;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.platform.security.SystemAttributeNames;
import st.portal.action.BasicAction;
import st.system.dao.PtdeptBean;
import st.system.dao.PtoperBean;
import com.opensymphony.xwork2.ActionContext;
/**
* session 取内容
* @author Administrator
*
*/
@ParentPackage("struts-filter")
@Namespace("/st/system/action/session")
public class SessionAction extends BasicAction {
private PtoperBean oper;
private PtdeptBean dept;
/**
*返回session数值
* @return String 返回操作结果
*/
@Action(value = "SessionAction_getSession", results = {
@Result(type = "json", name = SUCCESS, params = { "includeProperties", "oper.*,dept.*" }) })
public String getSession(){
ActionContext actionContext = ActionContext.getContext();
Map session = actionContext.getSession();
oper = (PtoperBean)session.get(SystemAttributeNames.USER_INFO_NAME);
System.out.println(oper.getBirthday());
dept = (PtdeptBean)session.get(SystemAttributeNames.DEPT_INFO_NAME);
System.out.println(dept.getDeptno());
return SUCCESS;
}
public PtdeptBean getDept() {
return dept;
}
public void setDept(PtdeptBean dept) {
this.dept = dept;
}
public PtoperBean getOper() {
return oper;
}
public void setOper(PtoperBean oper) {
this.oper = oper;
}
}
| zyjk | trunk/src/st/system/action/session/SessionAction.java | Java | oos | 1,840 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class PxjginfoTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
return "";
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "基本信息");
map.put("url", "/UI/action/zyjk/PxjgbaAction_findByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "2");
map.put("pid", "0");
map.put("text", "人员信息");
map.put("url", "/UI/zyjk/pxjg/pxjgjs/pxjgjslist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "0");
map.put("text", "培训信息");
map.put("url", "/UI/zyjk/pxjg/pxxx/qypxjl/qypxjl.jsp");
list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PxjginfoTree.java | Java | oos | 2,082 |
/****************************************************
* <p>处理内容:Tree</p>
* <p>Copyright: Copyright (c) 2010</p>;
* @author ;
* 改版履历;
* Rev - Date ------- Name ---------- Note -------------------
* 1.0 2013-03-26 新規作成 ;
****************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class FormTree extends TreeBasic {
private static final long serialVersionUID = 1L;
/**
* 取得SQL语句
*
* @param strWhere
* @param strTreeID
* @param isFlag
* @throws Exception
*/
public String getSQL(String strWhere, String strTreeID, String isFlag) {
String strSQL = "select formid,formname,formpath from ptform";
if (strWhere != null && !(strWhere.equals(""))) {
strSQL = strSQL + strWhere;
}
return strSQL;
}
/**
* 对结果集合进行处理
*
* @param rs
* @@return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "表单域");
List<String> childrenlist = new ArrayList<String>();
map.put("children", childrenlist);
list.add(map);
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id = rs.getString("formid");
String pid = "1";
String text = rs.getString("formname");
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/FormTree.java | Java | oos | 1,917 |
/****************************************************
* <p>处理内容:Tree</p>
* <p>Copyright: Copyright (c) 2010</p>;
* @author ;
* 改版履历;
* Rev - Date ------- Name ---------- Note -------------------
* 1.0 2013-03-23 新規作成 ;
****************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class PTenumTree extends TreeBasic {
private static final long serialVersionUID = 1L;
/**
* 取得SQL语句
*
* @param strWhere
* @param strTreeID
* @param isFlag
* @throws Exception
*/
public String getSQL(String strWhere, String strTreeID, String isFlag) {
String strSQL = "select enutype,enuname,valuetype,enudesc,parenutype,isleaf from ptenumain";
if (strWhere != null && !(strWhere.equals(""))) {
strSQL = strSQL + strWhere;
}
return strSQL;
}
/**
* 对结果集合进行处理
*
* @param rs
* @@return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "枚举树");
List<String> childrenlist = new ArrayList<String>();
map.put("children", childrenlist);
list.add(map);
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id = rs.getString("enutype");
String pid = "1";
String text = rs.getString("enutype");
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PTenumTree.java | Java | oos | 1,949 |
/****************************************************
* <p>处理内容:Grid Tree</p>
* <p>Copyright: Copyright (c) 2010</p>;
* @author ;
* 改版履历;
* Rev - Date ------- Name ---------- Note -------------------
* 1.0 2013-03-21 新規作成 ;
****************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class PTGridTree extends TreeBasic {
private static final long serialVersionUID = 1L;
/**
* 取得SQL语句
*
* @param strWhere
* @param strTreeID
* @param isFlag
* @throws Exception
*/
public String getSQL(String strWhere, String strTreeID, String isFlag) {
String strSQL = "select gridid,gridname,griddesc from ptgrids";
if (strWhere != null && !(strWhere.equals(""))) {
strSQL = strSQL + strWhere;
}
return strSQL;
}
/**
* 对结果集合进行处理
*
* @param rs
* @@return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "表格树");
List<String> childrenlist = new ArrayList<String>();
map.put("children", childrenlist);
list.add(map);
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id = rs.getString("gridid");
String pid = "1";
String text = rs.getString("griddesc")+"("+rs.getString("gridname")+")";
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PTGridTree.java | Java | oos | 1,958 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class WsjginfoTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
return "";
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "基本信息");
map.put("url", "/UI/action/zyjk/WsjgbaAction_loginFindByKey.action");
list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "2");
// map.put("pid", "0");
// map.put("text", "人员信息");
// map.put("url", "/UI/zyjk/cor/info/zsitelist.jsp");
// list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "2");
// map.put("pid", "0");
// map.put("text", "人员信息");
// map.put("url", "/UI/zyjk/cor/info/zsitelist.jsp");
// list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "0");
map.put("text", "体检信息");
map.put("url", "/UI/zyjk/wsjg/tjqk/tjqklist.jsp");
list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/WsjginfoTree.java | Java | oos | 2,357 |
/*********************************************************************
*<p>处理内容:TREE 父类</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class TreeBasic {
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
return "";
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/TreeBasic.java | Java | oos | 1,103 |
/*********************************************************************
*<p>处理内容:Actions TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.06.06---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class LoginTree extends TreeBasic{
/*
* 取得SQL语句
* (non-Javadoc)
* @see st.system.action.tree.TreeBasic#getSQL(java.lang.String, java.lang.String, java.lang.String)
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = "select deptno,parentdeptid,deptnm from ptdept where parentdeptid in('40-37000000-001','1') ";
// if(strWhere!=null&&!(strWhere.equals(""))) {
// strSQL = strSQL+strWhere;
// }
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id=rs.getString("deptno");
String pid=rs.getString("parentdeptid");
String name=rs.getString("deptnm");
map.put("id", id);
map.put("pid", pid);
map.put("text", name);
map.put("isexpand", "true");
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/LoginTree.java | Java | oos | 1,948 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.05.29---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class LaborfileTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
return "";
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "劳动者基本信息");
map.put("url", "UI/action/ldzjbxx/LdzjbxxAction_findByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "2");
map.put("pid", "0");
map.put("text", "劳动者的职业史");
map.put("url", "UI/enterfile/ldzcys/ldzcys.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "0");
map.put("text", "劳动者职业危害接触史");
map.put("url", "UI/enterfile/ldzzywhjcs/ldzzywhjcs.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "4");
map.put("pid", "0");
map.put("text", "职业卫生健康检查结果");
map.put("url", "UI/enterfile/ldzjkjcjg/ldzjkjcjg.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "5");
map.put("pid", "0");
map.put("text", "职业病诊疗情况");
map.put("url", "UI/enterfile/ldzzybzlqk/ldzzybzlqk.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "6");
map.put("pid", "0");
map.put("text", "治疗康复情况");
map.put("url", "UI/enterfile/ldzkfqk/ldzkfqk.jsp");
list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/LaborfileTree.java | Java | oos | 3,051 |
/*********************************************************************
*<p>处理内容:SYSMENU TRE 系统开始的菜单树形结构</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.26---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import st.platform.db.RecordSet;
import st.platform.security.SystemAttributeNames;
import st.portal.system.dao.PtOperBean;
import st.system.dao.PtoperBean;
public class SysMenuTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
//取出session中的用户名称
PtoperBean ptoperbean= (PtoperBean) ServletActionContext.getContext().getSession().get(SystemAttributeNames.USER_INFO_NAME);
String strSQL = "SELECT menuid,PARENTMENUID,MENULABEL,ISLEAF,MENUACTION FROM ptmenu " ;
System.out.println("strWhere:"+strWhere);
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+" where PARENTMENUID='"+ strWhere +"' and menuid in( select resid from ptoperrole,ptroleres where operid ='"+ptoperbean.getSysno()+"' and ptoperrole.roleid = ptroleres.roleid)";
}else{
strSQL = strSQL +" where menuid in( select resid from ptoperrole,ptroleres where operid ='"+ptoperbean.getSysno()+"' and ptoperrole.roleid = ptroleres.roleid)";
}
String strOrder=" order by levelidx";
strSQL=strSQL+strOrder;
return strSQL;
// SELECT menuid,PARENTMENUID,MENULABEL,ISLEAF,MENUACTION FROM ptmenu
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
while (rs != null && rs.next()) {
String id = rs.getString("menuid");
String pid = rs.getString("PARENTMENUID");
String text = rs.getString("MENULABEL");
String isleaf = rs.getString("ISLEAF");
String url=rs.getString("MENUACTION");
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
map.put("url", url);
//
if (!(isleaf.equals("1"))) {
List<String> childrenlist = new ArrayList<String>();
//childrenlist.add("");
map.put("isexpand", "false");
map.put("children", childrenlist);
}
//
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/SysMenuTree.java | Java | oos | 3,343 |
/*********************************************************************
*<p>处理内容:数据库表 TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class PTableTree extends TreeBasic {
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = "SELECT tableid,tablename,tabledesc FROM ptable ";
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text","数据库");
List<String> childrenlist = new ArrayList<String>();
map.put("children", childrenlist);
list.add(map);
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id = rs.getString("tableid");
String pid = "1";
String text = rs.getString("tablename");
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PTableTree.java | Java | oos | 1,923 |
/*********************************************************************
*<p>处理内容:ptdetp TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.20---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.platform.utils.Config;
public class PtdeptTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = "SELECT deptno,deptnm,DEPTLVL,DISTCODE,CREATEDT,NORMALPEOS,REALPEOS,MANAGERNM,PARENTDEPTID,DEPTINFO,BMJC FROM ptdept where 1=1 ";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}else if(strTreeID!=null&&!(strTreeID.equals(""))) {
//if(isFlag.equals("leafpoint")){
strSQL = strSQL + " and deptnm = '"+strTreeID+"'";
// }else{
// strSQL = strSQL + " WHERE parentdeptid = '"+strTreeID+"'";
// }
}
String distcode=Config.getProperty("distcode");
if(null!=distcode&&distcode!=""){
strSQL+=" and deptno like '%"+distcode+"%'";
}
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
while (rs != null && rs.next()) {
String id = rs.getString("deptno");
String pid = rs.getString("PARENTDEPTID");
String text = rs.getString("deptnm");
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
map.put("isexpand","false");
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PtdeptTree.java | Java | oos | 2,540 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.06.16---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class EnterViewTree extends TreeBasic {
/**
* 取得SQL语句
*
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere, String strTreeID, String isFlag) {
return "";
}
/**
* 对结果集合进行处理
*
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "用人单位基本信息");
map.put("url", "/UI/action/enter/EnterMain_findByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "2");
map.put("pid", "0");
map.put("text", "职业卫生管理机构");
map.put("url", "/UI/enterfile/zywsgljg/zywsgljgmain.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "0");
map.put("text", "接害人员名单");
map.put("url", "/UI/enterfile/qyryxx/qyryxx.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "4");
map.put("pid", "0");
map.put("text", "职业卫生档案");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "5");
map.put("pid", "4");
map.put("text", "规章制度、操作规程");
map.put("url", "/UI/enterfile/qygzzd/qygzzd.jsp");
list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "6");
// map.put("pid", "4");
// map.put("text", "培训信息");
// map.put("url", "/UI/enterfile/qypxjl/qypxjl.jsp");
// list.add(map);
//企业负责人培训
map = new HashMap<String, Object>();
map.put("id", "24");
map.put("pid", "4");
map.put("text", "企业负责人培训");
map.put("url", "/UI/enterfile/qypxjl/qypxjl.jsp?zw=01");
list.add(map);
//从业人员培训
map = new HashMap<String, Object>();
map.put("id", "25");
map.put("pid", "4");
map.put("text", "从业人员培训");
map.put("url", "/UI/enterfile/qypxjl/qypxjl.jsp?zw=02");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "7");
map.put("pid", "4");
map.put("text", "劳动者职业健康监护档案");
map.put("url", "/UI/enterfile/ldzjbxx/ldzjbxx.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "8");
map.put("pid", "4");
map.put("text", "新发职业病");
map.put("url", "/UI/enterfile/qyxfzybxx/qyxfzybxx.jsp");
list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "9");
// map.put("pid", "4");
// map.put("text", "工作场所职业危害种类清单");
// map.put("url", "/UI/enterfile/zywsgljg/zzywsgljg.jsp");
// list.add(map);
map = new HashMap<String, Object>();
map.put("id", "10");
map.put("pid", "4");
map.put("text", "检测、评价报告与记录");
map.put("url", "/UI/enterfile/jcjgpjbgjbqk/jcjgpjbgjbqk.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "11");
map.put("pid", "4");
map.put("text", "职业病危害申报情况");
map.put("url", "/UI/zyjk/cor/info/enterinfomain.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "12");
map.put("pid", "4");
map.put("text", "职业病防护用品管理");
map.put("url", "/UI/enterfile/zybfhypgl/zybfhypgl.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "13");
map.put("pid", "4");
map.put("text", "职业病防护用品发放管理");
map.put("url", "/UI/enterfile/fhypffgl/fhypffgl.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "15");
map.put("pid", "4");
map.put("text", "职业病防护设施");
map.put("url", "/UI/enterfile/zybfhss/zybfhss.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "16");
map.put("pid", "4");
map.put("text", "职业病危害事故报告与应急处置记录");
map.put("url", "/UI/enterfile/qyzybsgczjl/qyzybsgczjl.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "18");
map.put("pid", "4");
map.put("text", "职业卫生安全许可证");
map.put("url", "/UI/enterfile/zywsxkz/ZywsxkzUpAction_findByKey.action");
list.add(map);
//
map = new HashMap<String, Object>();
map.put("id", "17");
map.put("pid", "0");
map.put("text", "建设项目三同时");
map.put("url", "/UI/zyjk/jsxmsts/qyjsxmlist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "19");
map.put("pid", "0");
map.put("text", "基础建设");
//map.put("url","");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "20");
map.put("pid", "19");
map.put("text", "自查自纠填报");
map.put("url","/UI/action/zyjk/ZczjAction_getTBZczjList.action?messageBean.method=add&zbid=T_YHZC_BZZB370000130605000001");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "23");
map.put("pid", "19");
map.put("text", "历史查询");
map.put("url","/UI/zczj/qyzczjlist.jsp?zbid=T_YHZC_BZZB370000130605000001");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "21");
map.put("pid", "19");
map.put("text", "整改情况");
map.put("url","/UI/zczj/bhglist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "22");
map.put("pid", "0");
map.put("text", "密码修改");
map.put("url","/UI/system/user/qymodifypass.jsp");
list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/EnterViewTree.java | Java | oos | 6,349 |
/*********************************************************************
*<p>处理内容:role TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.21---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.dao.PtroleBean;
public class PtOperTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = "SELECT PTOperRole.OperID ,PTRole.RoleID AS roleid,PTRole.PARROLEID AS parroleid," +
"PTRole.RoleDesc AS roledesc FROM PTRole,PTOperRole WHERE (PTRole.RoleID=PTOperRole.RoleID) ";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}else if(strTreeID!=null&&!(strTreeID.equals(""))) {
strSQL = strSQL + " and operid= '"+strTreeID+"'";
}
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
@SuppressWarnings("unchecked")
public List<Map<String, Object>> getTree(RecordSet rs) {
PtroleBean ptRoleBean=new PtroleBean();
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
List<String> idlist=new ArrayList<String>();
try {
List<PtroleBean> operlist=new ArrayList<PtroleBean>();
operlist=ptRoleBean.findByWhere(" where 1=1");
while (rs != null && rs.next()) {
String id = rs.getString("roleid");
idlist.add(id);
}
System.out.println("需要遍历的节点"+idlist);
for(int i=0;i<operlist.size();i++){
Map<String, Object> map = new HashMap<String, Object>();
String roleid=operlist.get(i).getRoleid();
map.put("id", roleid);
map.put("pid", operlist.get(i).getParroleid());
map.put("text", operlist.get(i).getRoledesc());
if(idlist.indexOf(roleid)>=0){
map.put("ischecked", "true");
}
list.add(map);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PtOperTree.java | Java | oos | 2,926 |
/*********************************************************************
*<p>处理内容:TREE Action</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.03.05---- 孙雁斌 --------- 新规作成<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- update<br>
***********************************************************************/
package st.system.action.tree;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.platform.db.RecordSet;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.system.action.form.CreateJAVATree;
import st.system.dao.PtreesBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/tree")
public class TreeAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(TreeAction.class);
private String strWhere=""; //查询条件
private String strTreeID=""; //Tree主键编号
private MessageBean messageBean;// 操作状态
private List<Map<String, Object>> treeList;//返回的信息
private String strTreeName="";//tree名称
private String isFlag=""; //判断是否上级节点
private PtreesBean ptreesBean ; //tree
/**
* 刷新树形结构的方法
* @return
*/
@Action(value = "tree_getTree")
public String getTree(){
try {
TreeBasic treeBasic = new TreeBasic();
Class<?> forName;
logger.debug(strTreeName);
forName = Class.forName("st.system.action.tree."+strTreeName);
treeBasic = (TreeBasic)forName.newInstance();
//根据sql查询返回内容
String strSQL = treeBasic.getSQL(strWhere,strTreeID,isFlag);
logger.debug(strSQL);
System.out.println(strSQL);
RecordSet rs = executeQuery(strSQL);
treeList = treeBasic.getTree(rs);
//对内容进行处理
logger.debug(treeList.size());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return MisConstant.TREELIST;
}
/**
* 创建tree方法
* @return
*/
@Action(value = "tree_getCreat")
public String getCreat() {
try {
messageBean = new MessageBean();
ptreesBean = new PtreesBean();
ptreesBean = (PtreesBean) findByKey(ptreesBean, " where treeid ='" + strTreeID + "'");
if (ptreesBean != null) {
//创建文件
CreateJAVATree createTree = new CreateJAVATree();
createTree.createJava(ptreesBean);
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 添加
*
* @return
*/
@Action(value = "tree_insert")
public String insert() {
logger.debug("insert");
try {
String number = "PTREES_"+System.currentTimeMillis();
logger.debug(number);
ptreesBean.setTreeid(number);
logger.debug(ptreesBean.getTreename());
logger.debug(ptreesBean.getTreedesc());
messageBean = insert(ptreesBean);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return
*/
@Action(value = "tree_findByKey", results = {
@Result(type = "json", name = SUCCESS, params = { "includeProperties", "messageBean.*,ptreesBean.*" }) })
public String findByKey() {
try {
messageBean = new MessageBean();
ptreesBean = new PtreesBean();
ptreesBean = (PtreesBean) findByKey(ptreesBean, " where treeid ='" + strTreeID + "'");
if (ptreesBean != null) {
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return SUCCESS;
}
/**
* 修改
*
* @return
*/
@Action(value = "tree_update")
public String update() {
logger.debug("修改");
try {
messageBean = update(ptreesBean, " where treeid ='" + ptreesBean.getTreeid() + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 删除
*
* @return
*/
@Action(value = "tree_delete")
public String delete() {
try {
ptreesBean = new PtreesBean();
messageBean = delete(ptreesBean, " where treeid ='" + strTreeID + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public String getStrTreeID() {
return strTreeID;
}
public void setStrTreeID(String strTreeID) {
this.strTreeID = strTreeID;
}
public String getStrTreeName() {
return strTreeName;
}
public void setStrTreeName(String strTreeName) {
this.strTreeName = strTreeName;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public List<Map<String, Object>> getTreeList() {
return treeList;
}
public void setTreeList(List<Map<String, Object>> treeList) {
this.treeList = treeList;
}
public static Logger getLogger() {
return logger;
}
public static void setLogger(Logger logger) {
TreeAction.logger = logger;
}
public String getIsFlag() {
return isFlag;
}
public void setIsFlag(String isFlag) {
this.isFlag = isFlag;
}
public PtreesBean getPtreesBean() {
return ptreesBean;
}
public void setPtreesBean(PtreesBean ptreesBean) {
this.ptreesBean = ptreesBean;
}
}
| zyjk | trunk/src/st/system/action/tree/TreeAction.java | Java | oos | 8,815 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class PxjgLoginTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
return "";
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "基本信息");
map.put("url", "/UI/action/zyjk/PxjgbaAction_loginFindByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "2");
map.put("pid", "0");
map.put("text", "讲师信息");
map.put("url", "/UI/zyjk/pxjg/pxjgjs/pxjgjslist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "0");
map.put("text", "培训信息");
map.put("url", "/UI/zyjk/pxjg/pxxx/qypxjl/qypxjl.jsp");
list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "4");
// map.put("pid", "0");
// map.put("text", "系统提醒");
// map.put("url", "/UI/zyjk/cor/info/zsclist.jsp");
// list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "5");
// map.put("pid", "4");
// map.put("text", "有效期提醒");
// map.put("url", "/UI/zyjk/cor/info/zsclist.jsp");
// list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PxjgLoginTree.java | Java | oos | 2,621 |
/****************************************************
* <p>处理内容:Tree</p>
* <p>Copyright: Copyright (c) 2010</p>;
* @author ;
* 改版履历;
* Rev - Date ------- Name ---------- Note -------------------
* 1.0 2013-07-02 孙雁斌 新規作成 ;
****************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class EBzbTree extends TreeBasic {
private static final long serialVersionUID = 1L;
/**
* 取得SQL语句
*
* @param strWhere
* @param strTreeID
* @param isFlag
* @throws Exception
*/
public String getSQL(String strWhere, String strTreeID, String isFlag) {
String strSQL = "select id,parentid,bzmc,sxh,level,allparentid from t_yhzc_bzb where zbid='"+ strTreeID +"'";
if (strWhere != null && !(strWhere.equals(""))) {
strSQL = strSQL + strWhere;
}
return strSQL;
}
/**
* 对结果集合进行处理
*
* @param rs
* @@return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
//map.put("id", "1");
//map.put("pid", "0");
//map.put("text", "TREE");
//List<String> childrenlist = new ArrayList<String>();
//map.put("children", childrenlist);
//list.add(map);
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id = rs.getString("id");
//String pid = "1";
String pid = rs.getString("parentid");
// String text = rs.getString("treedesc")+"("+rs.getString("treename")+")";
String text = rs.getString("bzmc");
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/EBzbTree.java | Java | oos | 2,111 |
/*********************************************************************
*<p>处理内容:Actions TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import st.platform.db.RecordSet;
import st.platform.security.SystemAttributeNames;
import st.system.dao.PtdeptBean;
import st.system.dao.PtoperBean;
public class EDistCodeTree extends TreeBasic{
/*
* 取得SQL语句
* (non-Javadoc)
* @see st.system.action.tree.TreeBasic#getSQL(java.lang.String, java.lang.String, java.lang.String)
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = "select distinct name,code,Depth,firstNodeCode,secondNodeCode,thirdNodeCode,fourthNodeCode,ordernum from organization where code not in ('370213008007','370213008001') ";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}
//else{
// strSQL = strSQL+"where Depth in (1,2) and code not in ('370213008007','370213008001') ";
//}
PtdeptBean dept=(PtdeptBean)ServletActionContext.getContext().getSession().get(SystemAttributeNames.DEPT_INFO_NAME);
String distcode="";
if(null!=dept){
distcode=dept.getDistcode();
}
if(distcode!=null&&!distcode.equals("null")&&!distcode.equals("")){
if(distcode.indexOf("00000000")>=0){
distcode=distcode.substring(0, 4);
strWhere+=" and code like '"+distcode+"%'";
}else if(distcode.indexOf("000000")>=0&&distcode.indexOf("00000000")<0){
distcode=distcode.substring(0, 6);
strWhere+=" and code like '"+distcode+"%'";
}else if(distcode.indexOf("000000")<0&&distcode.indexOf("00000000")<0&&distcode.indexOf("000")>=0){
distcode=distcode.substring(0, 9);
strWhere+=" and code like '"+distcode+"%'";
}
}
strSQL = strSQL+strWhere;
String strOrder=" order by ordernum";
strSQL=strSQL+strOrder;
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id=rs.getString("code").trim();
String pid=rs.getString("firstNodeCode").trim();
String depth=rs.getString("Depth");
if(depth.equals("1")){
pid="0";
}else if(depth.equals("2")){
pid=rs.getString("code").trim().substring(0, 4)+"00000000";
}else if(depth.equals("3")){
pid=rs.getString("code").trim().substring(0, 6)+"000000";
}else if(depth.equals("4")){
pid=rs.getString("code").trim().substring(0, 9)+"000";
}
String name=rs.getString("name");
map.put("id", id);
map.put("pid", pid);
map.put("text", name);
map.put("depth", depth);
map.put("isexpand", "false");
//System.out.println("pid:"+pid);
if (pid.indexOf("0000")>=0){
List<String> childrenlist = new ArrayList<String>();
//childrenlist.add("");
map.put("isexpand", "false");
map.put("children", childrenlist);
}
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/EDistCodeTree.java | Java | oos | 4,084 |
/*********************************************************************
*<p>处理内容:Actions TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import st.platform.db.RecordSet;
import st.platform.security.SystemAttributeNames;
import st.system.dao.PtdeptBean;
public class TDQTree extends TreeBasic{
String discode="";
/*
* 取得SQL语句
* (non-Javadoc)
* @see st.system.action.tree.TreeBasic#getSQL(java.lang.String, java.lang.String, java.lang.String)
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
// if(strWhere!=null&&!(strWhere.equals(""))) {
// strSQL = strSQL+strWhere;
// }
PtdeptBean dept=(PtdeptBean)ServletActionContext.getContext().getSession().get(SystemAttributeNames.DEPT_INFO_NAME);
String dqcode=dept.getDeptno();
String[] dises=dqcode.split("-");
if(dises[1].length()>8){
if(dises[1].indexOf("0000")>=0){
dqcode=dqcode.substring(3, 7);
discode=dqcode+"00";
}else if(dises[1].indexOf("00")>=0&&dises[1].indexOf("0000")<0){
dqcode=dqcode.substring(3, 9);
discode=dqcode;
}else if(dises[1].indexOf("00")<0&&dises[1].indexOf("0000")<0){
dqcode=dqcode.substring(3, 11);
discode=dqcode;
}
}else{
if(dises[1].substring(0,6).indexOf("0000")>=0){
dqcode=dqcode.substring(3, 5);
discode=dqcode+"0000";
}else if(dises[1].substring(0,6).indexOf("00")>=0&&dises[1].substring(0,6).indexOf("0000")<0){
dqcode=dqcode.substring(3, 7);
discode=dqcode+"00";
}else if(dises[1].substring(0,6).indexOf("00")<0&&dises[1].substring(0,6).indexOf("0000")<0){
dqcode=dqcode.substring(3, 9);
discode=dqcode;
}
}
String strSQL = "select dqbh as id,dqdj,dqmc as label,sjdqbh as pid from T_Diqu where dqbh like '"+dqcode+"%' order by id";
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id=rs.getString("id");
String pid=rs.getString("pid");
//String xid=id+"00";
if(id.length()==2){
id=id+"0000";
}else if(id.length()==4){
id=id+"00";
}
if(pid.length()==2){
pid=pid+"0000";
}else if(pid.length()==4){
pid=pid+"00";
}
if(id.equals(discode)){
pid="0";
}
String name=rs.getString("label");
map.put("id", id);
map.put("pid", pid);
map.put("text", name);
map.put("isexpand", "false");
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/TDQTree.java | Java | oos | 3,440 |
package st.system.action.tree;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import st.platform.db.RecordSet;
import st.platform.security.SystemAttributeNames;
import st.portal.action.BasicAction;
import st.system.dao.PtmenuBean;
import st.system.dao.PtoperBean;
public class PtDeptResTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL ="select menuid,parentmenuid,menulevel,isleaf,menudesc,menulabel,menuicon,menuaction,levelidx " +
"from ptdeptres,ptmenu where ptmenu.menuid=ptdeptres.resid ";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}else{
strSQL = strSQL+" and ptdeptres.deptid = '"+strTreeID+"' ";
}
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
PtmenuBean ptResBean=new PtmenuBean();
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
List<String> idlist=new ArrayList<String>();
try {
List<PtmenuBean> reslist=new ArrayList<PtmenuBean>();
// 查询出所有的树形结构
//根据权限进行判断
PtoperBean ptoperbean = (PtoperBean) ServletActionContext.getContext().getSession().get(SystemAttributeNames.USER_INFO_NAME);
if(ptoperbean!=null){
String issuper = ptoperbean.getIssuper();
//当人员是超级管理员
System.out.println(issuper);
System.out.println(ptoperbean.getDeptid());
if(issuper.equals("1")){
reslist=ptResBean.findByWhere(" where 1=1");
}else{
String strSQL ="select menuid,parentmenuid,menulevel,isleaf,menudesc,menulabel,menuicon,menuaction,levelidx " +
"from ptdeptres,ptmenu where ptmenu.menuid=ptdeptres.resid and ptdeptres.deptid = '"+ptoperbean.getDeptid()+"' ";
BasicAction basc = new BasicAction();
RecordSet gridRS = basc.executeQuery(strSQL);
while (gridRS != null && gridRS.next()) {
PtmenuBean menubean = new PtmenuBean();
menubean.setMenuid(gridRS.getString("menuid"));
menubean.setParentmenuid(gridRS.getString("parentmenuid"));
menubean.setMenulevel(gridRS.getString("menulevel"));
menubean.setIsleaf(gridRS.getString("isleaf"));
menubean.setMenudesc(gridRS.getString("menudesc"));
menubean.setMenulabel(gridRS.getString("menulabel"));
reslist.add(menubean);
}
}
}
while (rs != null && rs.next()) {
String resid = rs.getString("menuid");
idlist.add(resid);
}
Map<String, Object> map;
for(int i=0;i<reslist.size();i++){
map = new HashMap<String, Object>();
String ResID=reslist.get(i).getMenuid();
map.put("id", ResID);
map.put("pid", reslist.get(i).getParentmenuid());
map.put("text", reslist.get(i).getMenulabel());
if(idlist.indexOf(ResID)>=0){
map.put("ischecked", "true");
}
list.add(map);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PtDeptResTree.java | Java | oos | 4,575 |
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class HYFLTree extends TreeBasic{
/*
* 取得SQL语句
* (non-Javadoc)
* @see st.system.action.tree.TreeBasic#getSQL(java.lang.String, java.lang.String, java.lang.String)
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = " select enuitemvalue,enuitemlabel from ptenudetail where enutype='HYLB' ";
//}
String strOrder=" ";
strSQL=strSQL+strOrder;
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id=rs.getString("enuitemvalue");
String pid="";
if(id.length()==2){
pid="0";
}else if(id.length()==4){
pid=id.substring(0,2);
}else{
pid=id.substring(0,4);
}
String name=rs.getString("enuitemlabel");
map.put("id", id);
map.put("pid", pid);
map.put("text", name);
map.put("isexpand", "false");
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/HYFLTree.java | Java | oos | 1,671 |
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class WHYSTree extends TreeBasic{
/*
* 取得SQL语句
* (non-Javadoc)
* @see st.system.action.tree.TreeBasic#getSQL(java.lang.String, java.lang.String, java.lang.String)
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = " select ENUITEMVALUE as id,substring(ENUITEMVALUE,1,2) as pid ,ENUITEMLABEL as label from ptenudetail where enutype='WHYS' ";
//}
String strOrder=" ";
strSQL=strSQL+strOrder;
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id=rs.getString("id");
String pid=rs.getString("pid");
String name=rs.getString("label");
//id=id.substring(2);
if(id.length()==2){
pid="0";
}else if(id.length()>0){
pid=rs.getString("pid");
}
map.put("id", id);
map.put("pid", pid);
map.put("text", name);
map.put("isexpand", "false");
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/WHYSTree.java | Java | oos | 1,715 |
/****************************************************
* <p>处理内容:Tree</p>
* <p>Copyright: Copyright (c) 2010</p>;
* @author ;
* 改版履历;
* Rev - Date ------- Name ---------- Note -------------------
* 1.0 2013-07-02 孙雁斌 新規作成 ;
****************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class BzbTree extends TreeBasic {
private static final long serialVersionUID = 1L;
/**
* 取得SQL语句
*
* @param strWhere
* @param strTreeID
* @param isFlag
* @throws Exception
*/
public String getSQL(String strWhere, String strTreeID, String isFlag) {
String strSQL = "select id,parentid,bzmc,sxh,level,allparentid from t_yhzc_bzb where level in('1','2') and zbid='"+ strTreeID +"'";
if (strWhere != null && !(strWhere.equals(""))) {
strSQL = strSQL + strWhere;
}
return strSQL;
}
/**
* 对结果集合进行处理
*
* @param rs
* @@return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
//map.put("id", "1");
//map.put("pid", "0");
//map.put("text", "TREE");
//List<String> childrenlist = new ArrayList<String>();
//map.put("children", childrenlist);
//list.add(map);
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id = rs.getString("id");
//String pid = "1";
String pid = rs.getString("parentid");
// String text = rs.getString("treedesc")+"("+rs.getString("treename")+")";
String text = rs.getString("bzmc");
String level=rs.getString("level");
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
map.put("level", level);
map.put("isexpand", "false");
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/BzbTree.java | Java | oos | 2,259 |
/*********************************************************************
*<p>处理内容:ptResource TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.21---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import st.platform.db.RecordSet;
import st.platform.security.SystemAttributeNames;
import st.portal.action.BasicAction;
import st.system.dao.PtmenuBean;
import st.system.dao.PtoperBean;
public class PtResTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL ="select menuid,ptmenu.menulabel AS roledesc,ptrole.roleid as roleid,ptrole.parroleid as parroleid " +
"from ptroleres,ptmenu,ptrole where ptmenu.menuid=ptroleres.resid ";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}else if(strTreeID!=null&&!(strTreeID.equals(""))) {
strSQL = strSQL + " and ptroleres.roleid= '"+strTreeID+"'";
}
System.out.println("----------------------------:"+strSQL);
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
PtmenuBean ptResBean=new PtmenuBean();
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
List<String> idlist=new ArrayList<String>();
try {
List<PtmenuBean> reslist=new ArrayList<PtmenuBean>();
// 查询出所有的树形结构
//根据权限进行判断
PtoperBean ptoperbean = (PtoperBean) ServletActionContext.getContext().getSession().get(SystemAttributeNames.USER_INFO_NAME);
if(ptoperbean!=null){
String issuper = ptoperbean.getIssuper();
//当人员是超级管理员
System.out.println(issuper);
System.out.println(ptoperbean.getDeptid());
if(issuper.equals("1")){
reslist=ptResBean.findByWhere(" where 1=1");
}else{
String strSQL ="select menuid,parentmenuid,menulevel,isleaf,menudesc,menulabel,menuicon,menuaction,levelidx " +
"from ptdeptres,ptmenu where ptmenu.menuid=ptdeptres.resid and ptdeptres.deptid = '"+ptoperbean.getDeptid()+"' ";
BasicAction basc = new BasicAction();
RecordSet gridRS = basc.executeQuery(strSQL);
while (gridRS != null && gridRS.next()) {
PtmenuBean menubean = new PtmenuBean();
menubean.setMenuid(gridRS.getString("menuid"));
menubean.setParentmenuid(gridRS.getString("parentmenuid"));
menubean.setMenulevel(gridRS.getString("menulevel"));
menubean.setIsleaf(gridRS.getString("isleaf"));
menubean.setMenudesc(gridRS.getString("menudesc"));
menubean.setMenulabel(gridRS.getString("menulabel"));
reslist.add(menubean);
}
}
}
reslist=ptResBean.findByWhere(" where 1=1");
while (rs != null && rs.next()) {
String resid = rs.getString("menuid");
idlist.add(resid);
}
Map<String, Object> map;
for(int i=0;i<reslist.size();i++){
map = new HashMap<String, Object>();
String ResID=reslist.get(i).getMenuid();
map.put("id", ResID);
map.put("pid", reslist.get(i).getParentmenuid());
map.put("text", reslist.get(i).getMenulabel());
if(idlist.indexOf(ResID)>=0){
map.put("ischecked", "true");
}
list.add(map);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PtResTree.java | Java | oos | 4,877 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class JcjginfoTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
return "";
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "基本信息");
map.put("url", "/UI/action/zyjk/JcjgbaAction_findByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "2");
map.put("pid", "0");
map.put("text", "人员信息");
map.put("url", "/UI/zyjk/jcjg/jcjgry/jcjgrylist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "0");
map.put("text", "检测设备管理");
map.put("url", "/UI/zyjk/jcjg/jcjgsb/jcjgsblist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "4");
map.put("pid", "0");
map.put("text", "年检管理");
map.put("url", "/UI/zyjk/jcjg/jcjgnj/jcjgnjList.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "5");
map.put("pid", "0");
map.put("text", "评价报告");
map.put("url", "/UI/zyjk/jcjg/jcjgbg/jcjgbglist.jsp");
list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/JcjginfoTree.java | Java | oos | 2,605 |
/*********************************************************************
*<p>处理内容:Actions TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import st.platform.db.RecordSet;
import st.platform.security.SystemAttributeNames;
import st.system.dao.PtdeptBean;
import st.system.dao.PtoperBean;
public class DistCodeTree extends TreeBasic{
/*
* 取得SQL语句
* (non-Javadoc)
* @see st.system.action.tree.TreeBasic#getSQL(java.lang.String, java.lang.String, java.lang.String)
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = "select distinct name,code,Depth,firstNodeCode,secondNodeCode,thirdNodeCode,fourthNodeCode,ordernum from organization where code not in ('370213008007','370213008001') ";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}
//else{
// strSQL = strSQL+"where Depth in (1,2) and code not in ('370213008007','370213008001') ";
//}
PtdeptBean dept=(PtdeptBean)ServletActionContext.getContext().getSession().get(SystemAttributeNames.DEPT_INFO_NAME);
String distcode="";
if(null!=dept){
distcode=dept.getDistcode();
}
if(distcode!=null&&!distcode.equals("null")&&!distcode.equals("")){
if(distcode.indexOf("00000000")>=0){
distcode=distcode.substring(0, 4);
strWhere+=" and code like '"+distcode+"%'";
}else if(distcode.indexOf("000000")>=0&&distcode.indexOf("00000000")<0){
distcode=distcode.substring(0, 6);
strWhere+=" and code like '"+distcode+"%'";
}else if(distcode.indexOf("000000")<0&&distcode.indexOf("00000000")<0&&distcode.indexOf("000")>=0){
distcode=distcode.substring(0, 9);
strWhere+=" and code like '"+distcode+"%'";
}
}else{
strWhere+=" and code ='0000000000000000'";
}
strSQL = strSQL+strWhere;
String strOrder=" order by ordernum";
strSQL=strSQL+strOrder;
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id=rs.getString("code").trim();
String pid=rs.getString("firstNodeCode").trim();
String depth=rs.getString("Depth");
if(depth.equals("1")){
pid="0";
}else if(depth.equals("2")){
pid=rs.getString("code").trim().substring(0, 4)+"00000000";
}else if(depth.equals("3")){
pid=rs.getString("code").trim().substring(0, 6)+"000000";
}else if(depth.equals("4")){
pid=rs.getString("code").trim().substring(0, 9)+"000";
}
String name=rs.getString("name");
map.put("id", id);
map.put("pid", pid);
map.put("text", name);
map.put("depth", depth);
map.put("isexpand", "true");
//System.out.println("pid:"+pid);
if (pid.indexOf("0000")>=0){
List<String> childrenlist = new ArrayList<String>();
//childrenlist.add("");
map.put("isexpand", "false");
map.put("children", childrenlist);
}
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/DistCodeTree.java | Java | oos | 4,150 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class JcjgLoginTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
return "";
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "基本信息");
map.put("url", "/UI/action/zyjk/JcjgbaAction_loginFindByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "2");
map.put("pid", "0");
map.put("text", "人员信息");
map.put("url", "/UI/zyjk/jcjg/jcjgry/jcjgrylist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "0");
map.put("text", "检测设备管理");
map.put("url", "/UI/zyjk/jcjg/jcjgsb/jcjgsblist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "4");
map.put("pid", "0");
map.put("text", "年检管理");
map.put("url", "/UI/zyjk/jcjg/jcjgnj/jcjgnjList.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "5");
map.put("pid", "0");
map.put("text", "检测与评价报告管理");
//map.put("url", "/UI/zyjk/cor/info/zsclist.jsp");
map.put("url", "UI/zyjk/jcjg/jcjgbg/jcjgbglist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "6");
map.put("pid", "0");
map.put("text", "系统提醒");
map.put("url", "/UI/zyjk/cor/info/zsclist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "7");
map.put("pid", "6");
map.put("text", "资质过期提醒");
map.put("url", "/UI/zyjk/cor/info/zsclist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "8");
map.put("pid", "6");
map.put("text", "资质级别提醒");
map.put("url", "/UI/zyjk/cor/info/zsclist.jsp");
list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/JcjgLoginTree.java | Java | oos | 3,446 |
/*********************************************************************
*<p>处理内容:Enm TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.19---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class EnumTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = "SELECT ENUTYPE,ENUNAME,PARENUTYPE FROM ptenumain ";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}else if(strTreeID!=null&&!(strTreeID.equals(""))) {
strSQL = strSQL + " WHERE ENUTYPE = '"+strTreeID+"'";
}
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
while (rs != null && rs.next()) {
String id = rs.getString("ENUTYPE");
String pid = rs.getString("PARENUTYPE");
String text = rs.getString("ENUNAME")+"("+rs.getString("ENUTYPE")+")";
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
//
//
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/EnumTree.java | Java | oos | 2,098 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class EnterinfoTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
return "";
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "新版");
map.put("url", "");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "2");
map.put("pid", "0");
map.put("text", "旧版");
map.put("url", "");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "2");
map.put("text", "基本信息");
map.put("url", "/UI/action/zyjk/ZcorAction_findByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "4");
map.put("pid", "2");
map.put("text", "职业病危害作业场所");
map.put("url", "/UI/zyjk/cor/info/zsitelist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "5");
map.put("pid", "2");
map.put("text", "申报单位基本生产情况");
map.put("url", "/UI/zyjk/cor/info/zsclist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "6");
map.put("pid", "2");
map.put("text", "场所职业病危害因素汇总表");
map.put("url", "/UI/zyjk/cor/info/zwhlist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "7");
map.put("pid", "2");
map.put("text", "人员管理情况汇总表");
map.put("url", "/UI/zyjk/cor/info/zpxtjlist.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "8");
map.put("pid", "1");
map.put("text", "新职业病危害项目申报表");
map.put("url", "/UI/zyjk/cor/info/newTable.jsp");
list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "7");
// map.put("pid", "0");
// map.put("text", "分类分级查询");
// map.put("url", "/UI/zyjk/flfj/flfjlist.jsp");
// list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "8");
// map.put("pid", "0");
// map.put("text", "分类分级打分");
// map.put("url", "/UI/zyjk/cor/info/zyjkfl.jsp");
// list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/EnterinfoTree.java | Java | oos | 3,885 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.05.29---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class JCReportTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
return "";
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "评价报告基本情况");
map.put("url", "UI/action/zyjk/JcjgbgAction_findByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "2");
map.put("pid", "0");
map.put("text", "被检测单位基本信息");
//map.put("url", "UI/enterfile/jcdwjbxx/jcdwjbxx.jsp");
map.put("url", "/UI/action/zyjk/JcdwjbxxAction_findByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "0");
map.put("text", "检测情况");
map.put("url", "UI/zyjk/jcjg/jcjgbg/jcqk/jcqk.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "4");
map.put("pid", "0");
map.put("text", "用人单位配备的防护设施及个人防护用品");
map.put("url", "UI/zyjk/jcjg/jcjgbg/jcyrdwfhssxx/jcyrdwfhssxx.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "5");
map.put("pid", "0");
map.put("text", "检测评价建议");
//map.put("url", "UI/enterfile/jcpjjyxx/jcpjjyxx.jsp");
map.put("url", "/UI/action/zyjk/JcpjjyxxAction_findByKey.action");
list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/JCReportTree.java | Java | oos | 2,968 |
/*********************************************************************
*<p>处理内容:role TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.21---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import st.platform.db.RecordSet;
import st.platform.security.SystemAttributeNames;
import st.system.dao.PtoperBean;
public class RoleTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
PtoperBean ptoperbean = (PtoperBean) ServletActionContext.getContext().getSession().get(SystemAttributeNames.USER_INFO_NAME);
String strSQL = "SELECT roleid,ROLEDESC,STATUS,PARROLEID,isleaf FROM ptrole ";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}else if(strTreeID!=null&&!(strTreeID.equals(""))) {
if(isFlag.equals("leafpoint")){
strSQL = strSQL + " WHERE roleid= '"+strTreeID+"'";
}else{
strSQL = strSQL + " WHERE PARROLEID= '"+strTreeID+"'";
}
if(ptoperbean!=null){
strSQL = strSQL + " and deptid= '"+ptoperbean.getDeptid()+"'";
}
}
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
while (rs != null && rs.next()) {
String id = rs.getString("roleid");
String pid = rs.getString("PARROLEID");
String text = rs.getString("ROLEDESC");
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/RoleTree.java | Java | oos | 2,530 |
/*********************************************************************
*<p>处理内容:Actions TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class ActionsTree extends TreeBasic{
/*
* 取得SQL语句
* (non-Javadoc)
* @see st.system.action.tree.TreeBasic#getSQL(java.lang.String, java.lang.String, java.lang.String)
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = "SELECT sysid,actionname,actiondesc FROM ptactions ";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text","ACTIONS");
List<String> childrenlist = new ArrayList<String>();
map.put("children", childrenlist);
list.add(map);
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id = rs.getString("sysid");
String pid = "1";
String text = rs.getString("actionname");
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/ActionsTree.java | Java | oos | 2,090 |
/****************************************************
* <p>处理内容:Tree</p>
* <p>Copyright: Copyright (c) 2010</p>;
* @author ;
* 改版履历;
* Rev - Date ------- Name ---------- Note -------------------
* 1.0 2013-03-21 新規作成 ;
****************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class PTableColumnTree extends TreeBasic {
private static final long serialVersionUID = 1L;
/**
* 取得SQL语句
* @param strWhere
* @param strTreeID
* @param isFlag
* @throws Exception
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = "Select columnid,tableid,tablename,columnname,columndesc,columnlength,columntype,iskey from ptablecolumn";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}
return strSQL;
}
/**
* 对结果集合进行处理
* @param rs
* @@return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text","表字段树");
List<String> childrenlist = new ArrayList<String>();
map.put("children", childrenlist);
list.add(map);
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id = rs.getString("columnid");
String pid = "1";
String text = rs.getString("columnname");
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PTableColumnTree.java | Java | oos | 1,753 |
/****************************************************
* <p>处理内容:Tree</p>
* <p>Copyright: Copyright (c) 2010</p>;
* @author ;
* 改版履历;
* Rev - Date ------- Name ---------- Note -------------------
* 1.0 2013-03-20 新規作成 ;
****************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class PTree extends TreeBasic {
private static final long serialVersionUID = 1L;
/**
* 取得SQL语句
*
* @param strWhere
* @param strTreeID
* @param isFlag
* @throws Exception
*/
public String getSQL(String strWhere, String strTreeID, String isFlag) {
String strSQL = "Select treeid,treename,treedesc from ptrees";
if (strWhere != null && !(strWhere.equals(""))) {
strSQL = strSQL + strWhere;
}
return strSQL;
}
/**
* 对结果集合进行处理
*
* @param rs
* @@return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "TREE");
List<String> childrenlist = new ArrayList<String>();
map.put("children", childrenlist);
list.add(map);
while (rs != null && rs.next()) {
map = new HashMap<String, Object>();
String id = rs.getString("treeid");
String pid = "1";
String text = rs.getString("treedesc")+"("+rs.getString("treename")+")";
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/PTree.java | Java | oos | 1,941 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.05.22---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class EnterfileTree extends TreeBasic {
/**
* 取得SQL语句
*
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere, String strTreeID, String isFlag) {
return "";
}
/**
* 对结果集合进行处理
*
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "用人单位基本信息");
map.put("url", "/UI/action/enterfile/EnterMain_findByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "2");
map.put("pid", "0");
map.put("text", "职业卫生管理机构");
map.put("url", "/UI/enterfile/zywsgljg/zywsgljgmain.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "0");
map.put("text", "接害人员名单");
map.put("url", "/UI/enterfile/qyryxx/qyryxx.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "4");
map.put("pid", "0");
map.put("text", "职业卫生档案");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "5");
map.put("pid", "4");
map.put("text", "规章制度、操作规程");
map.put("url", "/UI/enterfile/qygzzd/qygzzd.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "6");
map.put("pid", "4");
map.put("text", "职业卫生培训信息");
map.put("url", "/UI/enterfile/qypxjl/qypxjl.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "7");
map.put("pid", "4");
map.put("text", "劳动者职业健康监护档案");
map.put("url", "/UI/enterfile/ldzjbxx/ldzjbxx.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "8");
map.put("pid", "4");
map.put("text", "新发职业病");
map.put("url", "/UI/enterfile/qyxfzybxx/qyxfzybxx.jsp");
list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "9");
// map.put("pid", "4");
// map.put("text", "工作场所职业危害种类清单");
// map.put("url", "/UI/enterfile/zywsgljg/zzywsgljg.jsp");
// list.add(map);
map = new HashMap<String, Object>();
map.put("id", "10");
map.put("pid", "4");
map.put("text", "检测、评价报告与记录");
map.put("url", "/UI/enterfile/jcjgpjbgjbqk/jcjgpjbgjbqk.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "11");
//map.put("pid", "4");
map.put("pid", "4");
map.put("text", "职业病危害申报情况");
map.put("url", "/UI/zyjk/cor/info/enterinfomain.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "12");
map.put("pid", "4");
map.put("text", "职业病防护用品管理");
map.put("url", "/UI/enterfile/zybfhypgl/zybfhypgl.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "13");
map.put("pid", "4");
map.put("text", "职业病防护用品发放管理");
map.put("url", "/UI/enterfile/fhypffgl/fhypffgl.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "15");
map.put("pid", "4");
map.put("text", "职业病防护设施");
map.put("url", "/UI/enterfile/zybfhss/zybfhss.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "16");
map.put("pid", "4");
map.put("text", "职业病危害事故报告与应急处置记录");
map.put("url", "/UI/enterfile/qyzybsgczjl/qyzybsgczjl.jsp");
list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "17");
// map.put("pid", "4");
// map.put("text", "建设项目“三同时");
// map.put("url", "/UI/enterfile/zywsgljg/xzywsgljg.jsp");
// list.add(map);
map = new HashMap<String, Object>();
map.put("id", "18");
map.put("pid", "4");
map.put("text", "职业卫生安全许可证");
map.put("url", "/UI/enterfile/zywsxkz/zywsxkz.jsp");
list.add(map);
// map = new HashMap<String, Object>();
// map.put("id", "19");
// map.put("pid", "0");
// map.put("text", "监督检查信息");
// map.put("url", "/UI/enterfile/zywsgljg/xzywsgljg.jsp");
// list.add(map);
//企业负责人培训
map = new HashMap<String, Object>();
map.put("id", "24");
map.put("pid", "6");
map.put("text", "企业负责人培训");
map.put("url", "/UI/enterfile/qypxjl/qypxjl.jsp?zw=01");
list.add(map);
//从业人员培训
map = new HashMap<String, Object>();
map.put("id", "25");
map.put("pid", "6");
map.put("text", "从业人员培训");
map.put("url", "/UI/enterfile/qypxjl/qypxjl.jsp?zw=02");
list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/EnterfileTree.java | Java | oos | 5,506 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.03.11---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
public class MenuTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
String strSQL = "SELECT menuid,PARENTMENUID,MENULABEL,ISLEAF FROM ptmenu ";
if(strWhere!=null&&!(strWhere.equals(""))) {
strSQL = strSQL+strWhere;
}else if(strTreeID!=null&&!(strTreeID.equals(""))) {
if(isFlag.equals("true")){
strSQL = strSQL + " WHERE MENUID = '"+strTreeID+"'";
}else{
strSQL = strSQL + " WHERE PARENTMENUID = '"+strTreeID+"' and len(menuid)='3' ";
}
}
strSQL+=" order by levelidx";
return strSQL;
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
while (rs != null && rs.next()) {
String id = rs.getString("menuid");
String pid = rs.getString("PARENTMENUID");
String text = rs.getString("MENULABEL");
String isleaf = rs.getString("ISLEAF");
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", id);
map.put("pid", pid);
map.put("text", text);
map.put("isexpand", "false");
//
if (!(isleaf.equals("1"))) {
List<String> childrenlist = new ArrayList<String>();
map.put("children", childrenlist);
}
//
list.add(map);
}
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/MenuTree.java | Java | oos | 2,557 |
/*********************************************************************
*<p>处理内容:MENU TREE</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.1 --2013.05.29---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.tree;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.RecordSet;
import st.system.action.tree.TreeBasic;
public class ReportTree extends TreeBasic{
/**
* 取得SQL语句
* @param accpet
* @param syncmodel
* @return
*/
public String getSQL(String strWhere,String strTreeID,String isFlag) {
return "";
}
/**
* 对结果集合进行处理
* @param accpet
* @param syncmodel
* @return
*/
public List<Map<String, Object>> getTree(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>> ();
Map<String, Object> map = new HashMap<String, Object>();
map = new HashMap<String, Object>();
map.put("id", "1");
map.put("pid", "0");
map.put("text", "评价报告基本情况");
map.put("url", "UI/action/Jcjgpjbgjbqk/JcjgpjbgjbqkAction_findByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "2");
map.put("pid", "0");
map.put("text", "被检测单位基本信息");
//map.put("url", "UI/enterfile/jcdwjbxx/jcdwjbxx.jsp");
map.put("url", "UI/action/jcdwjbxx/JcdwjbxxAction_findByKey.action");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "3");
map.put("pid", "0");
map.put("text", "检测情况");
map.put("url", "UI/enterfile/jcqk/jcqk.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "4");
map.put("pid", "0");
map.put("text", "用人单位配备的防护设施及个人防护用品");
map.put("url", "UI/enterfile/jcyrdwfhssxx/jcyrdwfhssxx.jsp");
list.add(map);
map = new HashMap<String, Object>();
map.put("id", "5");
map.put("pid", "0");
map.put("text", "检测评价建议");
//map.put("url", "UI/enterfile/jcpjjyxx/jcpjjyxx.jsp");
map.put("url", "UI/action/jcpjjyxx/JcpjjyxxAction_findByKey.action");
list.add(map);
return list;
}
}
| zyjk | trunk/src/st/system/action/tree/ReportTree.java | Java | oos | 2,972 |
package st.system.action.init;
import st.portal.action.BasicAction;
/**
* 系统初始化功能 将需要的信息装入到内存中
* @author Administrator
*
*/
public class SysInitAction extends BasicAction{
}
| zyjk | trunk/src/st/system/action/init/SysInitAction.java | Java | oos | 231 |
/*********************************************************************
*<p>处理内容:Menu Action</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.02.28---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.menu;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.platform.db.DBUtil;
import st.platform.utils.Basic;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtmenuBean;
import UI.message.MisConstant;
import UI.util.BusinessDate;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/menu")
public class MenuAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(MenuAction.class);
private String strWhere=""; //查询条件
private String strSysno=""; //主键编号
private MessageBean messageBean ;//操作状态
private PtmenuBean ptMenuBean; //返回的信息
private List<Map<String, Object>> list;
/**
*添加方法
* @return String 返回操作结果
*/
@Action(value = "menu_insert")
public String insert() {
try {
//String number = BusinessDate.getNoFormatToday() + "-" + st.platform.db.SerialNumber.getNextSerialNo("67");
PtmenuBean parentmenu=new PtmenuBean();
parentmenu=(PtmenuBean) parentmenu.findFirstByWhere(" where menuid='"+ptMenuBean.getParentmenuid()+"'");
System.out.println("ptMenuBean.getParentmenuid()==="+ptMenuBean.getParentmenuid());
int menulevel=0;
if (null!=parentmenu) {
menulevel=Basic.getInt(parentmenu.getMenulevel())+1;
}
String s1 = DBUtil.getCellValue("ptmenu", "max(menuid)", "len(menuid)=(select max(len(menuid)) from ptmenu)");
s1 = (new StringBuffer(String.valueOf(Integer.parseInt(s1) + 1))).toString();
if(Integer.parseInt(s1) < 10)
s1 = "0" + s1;
ptMenuBean.setMenulevel(menulevel+"");
ptMenuBean.setMenuid(s1);
//ptMenuBean.setMenuid(number);
ptMenuBean.setParentmenuid(ptMenuBean.getParentmenuid());
ptMenuBean.setIsleaf("1");
messageBean = insert(ptMenuBean);
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return String 返回操作结果
*/
@Action(value = "menu_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/menu/menuinfo.jsp") })
public String findByKey() {
try {
logger.debug(messageBean.getMethod());
//ptMenuBean = new PtmenuBean();
if (!(messageBean.getMethod().equals("add"))) {
ptMenuBean = new PtmenuBean();
ptMenuBean = (PtmenuBean) findByKey(ptMenuBean," where menuid ='" + strSysno + "'");
if (ptMenuBean == null) {
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}else{
ptMenuBean.setParentmenuid(ptMenuBean.getParentmenuid());
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
* 修改
*
* @return String 返回操作结果
*/
@Action(value = "menu_update")
public String update() {
logger.debug("修改");
try {
messageBean = update(ptMenuBean, " where menuid ='" + ptMenuBean.getMenuid() + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 删除方法
*
* @return String 返回操作结果
*/
@Action(value = "menu_delete")
public String delete() {
try {
ptMenuBean = new PtmenuBean();
messageBean = delete(ptMenuBean, " where menuid in (" + strSysno
+ ")");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public PtmenuBean getPtMenuBean() {
return ptMenuBean;
}
public void setPtMenuBean(PtmenuBean ptMenuBean) {
this.ptMenuBean = ptMenuBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public static Logger getLogger() {
return logger;
}
public static void setLogger(Logger logger) {
MenuAction.logger = logger;
}
}
| zyjk | trunk/src/st/system/action/menu/MenuAction.java | Java | oos | 5,887 |
/*********************************************************************
*<p>处理内容:Ptoper Action</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.03.22---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.ptoper;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtoperroleBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/ptoper")
public class PtoperAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(PtoperAction.class);
private String strWhere=""; //查询条件
private String strSysno=""; //资源主键编号
private String strRoleno=""; //角色编号
private MessageBean messageBean ;//操作状态
private PtoperroleBean ptOPerRoleBean; //返回的信息
private List<Map<String, Object>> list;
private String operid="";
/**
*添加方法
* @return String 返回操作结果
*/
@Action(value = "ptoper_insert")
public String insert() {
try {
String[] strobj=strSysno.split(",");
System.out.println("长度"+strobj.length);
for(int i=0;i<strobj.length;i++){
ptOPerRoleBean=new PtoperroleBean();
ptOPerRoleBean.setOperid(strRoleno);
ptOPerRoleBean.setRoleid(strobj[i]);
messageBean = insert(ptOPerRoleBean);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
System.out.println("测试增方法测试增方法测试增方法测试增方法测试增方法测试增方法测试增方法测试增方法测试增方法");
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return String 返回操作结果
*/
@Action(value = "ptoper_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/safeoper/opertree.jsp") })
public String findByKey() {
try {
logger.debug(messageBean.getMethod());
if (!(messageBean.getMethod().equals("add"))) {
ptOPerRoleBean = new PtoperroleBean();
ptOPerRoleBean = (PtoperroleBean) findByKey(ptOPerRoleBean," where operid ='" + strSysno + "'");
if (ptOPerRoleBean == null) {
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}else{
ptOPerRoleBean.setOperid(ptOPerRoleBean.getOperid());
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
* 删除方法
*
* @return String 返回操作结果
*/
@Action(value = "ptoper_delete")
public String delete() {
try {
ptOPerRoleBean = new PtoperroleBean();
messageBean = delete(ptOPerRoleBean, " where operid='"+ strRoleno +"'");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
System.out.println("测试减方法测试减方法测试减方法测试减方法测试减方法测试减方法测试减方法测试减方法测试减方法测试减方法");
return MisConstant.RETMESSAGE;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public static Logger getLogger() {
return logger;
}
public static void setLogger(Logger logger) {
PtoperAction.logger = logger;
}
public String getStrRoleno() {
return strRoleno;
}
public void setStrRoleno(String strRoleno) {
this.strRoleno = strRoleno;
}
public PtoperroleBean getPtOPerRoleBean() {
return ptOPerRoleBean;
}
public void setPtOPerRoleBean(PtoperroleBean ptOPerRoleBean) {
this.ptOPerRoleBean = ptOPerRoleBean;
}
public String getOperid() {
return operid;
}
public void setOperid(String operid) {
this.operid = operid;
}
}
| zyjk | trunk/src/st/system/action/ptoper/PtoperAction.java | Java | oos | 5,287 |
/*********************************************************************
*<p>处理内容: GRID 管理</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.3.18---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.grid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.platform.system.cache.EnumerationType;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.portal.html.DBSelect;
import st.system.action.form.CreateListJSFile;
import st.system.action.form.CreateListJSPFile;
import st.system.dao.PtgridsBean;
import st.system.dao.PtgridscolumnBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/grid")
public class GridAction extends BasicAction{
private static Logger logger = Logger.getLogger(GridAction.class);
private static final long serialVersionUID = 1L;
private PtgridsBean ptgridBean; // 返回的信息
private String strWhere=""; // 查询条件
private String strSysno=""; // 主键编号
private PageBean pageBean; // 分页类
private MessageBean messageBean;// 操作状态
private String gridKey ="";
private String strOrderBy =""; //排序
/**
* 公共的分页查询
*
* @return
*/
@Action(value = "Grid_findList")
public String findList() {
try {
messageBean = new MessageBean();
if(strSysno!=null&&!(strSysno.equals("")))
{
//从数据库中取出sql语句
ptgridBean = new PtgridsBean();
ptgridBean = (PtgridsBean) findByKey(ptgridBean, " where gridid ='" + strSysno + "'");
if(ptgridBean!=null)
{
String strFSql = ptgridBean.getSqlstr();
strOrderBy = ptgridBean.getOrderstr();
if(strOrderBy==null){
strOrderBy = "";
}
if(strFSql!=null&&strFSql.length()>0)
{
strWhere = ptgridBean.getWherestr() +" " +strWhere;
pageBean = findList(strSysno,strFSql, strWhere, strOrderBy, pageBean);
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}
}
else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage("GRID IS NULL");
}
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDLIST;
}
/**
* 添加
*
* @return
*/
@Action(value = "GridAction_insert")
public String insert() {
try {
ptgridBean.setGridid(ptgridBean.getGridname());
messageBean = insert(ptgridBean);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return
*/
@Action(value = "GridAction_findByKey", results = {
@Result(type = "json", name = SUCCESS, params = { "includeProperties", "messageBean.*,ptgridBean.*" }) })
public String findByKey() {
try {
messageBean = new MessageBean();
ptgridBean = new PtgridsBean();
ptgridBean = (PtgridsBean) findByKey(ptgridBean, " where gridid ='" + strSysno + "'");
if (ptgridBean != null) {
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return SUCCESS;
}
/**
* 修改
*
* @return
*/
@Action(value = "GridAction_update")
public String update() {
logger.debug("修改");
try {
messageBean = update( ptgridBean, " where gridid ='" + ptgridBean.getGridid()+ "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 删除
*
* @return
*/
@Action(value = "GridAction_delete")
public String delete() {
try {
ptgridBean = new PtgridsBean();
messageBean = delete( ptgridBean, " where gridid in ('" + strSysno + "')");
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 生成sql
* @return
*/
@Action(value = "GridAction_createSQL")
public String createSQL() {
try {
messageBean = new MessageBean();
String arr [] = {"a","b","c","d","e","f","g"};
PtgridscolumnBean ptgridColumn = new PtgridscolumnBean();
List<PtgridscolumnBean> list = ptgridColumn.findByWhere(" where gridname ='" + strSysno + "'");
Map<String,String> map = new HashMap<String, String>();
String strSQL ="select ";
String strFrom =" from ";
//取出涉及的表名称
for(int i=0;i<list.size();i++)
{
ptgridColumn = list.get(i);
map.put(ptgridColumn.getTablename(), ptgridColumn.getTablename());
}
int state = 0;
//放入带表名称
for(Object obj:map.keySet())
{
String dname =arr[state];
String table = map.get(obj);
map.put(obj.toString(), dname);
strFrom = strFrom + table+" as "+arr[state]+",";
state++;
}
strFrom = strFrom.substring(0, strFrom.length()-1)+"";
for(int i=0;i<list.size();i++)
{
ptgridColumn = list.get(i);
strSQL = strSQL +map.get(ptgridColumn.getTablename())+"."+ptgridColumn.getColumnname()+",";
}
strSQL = strSQL.substring(0, strSQL.length()-1)+strFrom;
messageBean.setMethod(strSQL);
if (list != null) {
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 生成LIST JSP页面
* @return
*/
@Action(value = "GridAction_creatJsp")
public String createJsp() {
try {
messageBean = new MessageBean();
CreateListJSPFile jsp = new CreateListJSPFile();
ptgridBean = new PtgridsBean();
ptgridBean = (PtgridsBean) findByKey(ptgridBean, " where gridid ='" + strSysno + "'");
jsp.createJSP(ptgridBean);
CreateListJSFile js = new CreateListJSFile();
js.createJS(strSysno);
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public PtgridsBean getPtgridBean() {
return ptgridBean;
}
public void setPtgridBean(PtgridsBean ptgridBean) {
this.ptgridBean = ptgridBean;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public PageBean getPageBean() {
return pageBean;
}
public void setPageBean(PageBean pageBean) {
this.pageBean = pageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public String getGridKey() {
return gridKey;
}
public void setGridKey(String gridKey) {
this.gridKey = gridKey;
}
}
| zyjk | trunk/src/st/system/action/grid/GridAction.java | Java | oos | 11,689 |
/*********************************************************************
*<p>处理内容: GRIDColumn 管理</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.3.18---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.grid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.platform.db.SerialNumber;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtablecolumnBean;
import st.system.dao.PtgridsBean;
import st.system.dao.PtgridscolumnBean;
import UI.dao.DemoBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/grid")
public class GridColumnAction extends BasicAction{
private static Logger logger = Logger.getLogger(GridColumnAction.class);
private static final long serialVersionUID = 1L;
private PtgridscolumnBean ptgridcolumnBean; // 返回的信息
private String strWhere=""; // 查询条件
private String strSysno=""; // 主键编号
private PageBean pageBean; // 分页类
private MessageBean messageBean;// 操作状态
private String strColumnName;//字段COLUMN
private String strGridid; //GRID名称
private String strTableName;//
private String strOrder;// 排序类型
/**
* 动态添加
*
* @return
*/
@SuppressWarnings("unchecked")
@Action(value = "GridColumnAction_insertAll")
public String insertAll() {
try {
String columnArr[] = strColumnName.split(";");
messageBean = new MessageBean();
PtgridsBean ptgridsbean = new PtgridsBean();
ptgridsbean = (PtgridsBean)ptgridsbean.findFirstByWhere(" where gridid ='"+strGridid+"'");
PtablecolumnBean tableColumn = new PtablecolumnBean();
List<PtablecolumnBean> list = tableColumn.findByWhere(" where tablename ='"+strTableName+"'");
Map<String,PtablecolumnBean>map = new HashMap<String,PtablecolumnBean>();
for(int i=0;i<list.size();i++)
{
tableColumn = list.get(i);
map.put(tableColumn.getColumnname(), tableColumn);
}
//查询现有的信息 防止信息重复
PtgridscolumnBean gridcolumn = new PtgridscolumnBean();
List<PtgridscolumnBean> columnlist = gridcolumn.findByWhere(" where gridname ='"+strGridid+"' and tablename ='"+strTableName+"' order by dispno desc");
Map<String,PtgridscolumnBean>colummap = new HashMap<String,PtgridscolumnBean>();
for(int i=0;i<columnlist.size();i++)
{
gridcolumn = columnlist.get(i);
colummap.put(gridcolumn.getColumnname(), gridcolumn);
}
//排序序号的设立
int index = 0;
PtgridscolumnBean columns = (PtgridscolumnBean)gridcolumn.findFirstByWhere(" where gridname ='"+strGridid+"' order by dispno desc");
if(columns!=null){
index = Integer.parseInt(columns.getDispno());
}
for(int i=0;i<columnArr.length;i++)
{
if(colummap.get(columnArr[i])==null)
{
ptgridcolumnBean = new PtgridscolumnBean();
String number = "PTGRIDCOLUMN_" + SerialNumber.getNextSerialNo("67");;
ptgridcolumnBean.setSysid(number);
ptgridcolumnBean.setTablename(strTableName);
ptgridcolumnBean.setGridname(ptgridsbean.getGridname());
ptgridcolumnBean.setColumnname(columnArr[i]);
ptgridcolumnBean.setColumndesc(map.get(columnArr[i]).getColumndesc());
ptgridcolumnBean.setColumnalign("left");
ptgridcolumnBean.setColumnhide("1");
ptgridcolumnBean.setColumntype("text");
ptgridcolumnBean.setColumnstate("text");
ptgridcolumnBean.setColumnwidth("100");
ptgridcolumnBean.setIsfind("0");
//排序
int dispno = (index +i+1);
ptgridcolumnBean.setDispno(""+dispno);
insert(ptgridcolumnBean);
}
}
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 分页查询
*
* @return
*/
@Action(value = "GridColumnAction_findList")
public String findList() {
try {
messageBean = new MessageBean();
String strFSql = "select * from ptgridscolumn ";
// 查询条件
pageBean = findList("",strFSql, strWhere, "order by gridname,dispno", pageBean);
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDLIST;
}
/**
* 查询信息
*
* @return
*/
@Action(value = "GridColumnAction_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/resource/grid/gridinfo.jsp") })
public String findByKey() {
try {
ptgridcolumnBean = new PtgridscolumnBean();
if (!(messageBean.getMethod().equals("add"))) {
ptgridcolumnBean = (PtgridscolumnBean) findByKey(ptgridcolumnBean, " where sysid ='" + strSysno + "'");
if (ptgridcolumnBean != null) {
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}else{
ptgridcolumnBean = new PtgridscolumnBean();
ptgridcolumnBean.setGridname(strSysno);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
* 添加
*
* @return
*/
@Action(value = "GridColumnAction_insert")
public String insert() {
try {
String number = "PTGRIDCOLUMN_"+System.currentTimeMillis();
//查询现有的信息 防止信息重复
PtgridscolumnBean gridcolumn = new PtgridscolumnBean();
List<PtgridscolumnBean> columnlist = gridcolumn.findByWhere(" where gridname ='"+ptgridcolumnBean.getGridname()+"' and tablename ='"+ptgridcolumnBean.getTablename()+"' order by dispno desc");
//排序序号的设立 取出最大的一个
//排序序号的设立
int index = 0;
PtgridscolumnBean columns = (PtgridscolumnBean)gridcolumn.findFirstByWhere(" where gridname ='"+ptgridcolumnBean.getGridname()+"' order by dispno desc");
if(columns!=null){
index = Integer.parseInt(columns.getDispno());
}
ptgridcolumnBean.setSysid(number);
int dispno = (index +1);
ptgridcolumnBean.setDispno(""+dispno);
messageBean = insert(ptgridcolumnBean);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 修改
*
* @return
*/
@Action(value = "GridColumnAction_update")
public String update() {
try {
messageBean = update( ptgridcolumnBean, " where sysid ='" + ptgridcolumnBean.getSysid() + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 删除
*
* @return
*/
@Action(value = "GridColumnAction_delete")
public String delete() {
try {
ptgridcolumnBean = new PtgridscolumnBean();
messageBean = delete( ptgridcolumnBean, " where sysid in (" + strSysno + ")");
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 排序
*
* @return
*/
@Action(value = "GridColumnAction_order")
public String orderBy() {
try {
//有主键查询信息
ptgridcolumnBean = new PtgridscolumnBean();
messageBean = new MessageBean();
//根据主键 取出修改信息
ptgridcolumnBean = (PtgridscolumnBean)findByKey(ptgridcolumnBean, " where sysid ='"+strSysno+"'");
//取出当前的排序
PtgridscolumnBean updateColumnBean = null;
if(strOrder.equals("up")){
updateColumnBean = (PtgridscolumnBean)findByKey(ptgridcolumnBean, " where gridname ='"+ptgridcolumnBean.getGridname()+"' and dispno < '"+ptgridcolumnBean.getDispno()+"' order by dispno desc ");
}else if(strOrder.equals("down")){
updateColumnBean = (PtgridscolumnBean)findByKey(ptgridcolumnBean, " where gridname ='"+ptgridcolumnBean.getGridname()+"' and dispno > '"+ptgridcolumnBean.getDispno()+"' order by dispno ");
}
if(updateColumnBean!=null){
String dispno = updateColumnBean.getDispno();
updateColumnBean.setDispno(ptgridcolumnBean.getDispno());
ptgridcolumnBean.setDispno(dispno);
//修改排序
messageBean = update( ptgridcolumnBean, " where sysid ='" + ptgridcolumnBean.getSysid() + "'");
messageBean = update( updateColumnBean, " where sysid ='" + updateColumnBean.getSysid() + "'");
}else{
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public PtgridscolumnBean getPtgridcolumnBean() {
return ptgridcolumnBean;
}
public void setPtgridcolumnBean(PtgridscolumnBean ptgridcolumnBean) {
this.ptgridcolumnBean = ptgridcolumnBean;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public PageBean getPageBean() {
return pageBean;
}
public void setPageBean(PageBean pageBean) {
this.pageBean = pageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public String getStrColumnName() {
return strColumnName;
}
public void setStrColumnName(String strColumnName) {
this.strColumnName = strColumnName;
}
public String getStrTableName() {
return strTableName;
}
public void setStrTableName(String strTableName) {
this.strTableName = strTableName;
}
public String getStrGridid() {
return strGridid;
}
public void setStrGridid(String strGridid) {
this.strGridid = strGridid;
}
public String getStrOrder() {
return strOrder;
}
public void setStrOrder(String strOrder) {
this.strOrder = strOrder;
}
}
| zyjk | trunk/src/st/system/action/grid/GridColumnAction.java | Java | oos | 14,708 |
/*********************************************************************
*<p>处理内容:ptdept Action</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.03.20---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.ptdept;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtdeptBean;
import UI.message.MisConstant;
import UI.util.BusinessDate;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/ptdept")
public class PtDeptAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(PtDeptAction.class);
private String strWhere=""; //查询条件
private String strSysno=""; //主键编号
private MessageBean messageBean ;//操作状态
private PtdeptBean ptDeptBean; //返回的信息
private List<Map<String, Object>> list;
/**
*添加方法
* @return String 返回操作结果
*/
@Action(value = "ptdept_insert")
public String insert() {
try {
String number = BusinessDate.getNoFormatToday() + "-" + st.platform.db.SerialNumber.getNextSerialNo("67");
ptDeptBean.setDeptno(number);
messageBean = insert(ptDeptBean);
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return String 返回操作结果
*/
@Action(value = "ptdept_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/ptdept/ptdeptinfo.jsp") })
public String findByKey() {
try {
logger.debug(messageBean.getMethod());
if (!(messageBean.getMethod().equals("add"))) {
ptDeptBean = new PtdeptBean();
ptDeptBean = (PtdeptBean) findByKey(ptDeptBean," where deptno ='" + strSysno + "'");
if (ptDeptBean == null) {
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}
else{
ptDeptBean.setParentdeptid(ptDeptBean.getParentdeptid());
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
* 修改
*
* @return String 返回操作结果
*/
@Action(value = "ptdept_update")
public String update() {
logger.debug("修改");
try {
messageBean = update(ptDeptBean, " where deptno ='" + ptDeptBean.getDeptno() + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 删除方法
*
* @return String 返回操作结果
*/
@Action(value = "ptdept_delete")
public String delete() {
try {
ptDeptBean = new PtdeptBean();
messageBean = delete(ptDeptBean, " where deptno in (" + strSysno
+ ")");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public static Logger getLogger() {
return logger;
}
public static void setLogger(Logger logger) {
PtDeptAction.logger = logger;
}
public PtdeptBean getPtDeptBean() {
return ptDeptBean;
}
public void setPtDeptBean(PtdeptBean ptDeptBean) {
this.ptDeptBean = ptDeptBean;
}
}
| zyjk | trunk/src/st/system/action/ptdept/PtDeptAction.java | Java | oos | 5,000 |
/*********************************************************************
*<p>处理内容:Role Action</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.03.21---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.role;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtroleBean;
import UI.message.MisConstant;
import UI.util.BusinessDate;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/role")
public class RoleAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(RoleAction.class);
private String strWhere=""; //查询条件
private String strSysno=""; //主键编号
private MessageBean messageBean ;//操作状态
private PtroleBean ptRoleBean; //返回的信息
private List<Map<String, Object>> list;
/**
*添加方法
* @return String 返回操作结果
*/
@Action(value = "role_insert")
public String insert() {
try {
String number = BusinessDate.getNoFormatToday() + "-" + st.platform.db.SerialNumber.getNextSerialNo("67");
ptRoleBean.setRoleid(number);
messageBean = insert(ptRoleBean);
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return String 返回操作结果
*/
@Action(value = "role_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/role/roleinfo.jsp") })
public String findByKey() {
try {
logger.debug(messageBean.getMethod());
if (!(messageBean.getMethod().equals("add"))) {
ptRoleBean = new PtroleBean();
ptRoleBean = (PtroleBean) findByKey(ptRoleBean," where roleid ='" + strSysno + "'");
if (ptRoleBean == null) {
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}else{
ptRoleBean.setParroleid(ptRoleBean.getParroleid());
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
* 修改
*
* @return String 返回操作结果
*/
@Action(value = "role_update")
public String update() {
logger.debug("修改");
try {
messageBean = update(ptRoleBean, " where roleid ='" + ptRoleBean.getRoleid() + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 删除方法
*
* @return String 返回操作结果
*/
@Action(value = "role_delete")
public String delete() {
try {
ptRoleBean = new PtroleBean();
messageBean = delete(ptRoleBean, " where roleid in (" + strSysno
+ ")");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public static Logger getLogger() {
return logger;
}
public static void setLogger(Logger logger) {
RoleAction.logger = logger;
}
public PtroleBean getPtRoleBean() {
return ptRoleBean;
}
public void setPtRoleBean(PtroleBean ptRoleBean) {
this.ptRoleBean = ptRoleBean;
}
}
| zyjk | trunk/src/st/system/action/role/RoleAction.java | Java | oos | 4,955 |
/*********************************************************************
*<p>处理内容:部门分配权限</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.06.03---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.role;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import UI.message.MisConstant;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.system.dao.PtdeptresBean;
import st.system.dao.PtroleresBean;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/role")
public class DeptResAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(RoleResAction.class);
private String strWhere=""; //查询条件
private String strSysno=""; //资源主键编号
private String strDeptid=""; //部门编号
private MessageBean messageBean ;//操作状态
private PtdeptresBean ptdeptresBean; //返回的信息
private List<Map<String, Object>> list;
/**
*添加方法
* @return String 返回操作结果
*/
@Action(value = "deptres_insert")
public String insert() {
try {
//删除原先已有的资源
ptdeptresBean = new PtdeptresBean();
messageBean = delete(ptdeptresBean, " where deptid='"+ strDeptid +"'");
String[] strobj=strSysno.split(",");
for(int i=0;i<strobj.length;i++){
ptdeptresBean=new PtdeptresBean();
ptdeptresBean.setDeptid(strDeptid);
ptdeptresBean.setResid(strobj[i]);
messageBean = insert(ptdeptresBean);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return String 返回操作结果
*/
@Action(value = "deptres_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/ptdept/roletree.jsp") })
public String findByKey() {
try {
logger.debug(messageBean.getMethod());
if (!(messageBean.getMethod().equals("add"))) {
}else{
ptdeptresBean = new PtdeptresBean();
ptdeptresBean.setDeptid(strDeptid);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public PtdeptresBean getPtdeptresBean() {
return ptdeptresBean;
}
public void setPtdeptresBean(PtdeptresBean ptdeptresBean) {
this.ptdeptresBean = ptdeptresBean;
}
public String getStrDeptid() {
return strDeptid;
}
public void setStrDeptid(String strDeptid) {
this.strDeptid = strDeptid;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
}
| zyjk | trunk/src/st/system/action/role/DeptResAction.java | Java | oos | 4,643 |
/*********************************************************************
*<p>处理内容:RoleRes Action</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.03.22---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.role;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtroleresBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/roleres")
public class RoleResAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(RoleResAction.class);
private String strWhere=""; //查询条件
private String strSysno=""; //资源主键编号
private String strRoleno=""; //角色编号
private MessageBean messageBean ;//操作状态
private PtroleresBean ptRoleResBean; //返回的信息
private List<Map<String, Object>> list;
/**
*添加方法
*
* @return String 返回操作结果
*/
@Action(value = "roleres_insert")
public String insert() {
try {
ptRoleResBean = new PtroleresBean();
messageBean = delete(ptRoleResBean, " where roleid='"+ strRoleno +"'");
String[] strobj=strSysno.split(",");
for(int i=0;i<strobj.length;i++){
ptRoleResBean=new PtroleresBean();
ptRoleResBean.setRoleid(strRoleno);
ptRoleResBean.setResid(strobj[i]);
messageBean = insert(ptRoleResBean);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return String 返回操作结果
*/
@Action(value = "roleres_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/role/roletree.jsp") })
public String findByKey() {
try {
logger.debug(messageBean.getMethod());
if (!(messageBean.getMethod().equals("add"))) {
}else{
ptRoleResBean.setRoleid(ptRoleResBean.getRoleid());
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
* 删除方法
*
* @return String 返回操作结果
*/
@Action(value = "roleres_delete")
public String delete() {
try {
ptRoleResBean = new PtroleresBean();
messageBean = delete(ptRoleResBean, " where roleid='"+ strRoleno +"'");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public static Logger getLogger() {
return logger;
}
public static void setLogger(Logger logger) {
RoleResAction.logger = logger;
}
public PtroleresBean getPtRoleResBean() {
return ptRoleResBean;
}
public void setPtRoleResBean(PtroleresBean ptRoleResBean) {
this.ptRoleResBean = ptRoleResBean;
}
public String getStrRoleno() {
return strRoleno;
}
public void setStrRoleno(String strRoleno) {
this.strRoleno = strRoleno;
}
}
| zyjk | trunk/src/st/system/action/role/RoleResAction.java | Java | oos | 4,586 |
/*********************************************************************
*<p>处理内容:TABLE Column Action</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.3.2---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.table;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import st.platform.db.RecordSet;
import st.portal.action.BasicAction;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/table")
public class TableColumnAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 插入map的key主键返回设置的tablecolum集合
* @param columkey
* @return
*/
private List<Map<String,Object>> columnList;
private String key;
/**
* 根据key的信息返回表头内容
* @param key
* @return
*/
@Action(value = "table_getColumn")
public String getColumn()
{
try {
/* TableBasic tableBasic = new TableBasic();
Class<?> forName;
forName = Class.forName("st.system.action.table."+key);
tableBasic = (TableBasic)forName.newInstance();
*/
//查询数据 并编制字段内容
String strSQL = "SELECT * FROM ptgridscolumn WHERE gridname ='"+key+"' order by dispno";
List<Map<String, Object>> listDate = new ArrayList<Map<String, Object>>();
Map<String, Object> map;
RecordSet gridRS = executeQuery(strSQL);
while (gridRS != null && gridRS.next()) {
map = new HashMap<String, Object>();
String display = gridRS.getString("columndesc");
String name = gridRS.getString("columnname");
String width = gridRS.getString("columnwidth");
String align = gridRS.getString("columnalign");
String hide = gridRS.getString("columnhide");
map.put("display", display);
map.put("name", name);
map.put("width", width);
map.put("align", align);
if(hide.equals("0"))
{
map.put("hide", "true");
}
listDate.add(map);
}
columnList = listDate;
//根据sql查询返回内容
//对内容进行处理
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return MisConstant.TABLECOLUMN;
}
public List<Map<String, Object>> getColumnList() {
return columnList;
}
public void setColumnList(List<Map<String, Object>> columnList) {
this.columnList = columnList;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
| zyjk | trunk/src/st/system/action/table/TableColumnAction.java | Java | oos | 3,588 |
/*********************************************************************
*<p>处理内容:TABLE Column 父类</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.3.2---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.table;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class TableBasic {
public List<Map<String,Object>> getColumList()
{
return new ArrayList<Map<String,Object>>();
}
}
| zyjk | trunk/src/st/system/action/table/TableBasic.java | Java | oos | 668 |
/*********************************************************************
*<p>处理内容: 系统登陆管理</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.3.18---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.login;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import st.platform.db.sql.AbstractBasicBean;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.system.dao.PtdeptBean;
import st.system.dao.PtoperBean;
import UI.message.MisConstant;
import st.platform.security.SystemAttributeNames;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/login")
public class LoginAction extends BasicAction{
private static Logger logger = Logger.getLogger(LoginAction.class);
private static final long serialVersionUID = 1L;
private PtoperBean ptoperBean = new PtoperBean(); //人员信息
private PtdeptBean ptdeptBean =new PtdeptBean(); //部门信息
private MessageBean messageBean = new MessageBean();// 操作状态
private String strWhere="";
private String opernm="";
private String passwd="";
/**
* 检查登陆
*/
@Action(value = "LoginAction_check")
public String check(){
try {
ServletActionContext.getContext().getSession().put("login", "false");
// 判断用户姓名和密码是否一致
// 判断账户是否已经停用
if ( null==ptoperBean.getOpernm() || null==ptoperBean.getPasswd()||ptoperBean.getOpernm().equals("") ||ptoperBean.getPasswd().equals("") ) {
return LOGIN;
} else {
strWhere = " where opernm='" + ptoperBean.getOpernm() + "' and passwd='" + ptoperBean.getPasswd() + "' and deptid='"+ptoperBean.getDeptid()+"'";
}
//如果用户名和密码正确
ptoperBean=ptoperBean.findFirst(strWhere);
String sSqlWhere=" where deptno='"+ ptoperBean.getDeptid() +"'";
ptdeptBean=ptdeptBean.findFirst(sSqlWhere);
Map<String,Object> map;
if (ptoperBean != null) {
ServletActionContext.getContext().getSession().put(SystemAttributeNames.USER_INFO_NAME, ptoperBean);
ServletActionContext.getContext().getSession().put(SystemAttributeNames.DEPT_INFO_NAME,ptdeptBean);
ServletActionContext.getContext().getSession().put(SystemAttributeNames.OPER_TYPE,"1");
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 注销
* @return
*/
@Action(value = "LoginAction_remove")
public String remove() {
// 注销情况session
try
{
ServletActionContext.getContext().getSession().clear();
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
//return SUCCESS;
}
catch (Exception e) {
e.printStackTrace();
logger.error(MisConstant.MSG_NO_DATA, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 修改密码
* @return 分别对返回类型为sucess和error设置返回的对象格式<br>
* 自定义返回对象checkResult
*/
@Action(value = "LoginAction_editPassWord")
public String editPassWord() {
try {
messageBean = update(ptoperBean, " where sysno='"+ ptoperBean.getSysno() + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public PtoperBean getPtoperBean() {
return ptoperBean;
}
public void setPtoperBean(PtoperBean ptoperBean) {
this.ptoperBean = ptoperBean;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public String getOpernm() {
return opernm;
}
public void setOpernm(String opernm) {
this.opernm = opernm;
}
public String getPasswd() {
return passwd;
}
public void setPasswd(String passwd) {
this.passwd = passwd;
}
public PtdeptBean getPtdeptBean() {
return ptdeptBean;
}
public void setPtdeptBean(PtdeptBean ptdeptBean) {
this.ptdeptBean = ptdeptBean;
}
}
| zyjk | trunk/src/st/system/action/login/LoginAction.java | Java | oos | 6,067 |
/*********************************************************************
*<p>处理内容: 企业登陆管理</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.6.7---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.login;
import java.sql.SQLException;
import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import st.platform.security.SystemAttributeNames;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import UI.dao.enterfile.QyjbqkBean;
import UI.dao.zyjk.JcjgbaxxBean;
import UI.dao.zyjk.PxjgbaxxBean;
import UI.dao.zyjk.T_officerBean;
import UI.dao.zyjk.WsjgbaxxBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/enterlogin")
public class EnterLoginAction extends BasicAction{
private static Logger logger = Logger.getLogger(EnterLoginAction.class);
private static final long serialVersionUID = 1L;
private T_officerBean officerBean = new T_officerBean(); //人员信息
private MessageBean messageBean = new MessageBean();// 操作状态
private String strWhere="";
private String Officer_Name="";
private String C_PWD="";
private String sysno="";
private String rand="";
/**
* 检查登陆
*/
@Action(value = "EnterLoginAction_check")
public String check(){
try {
ServletActionContext.getContext().getSession().put("login", "false");
//验证码
String randv=(String)ServletActionContext.getContext().getSession().get("rand");
if(!rand.equals(randv)){
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_VERI_FAIL);
return MisConstant.RETMESSAGE;
}
// 判断用户姓名和密码是否一致
// 判断账户是否已经停用
if ( null==officerBean.getOfficer_name()|| null==officerBean.getC_pwd()||officerBean.getOfficer_name().equals("") ||officerBean.getC_pwd().equals("") ) {
return MisConstant.RETMESSAGE;
} else {
strWhere = " where officer_name='" + officerBean.getOfficer_name() + "' and c_pwd='" + officerBean.getC_pwd() + "'";
}
//如果用户名和密码正确
officerBean=officerBean.findFirst(strWhere);
String corpkey=officerBean.getLogin_id();
JcjgbaxxBean jcjgBean=new JcjgbaxxBean();
PxjgbaxxBean pxjgBean=new PxjgbaxxBean();
WsjgbaxxBean wsjgBean=new WsjgbaxxBean();
QyjbqkBean qyBean=new QyjbqkBean();
if (officerBean != null) {
ServletActionContext.getContext().getSession().put(SystemAttributeNames.CORP_INFO_NAME, officerBean);
ServletActionContext.getContext().getSession().put(SystemAttributeNames.OPER_TYPE,"2");
QyjbqkBean jbqkBean=new QyjbqkBean();
//判断登陆用户类型
String dept_type=officerBean.getDept_type();
messageBean.setWidgetValue(dept_type);
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
corpkey=officerBean.getLogin_id();
qyBean=qyBean.findFirst(" where corpkey='"+ corpkey +"'");
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 注销
* @return
*/
@Action(value = "LoginAction_remove")
public String remove() {
// 注销情况session
try
{
ServletActionContext.getContext().getSession().clear();
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}
catch (Exception e) {
e.printStackTrace();
logger.error(MisConstant.MSG_NO_DATA, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
*
* @return 判断企业端初始登陆状态
* @throws SQLException
* @throws Exception
*/
@Action(value = "LoginAction_loadDlxx")
public String loadDlxx() throws SQLException, Exception {
try{
officerBean=(T_officerBean) ServletActionContext.getContext().getSession().get(SystemAttributeNames.CORP_INFO_NAME);
QyjbqkBean qyBean=new QyjbqkBean();
if (officerBean != null) {
//String corpkey=officerBean.getLogin_id();
//qyBean=qyBean.findFirst(" where corpkey='"+ corpkey +"'");
//String enterno=qyBean.getEnterno();
//System.out.println("企业主键名"+enterno);
//messageBean.setWidgetValue(enterno);
//判断登陆用户类型
String dept_type=officerBean.getDept_type();
messageBean.setWidgetValue(dept_type);
// 设置正确返回的提示
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} else {
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}catch(Exception e){
e.printStackTrace();
logger.error(MisConstant.MSG_NO_DATA, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
*
* @return
* @throws SQLException
* @throws Exception
*/
@Action(value = "LoginAction_loadQyxx")
public String loadQyxx() throws SQLException, Exception {
try{
officerBean=(T_officerBean) ServletActionContext.getContext().getSession().get(SystemAttributeNames.CORP_INFO_NAME);
//状态
String type=officerBean.getDept_type();
//corpkey
String corpkey=officerBean.getLogin_id();
QyjbqkBean qyBean=new QyjbqkBean();
JcjgbaxxBean jcBean=new JcjgbaxxBean();
PxjgbaxxBean pxBean=new PxjgbaxxBean();
WsjgbaxxBean wsBean=new WsjgbaxxBean();
//企业
qyBean=qyBean.findFirst(" where corpkey='"+ corpkey +"'");
//检测
jcBean=jcBean.findFirst(" where sysno='"+ corpkey +"'");
//培训
pxBean=pxBean.findFirst(" where sysno='"+ corpkey +"'");
//卫生
wsBean=wsBean.findFirst(" where sysno='"+ corpkey +"'");
//判断是否已经保存
String flag="";
if(type.equals("1")&&qyBean != null){
flag="2";
}else if(type.equals("2")&&jcBean != null){
flag="2";
}else if(type.equals("3")&&pxBean != null){
flag="2";
}else if(type.equals("4")&&wsBean != null){
flag="2";
}
if (flag.equals("2")) {
// 设置正确返回的提示
if(type.equals("1")&&qyBean != null){
String enterno=qyBean.getEnterno();
messageBean.setWidgetValue(enterno);
}
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} else {
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}catch(Exception e){
e.printStackTrace();
logger.error(MisConstant.MSG_NO_DATA, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 修改密码
* @return 分别对返回类型为sucess和error设置返回的对象格式<br>
* 自定义返回对象checkResult
*/
@Action(value = "LoginAction_editPassWord")
public String editPassWord() {
try {
//officerBean=officerBean.findFirst(" where officer_id='"+ officerBean.getOfficer_id() + "'");
messageBean = update(officerBean, " where officer_id='"+ sysno + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public String getC_PWD() {
return C_PWD;
}
public void setC_PWD(String c_pwd) {
C_PWD = c_pwd;
}
public String getOfficer_Name() {
return Officer_Name;
}
public void setOfficer_Name(String officer_Name) {
Officer_Name = officer_Name;
}
public T_officerBean getOfficerBean() {
return officerBean;
}
public void setOfficerBean(T_officerBean officerBean) {
this.officerBean = officerBean;
}
public String getSysno() {
return sysno;
}
public void setSysno(String sysno) {
this.sysno = sysno;
}
public String getRand() {
return rand;
}
public void setRand(String rand) {
this.rand = rand;
}
}
| zyjk | trunk/src/st/system/action/login/EnterLoginAction.java | Java | oos | 11,038 |
/*********************************************************************
*<p>处理内容:Enumdetail Action</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.03.20---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.enume;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtenudetailBean;
import st.system.dao.PtenumainBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/enudetail")
public class EnuDetailAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(EnuDetailAction.class);
private String strWhere=""; //查询条件
private String strSysno=""; //主键编号
private MessageBean messageBean ;//操作状态s
private List<Map<String, Object>> list;
private PtenudetailBean ptEnuDetailBean;
private PtenumainBean ptEnuMainBean;
private String enutype="";
private String enuname="";
/**
*添加方法
* @return String 返回操作结果
*/
@Action(value = "enudetail_insert")
public String insert() {
try {
messageBean = insert(ptEnuDetailBean);
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return String 返回操作结果
*/
@Action(value = "enudetail_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/enum/enudetailinfo.jsp") })
public String findByKey() {
try {
logger.debug(messageBean.getMethod());
//ptMenuBean = new PtmenuBean();
ptEnuDetailBean = new PtenudetailBean();
if (!(messageBean.getMethod().equals("add"))) {
ptEnuDetailBean = (PtenudetailBean) findByKey(ptEnuDetailBean," where enutype ='" + ptEnuMainBean.getEnutype() + "' and enuitemvalue='"+ strSysno +"'");
if (ptEnuDetailBean == null) {
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
* 修改
*
* @return String 返回操作结果
*/
@Action(value = "enudetail_update")
public String update() {
logger.debug("修改");
try {
messageBean = update(ptEnuDetailBean, " where enutype ='"+ ptEnuMainBean.getEnutype() + "' and ENUITEMVALUE='"+ ptEnuDetailBean.getEnuitemvalue() +"'");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 删除方法
*
* @return String 返回操作结果
*/
@Action(value = "enudetail_delete")
public String delete() {
try {
ptEnuDetailBean = new PtenudetailBean();
messageBean = delete(ptEnuDetailBean, " where enutype='"+ ptEnuMainBean.getEnutype() +"' and ENUITEMVALUE in (" + strSysno + ")");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public static Logger getLogger() {
return logger;
}
public static void setLogger(Logger logger) {
EnuDetailAction.logger = logger;
}
public String getEnuname() {
return enuname;
}
public void setEnuname(String enuname) {
this.enuname = enuname;
}
public String getEnutype() {
return enutype;
}
public void setEnutype(String enutype) {
this.enutype = enutype;
}
public PtenudetailBean getPtEnuDetailBean() {
return ptEnuDetailBean;
}
public void setPtEnuDetailBean(PtenudetailBean ptEnuDetailBean) {
this.ptEnuDetailBean = ptEnuDetailBean;
}
public PtenumainBean getPtEnuMainBean() {
return ptEnuMainBean;
}
public void setPtEnuMainBean(PtenumainBean ptEnuMainBean) {
this.ptEnuMainBean = ptEnuMainBean;
}
}
| zyjk | trunk/src/st/system/action/enume/EnuDetailAction.java | Java | oos | 5,634 |
/*********************************************************************
*<p>处理内容:Enum Action</p>
*<p>Copyright: Copyright (c) 2013</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.03.19---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.enume;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtenumainBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/enum")
public class EnumAction extends BasicAction {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(EnumAction.class);
private String strWhere=""; //查询条件
private String strSysno=""; //主键编号
private MessageBean messageBean ;//操作状态
private List<Map<String, Object>> list;
private PtenumainBean ptEnuMainBean;
private String enutype="";
private String enuname="";
/**
*添加方法
* @return String 返回操作结果
*/
@Action(value = "enum_insert")
public String insert() {
try {
ptEnuMainBean.setParenutype("system");
messageBean = insert(ptEnuMainBean);
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 查询信息
*
* @return String 返回操作结果
*/
@Action(value = "enum_findByKey", results = {
@Result(name = MisConstant.FINDBYKEY, location = "/UI/system/enum/enuminfo.jsp") })
public String findByKey() {
try {
logger.debug(messageBean.getMethod());
//ptMenuBean = new PtmenuBean();
ptEnuMainBean = new PtenumainBean();
if (!(messageBean.getMethod().equals("add"))) {
ptEnuMainBean = (PtenumainBean) findByKey(ptEnuMainBean," where enutype ='" + enutype + "'");
if (ptEnuMainBean == null) {
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDBYKEY;
}
/**
* 修改
*
* @return String 返回操作结果
*/
@Action(value = "enum_update")
public String update() {
logger.debug("修改");
try {
messageBean = update(ptEnuMainBean, " where enutype ='" + ptEnuMainBean.getEnutype() + "'");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 删除方法
*
* @return String 返回操作结果
*/
@Action(value = "enum_delete")
public String delete() {
try {
ptEnuMainBean = new PtenumainBean();
messageBean = delete(ptEnuMainBean, " where enutype in (" + strSysno
+ ")");
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public static Logger getLogger() {
return logger;
}
public static void setLogger(Logger logger) {
EnumAction.logger = logger;
}
public PtenumainBean getPtEnuMainBean() {
return ptEnuMainBean;
}
public void setPtEnuMainBean(PtenumainBean ptEnuMainBean) {
this.ptEnuMainBean = ptEnuMainBean;
}
public String getEnuname() {
return enuname;
}
public void setEnuname(String enuname) {
this.enuname = enuname;
}
public String getEnutype() {
return enutype;
}
public void setEnutype(String enutype) {
this.enutype = enutype;
}
}
| zyjk | trunk/src/st/system/action/enume/EnumAction.java | Java | oos | 5,160 |
/*********************************************************************
*<p>处理内容:数据库管理 Action</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.3.18---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.system.action.databasc;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import st.platform.db.RecordSet;
import st.platform.utils.Config;
import st.platform.utils.JavaBeanCreator;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtableBean;
import st.system.dao.PtablecolumnBean;
import UI.dao.DemoBean;
import UI.message.MisConstant;
@ParentPackage("struts-filter")
@Namespace("/st/system/action/databasc")
public class DataBasc extends BasicAction {
/**
*
*/
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(DataBasc.class);
private PtableBean ptableBean ;//返回的主表
private PtablecolumnBean ptableColumnBean;//返回的数据字段表
private String strWhere=""; // 查询条件
private String strSQL=""; // 执行sql
private String strSysno=""; // 主键编号
private PageBean pageBean; // 分页类
private MessageBean messageBean;// 操作状态
private List<Map<String,String>> columnList; //表字段
private String strTableName ="";//表名称
private String strColumnName ="";//字段名称
private String strBeanPath =""; //创建的bean路径
/***
* 初始化数据库表名称到数据库
* @return
*/
@Action(value = "DataBasc_initDataBasc")
public String initDataBasc(){
try {
messageBean = new MessageBean();
PtableBean ptableBean =new PtableBean();
PtablecolumnBean ptableColumnBean = new PtablecolumnBean();
//清空现有的信息
String strDataName = Config.getProperty("db2Schema");
String strSql = "";
if(dataType.equalsIgnoreCase("mysql"))
{
strSql= "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE table_schema ='"+strDataName+"' and table_name ='"+strTableName+"'";
}else if(dataType.equalsIgnoreCase("sqlserver"))
{
strSql= "SELECT * FROM INFORMATION_SCHEMA.TABLES ";
}
if(strTableName!=null&&!(strTableName.equals("")))
{
//单表的操作
strSql = strSql + " and table_name ='"+strTableName+"'";
messageBean =delete(ptableColumnBean, " where tablename ='"+strTableName+"'");
ptableBean = (PtableBean) findByKey(ptableBean," where tablename ='"+strTableName+"'");
RecordSet gridColumn = executeQuery("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema ='"+strDataName+"' and table_name ='"+strTableName+"'");
logger.debug("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema ='"+strDataName+"' and table_name ='"+strTableName+"'");
String sqlHear = "Select ";
String sqlCenter = "";
String sqlEnd =" from "+strTableName;
while (gridColumn != null && gridColumn.next()) {
ptableColumnBean.setColumnid("PTABLECOLUMN_"+System.currentTimeMillis());
ptableColumnBean.setTableid(ptableBean.getTableid());
ptableColumnBean.setTablename(strTableName.toLowerCase());
ptableColumnBean.setColumndesc(gridColumn.getString("column_comment"));
ptableColumnBean.setColumnname(gridColumn.getString("COLUMN_NAME").toLowerCase());
ptableColumnBean.setColumnlength(gridColumn.getString("character_maximum_length"));
ptableColumnBean.setColumntype(gridColumn.getString("data_type"));
ptableColumnBean.setIskey(gridColumn.getString("column_key"));
sqlCenter = sqlCenter+ptableColumnBean.getColumnname()+",";
ptableColumnBean.insert();
}
sqlCenter = sqlCenter.substring(0,sqlCenter.length()-1);
String strSQL = sqlHear + sqlCenter + sqlEnd;
ptableBean.setStrsql(strSQL);
ptableBean.setBeanname(strTableName+"Bean");
messageBean = update(ptableBean," where tablename ='"+strTableName+"'");
}
else{
//全库操作
messageBean =delete(ptableBean, "");
messageBean =delete(ptableColumnBean, "");
logger.debug(strSql);
RecordSet gridRS = executeQuery(strSql);
String strTableName;
String strTableID;
while (gridRS != null && gridRS.next()) {
strTableName = gridRS.getString("table_name").toLowerCase();
strTableID = "PTABLE_"+System.currentTimeMillis();
ptableBean.setTableid(strTableID);
ptableBean.setTablename(strTableName);
String sqlSTR ="";
//字段说明
Map<String,String> mapcolum = new HashMap<String, String>();
String pkcolumn = "";
if(dataType.equalsIgnoreCase("mysql"))
{
sqlSTR= "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema ='"+strDataName+"' and table_name ='"+strTableName+"'";
}else if(dataType.equalsIgnoreCase("sqlserver"))
{
sqlSTR ="SELECT colorder=a.colorder, COLUMN_NAME =a.name,column_key=case when exists(SELECT 1 FROM sysobjects " +
"where xtype='PK' and parent_obj=a.id and name in ( SELECT name FROM sysindexes WHERE indid in( " +
"SELECT indid FROM sysindexkeys WHERE id = a.id AND colid=a.colid))) then 'PRI' else '' end,data_type =b.name," +
" character_maximum_length=COLUMNPROPERTY(a.id,a.name,'PRECISION'), column_comment=cast(g.[value] as nvarchar)" +
" FROM syscolumns a left join systypes b on a.xusertype=b.xusertype inner join sysobjects d on a.id=d.id " +
"and d.xtype='U' and d.name<>'dtproperties' left join syscomments e on a.cdefault=e.id " +
"left join sys.extended_properties g on a.id=g.major_id and a.colid=g.minor_id " +
"left join sys.extended_properties f on d.id=f.major_id and f.minor_id=0 where d.name='"+strTableName+"'";
}
RecordSet gridColumn = executeQuery(sqlSTR);
logger.debug(sqlSTR);
String sqlHear = "Select ";
String sqlCenter = "";
String sqlEnd =" from "+strTableName;
while (gridColumn != null && gridColumn.next()) {
ptableColumnBean.setColumnid("PTABLECOLUMN_"+System.currentTimeMillis());
ptableColumnBean.setTableid(strTableID);
ptableColumnBean.setTablename(strTableName);
ptableColumnBean.setColumnname(gridColumn.getString("COLUMN_NAME").toLowerCase());
ptableColumnBean.setColumndesc(gridColumn.getString("column_comment"));
ptableColumnBean.setColumnlength(gridColumn.getString("character_maximum_length"));
ptableColumnBean.setColumntype(gridColumn.getString("data_type"));
ptableColumnBean.setIskey(gridColumn.getString("column_key"));
sqlCenter = sqlCenter+ptableColumnBean.getColumnname()+",";
ptableColumnBean.insert();
}
sqlCenter = sqlCenter.substring(0,sqlCenter.length()-1);
String strSQL = sqlHear + sqlCenter + sqlEnd;
ptableBean.setBeanname(strTableName+"Bean");
ptableBean.setStrsql(strSQL);
ptableBean.insert();
}
}
} catch (Exception e) {
messageBean.setCheckFlag(0);
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 根据表名称 生成Bean
* @return
*/
@Action(value = "DataBasc_creatBean")
public String creatBean(){
messageBean = new MessageBean();
ptableBean = new PtableBean();
try {
ptableBean = (PtableBean) findByKey(ptableBean," where tablename ='"+strTableName+"'");
//System.out.println("strBeanPath"+strBeanPath);
//System.out.println("strTableName"+strTableName);
logger.debug(strTableName);
String clasBean = JavaBeanCreator.createBean(strBeanPath,strTableName);
ptableBean.setBeanname(clasBean);
ptableBean.setBeanpath(strBeanPath);
update(ptableBean, " where tablename ='"+strTableName+"'");
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
messageBean.setCheckFlag(0);
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
e.printStackTrace();
}
return MisConstant.RETMESSAGE;
}
/**
* 执行sql语句
* 查询返回表格字段
* 执行返回执行情况
* @return
*/
@Action(value = "DataBasc_runSQL" , results = {
@Result(type = "json", name = "SELECT", params = { "root", "columnList.*" }),
@Result(type = "json", name = "UPDATE", params = { "root", "messageBean.*" }) })
public String runSQL()
{
String strRet ="";
try {
if(strWhere!=null&&!(strWhere.equals("")))
{
String strSqlArr[] =strSQL.trim().split(" ");
String sqlIndex = strSqlArr[0].toLowerCase();
if(sqlIndex.equals("select")||sqlIndex.equals("show")) {
strRet = "SELECT";
columnList = new ArrayList<Map<String, String>>();
Map<String, String> map;
RecordSet gridRS = executeQuery("Select * from ("+strSQL+")as s where (1>1)");
while (gridRS != null && gridRS.next()) {
map = new HashMap<String, String>();
for (int i = 0; i < gridRS.getColumnCount(); i++) {
String mark = gridRS.getFieldName(i);
map.put("display", mark);
map.put("name", mark);
map.put("width", "100");
map.put("align", "left");
}
columnList.add(map);
}
}else{
//执行操作
strRet = "UPDATE";
messageBean = executeUpdate(strSQL);
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return strRet;
}
/**
* 查询
*
* @return
*/
@Action(value = "DataBasc_findList")
public String findList() {
try {
messageBean = new MessageBean();
String strFSql ="Select * from ptablecolumn";
// 查询条件
pageBean = findList("",strFSql, strWhere, "", pageBean);
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.FINDLIST;
}
/**
* 查询信息
*
* @return
*/
@Action(value = "DataBasc_findByKey", results = {
@Result(type = "json", name = MisConstant.RETMESSAGE, params = { "includeProperties", "messageBean.*, ptableBean.*" }) })
public String findByKey() {
try {
ptableBean = new PtableBean();
messageBean = new MessageBean();
ptableBean = (PtableBean) findByKey(ptableBean, " where tableid ='"+strSysno+"'");
logger.debug(ptableBean.getStrsql());
if (ptableBean != null) {
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 根据表名称和字段名称查询
*
* @return
*/
@Action(value = "DataBasc_findColumn", results = {
@Result(type = "json", name = MisConstant.RETMESSAGE, params = { "includeProperties", "messageBean.*, ptableColumnBean.*" }) })
public String findColumn() {
try {
ptableColumnBean = new PtablecolumnBean();
messageBean = new MessageBean();
ptableColumnBean = (PtablecolumnBean) findByKey(ptableColumnBean, " where tablename ='"+strTableName+"' and columnname ='"+strColumnName+"'");
if (ptableColumnBean != null) {
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
}else{
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public List<Map<String, String>> getColumnList() {
return columnList;
}
public void setColumnList(List<Map<String, String>> columnList) {
this.columnList = columnList;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public PageBean getPageBean() {
return pageBean;
}
public void setPageBean(PageBean pageBean) {
this.pageBean = pageBean;
}
public PtableBean getPtableBean() {
return ptableBean;
}
public void setPtableBean(PtableBean ptableBean) {
this.ptableBean = ptableBean;
}
public PtablecolumnBean getPtableColumnBean() {
return ptableColumnBean;
}
public void setPtableColumnBean(PtablecolumnBean ptableColumnBean) {
this.ptableColumnBean = ptableColumnBean;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
public String getStrSQL() {
return strSQL;
}
public void setStrSQL(String strSQL) {
this.strSQL = strSQL;
}
public String getStrBeanPath() {
return strBeanPath;
}
public void setStrBeanPath(String strBeanPath) {
this.strBeanPath = strBeanPath;
}
public String getStrTableName() {
return strTableName;
}
public void setStrTableName(String strTableName) {
this.strTableName = strTableName;
}
public String getStrColumnName() {
return strColumnName;
}
public void setStrColumnName(String strColumnName) {
this.strColumnName = strColumnName;
}
}
| zyjk | trunk/src/st/system/action/databasc/DataBasc.java | Java | oos | 18,869 |
package st.system.action.databasc;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import st.platform.db.ConnectionManager;
import st.platform.db.DatabaseConnection;
import st.platform.db.RecordSet;
import st.system.dao.PtableBean;
import st.system.dao.PtablecolumnBean;
/**
* 移植到sqlserver
* @author Administrator
*
*/
public class SQLSERVER {
ConnectionManager cm = ConnectionManager.getInstance();
DatabaseConnection DBCon = cm.getConnection();
String DataName = "zpf";
//取得连接
public SQLSERVER(){
try {
// DBCon = new DatabaseConnection("net.sourceforge.jtds.jdbc.Driver", "jdbc:jtds:sqlserver://localhost:1433/zpf", "sa", "yjzh");
DBCon = new DatabaseConnection("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://localhost:1433;DatabaseName=zpf", "sa", "sa123");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//创建表结构
//描述sql server 只支持sp_addextendedproperty方式添加描述信息,所以CREATE TABLE语句不能直接添加
public void createTable(PtableBean ptable,List<PtablecolumnBean> list,String primary ){
try {
RecordSet gridRS = DBCon.executeQuery("SELECT name FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].["+ptable.getTablename()+"]') AND type in (N'U')");
System.out.println(gridRS.getRecordCount());
while (gridRS != null && gridRS.next()) {
System.out.println(gridRS.getString("name"));
if(gridRS.getString("name")!=null&&!(gridRS.getString("name").equals("")))
{
int sta = DBCon.executeUpdate(" DROP TABLE dbo."+ptable.getTablename());
}
}
DBCon.commit();
String sql =" CREATE TABLE [dbo].["+ptable.getTablename()+"](";
for(int i=0;i<list.size();i++)
{
PtablecolumnBean ptcolumn = list.get(i);
sql = sql+"["+ptcolumn.getColumnname()+"] ";
if(ptcolumn.getColumntype().equals("varchar")){
sql =sql+"[nvarchar] ";
}else{
sql =sql+"["+ptcolumn.getColumntype()+"] ";
}
if(ptcolumn.getColumnlength().equals("0")){
}else{
sql =sql+" ("+ptcolumn.getColumnlength()+")";
}
sql =sql+" "+ptcolumn.getIsnulls()+",";
}
if(primary==null)
{
sql = sql.substring(0, sql.length()-1)+"";
sql =sql +")";
}else{
sql =sql +" CONSTRAINT [PK_"+ptable.getTablename()+"] PRIMARY KEY CLUSTERED" +
" ( ["+primary+"] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, " +
"IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON" +
" [PRIMARY]) ON [PRIMARY]";
}
System.out.println(sql);
DBCon.executeUpdate(sql);
DBCon.executeUpdate("SET ANSI_PADDING OFF");
for(int i=0;i<list.size();i++)
{
PtablecolumnBean ptcolumn = list.get(i);
String column = "EXEC sys.sp_addextendedproperty @name=N'MS_Description', " +
"@value=N'"+ptcolumn.getColumndesc()+"' , @level0type=N'SCHEMA',@level0name=N'dbo', " +
"@level1type=N'TABLE',@level1name=N'"+ptcolumn.getTablename()+"'," +
" @level2type=N'COLUMN',@level2name=N'"+ptcolumn.getColumnname()+"'";
DBCon.executeUpdate(column);
}
} catch (Exception e) {
// TODO Auto-generated catch block
//DBCon.close();
e.printStackTrace();
}
}
//数据移植
public void insertData(PtableBean ptable, RecordSet gridRS,Map<String,String> map){
String insertSQL = "INSERT INTO ["+ptable.getTablename()+"]";
while (gridRS != null && gridRS.next()) {
String column = "(";
String values = "VALUES(";
for (int i = 0; i < gridRS.getColumnCount(); i++) {
String mark = gridRS.getFieldName(i);
String value = gridRS.getString(gridRS.getFieldName(i)).trim().replace("\r\n", "");
column = column+"["+mark+"]"+",";
if(map.get(mark)==null)
{
values = values +"'"+value+"',";
}
else if(map.get(mark)!=null){
if(value.equals(""))
{
values = values +"'"+0+"',";
}else{
values = values +"'"+value+"',";
}
}
}
values = values.substring(0, values.length()-1)+"";
column = column.substring(0, column.length()-1)+"";
String sql = insertSQL +column+") "+values+")";
//System.out.println(sql);
try {
DBCon.executeUpdate(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println(sql);
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println(sql);
e.printStackTrace();
}
}
}
}
| zyjk | trunk/src/st/system/action/databasc/SQLSERVER.java | Java | oos | 5,766 |
package st.system.action.databasc;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import st.platform.db.RecordSet;
import st.portal.action.BasicAction;
import st.portal.action.MessageBean;
import st.portal.action.PageBean;
import st.system.dao.PtableBean;
import st.system.dao.PtablecolumnBean;
import UI.message.MisConstant;
/**
* 数据库的移植功能
* 可实现将两个不同数据库直接的移植
*
* 1 mysql 移植到sqlserver
* 2 sqlserver 到mysql
*
* 1 单表移植
* 2 数据库移植
* 3 根据sql语句的移植
* @author Administrator
*
*/
@ParentPackage("struts-filter")
@Namespace("/st/system/action/databasc")
public class DataTransp extends BasicAction{
/**
*
*/
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(DataTransp.class);
private PtableBean ptableBean ;//返回的主表
private PtablecolumnBean ptableColumnBean;//返回的数据字段表
private String strWhere=""; // 查询条件
private String strSQL=""; // 执行sql
private String strSysno=""; // 主键编号
private PageBean pageBean; // 分页类
private MessageBean messageBean;// 操作状态
/**
* 根据表名称 单表移植
* @return
*//*
public String transTable(){
}*/
/**
* 向sqlserver数据库整体移植
* @return
*/
@Action(value = "DataTransp_initDataBasc")
public String toSqlServer(){
try {
PtableBean ptable = new PtableBean();
List<PtableBean> list = ptable.findByWhere("");
SQLSERVER sqlserver = new SQLSERVER();
messageBean = new MessageBean();
for(int i=0;i<list.size();i++)
{
PtablecolumnBean ptcolumn = new PtablecolumnBean();
//字段查询
ptable = list.get(i);
List<PtablecolumnBean> columlist = ptcolumn.findByWhere(" where tablename ='"+ptable.getTablename()+"' ");
//查询出系统的主键
ptcolumn = (PtablecolumnBean) ptcolumn.findFirstByWhere(" where tablename ='"+ptable.getTablename()+"' and iskey='PRI' ");
//数据查询
RecordSet gridRS = executeQuery("select * from "+ptable.getTablename()+"");
String pik ="";
if(ptcolumn==null)
{
pik = null;
}else{
pik = ptcolumn.getColumnname();
}
sqlserver.createTable(ptable, columlist,pik );
ptcolumn = new PtablecolumnBean();
List<PtablecolumnBean> columlistz = ptcolumn.findByWhere(" where tablename ='"+ptable.getTablename()+"' and columntype = 'decimal' ");
Map<String,String> map = new HashMap<String, String>();
for(int j=0;j<columlistz.size();j++)
{
PtablecolumnBean ptbcolumns = columlistz.get(j);
map.put(ptbcolumns.getColumnname(), ptbcolumns.getColumntype());
}
sqlserver.insertData(ptable, gridRS,map);
}
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
/**
* 向mysql数据库整体移植
* @return
*/
@Action(value = "DataTransp_initMysqlDataBasc")
public String toMysql(){
try {
PtableBean ptable = new PtableBean();
List<PtableBean> list = ptable.findByWhere("");
MYSQL mysql = new MYSQL();
messageBean = new MessageBean();
for(int i=0;i<list.size();i++)
{
PtablecolumnBean ptcolumn = new PtablecolumnBean();
//字段查询
ptable = list.get(i);
List<PtablecolumnBean> columlist = ptcolumn.findByWhere(" where tablename ='"+ptable.getTablename()+"' ");
//查询出系统的主键
ptcolumn = (PtablecolumnBean) ptcolumn.findFirstByWhere(" where tablename ='"+ptable.getTablename()+"' and iskey='PRI' ");
//数据查询
RecordSet gridRS = executeQuery("select * from "+ptable.getTablename()+"");
String pik ="";
if(ptcolumn==null)
{
pik = null;
}else{
pik = ptcolumn.getColumnname();
}
mysql.createTable(ptable, columlist,pik);
ptcolumn = new PtablecolumnBean();
List<PtablecolumnBean> columlistz = ptcolumn.findByWhere(" where tablename ='"+ptable.getTablename()+"' and columntype IN ('decimal','date') ");
Map<String,String> map = new HashMap<String, String>();
for(int j=0;j<columlistz.size();j++)
{
PtablecolumnBean ptbcolumns = columlistz.get(j);
map.put(ptbcolumns.getColumnname(), ptbcolumns.getColumntype());
}
mysql.insertData(ptable, gridRS,map);
}
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} catch (Exception e) {
// TODO Auto-generated catch block
// 设置错误返回的提示
logger.error(MisConstant.MSG_OPERATE_FAIL, e);
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
return MisConstant.RETMESSAGE;
}
public MessageBean getMessageBean() {
return messageBean;
}
public void setMessageBean(MessageBean messageBean) {
this.messageBean = messageBean;
}
public PageBean getPageBean() {
return pageBean;
}
public void setPageBean(PageBean pageBean) {
this.pageBean = pageBean;
}
public PtableBean getPtableBean() {
return ptableBean;
}
public void setPtableBean(PtableBean ptableBean) {
this.ptableBean = ptableBean;
}
public PtablecolumnBean getPtableColumnBean() {
return ptableColumnBean;
}
public void setPtableColumnBean(PtablecolumnBean ptableColumnBean) {
this.ptableColumnBean = ptableColumnBean;
}
public String getStrSQL() {
return strSQL;
}
public void setStrSQL(String strSQL) {
this.strSQL = strSQL;
}
public String getStrSysno() {
return strSysno;
}
public void setStrSysno(String strSysno) {
this.strSysno = strSysno;
}
public String getStrWhere() {
return strWhere;
}
public void setStrWhere(String strWhere) {
this.strWhere = strWhere;
}
/**
* 根据sql语句移植
* @return
*/
/*public String transSQL(){
}*/
}
| zyjk | trunk/src/st/system/action/databasc/DataTransp.java | Java | oos | 8,103 |
/*********************************************************************
*<p>处理内容:移植到mysql Action</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 孙雁斌 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.5.14---- 孙雁斌 --------- 新规作成<br>
***********************************************************************/
package st.system.action.databasc;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import st.platform.db.ConnectionManager;
import st.platform.db.DatabaseConnection;
import st.platform.db.RecordSet;
import st.system.dao.PtableBean;
import st.system.dao.PtablecolumnBean;
public class MYSQL {
ConnectionManager cm = ConnectionManager.getInstance();
DatabaseConnection DBCon = cm.getConnection();
String DataName = "zpf";
//取得连接
public MYSQL(){
try {
DBCon = new DatabaseConnection("com.mysql.jdbc.Driver", "jdbc:mysql://localhost:3306/z_sb?autoReconnect=true", "root", "root");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//创建表结构
public void createTable(PtableBean ptable,List<PtablecolumnBean> list,String primary ){
try {
RecordSet gridRS = DBCon.executeQuery("SELECT * FROM information_schema.TABLES WHERE table_schema='"+ ptable.getTablename() +"'");
System.out.println(gridRS.getRecordCount());
while (gridRS != null && gridRS.next()) {
System.out.println(gridRS.getString("name"));
if(gridRS.getString("name")!=null&&!(gridRS.getString("name").equals("")))
{
int sta = DBCon.executeUpdate(" DROP TABLE "+ptable.getTablename());
}
}
DBCon.commit();
String sql =" CREATE TABLE "+ptable.getTablename()+"(";
for(int i=0;i<list.size();i++)
{
PtablecolumnBean ptcolumn = list.get(i);
sql = sql+ptcolumn.getColumnname()+" ";
if(ptcolumn.getColumntype().equals("varchar")){
sql =sql+"nvarchar ";
}else{
sql =sql+""+ptcolumn.getColumntype()+" ";
}
if(ptcolumn.getColumnlength().equals("0")){
}else{
sql =sql+" ("+ptcolumn.getColumnlength()+")";
}
sql =sql+" "+ptcolumn.getIsnulls()+" COMMENT '"+ ptcolumn.getColumndesc() +"',";
}
sql = sql.substring(0, sql.length()-1)+"";
sql =sql +")";
DBCon.executeUpdate(sql);
if(primary!=null)
{
DBCon.executeUpdate("ALTER TABLE "+ ptable.getTablename() +" ADD PRIMARY KEY ("+ primary +")");
}
} catch (Exception e) {
// TODO Auto-generated catch block
//DBCon.close();
e.printStackTrace();
}
}
//数据移植
public void insertData(PtableBean ptable, RecordSet gridRS,Map<String,String> map){
String insertSQL = "INSERT INTO "+ptable.getTablename();
while (gridRS != null && gridRS.next()) {
String column = "(";
String values = "VALUES(";
for (int i = 0; i < gridRS.getColumnCount(); i++) {
String mark = gridRS.getFieldName(i);
String value = gridRS.getString(gridRS.getFieldName(i)).trim().replace("\r\n", "");
column = column+mark+",";
if(map.get(mark)==null)
{
values = values +"'"+value+"',";
}
else if(map.get(mark)!=null&&map.get(mark).equals("decimal")){
if(value.equals(""))
{
values = values +"'"+0+"',";
}else{
values = values +"'"+value+"',";
}
}else if(map.get(mark)!=null&&map.get(mark).equals("date")){
if(value.equals(""))
{
values = values +"'1900-01-01',";
}else{
values = values +"'"+value+"',";
}
}
}
values = values.substring(0, values.length()-1)+"";
column = column.substring(0, column.length()-1)+"";
String sql = insertSQL +column+") "+values+")";
try {
DBCon.executeUpdate(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| zyjk | trunk/src/st/system/action/databasc/MYSQL.java | Java | oos | 5,309 |
package st.portal.system.dao;
import java.util.*;
import st.platform.db.*;
import st.platform.db.sql.*;
import st.platform.control.business.ActionRequest;
public class PtOperBean extends AbstractBasicBean implements Cloneable {
public static List find(String sSqlWhere) throws Exception {
return new PtOperBean().findByWhere(sSqlWhere);
}
public static List findAndLock(String sSqlWhere) throws Exception {
return new PtOperBean().findAndLockByWhere(sSqlWhere);
}
public static PtOperBean findFirst(String sSqlWhere) throws Exception {
return (PtOperBean) new PtOperBean().findFirstByWhere(sSqlWhere);
}
public static PtOperBean findFirstAndLock(String sSqlWhere)
throws Exception {
return (PtOperBean) new PtOperBean().findFirstAndLockByWhere(sSqlWhere);
}
public static RecordSet findRecordSet(String sSqlWhere) throws Exception {
return new PtOperBean().findRecordSetByWhere(sSqlWhere);
}
public static List find(String sSqlWhere, boolean isAutoRelease)
throws Exception {
PtOperBean bean = new PtOperBean();
bean.setAutoRelease(isAutoRelease);
return bean.findByWhere(sSqlWhere);
}
public static List findAndLock(String sSqlWhere, boolean isAutoRelease)
throws Exception {
PtOperBean bean = new PtOperBean();
bean.setAutoRelease(isAutoRelease);
return bean.findAndLockByWhere(sSqlWhere);
}
public static PtOperBean findFirst(String sSqlWhere, boolean isAutoRelease)
throws Exception {
PtOperBean bean = new PtOperBean();
bean.setAutoRelease(isAutoRelease);
return (PtOperBean) bean.findFirstByWhere(sSqlWhere);
}
public static PtOperBean findFirstAndLock(String sSqlWhere,
boolean isAutoRelease) throws Exception {
PtOperBean bean = new PtOperBean();
bean.setAutoRelease(isAutoRelease);
return (PtOperBean) bean.findFirstAndLockByWhere(sSqlWhere);
}
public static RecordSet findRecordSet(String sSqlWhere,
boolean isAutoRelease) throws Exception {
PtOperBean bean = new PtOperBean();
bean.setAutoRelease(isAutoRelease);
return bean.findRecordSetByWhere(sSqlWhere);
}
String deptid;
String operid;
String operpasswd;
String issuper;
String opertype;
String opername;
String sex;
String email;
String mobilephone;
String operphone;
String otherphone;
String operenabled;
String fillstr50;
String fillstr80;
String fillstr100;
String fillstr150;
String fillstr600;
String filldate1;
String filldate2;
String filldate3;
String fillint6;
String fillint8;
String fillint10;
String fillint12;
String filldbl1;
String filldbl2;
String filldbl3;
String userguid;
String operbh;
String nation;
String birthday;
String indt;
String duty;
String edudegree;
String resume;
String memo;
public static final String TABLENAME = "ptoper";
private String operate_mode = "add";
public ChangeFileds cf = new ChangeFileds();
public String getTableName() {
return TABLENAME;
}
public void addObject(List list, RecordSet rs) {
PtOperBean abb = new PtOperBean();
abb.deptid = rs.getString("deptid");
abb.setKeyValue("DEPTID", "" + abb.getDeptid());
abb.operid = rs.getString("operid");
abb.setKeyValue("OPERID", "" + abb.getOperid());
abb.operpasswd = rs.getString("operpasswd");
abb.setKeyValue("OPERPASSWD", "" + abb.getOperpasswd());
abb.issuper = rs.getString("issuper");
abb.setKeyValue("ISSUPER", "" + abb.getIssuper());
abb.opertype = rs.getString("opertype");
abb.setKeyValue("OPERTYPE", "" + abb.getOpertype());
abb.opername = rs.getString("opername");
abb.setKeyValue("OPERNAME", "" + abb.getOpername());
abb.sex = rs.getString("sex");
abb.setKeyValue("SEX", "" + abb.getSex());
abb.email = rs.getString("email");
abb.setKeyValue("EMAIL", "" + abb.getEmail());
abb.mobilephone = rs.getString("mobilephone");
abb.setKeyValue("MOBILEPHONE", "" + abb.getMobilephone());
abb.operphone = rs.getString("operphone");
abb.setKeyValue("OPERPHONE", "" + abb.getOperphone());
abb.otherphone = rs.getString("otherphone");
abb.setKeyValue("OTHERPHONE", "" + abb.getOtherphone());
abb.operenabled = rs.getString("operenabled");
abb.setKeyValue("OPERENABLED", "" + abb.getOperenabled());
abb.fillstr50 = rs.getString("fillstr50");
abb.setKeyValue("FILLSTR50", "" + abb.getFillstr50());
abb.fillstr80 = rs.getString("fillstr80");
abb.setKeyValue("FILLSTR80", "" + abb.getFillstr80());
abb.fillstr100 = rs.getString("fillstr100");
abb.setKeyValue("FILLSTR100", "" + abb.getFillstr100());
abb.fillstr150 = rs.getString("fillstr150");
abb.setKeyValue("FILLSTR150", "" + abb.getFillstr150());
abb.fillstr600 = rs.getString("fillstr600");
abb.setKeyValue("FILLSTR600", "" + abb.getFillstr600());
abb.filldate1 = rs.getString("filldate1");
abb.setKeyValue("FILLDATE1", "" + abb.getFilldate1());
abb.filldate2 = rs.getString("filldate2");
abb.setKeyValue("FILLDATE2", "" + abb.getFilldate2());
abb.filldate3 = rs.getString("filldate3");
abb.setKeyValue("FILLDATE3", "" + abb.getFilldate3());
abb.fillint6 = rs.getString("fillint6");
abb.setKeyValue("FILLINT6", "" + abb.getFillint6());
abb.fillint8 = rs.getString("fillint8");
abb.setKeyValue("FILLINT8", "" + abb.getFillint8());
abb.fillint10 = rs.getString("fillint10");
abb.setKeyValue("FILLINT10", "" + abb.getFillint10());
abb.fillint12 = rs.getString("fillint12");
abb.setKeyValue("FILLINT12", "" + abb.getFillint12());
abb.filldbl1 = rs.getString("filldbl1");
abb.setKeyValue("FILLDBL1", "" + abb.getFilldbl1());
abb.filldbl2 = rs.getString("filldbl2");
abb.setKeyValue("FILLDBL2", "" + abb.getFilldbl2());
abb.filldbl3 = rs.getString("filldbl3");
abb.setKeyValue("FILLDBL3", "" + abb.getFilldbl3());
abb.userguid = rs.getString("userguid");
abb.setKeyValue("USERGUID", "" + abb.getUserguid());
abb.operbh = rs.getString("operbh");
abb.setKeyValue("OPERBH", "" + abb.getOperbh());
abb.nation = rs.getString("nation");
abb.setKeyValue("NATION", "" + abb.getNation());
abb.birthday = rs.getString("birthday");
abb.setKeyValue("BIRTHDAY", "" + abb.getBirthday());
abb.indt = rs.getString("indt");
abb.setKeyValue("INDT", "" + abb.getIndt());
abb.duty = rs.getString("duty");
abb.setKeyValue("DUTY", "" + abb.getDuty());
abb.edudegree = rs.getString("edudegree");
abb.setKeyValue("EDUDEGREE", "" + abb.getEdudegree());
abb.resume = rs.getString("resume");
abb.setKeyValue("RESUME", "" + abb.getResume());
abb.memo = rs.getString("memo");
abb.setKeyValue("MEMO", "" + abb.getMemo());
list.add(abb);
abb.operate_mode = "edit";
}
public String getDeptid() {
if (this.deptid == null) {
return "";
} else {
return this.deptid;
}
}
public String getOperid() {
if (this.operid == null) {
return "";
} else {
return this.operid;
}
}
public String getOperpasswd() {
if (this.operpasswd == null) {
return "";
} else {
return this.operpasswd;
}
}
public String getIssuper() {
if (this.issuper == null) {
return "";
} else {
return this.issuper;
}
}
public String getOpertype() {
if (this.opertype == null) {
return "";
} else {
return this.opertype;
}
}
public String getOpername() {
if (this.opername == null) {
return "";
} else {
return this.opername;
}
}
public String getSex() {
if (this.sex == null) {
return "";
} else {
return this.sex;
}
}
public String getEmail() {
if (this.email == null) {
return "";
} else {
return this.email;
}
}
public String getMobilephone() {
if (this.mobilephone == null) {
return "";
} else {
return this.mobilephone;
}
}
public String getOperphone() {
if (this.operphone == null) {
return "";
} else {
return this.operphone;
}
}
public String getOtherphone() {
if (this.otherphone == null) {
return "";
} else {
return this.otherphone;
}
}
public String getOperenabled() {
if (this.operenabled == null) {
return "";
} else {
return this.operenabled;
}
}
public String getFillstr50() {
if (this.fillstr50 == null) {
return "";
} else {
return this.fillstr50;
}
}
public String getFillstr80() {
if (this.fillstr80 == null) {
return "";
} else {
return this.fillstr80;
}
}
public String getFillstr100() {
if (this.fillstr100 == null) {
return "";
} else {
return this.fillstr100;
}
}
public String getFillstr150() {
if (this.fillstr150 == null) {
return "";
} else {
return this.fillstr150;
}
}
public String getFillstr600() {
if (this.fillstr600 == null) {
return "";
} else {
return this.fillstr600;
}
}
public String getFilldate1() {
if (this.filldate1 == null) {
return "";
} else {
return this.filldate1;
}
}
public String getFilldate2() {
if (this.filldate2 == null) {
return "";
} else {
return this.filldate2;
}
}
public String getFilldate3() {
if (this.filldate3 == null) {
return "";
} else {
return this.filldate3;
}
}
public String getFillint6() {
if (this.fillint6 == null) {
return "";
} else {
return this.fillint6;
}
}
public String getFillint8() {
if (this.fillint8 == null) {
return "";
} else {
return this.fillint8;
}
}
public String getFillint10() {
if (this.fillint10 == null) {
return "";
} else {
return this.fillint10;
}
}
public String getFillint12() {
if (this.fillint12 == null) {
return "";
} else {
return this.fillint12;
}
}
public String getFilldbl1() {
if (this.filldbl1 == null) {
return "";
} else {
return this.filldbl1;
}
}
public String getFilldbl2() {
if (this.filldbl2 == null) {
return "";
} else {
return this.filldbl2;
}
}
public String getFilldbl3() {
if (this.filldbl3 == null) {
return "";
} else {
return this.filldbl3;
}
}
public String getUserguid() {
if (this.userguid == null) {
return "";
} else {
return this.userguid;
}
}
public String getOperbh() {
if (this.operbh == null) {
return "";
} else {
return this.operbh;
}
}
public String getNation() {
if (this.nation == null) {
return "";
} else {
return this.nation;
}
}
public String getBirthday() {
if (this.birthday == null) {
return "";
} else {
return this.birthday;
}
}
public String getIndt() {
if (this.indt == null) {
return "";
} else {
return this.indt;
}
}
public String getDuty() {
if (this.duty == null) {
return "";
} else {
return this.duty;
}
}
public String getEdudegree() {
if (this.edudegree == null) {
return "";
} else {
return this.edudegree;
}
}
public String getResume() {
if (this.resume == null) {
return "";
} else {
return this.resume;
}
}
public String getMemo() {
if (this.memo == null) {
return "";
} else {
return this.memo;
}
}
public void setDeptid(String deptid) {
sqlMaker.setField("deptid", deptid, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptid().equals(deptid))
cf.add("deptid", this.deptid, deptid);
}
this.deptid = deptid;
}
public void setOperid(String operid) {
sqlMaker.setField("operid", operid, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getOperid().equals(operid))
cf.add("operid", this.operid, operid);
}
this.operid = operid;
}
public void setOperpasswd(String operpasswd) {
sqlMaker.setField("operpasswd", operpasswd, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getOperpasswd().equals(operpasswd))
cf.add("operpasswd", this.operpasswd, operpasswd);
}
this.operpasswd = operpasswd;
}
public void setIssuper(String issuper) {
sqlMaker.setField("issuper", issuper, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getIssuper().equals(issuper))
cf.add("issuper", this.issuper, issuper);
}
this.issuper = issuper;
}
public void setOpertype(String opertype) {
sqlMaker.setField("opertype", opertype, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getOpertype().equals(opertype))
cf.add("opertype", this.opertype, opertype);
}
this.opertype = opertype;
}
public void setOpername(String opername) {
sqlMaker.setField("opername", opername, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getOpername().equals(opername))
cf.add("opername", this.opername, opername);
}
this.opername = opername;
}
public void setSex(String sex) {
sqlMaker.setField("sex", sex, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getSex().equals(sex))
cf.add("sex", this.sex, sex);
}
this.sex = sex;
}
public void setEmail(String email) {
sqlMaker.setField("email", email, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getEmail().equals(email))
cf.add("email", this.email, email);
}
this.email = email;
}
public void setMobilephone(String mobilephone) {
sqlMaker.setField("mobilephone", mobilephone, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getMobilephone().equals(mobilephone))
cf.add("mobilephone", this.mobilephone, mobilephone);
}
this.mobilephone = mobilephone;
}
public void setOperphone(String operphone) {
sqlMaker.setField("operphone", operphone, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getOperphone().equals(operphone))
cf.add("operphone", this.operphone, operphone);
}
this.operphone = operphone;
}
public void setOtherphone(String otherphone) {
sqlMaker.setField("otherphone", otherphone, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getOtherphone().equals(otherphone))
cf.add("otherphone", this.otherphone, otherphone);
}
this.otherphone = otherphone;
}
public void setOperenabled(String operenabled) {
sqlMaker.setField("operenabled", operenabled, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getOperenabled().equals(operenabled))
cf.add("operenabled", this.operenabled, operenabled);
}
this.operenabled = operenabled;
}
public void setFillstr50(String fillstr50) {
sqlMaker.setField("fillstr50", fillstr50, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFillstr50().equals(fillstr50))
cf.add("fillstr50", this.fillstr50, fillstr50);
}
this.fillstr50 = fillstr50;
}
public void setFillstr80(String fillstr80) {
sqlMaker.setField("fillstr80", fillstr80, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFillstr80().equals(fillstr80))
cf.add("fillstr80", this.fillstr80, fillstr80);
}
this.fillstr80 = fillstr80;
}
public void setFillstr100(String fillstr100) {
sqlMaker.setField("fillstr100", fillstr100, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFillstr100().equals(fillstr100))
cf.add("fillstr100", this.fillstr100, fillstr100);
}
this.fillstr100 = fillstr100;
}
public void setFillstr150(String fillstr150) {
sqlMaker.setField("fillstr150", fillstr150, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFillstr150().equals(fillstr150))
cf.add("fillstr150", this.fillstr150, fillstr150);
}
this.fillstr150 = fillstr150;
}
public void setFillstr600(String fillstr600) {
sqlMaker.setField("fillstr600", fillstr600, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFillstr600().equals(fillstr600))
cf.add("fillstr600", this.fillstr600, fillstr600);
}
this.fillstr600 = fillstr600;
}
public void setFilldate1(String filldate1) {
sqlMaker.setField("filldate1", filldate1, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldate1().equals(filldate1))
cf.add("filldate1", this.filldate1, filldate1);
}
this.filldate1 = filldate1;
}
public void setFilldate2(String filldate2) {
sqlMaker.setField("filldate2", filldate2, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldate2().equals(filldate2))
cf.add("filldate2", this.filldate2, filldate2);
}
this.filldate2 = filldate2;
}
public void setFilldate3(String filldate3) {
sqlMaker.setField("filldate3", filldate3, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldate3().equals(filldate3))
cf.add("filldate3", this.filldate3, filldate3);
}
this.filldate3 = filldate3;
}
public void setFillint6(String fillint6) {
sqlMaker.setField("fillint6", fillint6, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFillint6().equals(fillint6))
cf.add("fillint6", this.fillint6, fillint6);
}
this.fillint6 = fillint6;
}
public void setFillint8(String fillint8) {
sqlMaker.setField("fillint8", fillint8, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFillint8().equals(fillint8))
cf.add("fillint8", this.fillint8, fillint8);
}
this.fillint8 = fillint8;
}
public void setFillint10(String fillint10) {
sqlMaker.setField("fillint10", fillint10, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFillint10().equals(fillint10))
cf.add("fillint10", this.fillint10, fillint10);
}
this.fillint10 = fillint10;
}
public void setFillint12(String fillint12) {
sqlMaker.setField("fillint12", fillint12, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFillint12().equals(fillint12))
cf.add("fillint12", this.fillint12, fillint12);
}
this.fillint12 = fillint12;
}
public void setFilldbl1(String filldbl1) {
sqlMaker.setField("filldbl1", filldbl1, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldbl1().equals(filldbl1))
cf.add("filldbl1", this.filldbl1, filldbl1);
}
this.filldbl1 = filldbl1;
}
public void setFilldbl2(String filldbl2) {
sqlMaker.setField("filldbl2", filldbl2, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldbl2().equals(filldbl2))
cf.add("filldbl2", this.filldbl2, filldbl2);
}
this.filldbl2 = filldbl2;
}
public void setFilldbl3(String filldbl3) {
sqlMaker.setField("filldbl3", filldbl3, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldbl3().equals(filldbl3))
cf.add("filldbl3", this.filldbl3, filldbl3);
}
this.filldbl3 = filldbl3;
}
public void setUserguid(String userguid) {
sqlMaker.setField("userguid", userguid, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getUserguid().equals(userguid))
cf.add("userguid", this.userguid, userguid);
}
this.userguid = userguid;
}
public void setOperbh(String operbh) {
sqlMaker.setField("operbh", operbh, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getOperbh().equals(operbh))
cf.add("operbh", this.operbh, operbh);
}
this.operbh = operbh;
}
public void setNation(String nation) {
sqlMaker.setField("nation", nation, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getNation().equals(nation))
cf.add("nation", this.nation, nation);
}
this.nation = nation;
}
public void setBirthday(String birthday) {
sqlMaker.setField("birthday", birthday, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getBirthday().equals(birthday))
cf.add("birthday", this.birthday, birthday);
}
this.birthday = birthday;
}
public void setIndt(String indt) {
sqlMaker.setField("indt", indt, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getIndt().equals(indt))
cf.add("indt", this.indt, indt);
}
this.indt = indt;
}
public void setDuty(String duty) {
sqlMaker.setField("duty", duty, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDuty().equals(duty))
cf.add("duty", this.duty, duty);
}
this.duty = duty;
}
public void setEdudegree(String edudegree) {
sqlMaker.setField("edudegree", edudegree, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getEdudegree().equals(edudegree))
cf.add("edudegree", this.edudegree, edudegree);
}
this.edudegree = edudegree;
}
public void setResume(String resume) {
sqlMaker.setField("resume", resume, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getResume().equals(resume))
cf.add("resume", this.resume, resume);
}
this.resume = resume;
}
public void setMemo(String memo) {
sqlMaker.setField("memo", memo, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getMemo().equals(memo))
cf.add("memo", this.memo, memo);
}
this.memo = memo;
}
public void init(int i, ActionRequest actionRequest) throws Exception {
if (actionRequest.getFieldValue(i, "deptid") != null)
this.setDeptid(actionRequest.getFieldValue(i, "deptid"));
if (actionRequest.getFieldValue(i, "operid") != null)
this.setOperid(actionRequest.getFieldValue(i, "operid"));
if (actionRequest.getFieldValue(i, "operpasswd") != null)
this.setOperpasswd(actionRequest.getFieldValue(i, "operpasswd"));
if (actionRequest.getFieldValue(i, "issuper") != null)
this.setIssuper(actionRequest.getFieldValue(i, "issuper"));
if (actionRequest.getFieldValue(i, "opertype") != null)
this.setOpertype(actionRequest.getFieldValue(i, "opertype"));
if (actionRequest.getFieldValue(i, "opername") != null)
this.setOpername(actionRequest.getFieldValue(i, "opername"));
if (actionRequest.getFieldValue(i, "sex") != null)
this.setSex(actionRequest.getFieldValue(i, "sex"));
if (actionRequest.getFieldValue(i, "email") != null)
this.setEmail(actionRequest.getFieldValue(i, "email"));
if (actionRequest.getFieldValue(i, "mobilephone") != null)
this.setMobilephone(actionRequest.getFieldValue(i, "mobilephone"));
if (actionRequest.getFieldValue(i, "operphone") != null)
this.setOperphone(actionRequest.getFieldValue(i, "operphone"));
if (actionRequest.getFieldValue(i, "otherphone") != null)
this.setOtherphone(actionRequest.getFieldValue(i, "otherphone"));
if (actionRequest.getFieldValue(i, "operenabled") != null)
this.setOperenabled(actionRequest.getFieldValue(i, "operenabled"));
if (actionRequest.getFieldValue(i, "fillstr50") != null)
this.setFillstr50(actionRequest.getFieldValue(i, "fillstr50"));
if (actionRequest.getFieldValue(i, "fillstr80") != null)
this.setFillstr80(actionRequest.getFieldValue(i, "fillstr80"));
if (actionRequest.getFieldValue(i, "fillstr100") != null)
this.setFillstr100(actionRequest.getFieldValue(i, "fillstr100"));
if (actionRequest.getFieldValue(i, "fillstr150") != null)
this.setFillstr150(actionRequest.getFieldValue(i, "fillstr150"));
if (actionRequest.getFieldValue(i, "fillstr600") != null)
this.setFillstr600(actionRequest.getFieldValue(i, "fillstr600"));
if (actionRequest.getFieldValue(i, "filldate1") != null)
this.setFilldate1(actionRequest.getFieldValue(i, "filldate1"));
if (actionRequest.getFieldValue(i, "filldate2") != null)
this.setFilldate2(actionRequest.getFieldValue(i, "filldate2"));
if (actionRequest.getFieldValue(i, "filldate3") != null)
this.setFilldate3(actionRequest.getFieldValue(i, "filldate3"));
if (actionRequest.getFieldValue(i, "fillint6") != null)
this.setFillint6(actionRequest.getFieldValue(i, "fillint6"));
if (actionRequest.getFieldValue(i, "fillint8") != null)
this.setFillint8(actionRequest.getFieldValue(i, "fillint8"));
if (actionRequest.getFieldValue(i, "fillint10") != null)
this.setFillint10(actionRequest.getFieldValue(i, "fillint10"));
if (actionRequest.getFieldValue(i, "fillint12") != null)
this.setFillint12(actionRequest.getFieldValue(i, "fillint12"));
if (actionRequest.getFieldValue(i, "filldbl1") != null)
this.setFilldbl1(actionRequest.getFieldValue(i, "filldbl1"));
if (actionRequest.getFieldValue(i, "filldbl2") != null)
this.setFilldbl2(actionRequest.getFieldValue(i, "filldbl2"));
if (actionRequest.getFieldValue(i, "filldbl3") != null)
this.setFilldbl3(actionRequest.getFieldValue(i, "filldbl3"));
if (actionRequest.getFieldValue(i, "userguid") != null)
this.setUserguid(actionRequest.getFieldValue(i, "userguid"));
if (actionRequest.getFieldValue(i, "operbh") != null)
this.setOperbh(actionRequest.getFieldValue(i, "operbh"));
if (actionRequest.getFieldValue(i, "nation") != null)
this.setNation(actionRequest.getFieldValue(i, "nation"));
if (actionRequest.getFieldValue(i, "birthday") != null)
this.setBirthday(actionRequest.getFieldValue(i, "birthday"));
if (actionRequest.getFieldValue(i, "indt") != null)
this.setIndt(actionRequest.getFieldValue(i, "indt"));
if (actionRequest.getFieldValue(i, "duty") != null)
this.setDuty(actionRequest.getFieldValue(i, "duty"));
if (actionRequest.getFieldValue(i, "edudegree") != null)
this.setEdudegree(actionRequest.getFieldValue(i, "edudegree"));
if (actionRequest.getFieldValue(i, "resume") != null)
this.setResume(actionRequest.getFieldValue(i, "resume"));
if (actionRequest.getFieldValue(i, "memo") != null)
this.setMemo(actionRequest.getFieldValue(i, "memo"));
}
public void init(ActionRequest actionRequest) throws Exception {
this.init(0, actionRequest);
}
public void initAll(int i, ActionRequest actionRequest) throws Exception {
this.init(i, actionRequest);
}
public void initAll(ActionRequest actionRequest) throws Exception {
this.initAll(0, actionRequest);
}
public Object clone() throws CloneNotSupportedException {
PtOperBean obj = (PtOperBean) super.clone();
obj.setDeptid(obj.deptid);
obj.setOperid(obj.operid);
obj.setOperpasswd(obj.operpasswd);
obj.setIssuper(obj.issuper);
obj.setOpertype(obj.opertype);
obj.setOpername(obj.opername);
obj.setSex(obj.sex);
obj.setEmail(obj.email);
obj.setMobilephone(obj.mobilephone);
obj.setOperphone(obj.operphone);
obj.setOtherphone(obj.otherphone);
obj.setOperenabled(obj.operenabled);
obj.setFillstr50(obj.fillstr50);
obj.setFillstr80(obj.fillstr80);
obj.setFillstr100(obj.fillstr100);
obj.setFillstr150(obj.fillstr150);
obj.setFillstr600(obj.fillstr600);
obj.setFilldate1(obj.filldate1);
obj.setFilldate2(obj.filldate2);
obj.setFilldate3(obj.filldate3);
obj.setFillint6(obj.fillint6);
obj.setFillint8(obj.fillint8);
obj.setFillint10(obj.fillint10);
obj.setFillint12(obj.fillint12);
obj.setFilldbl1(obj.filldbl1);
obj.setFilldbl2(obj.filldbl2);
obj.setFilldbl3(obj.filldbl3);
obj.setUserguid(obj.userguid);
obj.setOperbh(obj.operbh);
obj.setNation(obj.nation);
obj.setBirthday(obj.birthday);
obj.setIndt(obj.indt);
obj.setDuty(obj.duty);
obj.setEdudegree(obj.edudegree);
obj.setResume(obj.resume);
obj.setMemo(obj.memo);
return obj;
}
} | zyjk | trunk/src/st/portal/system/dao/PtOperBean.java | Java | oos | 26,647 |
package st.portal.system.dao;
import java.util.*;
import st.platform.db.*;
import st.platform.db.sql.*;
import st.platform.control.business.ActionRequest;
public class PtdeptBean extends AbstractBasicBean implements Cloneable {
public static List find(String sSqlWhere) throws Exception {
return new PtdeptBean().findByWhere(sSqlWhere);
}
public static List findAndLock(String sSqlWhere) throws Exception {
return new PtdeptBean().findAndLockByWhere(sSqlWhere);
}
public static PtdeptBean findFirst(String sSqlWhere) throws Exception {
return (PtdeptBean) new PtdeptBean().findFirstByWhere(sSqlWhere);
}
public static PtdeptBean findFirstAndLock(String sSqlWhere)
throws Exception {
return (PtdeptBean) new PtdeptBean().findFirstAndLockByWhere(sSqlWhere);
}
public static RecordSet findRecordSet(String sSqlWhere) throws Exception {
return new PtdeptBean().findRecordSetByWhere(sSqlWhere);
}
public static List find(String sSqlWhere, boolean isAutoRelease)
throws Exception {
PtdeptBean bean = new PtdeptBean();
bean.setAutoRelease(isAutoRelease);
return bean.findByWhere(sSqlWhere);
}
public static List findAndLock(String sSqlWhere, boolean isAutoRelease)
throws Exception {
PtdeptBean bean = new PtdeptBean();
bean.setAutoRelease(isAutoRelease);
return bean.findAndLockByWhere(sSqlWhere);
}
public static PtdeptBean findFirst(String sSqlWhere, boolean isAutoRelease)
throws Exception {
PtdeptBean bean = new PtdeptBean();
bean.setAutoRelease(isAutoRelease);
return (PtdeptBean) bean.findFirstByWhere(sSqlWhere);
}
public static PtdeptBean findFirstAndLock(String sSqlWhere,
boolean isAutoRelease) throws Exception {
PtdeptBean bean = new PtdeptBean();
bean.setAutoRelease(isAutoRelease);
return (PtdeptBean) bean.findFirstAndLockByWhere(sSqlWhere);
}
public static RecordSet findRecordSet(String sSqlWhere,
boolean isAutoRelease) throws Exception {
PtdeptBean bean = new PtdeptBean();
bean.setAutoRelease(isAutoRelease);
return bean.findRecordSetByWhere(sSqlWhere);
}
String deptid;
String deptname;
String deptdesc;
String parentdeptid;
String deptleaf;
String deptlevel;
String depttype;
String dqdm;
String mkdm;
String deptindex;
String deptguid;
String deptphone;
String fillstr10;
String fillstr20;
String fillstr100;
String fillstr150;
String fillint4;
String fillint6;
String fillint8;
String filldbl2;
String filldbl22;
String filldbl4;
String filldate1;
String filldate2;
String depttel;
String deptpost;
String accounts;
String accountnm;
String deptaddr;
String distcode;
String createdt;
String normalpeos;
String realpeos;
String managernm;
String deptinfo;
String bmjc;
public static final String TABLENAME = "ptdept";
private String operate_mode = "add";
public ChangeFileds cf = new ChangeFileds();
public String getTableName() {
return TABLENAME;
}
public void addObject(List list, RecordSet rs) {
PtdeptBean abb = new PtdeptBean();
abb.deptid = rs.getString("deptid");
abb.setKeyValue("DEPTID", "" + abb.getDeptid());
abb.deptname = rs.getString("deptname");
abb.setKeyValue("DEPTNAME", "" + abb.getDeptname());
abb.deptdesc = rs.getString("deptdesc");
abb.setKeyValue("DEPTDESC", "" + abb.getDeptdesc());
abb.parentdeptid = rs.getString("parentdeptid");
abb.setKeyValue("PARENTDEPTID", "" + abb.getParentdeptid());
abb.deptleaf = rs.getString("deptleaf");
abb.setKeyValue("DEPTLEAF", "" + abb.getDeptleaf());
abb.deptlevel = rs.getString("deptlevel");
abb.setKeyValue("DEPTLEVEL", "" + abb.getDeptlevel());
abb.depttype = rs.getString("depttype");
abb.setKeyValue("DEPTTYPE", "" + abb.getDepttype());
abb.dqdm = rs.getString("dqdm");
abb.setKeyValue("DQDM", "" + abb.getDqdm());
abb.mkdm = rs.getString("mkdm");
abb.setKeyValue("MKDM", "" + abb.getMkdm());
abb.deptindex = rs.getString("deptindex");
abb.setKeyValue("DEPTINDEX", "" + abb.getDeptindex());
abb.deptguid = rs.getString("deptguid");
abb.setKeyValue("DEPTGUID", "" + abb.getDeptguid());
abb.deptphone = rs.getString("deptphone");
abb.setKeyValue("DEPTPHONE", "" + abb.getDeptphone());
abb.fillstr10 = rs.getString("fillstr10");
abb.setKeyValue("FILLSTR10", "" + abb.getFillstr10());
abb.fillstr20 = rs.getString("fillstr20");
abb.setKeyValue("FILLSTR20", "" + abb.getFillstr20());
abb.fillstr100 = rs.getString("fillstr100");
abb.setKeyValue("FILLSTR100", "" + abb.getFillstr100());
abb.fillstr150 = rs.getString("fillstr150");
abb.setKeyValue("FILLSTR150", "" + abb.getFillstr150());
abb.fillint4 = rs.getString("fillint4");
abb.setKeyValue("FILLINT4", "" + abb.getFillint4());
abb.fillint6 = rs.getString("fillint6");
abb.setKeyValue("FILLINT6", "" + abb.getFillint6());
abb.fillint8 = rs.getString("fillint8");
abb.setKeyValue("FILLINT8", "" + abb.getFillint8());
abb.filldbl2 = rs.getString("filldbl2");
abb.setKeyValue("FILLDBL2", "" + abb.getFilldbl2());
abb.filldbl22 = rs.getString("filldbl22");
abb.setKeyValue("FILLDBL22", "" + abb.getFilldbl22());
abb.filldbl4 = rs.getString("filldbl4");
abb.setKeyValue("FILLDBL4", "" + abb.getFilldbl4());
abb.filldate1 = rs.getString("filldate1");
abb.setKeyValue("FILLDATE1", "" + abb.getFilldate1());
abb.filldate2 = rs.getString("filldate2");
abb.setKeyValue("FILLDATE2", "" + abb.getFilldate2());
abb.depttel = rs.getString("depttel");
abb.setKeyValue("DEPTTEL", "" + abb.getDepttel());
abb.deptpost = rs.getString("deptpost");
abb.setKeyValue("DEPTPOST", "" + abb.getDeptpost());
abb.accounts = rs.getString("accounts");
abb.setKeyValue("ACCOUNTS", "" + abb.getAccounts());
abb.accountnm = rs.getString("accountnm");
abb.setKeyValue("ACCOUNTNM", "" + abb.getAccountnm());
abb.deptaddr = rs.getString("deptaddr");
abb.setKeyValue("DEPTADDR", "" + abb.getDeptaddr());
abb.distcode = rs.getString("distcode");
abb.setKeyValue("DISTCODE", "" + abb.getDistcode());
abb.createdt = rs.getString("createdt");
abb.setKeyValue("CREATEDT", "" + abb.getCreatedt());
abb.normalpeos = rs.getString("normalpeos");
abb.setKeyValue("NORMALPEOS", "" + abb.getNormalpeos());
abb.realpeos = rs.getString("realpeos");
abb.setKeyValue("REALPEOS", "" + abb.getRealpeos());
abb.managernm = rs.getString("managernm");
abb.setKeyValue("MANAGERNM", "" + abb.getManagernm());
abb.deptinfo = rs.getString("deptinfo");
abb.setKeyValue("DEPTINFO", "" + abb.getDeptinfo());
abb.bmjc = rs.getString("bmjc");
abb.setKeyValue("BMJC", "" + abb.getBmjc());
list.add(abb);
abb.operate_mode = "edit";
}
public String getDeptid() {
if (this.deptid == null) {
return "";
} else {
return this.deptid;
}
}
public String getDeptname() {
if (this.deptname == null) {
return "";
} else {
return this.deptname;
}
}
public String getDeptdesc() {
if (this.deptdesc == null) {
return "";
} else {
return this.deptdesc;
}
}
public String getParentdeptid() {
if (this.parentdeptid == null) {
return "";
} else {
return this.parentdeptid;
}
}
public String getDeptleaf() {
if (this.deptleaf == null) {
return "";
} else {
return this.deptleaf;
}
}
public String getDeptlevel() {
if (this.deptlevel == null) {
return "";
} else {
return this.deptlevel;
}
}
public String getDepttype() {
if (this.depttype == null) {
return "";
} else {
return this.depttype;
}
}
public String getDqdm() {
if (this.dqdm == null) {
return "";
} else {
return this.dqdm;
}
}
public String getMkdm() {
if (this.mkdm == null) {
return "";
} else {
return this.mkdm;
}
}
public String getDeptindex() {
if (this.deptindex == null) {
return "";
} else {
return this.deptindex;
}
}
public String getDeptguid() {
if (this.deptguid == null) {
return "";
} else {
return this.deptguid;
}
}
public String getDeptphone() {
if (this.deptphone == null) {
return "";
} else {
return this.deptphone;
}
}
public String getFillstr10() {
if (this.fillstr10 == null) {
return "";
} else {
return this.fillstr10;
}
}
public String getFillstr20() {
if (this.fillstr20 == null) {
return "";
} else {
return this.fillstr20;
}
}
public String getFillstr100() {
if (this.fillstr100 == null) {
return "";
} else {
return this.fillstr100;
}
}
public String getFillstr150() {
if (this.fillstr150 == null) {
return "";
} else {
return this.fillstr150;
}
}
public String getFillint4() {
if (this.fillint4 == null) {
return "";
} else {
return this.fillint4;
}
}
public String getFillint6() {
if (this.fillint6 == null) {
return "";
} else {
return this.fillint6;
}
}
public String getFillint8() {
if (this.fillint8 == null) {
return "";
} else {
return this.fillint8;
}
}
public String getFilldbl2() {
if (this.filldbl2 == null) {
return "";
} else {
return this.filldbl2;
}
}
public String getFilldbl22() {
if (this.filldbl22 == null) {
return "";
} else {
return this.filldbl22;
}
}
public String getFilldbl4() {
if (this.filldbl4 == null) {
return "";
} else {
return this.filldbl4;
}
}
public String getFilldate1() {
if (this.filldate1 == null) {
return "";
} else {
return this.filldate1;
}
}
public String getFilldate2() {
if (this.filldate2 == null) {
return "";
} else {
return this.filldate2;
}
}
public String getDepttel() {
if (this.depttel == null) {
return "";
} else {
return this.depttel;
}
}
public String getDeptpost() {
if (this.deptpost == null) {
return "";
} else {
return this.deptpost;
}
}
public String getAccounts() {
if (this.accounts == null) {
return "";
} else {
return this.accounts;
}
}
public String getAccountnm() {
if (this.accountnm == null) {
return "";
} else {
return this.accountnm;
}
}
public String getDeptaddr() {
if (this.deptaddr == null) {
return "";
} else {
return this.deptaddr;
}
}
public String getDistcode() {
if (this.distcode == null) {
return "";
} else {
return this.distcode;
}
}
public String getCreatedt() {
if (this.createdt == null) {
return "";
} else {
return this.createdt;
}
}
public String getNormalpeos() {
if (this.normalpeos == null) {
return "";
} else {
return this.normalpeos;
}
}
public String getRealpeos() {
if (this.realpeos == null) {
return "";
} else {
return this.realpeos;
}
}
public String getManagernm() {
if (this.managernm == null) {
return "";
} else {
return this.managernm;
}
}
public String getDeptinfo() {
if (this.deptinfo == null) {
return "";
} else {
return this.deptinfo;
}
}
public String getBmjc() {
if (this.bmjc == null) {
return "";
} else {
return this.bmjc;
}
}
public void setDeptid(String deptid) {
sqlMaker.setField("deptid", deptid, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptid().equals(deptid))
cf.add("deptid", this.deptid, deptid);
}
this.deptid = deptid;
}
public void setDeptname(String deptname) {
sqlMaker.setField("deptname", deptname, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptname().equals(deptname))
cf.add("deptname", this.deptname, deptname);
}
this.deptname = deptname;
}
public void setDeptdesc(String deptdesc) {
sqlMaker.setField("deptdesc", deptdesc, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptdesc().equals(deptdesc))
cf.add("deptdesc", this.deptdesc, deptdesc);
}
this.deptdesc = deptdesc;
}
public void setParentdeptid(String parentdeptid) {
sqlMaker.setField("parentdeptid", parentdeptid, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getParentdeptid().equals(parentdeptid))
cf.add("parentdeptid", this.parentdeptid, parentdeptid);
}
this.parentdeptid = parentdeptid;
}
public void setDeptleaf(String deptleaf) {
sqlMaker.setField("deptleaf", deptleaf, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptleaf().equals(deptleaf))
cf.add("deptleaf", this.deptleaf, deptleaf);
}
this.deptleaf = deptleaf;
}
public void setDeptlevel(String deptlevel) {
sqlMaker.setField("deptlevel", deptlevel, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptlevel().equals(deptlevel))
cf.add("deptlevel", this.deptlevel, deptlevel);
}
this.deptlevel = deptlevel;
}
public void setDepttype(String depttype) {
sqlMaker.setField("depttype", depttype, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDepttype().equals(depttype))
cf.add("depttype", this.depttype, depttype);
}
this.depttype = depttype;
}
public void setDqdm(String dqdm) {
sqlMaker.setField("dqdm", dqdm, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDqdm().equals(dqdm))
cf.add("dqdm", this.dqdm, dqdm);
}
this.dqdm = dqdm;
}
public void setMkdm(String mkdm) {
sqlMaker.setField("mkdm", mkdm, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getMkdm().equals(mkdm))
cf.add("mkdm", this.mkdm, mkdm);
}
this.mkdm = mkdm;
}
public void setDeptindex(String deptindex) {
sqlMaker.setField("deptindex", deptindex, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptindex().equals(deptindex))
cf.add("deptindex", this.deptindex, deptindex);
}
this.deptindex = deptindex;
}
public void setDeptguid(String deptguid) {
sqlMaker.setField("deptguid", deptguid, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptguid().equals(deptguid))
cf.add("deptguid", this.deptguid, deptguid);
}
this.deptguid = deptguid;
}
public void setDeptphone(String deptphone) {
sqlMaker.setField("deptphone", deptphone, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptphone().equals(deptphone))
cf.add("deptphone", this.deptphone, deptphone);
}
this.deptphone = deptphone;
}
public void setFillstr10(String fillstr10) {
sqlMaker.setField("fillstr10", fillstr10, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFillstr10().equals(fillstr10))
cf.add("fillstr10", this.fillstr10, fillstr10);
}
this.fillstr10 = fillstr10;
}
public void setFillstr20(String fillstr20) {
sqlMaker.setField("fillstr20", fillstr20, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFillstr20().equals(fillstr20))
cf.add("fillstr20", this.fillstr20, fillstr20);
}
this.fillstr20 = fillstr20;
}
public void setFillstr100(String fillstr100) {
sqlMaker.setField("fillstr100", fillstr100, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFillstr100().equals(fillstr100))
cf.add("fillstr100", this.fillstr100, fillstr100);
}
this.fillstr100 = fillstr100;
}
public void setFillstr150(String fillstr150) {
sqlMaker.setField("fillstr150", fillstr150, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFillstr150().equals(fillstr150))
cf.add("fillstr150", this.fillstr150, fillstr150);
}
this.fillstr150 = fillstr150;
}
public void setFillint4(String fillint4) {
sqlMaker.setField("fillint4", fillint4, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFillint4().equals(fillint4))
cf.add("fillint4", this.fillint4, fillint4);
}
this.fillint4 = fillint4;
}
public void setFillint6(String fillint6) {
sqlMaker.setField("fillint6", fillint6, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFillint6().equals(fillint6))
cf.add("fillint6", this.fillint6, fillint6);
}
this.fillint6 = fillint6;
}
public void setFillint8(String fillint8) {
sqlMaker.setField("fillint8", fillint8, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFillint8().equals(fillint8))
cf.add("fillint8", this.fillint8, fillint8);
}
this.fillint8 = fillint8;
}
public void setFilldbl2(String filldbl2) {
sqlMaker.setField("filldbl2", filldbl2, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldbl2().equals(filldbl2))
cf.add("filldbl2", this.filldbl2, filldbl2);
}
this.filldbl2 = filldbl2;
}
public void setFilldbl22(String filldbl22) {
sqlMaker.setField("filldbl22", filldbl22, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldbl22().equals(filldbl22))
cf.add("filldbl22", this.filldbl22, filldbl22);
}
this.filldbl22 = filldbl22;
}
public void setFilldbl4(String filldbl4) {
sqlMaker.setField("filldbl4", filldbl4, Field.NUMBER);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldbl4().equals(filldbl4))
cf.add("filldbl4", this.filldbl4, filldbl4);
}
this.filldbl4 = filldbl4;
}
public void setFilldate1(String filldate1) {
sqlMaker.setField("filldate1", filldate1, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldate1().equals(filldate1))
cf.add("filldate1", this.filldate1, filldate1);
}
this.filldate1 = filldate1;
}
public void setFilldate2(String filldate2) {
sqlMaker.setField("filldate2", filldate2, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getFilldate2().equals(filldate2))
cf.add("filldate2", this.filldate2, filldate2);
}
this.filldate2 = filldate2;
}
public void setDepttel(String depttel) {
sqlMaker.setField("depttel", depttel, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDepttel().equals(depttel))
cf.add("depttel", this.depttel, depttel);
}
this.depttel = depttel;
}
public void setDeptpost(String deptpost) {
sqlMaker.setField("deptpost", deptpost, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptpost().equals(deptpost))
cf.add("deptpost", this.deptpost, deptpost);
}
this.deptpost = deptpost;
}
public void setAccounts(String accounts) {
sqlMaker.setField("accounts", accounts, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getAccounts().equals(accounts))
cf.add("accounts", this.accounts, accounts);
}
this.accounts = accounts;
}
public void setAccountnm(String accountnm) {
sqlMaker.setField("accountnm", accountnm, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getAccountnm().equals(accountnm))
cf.add("accountnm", this.accountnm, accountnm);
}
this.accountnm = accountnm;
}
public void setDeptaddr(String deptaddr) {
sqlMaker.setField("deptaddr", deptaddr, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptaddr().equals(deptaddr))
cf.add("deptaddr", this.deptaddr, deptaddr);
}
this.deptaddr = deptaddr;
}
public void setDistcode(String distcode) {
sqlMaker.setField("distcode", distcode, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDistcode().equals(distcode))
cf.add("distcode", this.distcode, distcode);
}
this.distcode = distcode;
}
public void setCreatedt(String createdt) {
sqlMaker.setField("createdt", createdt, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getCreatedt().equals(createdt))
cf.add("createdt", this.createdt, createdt);
}
this.createdt = createdt;
}
public void setNormalpeos(String normalpeos) {
sqlMaker.setField("normalpeos", normalpeos, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getNormalpeos().equals(normalpeos))
cf.add("normalpeos", this.normalpeos, normalpeos);
}
this.normalpeos = normalpeos;
}
public void setRealpeos(String realpeos) {
sqlMaker.setField("realpeos", realpeos, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getRealpeos().equals(realpeos))
cf.add("realpeos", this.realpeos, realpeos);
}
this.realpeos = realpeos;
}
public void setManagernm(String managernm) {
sqlMaker.setField("managernm", managernm, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getManagernm().equals(managernm))
cf.add("managernm", this.managernm, managernm);
}
this.managernm = managernm;
}
public void setDeptinfo(String deptinfo) {
sqlMaker.setField("deptinfo", deptinfo, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getDeptinfo().equals(deptinfo))
cf.add("deptinfo", this.deptinfo, deptinfo);
}
this.deptinfo = deptinfo;
}
public void setBmjc(String bmjc) {
sqlMaker.setField("bmjc", bmjc, Field.TEXT);
if (this.operate_mode.equals("edit")) {
if (!this.getBmjc().equals(bmjc))
cf.add("bmjc", this.bmjc, bmjc);
}
this.bmjc = bmjc;
}
public void init(int i, ActionRequest actionRequest) throws Exception {
if (actionRequest.getFieldValue(i, "deptid") != null)
this.setDeptid(actionRequest.getFieldValue(i, "deptid"));
if (actionRequest.getFieldValue(i, "deptname") != null)
this.setDeptname(actionRequest.getFieldValue(i, "deptname"));
if (actionRequest.getFieldValue(i, "deptdesc") != null)
this.setDeptdesc(actionRequest.getFieldValue(i, "deptdesc"));
if (actionRequest.getFieldValue(i, "parentdeptid") != null)
this
.setParentdeptid(actionRequest.getFieldValue(i,
"parentdeptid"));
if (actionRequest.getFieldValue(i, "deptleaf") != null)
this.setDeptleaf(actionRequest.getFieldValue(i, "deptleaf"));
if (actionRequest.getFieldValue(i, "deptlevel") != null)
this.setDeptlevel(actionRequest.getFieldValue(i, "deptlevel"));
if (actionRequest.getFieldValue(i, "depttype") != null)
this.setDepttype(actionRequest.getFieldValue(i, "depttype"));
if (actionRequest.getFieldValue(i, "dqdm") != null)
this.setDqdm(actionRequest.getFieldValue(i, "dqdm"));
if (actionRequest.getFieldValue(i, "mkdm") != null)
this.setMkdm(actionRequest.getFieldValue(i, "mkdm"));
if (actionRequest.getFieldValue(i, "deptindex") != null)
this.setDeptindex(actionRequest.getFieldValue(i, "deptindex"));
if (actionRequest.getFieldValue(i, "deptguid") != null)
this.setDeptguid(actionRequest.getFieldValue(i, "deptguid"));
if (actionRequest.getFieldValue(i, "deptphone") != null)
this.setDeptphone(actionRequest.getFieldValue(i, "deptphone"));
if (actionRequest.getFieldValue(i, "fillstr10") != null)
this.setFillstr10(actionRequest.getFieldValue(i, "fillstr10"));
if (actionRequest.getFieldValue(i, "fillstr20") != null)
this.setFillstr20(actionRequest.getFieldValue(i, "fillstr20"));
if (actionRequest.getFieldValue(i, "fillstr100") != null)
this.setFillstr100(actionRequest.getFieldValue(i, "fillstr100"));
if (actionRequest.getFieldValue(i, "fillstr150") != null)
this.setFillstr150(actionRequest.getFieldValue(i, "fillstr150"));
if (actionRequest.getFieldValue(i, "fillint4") != null)
this.setFillint4(actionRequest.getFieldValue(i, "fillint4"));
if (actionRequest.getFieldValue(i, "fillint6") != null)
this.setFillint6(actionRequest.getFieldValue(i, "fillint6"));
if (actionRequest.getFieldValue(i, "fillint8") != null)
this.setFillint8(actionRequest.getFieldValue(i, "fillint8"));
if (actionRequest.getFieldValue(i, "filldbl2") != null)
this.setFilldbl2(actionRequest.getFieldValue(i, "filldbl2"));
if (actionRequest.getFieldValue(i, "filldbl22") != null)
this.setFilldbl22(actionRequest.getFieldValue(i, "filldbl22"));
if (actionRequest.getFieldValue(i, "filldbl4") != null)
this.setFilldbl4(actionRequest.getFieldValue(i, "filldbl4"));
if (actionRequest.getFieldValue(i, "filldate1") != null)
this.setFilldate1(actionRequest.getFieldValue(i, "filldate1"));
if (actionRequest.getFieldValue(i, "filldate2") != null)
this.setFilldate2(actionRequest.getFieldValue(i, "filldate2"));
if (actionRequest.getFieldValue(i, "depttel") != null)
this.setDepttel(actionRequest.getFieldValue(i, "depttel"));
if (actionRequest.getFieldValue(i, "deptpost") != null)
this.setDeptpost(actionRequest.getFieldValue(i, "deptpost"));
if (actionRequest.getFieldValue(i, "accounts") != null)
this.setAccounts(actionRequest.getFieldValue(i, "accounts"));
if (actionRequest.getFieldValue(i, "accountnm") != null)
this.setAccountnm(actionRequest.getFieldValue(i, "accountnm"));
if (actionRequest.getFieldValue(i, "deptaddr") != null)
this.setDeptaddr(actionRequest.getFieldValue(i, "deptaddr"));
if (actionRequest.getFieldValue(i, "distcode") != null)
this.setDistcode(actionRequest.getFieldValue(i, "distcode"));
if (actionRequest.getFieldValue(i, "createdt") != null)
this.setCreatedt(actionRequest.getFieldValue(i, "createdt"));
if (actionRequest.getFieldValue(i, "normalpeos") != null)
this.setNormalpeos(actionRequest.getFieldValue(i, "normalpeos"));
if (actionRequest.getFieldValue(i, "realpeos") != null)
this.setRealpeos(actionRequest.getFieldValue(i, "realpeos"));
if (actionRequest.getFieldValue(i, "managernm") != null)
this.setManagernm(actionRequest.getFieldValue(i, "managernm"));
if (actionRequest.getFieldValue(i, "deptinfo") != null)
this.setDeptinfo(actionRequest.getFieldValue(i, "deptinfo"));
if (actionRequest.getFieldValue(i, "bmjc") != null)
this.setBmjc(actionRequest.getFieldValue(i, "bmjc"));
}
public void init(ActionRequest actionRequest) throws Exception {
this.init(0, actionRequest);
}
public void initAll(int i, ActionRequest actionRequest) throws Exception {
this.init(i, actionRequest);
}
public void initAll(ActionRequest actionRequest) throws Exception {
this.initAll(0, actionRequest);
}
public Object clone() throws CloneNotSupportedException {
PtdeptBean obj = (PtdeptBean) super.clone();
obj.setDeptid(obj.deptid);
obj.setDeptname(obj.deptname);
obj.setDeptdesc(obj.deptdesc);
obj.setParentdeptid(obj.parentdeptid);
obj.setDeptleaf(obj.deptleaf);
obj.setDeptlevel(obj.deptlevel);
obj.setDepttype(obj.depttype);
obj.setDqdm(obj.dqdm);
obj.setMkdm(obj.mkdm);
obj.setDeptindex(obj.deptindex);
obj.setDeptguid(obj.deptguid);
obj.setDeptphone(obj.deptphone);
obj.setFillstr10(obj.fillstr10);
obj.setFillstr20(obj.fillstr20);
obj.setFillstr100(obj.fillstr100);
obj.setFillstr150(obj.fillstr150);
obj.setFillint4(obj.fillint4);
obj.setFillint6(obj.fillint6);
obj.setFillint8(obj.fillint8);
obj.setFilldbl2(obj.filldbl2);
obj.setFilldbl22(obj.filldbl22);
obj.setFilldbl4(obj.filldbl4);
obj.setFilldate1(obj.filldate1);
obj.setFilldate2(obj.filldate2);
obj.setDepttel(obj.depttel);
obj.setDeptpost(obj.deptpost);
obj.setAccounts(obj.accounts);
obj.setAccountnm(obj.accountnm);
obj.setDeptaddr(obj.deptaddr);
obj.setDistcode(obj.distcode);
obj.setCreatedt(obj.createdt);
obj.setNormalpeos(obj.normalpeos);
obj.setRealpeos(obj.realpeos);
obj.setManagernm(obj.managernm);
obj.setDeptinfo(obj.deptinfo);
obj.setBmjc(obj.bmjc);
return obj;
}
} | zyjk | trunk/src/st/portal/system/dao/PtdeptBean.java | Java | oos | 26,926 |
/*********************************************************************
*<p>处理内容:action 封裝父类</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.3.2---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.portal.action;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import st.platform.db.ConnectionManager;
import st.platform.db.DatabaseConnection;
import st.platform.db.RecordSet;
import st.platform.db.sql.AbstractBasicBean;
import st.platform.system.cache.EnumerationType;
import st.system.dao.PtgridscolumnBean;
import UI.dao.zyjk.T_yhzc_bzbBean;
import UI.message.MisConstant;
import UI.util.DistcodeUtil;
import com.opensymphony.xwork2.ActionSupport;
public class BasicAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 1L;
ConnectionManager cm = ConnectionManager.getInstance();
DatabaseConnection DBCon = cm.get();
private MessageBean messageBean;// 操作状态
public String dataType = DBCon.DbType;// 数据库类型
/**
* 分页查询
*
* @param fSQLStr
* sql语句
* @param fwhereStr
* 查询条件
* @param forderStr
* 排序条件
* @param pageBean
* 分页Bean
* @return
*/
public PageBean findList(String strGridName ,String strFSQL, String strFWhere, String strFOrder, PageBean pageBean) throws Exception {
try {
// 初始化查询条件
if (strFWhere == null) {
}
if (pageBean == null) {
pageBean = new PageBean();
}
// 返回的页数
RecordSet gridRS;
// 统计记录的数据量
String strCountSQL = "select count(*) from (" + strFSQL + " " + strFWhere + ") temp";
System.out.println("countSQL::" + strCountSQL);
gridRS = DBCon.executeQuery(strCountSQL);
if (gridRS.next()) {
pageBean.setTotal(gridRS.getInt(0));
//System.out.println(pageBean.getTotal());
}
// 查询内容
List<Map<String, String>> listDate = new ArrayList<Map<String, String>>();
Map<String, String> map;
gridRS = DBCon.executeQuery(strFSQL, strFWhere, strFOrder, pageBean.getPageSize()
* (pageBean.getPage() - 1) + 1, pageBean.getPageSize(), pageBean.getTotal());
//取出需要用到的enum枚举内容
PtgridscolumnBean ptcolumn = new PtgridscolumnBean();
List<PtgridscolumnBean> list = ptcolumn.findByWhere(" where gridname ='" + strGridName + "' and columnstate ='dropdown'");
PtgridscolumnBean ptcolgrid = new PtgridscolumnBean();
T_yhzc_bzbBean bzbBean=new T_yhzc_bzbBean();
while (gridRS != null && gridRS.next()) {
map = new HashMap<String, String>();
for (int i = 0; i < gridRS.getColumnCount(); i++) {
String mark = gridRS.getFieldName(i);
String value = gridRS.getString(gridRS.getFieldName(i)).trim().replace("\r\n", "");
if(mark.equals("nrsysno")){
bzbBean=new T_yhzc_bzbBean();
bzbBean=bzbBean.findFirst(" where id='"+ value +"'");
value=bzbBean.getBzmc();
}
//查询结果枚举
for(int j=0;j<list.size();j++)
{
ptcolgrid = list.get(j);
if(ptcolgrid.getColumnname().equals(mark)){
if(ptcolgrid.getColumnmenu().equals("distcode")){
value=DistcodeUtil.getDistName(value);
}else{
value = EnumerationType.getEnu(ptcolgrid.getColumnmenu(),value).split(";")[0];
}
}
}
map.put(mark, value);
}
listDate.add(map);
}
pageBean.setDataSet(listDate);
} catch (Exception e) {
throw e;
}
return pageBean;
}
/**
* 查询方法
*
* @param obj
* @param sqlWhere
* @return
*/
public AbstractBasicBean findByKey(AbstractBasicBean obj, String sqlWhere) throws Exception {
try {
obj = (AbstractBasicBean) obj.findFirstByWhere(sqlWhere);
} catch (Exception e) {
// TODO Auto-generated catch block
throw e;
}
return obj;
}
/**
* 公共添加的方法
*
* @param obj
* @return
*/
public MessageBean insert(AbstractBasicBean obj) throws Exception {
messageBean = new MessageBean();
try {
if (obj.insert() > 0) {
// 操作成功
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} else {
// 操作失败
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
throw e;
}
return messageBean;
}
/**
* 公共删除方法
*
* @param obj
* @return
*/
public MessageBean delete(AbstractBasicBean obj, String sqlWhere) throws Exception {
messageBean = new MessageBean();
try {
if (obj.deleteByWhere(sqlWhere) > 0) {
// 操作成功
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} else {
// 操作失败
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
throw e;
}
return messageBean;
}
/**
* 公共update方法
*
* @param obj
* @return
*/
public MessageBean update(AbstractBasicBean obj, String sqlWhere) throws Exception {
messageBean = new MessageBean();
try {
if (obj.updateByWhere(sqlWhere) > 0) {
// 操作成功
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} else {
// 操作失败
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
throw e;
}
return messageBean;
}
/**
* 公共查询SQL方法
*/
@SuppressWarnings("unused")
public RecordSet executeQuery(String strSQL) throws Exception {
RecordSet gridRS = null;
try {
System.out.println(strSQL);
gridRS = DBCon.executeQuery(strSQL);
} catch (Exception e) {
throw e;
}
return gridRS;
}
/**
* 公共执行SQL方法
*/
public MessageBean executeUpdate(String strSQL) throws Exception {
messageBean = new MessageBean();
try {
if (DBCon.executeUpdate(strSQL) > 0) {
// 操作成功
messageBean.setCheckFlag(MisConstant.MSG_SUCCESS);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_SUCCESS);
} else {
// 操作失败
messageBean.setCheckFlag(MisConstant.MSG_FAIL);
messageBean.setCheckMessage(MisConstant.MSG_OPERATE_FAIL);
}
} catch (Exception e) {
throw e;
}
return messageBean;
}
}
| zyjk | trunk/src/st/portal/action/BasicAction.java | Java | oos | 8,669 |
/*********************************************************************
*<p>处理内容:后台检查消息封装bean</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 吴业元 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2011.9.2---- 吴业元 --------- 新规作成<br>
***********************************************************************/
package st.portal.action;
public class MessageBean {
private static final long serialVersionUID = -8324911161163634531L;
// 成功失败标志位
private int checkFlag = 1;
// 检查字段英文名称
private String widgetName = "";
// 检查字段汉语名称
private String widgetLabel = "";
// widget当前值
private String widgetValue = "";
// 警告信息
private String checkMessage = "";
// 操作的状态
private String method = "";
public int getCheckFlag() {
return checkFlag;
}
public void setCheckFlag(int checkFlag) {
this.checkFlag = checkFlag;
}
public String getWidgetValue() {
return widgetValue;
}
public void setWidgetValue(String widgetValue) {
this.widgetValue = widgetValue;
}
public String getCheckMessage() {
return checkMessage;
}
public void setCheckMessage(String checkMessage) {
this.checkMessage = checkMessage;
}
public String getWidgetName() {
return widgetName;
}
public void setWidgetName(String widgetName) {
this.widgetName = widgetName;
}
public String getWidgetLabel() {
return widgetLabel;
}
public void setWidgetLabel(String widgetLabel) {
this.widgetLabel = widgetLabel;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
} | zyjk | trunk/src/st/portal/action/MessageBean.java | Java | oos | 1,965 |
/*********************************************************************
*<p>处理内容:分页bean</p>
*<p>Copyright: Copyright (c) 2011</p>
* @author 方立文 改版履历<br>
* @version Rev - Date ------- Name ---------- Note<br>
* @------- 1.0 --2013.3.2---- 方立文 --------- 新规作成<br>
***********************************************************************/
package st.portal.action;
import java.util.List;
import java.util.Map;
public class PageBean {
private static final long serialVersionUID = -8324911261163634531L;
private int total = 0; // 记录总数
private int pageSize = 15; // 每页显示记录数
private int pageCount = 0; // 总页数
private int page = 1; // 当前页数
private List<Map<String,String>> dataSet;//查询的内容
private String totalCountSQL;// 得到总记录数sql语句
private String listSQL;// 得到查询记录sql语句
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public String getListSQL() {
return listSQL;
}
public void setListSQL(String listSQL) {
this.listSQL = listSQL;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getPageCount() {
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String getTotalCountSQL() {
return totalCountSQL;
}
public void setTotalCountSQL(String totalCountSQL) {
this.totalCountSQL = totalCountSQL;
}
public List<Map<String, String>> getDataSet() {
return dataSet;
}
public void setDataSet(List<Map<String, String>> dataSet) {
this.dataSet = dataSet;
}
} | zyjk | trunk/src/st/portal/action/PageBean.java | Java | oos | 2,241 |