Exemplo n.º 1
0
  /**
   * 功能:新增管理资产查询。
   *
   * @return SQLModel 返回页面翻页查询SQLModel
   * @throws com.sino.base.exception.SQLModelException 发生日历异常时转化为该异常抛出
   */
  public SQLModel getPageQueryModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    try {
      List sqlArgs = new ArrayList();
      AssetsAddDTO dto = (AssetsAddDTO) dtoParameter;
      //             AssetsAddLDTO dtoL = (AssetsAddLDTO) dtoParameter;
      String sqlStr =
          "SELECT EAAH.HEAD_ID,\n"
              + "       EAAH.BILL_NO,\n"
              + " CASE WHEN EAAH.STATUS=0 THEN '未完成' ELSE '已完成' END STATUS,"
              + "       EAAH.CREATE_USER,\n"
              + "       EAAH.CREATED_DATE,\n"
              + "       EAAH.SPEC_DEPT,\n"
              + "       EAAL.BARCODE,\n"
              + "       EAAL.ITEM_CODE,\n"
              + "       ESI.ITEM_NAME,\n"
              + "       ESI.ITEM_SPEC,\n"
              + "       SU.USERNAME\n"
              + "FROM   ETS_ASSETS_ADD_H EAAH,\n"
              + "       ETS_ASSETS_ADD_L EAAL,\n"
              + "       ETS_SYSTEM_ITEM  ESI,\n"
              + "       SF_USER          SU\n"
              + "WHERE  EAAH.HEAD_ID = EAAL.HEAD_ID\n"
              + "       AND EAAL.ITEM_CODE = ESI.ITEM_CODE\n"
              + "       AND EAAH.CREATE_USER = SU.USER_ID\n"
              + "       AND SU.ORGANIZATION_ID = ?\n"
              + "       AND SU.USERNAME LIKE dbo.NVL(?, SU.USERNAME)\n"
              + "       AND ESI.ITEM_SPEC LIKE dbo.NVL(?, ESI.ITEM_SPEC)\n"
              + "       AND ESI.ITEM_NAME LIKE dbo.NVL(?, ESI.ITEM_NAME)\n"
              + "       AND EAAH.STATUS = ISNULL(?, EAAH.STATUS)\n"
              + "       AND (? = '' OR EAAH.CREATED_DATE >= ISNULL(?, EAAH.CREATED_DATE))\n"
              + "       AND (? = '' OR EAAH.CREATED_DATE <= ISNULL(?, EAAH.CREATED_DATE))\n"
              + "       AND EAAL.BARCODE LIKE dbo.NVL(?, EAAL.BARCODE)\n"
              + "ORDER  BY EAAH.BILL_NO,\n"
              + "          EAAL.BARCODE";
      sqlArgs.add(sfDto.getOrganizationId());
      sqlArgs.add(dto.getCreateUser());
      sqlArgs.add(dto.getItemSpec());
      sqlArgs.add(dto.getItemName());
      if ("".equals(dto.getStatus()) || null == dto.getStatus()) {
        sqlArgs.add(null);
      } else {
        sqlArgs.add(StrUtil.strToInt(dto.getStatus()));
      }
      sqlArgs.add(dto.getFromDate());
      sqlArgs.add(dto.getFromDate());
      sqlArgs.add(dto.getToDate());
      sqlArgs.add(dto.getToDate());
      sqlArgs.add(dto.getBarcod());

      sqlModel.setSqlStr(sqlStr);
      sqlModel.setArgs(sqlArgs);
    } catch (CalendarException ex) {
      ex.printLog();
      throw new SQLModelException(ex);
    }
    return sqlModel;
  }
Exemplo n.º 2
0
  /**
   * 功能:执行新增数据操作。
   *
   * @return SQLModel 返回数据插入用SQLModel
   */
  public SQLModel getDataCreateModel() {
    SQLModel sqlModel = new SQLModel();
    //            try {
    List sqlArgs = new ArrayList();
    AssetsAddDTO dto = (AssetsAddDTO) dtoParameter;
    String sqlStr =
        "INSERT INTO "
            + " ETS_ASSETS_ADD_H("
            + " HEAD_ID,"
            + " BILL_NO,"
            + " STATUS,"
            + " CREATE_USER,"
            + " CREATED_DATE,"
            + " SPEC_DEPT,"
            + " REMARK"
            + ") "
            + " VALUES (?, ?, ?, ?, GETDATE(), ?, ?)";

    sqlArgs.add(dto.getHeadId());
    sqlArgs.add(dto.getBillNo());
    sqlArgs.add(StrUtil.strToInt(dto.getStatus()));
    sqlArgs.add(userAccount.getUserId());
    sqlArgs.add(dto.getSpecialityDept());
    sqlArgs.add(dto.getRemark());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);
    return sqlModel;
  }
Exemplo n.º 3
0
  /**
   * 功能:框架自动生成备件事务头表(EAM) ETS_ASSETS_ADD_H数据更新SQLModel,请根据实际需要修改。
   *
   * @return SQLModel 返回数据更新用SQLModel
   */
  public SQLModel getDataUpdateModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    List sqlArgs = new ArrayList();
    AssetsAddDTO dto = (AssetsAddDTO) dtoParameter;
    String sqlStr =
        "UPDATE ETS_ASSETS_ADD_H"
            + " SET"
            + "     STATUS = ?, "
            + "     SPEC_DEPT = ?, "
            + "     REMARK = ? "
            + " WHERE"
            + "     HEAD_ID = ?";
    //            try {
    sqlArgs.add(StrUtil.strToInt(dto.getStatus()));
    sqlArgs.add(dto.getSpecialityDept());
    sqlArgs.add(dto.getRemark());
    sqlArgs.add(dto.getHeadId());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);
    return sqlModel;
  }