经理说我嵌套的case太麻烦,我该怎么简练一下呢,如下,谢谢!public class PropTjActionForm extends ActionForm {
public String getDealStatus_name() {
String name="-1";
switch(this.dealStatus) {
case 0:
name="全部";
break;
case 1:
name="签核中";
break;
case 46:
name="处理中";
break;
case 47:
name="处理结果确认中";
break;
case 40:
name="调整分类中";
break;
case 9:
name="结案";
break;
}
return name;
}
public String getDealScope_name() {
String name="-2";
switch(this.dealScope) {
case 2:
name="无";
break;
case 3:
name="非常满意";
break;
case 4:
name="较为满意";
break;
case 5:
name="满意";
break;
case 6:
name="不满意";
break;
case 7:
name="很不满意";
break;
}
return name;
}
public String doPropDetail() throws OAException {
String sql="";
/**
* <select name="dealStatus">
<option value="0">全部</option>
<option value="1">签核中</option>
<option value="46">处理中</option>
<option value="47">处理结果确认中</option>
<option value="40">调整分类中</option>
<option value="9">结案</option>
</select>
*/
if(this.deptType==0) {
//提报部门
sql="select distinct(a.flowNo),prop_no,prop_proposer,prop_proposer_name,prop_replacer,prop_replacer_name,";
sql+="prop_kind_name,prop_instancy_id,prop_instancy_name,prop_importance_id,prop_importance_name,";
sql+="prop_name,createTime,prop_want_time,score";
switch(this.dealStatus) {
case 0:
switch(this.dealScope){
case 2:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
break;
case 3:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
sql+=" score>=9 and score<=10 and";
break;
case 4:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
sql+=" score>=7 and score<=8 and";
break;
case 5:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
sql+=" score>=5 and score<=6 and";
break;
case 6:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
sql+=" score>=3 and score<=4 and";
break;
case 7:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
sql+=" score>=1 and score<=2 and";
break;
}
break;
case 1:
switch(this.dealScope){
case 2:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
case 3:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=9 and score<=10 ";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
case 4:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=7 and score<=8 ";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
case 5:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=5 and score<=6 ";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
case 6:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=3 and score<=4 ";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
case 7:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=1 and score<=2 ";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
}
break;
case 46:
switch(this.dealScope){
case 2:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and roleId='46' and b.type=0 and ";
break;
case 3:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=9 and score<=10 ";
sql+=" and roleId='46' and b.type=0 and ";
break;
case 4:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=7 and score<=8 ";
sql+=" and roleId='46' and b.type=0 and ";
break;
case 5:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=5 and score<=6 ";
sql+=" and roleId='46' and b.type=0 and ";
break;
case 6:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=3 and score<=4 ";
sql+=" and roleId='46' and b.type=0 and ";
break;
case 7:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=1 and score<=2 ";
sql+=" and roleId='46' and b.type=0 and ";
break;
}
break;
sql+=" prop_replacer='' and createTime between "+starttime+" and "+endtime+" and ";
sql+="(a.prop_proposer_dept_id='";
System.out.println(" 提报部门 sql = "+sql);
Vector v=new Vector();
DeptUtils du=new DeptUtils(conn);
du.getDeptId(dept_id, 0, -1, v);
for(int i=0;i<v.size();i++) {
if(i!=0) {
sql+=" or a.prop_proposer_dept_id='";
}
sql+=(String)v.get(i)+"'";
}
sql+=")order by prop_no";
public String getDealStatus_name() {
String name="-1";
switch(this.dealStatus) {
case 0:
name="全部";
break;
case 1:
name="签核中";
break;
case 46:
name="处理中";
break;
case 47:
name="处理结果确认中";
break;
case 40:
name="调整分类中";
break;
case 9:
name="结案";
break;
}
return name;
}
public String getDealScope_name() {
String name="-2";
switch(this.dealScope) {
case 2:
name="无";
break;
case 3:
name="非常满意";
break;
case 4:
name="较为满意";
break;
case 5:
name="满意";
break;
case 6:
name="不满意";
break;
case 7:
name="很不满意";
break;
}
return name;
}
public String doPropDetail() throws OAException {
String sql="";
/**
* <select name="dealStatus">
<option value="0">全部</option>
<option value="1">签核中</option>
<option value="46">处理中</option>
<option value="47">处理结果确认中</option>
<option value="40">调整分类中</option>
<option value="9">结案</option>
</select>
*/
if(this.deptType==0) {
//提报部门
sql="select distinct(a.flowNo),prop_no,prop_proposer,prop_proposer_name,prop_replacer,prop_replacer_name,";
sql+="prop_kind_name,prop_instancy_id,prop_instancy_name,prop_importance_id,prop_importance_name,";
sql+="prop_name,createTime,prop_want_time,score";
switch(this.dealStatus) {
case 0:
switch(this.dealScope){
case 2:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
break;
case 3:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
sql+=" score>=9 and score<=10 and";
break;
case 4:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
sql+=" score>=7 and score<=8 and";
break;
case 5:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
sql+=" score>=5 and score<=6 and";
break;
case 6:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
sql+=" score>=3 and score<=4 and";
break;
case 7:
sql+=" from tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno where";
sql+=" score>=1 and score<=2 and";
break;
}
break;
case 1:
switch(this.dealScope){
case 2:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
case 3:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=9 and score<=10 ";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
case 4:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=7 and score<=8 ";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
case 5:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=5 and score<=6 ";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
case 6:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=3 and score<=4 ";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
case 7:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=1 and score<=2 ";
sql+=" and b.type=0 and roleId<>'40' and roleId<>'46' and roleId<>'47' and ";
break;
}
break;
case 46:
switch(this.dealScope){
case 2:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and roleId='46' and b.type=0 and ";
break;
case 3:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=9 and score<=10 ";
sql+=" and roleId='46' and b.type=0 and ";
break;
case 4:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=7 and score<=8 ";
sql+=" and roleId='46' and b.type=0 and ";
break;
case 5:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=5 and score<=6 ";
sql+=" and roleId='46' and b.type=0 and ";
break;
case 6:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=3 and score<=4 ";
sql+=" and roleId='46' and b.type=0 and ";
break;
case 7:
sql+=" from (tblProp_prop as a left join tblProp_satisfy as c on a.flowno=c.flowno),checkinfo as b where b.flowNo=a.flowNo";
sql+=" and score>=1 and score<=2 ";
sql+=" and roleId='46' and b.type=0 and ";
break;
}
break;
sql+=" prop_replacer='' and createTime between "+starttime+" and "+endtime+" and ";
sql+="(a.prop_proposer_dept_id='";
System.out.println(" 提报部门 sql = "+sql);
Vector v=new Vector();
DeptUtils du=new DeptUtils(conn);
du.getDeptId(dept_id, 0, -1, v);
for(int i=0;i<v.size();i++) {
if(i!=0) {
sql+=" or a.prop_proposer_dept_id='";
}
sql+=(String)v.get(i)+"'";
}
sql+=")order by prop_no";
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货