Beispiel #1
0
	//改变所属单位
	public String par(){

		Users users=getLoginAdmin();
		String result="0";
		msg="改变菜单 "+unit.getName()+" 的所属菜单为 "+parname+" ";
		try {
			if (unit.getId()!=null&&unit.getId().trim().length()>0) {
				unitMapper=MybatisSessionFactory.getSession().getMapper(UnitMapper.class);
				unitMapper.updatePar(unit);
				MybatisSessionFactory.getSession().commit();
				result="1";
				msg+="成功<属性>"+unit.getId()+"<属性>"+unit.getParid();
			}else {
				msg="删除时没有获取到菜单 "+unit.getName();
			}
		} catch (Exception e) {
			try {
				MybatisSessionFactory.getSession().rollback();
			} catch (Exception e1) {
				e1.printStackTrace();
			}
			e.printStackTrace();
			result="0";
			msg+="失败:"+e.toString();
		}
		OperLogUtil.log(users.getLoginname(), msg, getHttpRequest());
		ResponseUtil.writeUTF(getHttpResponse(),result+msg);
		return null;
	}
Beispiel #2
0
	//保存
	public String find(){
		String result="0";
		StringBuilder sb=new StringBuilder();
		try {
			if (unit.getId()!=null && unit.getId().trim().length()>0) {
				unitMapper=MybatisSessionFactory.getSession().getMapper(UnitMapper.class);
				Unit currUnit=unitMapper.selectByPrimaryKey(unit.getId().trim());
				if (currUnit!=null) {
					sb.append(currUnit.getId());
					sb.append("<属性>");
					sb.append(currUnit.getName()!=null?currUnit.getName():"");
					sb.append("<属性>");
					sb.append(currUnit.getIsok());
					sb.append("<属性>");
					sb.append(currUnit.getOrdernum()!=null?currUnit.getOrdernum():"");
					sb.append("<属性>");
					sb.append(currUnit.getParid());
					sb.append("<属性>");
					sb.append(currUnit.getIsmail());
					result="1";
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			result="0";	
		}
		ResponseUtil.writeUTF(getHttpResponse(),result+sb.toString());
		return null;
	}