예제 #1
0
 /*
  * (non-Javadoc)
  *
  * @see com.imchooser.framework.service.BaseService#remove(java.lang.Object)
  */
 public boolean remove(Object myaction) throws Exception {
   DepartAction action = (DepartAction) myaction;
   String mess = null;
   mess =
       DBUtil.execOracleProcQueryString(
           "prc_sys_deletedepartid(?,?,?)",
           action.getTsysDepart().getDepartid(),
           action.getDepartID());
   boolean deleteSuccess = "1".equals(mess);
   if (deleteSuccess) {
     BusinessLogUtil.log(
         action.getLoginUser().getUserLoginId(),
         SysConstants.CZDX_T_SYS_DEPART,
         SysConstants.LOG_ACTION_DEL);
   } else {
     throw new Exception(mess);
   }
   return deleteSuccess;
 }
예제 #2
0
  public List<?> search(Object myaction, Pager pager) throws Exception {
    DepartAction action = (DepartAction) myaction;
    TSysDepart tSysDepart = action.getTsysDepart();
    TDepartDetail tDepartDetail = action.getDepartDetail();
    String sqlcolumn =
        "select a.departid,a.departname, "
            + "(select c.departname from T_Sys_Depart c where c.departid=a.updepartid) as updepartid,"
            + "b.linkman,b.linktel,b.email,b.fax ";
    String sql =
        " from T_Sys_Depart a left join T_Depart_Detail b on a.departid=b.departid where a.departid like '"
            + action.getDepartID()
            + "%' and a.sfsn='1'";

    if (tSysDepart != null) {
      if (StringUtils.isNotBlank(tSysDepart.getDepartname())) {
        sql += " and a.departname like '%" + tSysDepart.getDepartname() + "%'";
      }
      if (StringUtils.isNotBlank(tSysDepart.getDepartid())) {
        sql += " and a.departid like '" + tSysDepart.getDepartid() + "%'";
      }
      if (StringUtils.isNotBlank(tSysDepart.getUpdepartid())) {
        sql +=
            " and a.updepartid in (select c.departid from T_Sys_Depart c where c.departname like '%"
                + tSysDepart.getUpdepartid()
                + "%')";
      }
    }
    if (tDepartDetail != null) {
      if (StringUtils.isNotBlank(tDepartDetail.getLinkman())) {
        sql += " and b.linkman like '%" + tDepartDetail.getLinkman() + "%'";
      }
    }
    long c = DBUtil.count(" select count(*) as c " + sql);
    pager.setTotalRows(c);
    sql = sqlcolumn + sql + "  order by a.departid ,a.cc desc ";
    List<?> list = DBUtil.queryPageList(pager, sql);
    return list;
  }