📄 jcy_jd_submit.jsp
字号:
<%@ page contentType="text/html; charset=GBK" language="java" import="java.sql.*,com.vstsoft.std.*" errorPage="" %>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<jsp:useBean id="jcypurview" class="com.vstsoft.jcypurview" scope = "session" />
<html>
<%vststd std = new vststd();%>
<%
String dm_id = std.getValue(request,"ID"); // 培训代码
String szt = std.getValue(request,"zt"); // 按钮类别
String imager = "";
String lry ="";
int jl = 1; //录入人
String lrsj = ""; //录入时间
int ixy = 0;
%>
<%
if (jcypurview.checkLogin() == false)
{
%>
<Script Language=javascript>
alert("用户已断线或未正常登录,请重新登录!")
window.open("../index.htm","_top")
</Script>
<% return;
}
if (szt.equals("del"))
{
if (jcypurview.purviewVerdict("B0500042") == false) //判断是否有删除权限
{
%>
<Script Language=javascript>
alert("您没有操作此页权限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
if (szt.equals("modify"))
{
if (jcypurview.purviewVerdict("B0500041") == false) //判断是否有修改权限
{
%>
<Script Language=javascript>
alert("您没有操作此页权限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
if (szt.equals("new"))
{
if (jcypurview.purviewVerdict("B0500040") == false) //判断是否有新增权限
{
%>
<Script Language=javascript>
alert("您没有操作此页权限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}%>
<%
String nowuserid = jcypurview.getUserid(); //取当前用户编号
String nowusername = jcypurview.getUserName(); //取当前用户名称
String nowuserszqx = jcypurview.getUserSzqx(); //取当前用户所在区县
String nowuserszdw = jcypurview.getUserSzdw(); //取当前用户所在单位
%>
<%
//新增街道
if ( szt.equals("new"))
{
String dm_b = std.getValue(request,"dm_b").trim(); //用户输入的后三位
String dm_t = std.getValue(request,"dm_t").trim();
String dmm = "";
String mc = std.getValue(request,"mc").trim();
String dm = dm_t+dm_b;
out.print("I"+dm_b+"I");
if (dm_t.length() > 3)
{
imager = "街道所在区县格式不合法,请检查数据库是否连接!";
ixy = 1;
}
if (ixy !=1)
{
if (dm_t.equals(""))
{
imager = "街道所在区县为空,请检查数据库是否连接!";
ixy = 1;
}
}
if (ixy != 1)
{
if (dm_b.length()>3)
{
imager = "街道代码不能大于3位!";
ixy = 1;
}
}
if (ixy != 1)
{
if (dm_b.length()<3)
{
imager = "街道代码不能小于3位!";
ixy = 1;
}
}
if (ixy != 1)
{
if (dm_b.equals(""))
{
imager= "街道代码不能为空!";
ixy = 1;
}
}
if (ixy != 1)
{
if (mc.length() > 50)
{
imager= "街道名称长度不能大于50位!";
ixy = 1;
}
}
if (ixy != 1)
{
if (mc.equals(""))
{
imager= "街道名称不能为空!";
ixy = 1;
}
}
if (ixy != 1)
{
if (dm.length() > 7)
{
imager= "请重新选择选项!";
ixy = 1;
}
}
if (ixy == 0)
{
//取数据库时间
String lrrq = std.getDateStr("YYYY.MM.DD");
//单位序号
/*String userid ="SELECT LPAD(SEQ_jcyID.NEXTVAL,10,'0') FROM DUAL";
sun.jdbc.rowset.CachedRowSet crs = std.getResultBySelect("SELECT LPAD(SEQ_jcyID.NEXTVAL,10,'0') FROM DUAL");
crs.next();
String suserid = crs.getString(1);*/
//查询是否重名
String jcy_ryid = "select count(*) from dm_mx where dm = '"+dm+"'";
sun.jdbc.rowset.CachedRowSet jcy_ry = std.getResultBySelect(jcy_ryid);
jcy_ry.next();
String ry = jcy_ry.getString(1);
if (ry.equals("0"))
{
//新增单位信息
String sql_insert = "insert into dm_mx (dm,mc,dmm) values ('"+dm+"','"+mc+"','0002')";
int isi = std.getResultByUpdate(sql_insert);
if (isi == 1 )
{
imager = "保存成功!";
}
else
{
ixy = 1;
imager = "新增失败!";
}
}
else
{
ixy =1;
imager="此代码已经使用,请更改!";
}
}
}
//修改街道
if ( szt.equals("modify"))
{
String dm_b = std.getValue(request,"dm_b").trim(); //用户输入的后三位
String dm_t = std.getValue(request,"dm_t").trim();
String dmm = "";
String mc = std.getValue(request,"mc").trim();
String dm = dm_t+dm_b;
//out.print(dm);
if (dm_t.length() > 3)
{
imager = "街道所在区县格式不合法,请检查数据库是否连接!";
ixy = 1;
}
if (ixy !=1)
{
if (dm_t.equals(""))
{
imager = "街道所在区县为空,请检查数据库是否连接!";
ixy = 1;
}
}
if (ixy != 1)
{
if (dm_b.length()>3)
{
imager = "街道代码不能大于3位!";
ixy = 1;
}
}
if (ixy != 1)
{
if (dm_b.length()<3)
{
imager = "街道代码不能小于3位!";
ixy = 1;
}
}
if (ixy != 1)
{
if (dm_b.equals(""))
{
imager= "街道代码不能为空!";
ixy = 1;
}
}
if (ixy != 1)
{
if (mc.length() > 50)
{
imager= "街道名称长度不能大于50位!";
ixy = 1;
}
}
if (ixy != 1)
{
if (mc.equals(""))
{
imager= "街道名称不能为空!";
ixy = 1;
}
}
if (ixy != 1)
{
if (dm.length() > 7)
{
imager= "请重新选择选项!";
ixy = 1;
}
}
if (ixy == 0)
{
//取数据库时间
String lrrq = std.getDateStr("YYYY.MM.DD");
String jcy_jd="select dm from dm_mx where dm = '"+dm_id+"'";
sun.jdbc.rowset.CachedRowSet jcy_jds = std.getResultBySelect(jcy_jd);
jcy_jds.next();
String jd = jcy_jds.getString(1);
if (!jd.equals(dm))
{
String jcy_jdcount = "select count(*) from dm_mx where dm = '"+dm+"'";
sun.jdbc.rowset.CachedRowSet jcy_ry = std.getResultBySelect(jcy_jdcount);
jcy_ry.next();
String ry = jcy_ry.getString(1);
if (!ry.equals("0"))
{
imager ="此街道代码已经使用,请更改!";
ixy = 1;
}
else
{
String sql_update = "update dm_mx set dmm = '0002' ,mc= '"+mc+"',dm='"+dm+"' where dm = '"+dm_id+"' ";
int isu = std.getResultByUpdate(sql_update);
if (isu == 1)
{
imager = "修改成功!";
}else
{
ixy = 1;
imager = "修改失败!";
}
}
}
else
{
String sql_update = "update dm_mx set dmm = '0002' ,mc= '"+mc+"',dm='"+dm+"' where dm = '"+dm_id+"' ";
int isuo = std.getResultByUpdate(sql_update);
if (isuo == 1)
{
imager = "修改成功.";
}else
{
ixy = 1;
imager = "修改失败.";
}
}
}
}
//删除街道
if ( szt.equals("del"))
{
if (ixy == 0)
{
//判断外键关系
String sql_dw = "select count(*) from jcy_dw,dm_mx where dm_mx.dm = jcy_dw.jdbm and dm_mx.dm = '"+dm_id+"' and jcy_dw.yxbz='01'";
sun.jdbc.rowset.CachedRowSet ii = std.getResultBySelect(sql_dw);
ii.next();
jl = ii.getInt(1);
if (jl == 0)
{
String sql_del="delete from dm_mx where dmm = '0002' and dm = '"+dm_id+"'";
int idel = std.getResultByUpdate(sql_del);
if (idel == 1)
{
imager = "删除成功!";
}else
{
ixy = 1;
imager = "删除失败!";
}
}
else
{
ixy = 1;
imager = "此街道上有单位,请先删除单位后才能删除此街道!";
}
}
}
%>
<head>
<title>
</title>
</head>
<body onLoad="parent.f_imager('<%=imager%>','<%=ixy%>')">
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -