예제 #1
0
  /**
   * 插入一条数据
   *
   * @param lwTownIndicatorDto lwTownIndicatorDto
   * @throws Exception
   */
  public void insert(LwTownIndicatorDto lwTownIndicatorDto) throws Exception {
    StringBuffer buffer = new StringBuffer(200);
    buffer.append("INSERT INTO LwTownIndicator (");
    buffer.append("UserNo,");
    buffer.append("UserName,");
    buffer.append("Address,");
    buffer.append("ReadDate,");
    buffer.append("StatMonth,");
    buffer.append("ThisWorkNum,");
    buffer.append("MidWorkNum,");
    buffer.append("LastWorkNum,");
    buffer.append("Rate,");
    buffer.append("ReadQuantity,");
    buffer.append("ExcepQuantity,");
    buffer.append("ChgAmmeterQuantity,");
    buffer.append("CompensateQuantity,");
    buffer.append("AppendCalQuantity,");
    buffer.append("TranferLossQuantity,");
    buffer.append("PeoplePrice,");
    buffer.append("NotPeoplePrice,");
    buffer.append("FarmPrice,");
    buffer.append("ProducePrice,");
    buffer.append("BusinessPrice,");
    buffer.append("Voltlevel,");
    buffer.append("IndustryPrice,");
    buffer.append("ValidStatus,");
    buffer.append("Flag,");
    buffer.append("Remark,");
    buffer.append("InputDate ");
    buffer.append(") ");
    if (logger.isDebugEnabled()) {
      StringBuffer debugBuffer = new StringBuffer(buffer.length() * 4);
      debugBuffer.append(buffer.toString());
      debugBuffer.append("VALUES(");
      debugBuffer.append("'").append(lwTownIndicatorDto.getUserNo()).append("',");
      debugBuffer.append("'").append(lwTownIndicatorDto.getUserName()).append("',");
      debugBuffer.append("'").append(lwTownIndicatorDto.getAddress()).append("',");
      debugBuffer.append("'").append(lwTownIndicatorDto.getReadDate()).append("',");
      debugBuffer.append("'").append(lwTownIndicatorDto.getStatMonth()).append("',");
      debugBuffer.append("").append(lwTownIndicatorDto.getThisWorkNum()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getMidWorkNum()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getLastWorkNum()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getRate()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getReadQuantity()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getExcepQuantity()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getChgAmmeterQuantity()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getCompensateQuantity()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getAppendCalQuantity()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getTranferLossQuantity()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getPeoplePrice()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getNotPeoplePrice()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getFarmPrice()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getProducePrice()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getBusinessPrice()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getVoltlevel()).append(",");
      debugBuffer.append("").append(lwTownIndicatorDto.getIndustryPrice()).append(",");
      debugBuffer.append("'").append(lwTownIndicatorDto.getValidStatus()).append("',");
      debugBuffer.append("'").append(lwTownIndicatorDto.getFlag()).append("',");
      debugBuffer.append("'").append(lwTownIndicatorDto.getRemark()).append("',");
      debugBuffer.append("'").append(lwTownIndicatorDto.getInputDate()).append("')");
      logger.debug(debugBuffer.toString());
    }

    buffer.append("VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
    dbManager.prepareStatement(buffer.toString());
    dbManager.setString(1, lwTownIndicatorDto.getUserNo());
    dbManager.setString(2, lwTownIndicatorDto.getUserName());
    dbManager.setString(3, lwTownIndicatorDto.getAddress());
    dbManager.setString(4, lwTownIndicatorDto.getReadDate());
    dbManager.setString(5, lwTownIndicatorDto.getStatMonth());
    dbManager.setDouble(6, lwTownIndicatorDto.getThisWorkNum());
    dbManager.setDouble(7, lwTownIndicatorDto.getMidWorkNum());
    dbManager.setDouble(8, lwTownIndicatorDto.getLastWorkNum());
    dbManager.setDouble(9, lwTownIndicatorDto.getRate());
    dbManager.setDouble(10, lwTownIndicatorDto.getReadQuantity());
    dbManager.setDouble(11, lwTownIndicatorDto.getExcepQuantity());
    dbManager.setDouble(12, lwTownIndicatorDto.getChgAmmeterQuantity());
    dbManager.setDouble(13, lwTownIndicatorDto.getCompensateQuantity());
    dbManager.setLong(14, lwTownIndicatorDto.getAppendCalQuantity());
    dbManager.setLong(15, lwTownIndicatorDto.getTranferLossQuantity());
    dbManager.setDouble(16, lwTownIndicatorDto.getPeoplePrice());
    dbManager.setDouble(17, lwTownIndicatorDto.getNotPeoplePrice());
    dbManager.setDouble(18, lwTownIndicatorDto.getFarmPrice());
    dbManager.setDouble(19, lwTownIndicatorDto.getProducePrice());
    dbManager.setDouble(20, lwTownIndicatorDto.getBusinessPrice());
    dbManager.setInt(21, lwTownIndicatorDto.getVoltlevel());
    dbManager.setDouble(22, lwTownIndicatorDto.getIndustryPrice());
    dbManager.setString(23, lwTownIndicatorDto.getValidStatus());
    dbManager.setString(24, lwTownIndicatorDto.getFlag());
    dbManager.setString(25, lwTownIndicatorDto.getRemark());
    dbManager.setString(26, lwTownIndicatorDto.getInputDate());
    dbManager.executePreparedUpdate();
  }
예제 #2
0
  /**
   * 按主键更新一条数据(主键本身无法变更)
   *
   * @param lwTownIndicatorDto lwTownIndicatorDto
   * @throws Exception
   */
  public void update(LwTownIndicatorDto lwTownIndicatorDto) throws Exception {
    StringBuffer buffer = new StringBuffer(200);
    buffer.append("UPDATE LwTownIndicator SET ");
    buffer.append("UserName = ?, ");
    buffer.append("Address = ?, ");
    buffer.append("ReadDate = ?, ");
    buffer.append("ThisWorkNum = ?, ");
    buffer.append("MidWorkNum = ?, ");
    buffer.append("LastWorkNum = ?, ");
    buffer.append("Rate = ?, ");
    buffer.append("ReadQuantity = ?, ");
    buffer.append("ExcepQuantity = ?, ");
    buffer.append("ChgAmmeterQuantity = ?, ");
    buffer.append("CompensateQuantity = ?, ");
    buffer.append("AppendCalQuantity = ?, ");
    buffer.append("TranferLossQuantity = ?, ");
    buffer.append("PeoplePrice = ?, ");
    buffer.append("NotPeoplePrice = ?, ");
    buffer.append("FarmPrice = ?, ");
    buffer.append("ProducePrice = ?, ");
    buffer.append("BusinessPrice = ?, ");
    buffer.append("Voltlevel = ?, ");
    buffer.append("IndustryPrice = ?, ");
    buffer.append("ValidStatus = ?, ");
    buffer.append("Flag = ?, ");
    buffer.append("Remark = ?, ");
    buffer.append("InputDate = ? ");
    if (logger.isDebugEnabled()) {
      StringBuffer debugBuffer = new StringBuffer(buffer.length() * 4);
      debugBuffer.append("UPDATE LwTownIndicator SET ");
      debugBuffer.append("UserName = '******', ");
      debugBuffer.append("Address = '" + lwTownIndicatorDto.getAddress() + "', ");
      debugBuffer.append("ReadDate = '" + lwTownIndicatorDto.getReadDate() + "', ");
      debugBuffer.append("ThisWorkNum = " + lwTownIndicatorDto.getThisWorkNum() + ", ");
      debugBuffer.append("MidWorkNum = " + lwTownIndicatorDto.getMidWorkNum() + ", ");
      debugBuffer.append("LastWorkNum = " + lwTownIndicatorDto.getLastWorkNum() + ", ");
      debugBuffer.append("Rate = " + lwTownIndicatorDto.getRate() + ", ");
      debugBuffer.append("ReadQuantity = " + lwTownIndicatorDto.getReadQuantity() + ", ");
      debugBuffer.append("ExcepQuantity = " + lwTownIndicatorDto.getExcepQuantity() + ", ");
      debugBuffer.append(
          "ChgAmmeterQuantity = " + lwTownIndicatorDto.getChgAmmeterQuantity() + ", ");
      debugBuffer.append(
          "CompensateQuantity = " + lwTownIndicatorDto.getCompensateQuantity() + ", ");
      debugBuffer.append("AppendCalQuantity = " + lwTownIndicatorDto.getAppendCalQuantity() + ", ");
      debugBuffer.append(
          "TranferLossQuantity = " + lwTownIndicatorDto.getTranferLossQuantity() + ", ");
      debugBuffer.append("PeoplePrice = " + lwTownIndicatorDto.getPeoplePrice() + ", ");
      debugBuffer.append("NotPeoplePrice = " + lwTownIndicatorDto.getNotPeoplePrice() + ", ");
      debugBuffer.append("FarmPrice = " + lwTownIndicatorDto.getFarmPrice() + ", ");
      debugBuffer.append("ProducePrice = " + lwTownIndicatorDto.getProducePrice() + ", ");
      debugBuffer.append("BusinessPrice = " + lwTownIndicatorDto.getBusinessPrice() + ", ");
      debugBuffer.append("Voltlevel = " + lwTownIndicatorDto.getVoltlevel() + ", ");
      debugBuffer.append("IndustryPrice = " + lwTownIndicatorDto.getIndustryPrice() + ", ");
      debugBuffer.append("ValidStatus = '" + lwTownIndicatorDto.getValidStatus() + "', ");
      debugBuffer.append("Flag = '" + lwTownIndicatorDto.getFlag() + "', ");
      debugBuffer.append("Remark = '" + lwTownIndicatorDto.getRemark() + "', ");
      debugBuffer.append("InputDate = '" + lwTownIndicatorDto.getInputDate() + "' ");
      debugBuffer.append("WHERE ");
      debugBuffer
          .append("UserNo=")
          .append("'")
          .append(lwTownIndicatorDto.getUserNo())
          .append("' AND ");
      debugBuffer
          .append("StatMonth=")
          .append("'")
          .append(lwTownIndicatorDto.getStatMonth())
          .append("'");
      logger.debug(debugBuffer.toString());
    }

    buffer.append("WHERE ");
    buffer.append("UserNo = ? And ");
    buffer.append("StatMonth = ?");

    dbManager.prepareStatement(buffer.toString());
    // 设置更新字段;
    dbManager.setString(1, lwTownIndicatorDto.getUserName());
    dbManager.setString(2, lwTownIndicatorDto.getAddress());
    dbManager.setString(3, lwTownIndicatorDto.getReadDate());
    dbManager.setDouble(4, lwTownIndicatorDto.getThisWorkNum());
    dbManager.setDouble(5, lwTownIndicatorDto.getMidWorkNum());
    dbManager.setDouble(6, lwTownIndicatorDto.getLastWorkNum());
    dbManager.setDouble(7, lwTownIndicatorDto.getRate());
    dbManager.setDouble(8, lwTownIndicatorDto.getReadQuantity());
    dbManager.setDouble(9, lwTownIndicatorDto.getExcepQuantity());
    dbManager.setDouble(10, lwTownIndicatorDto.getChgAmmeterQuantity());
    dbManager.setDouble(11, lwTownIndicatorDto.getCompensateQuantity());
    dbManager.setLong(12, lwTownIndicatorDto.getAppendCalQuantity());
    dbManager.setLong(13, lwTownIndicatorDto.getTranferLossQuantity());
    dbManager.setDouble(14, lwTownIndicatorDto.getPeoplePrice());
    dbManager.setDouble(15, lwTownIndicatorDto.getNotPeoplePrice());
    dbManager.setDouble(16, lwTownIndicatorDto.getFarmPrice());
    dbManager.setDouble(17, lwTownIndicatorDto.getProducePrice());
    dbManager.setDouble(18, lwTownIndicatorDto.getBusinessPrice());
    dbManager.setInt(19, lwTownIndicatorDto.getVoltlevel());
    dbManager.setDouble(20, lwTownIndicatorDto.getIndustryPrice());
    dbManager.setString(21, lwTownIndicatorDto.getValidStatus());
    dbManager.setString(22, lwTownIndicatorDto.getFlag());
    dbManager.setString(23, lwTownIndicatorDto.getRemark());
    dbManager.setString(24, lwTownIndicatorDto.getInputDate());
    // 设置条件字段;
    dbManager.setString(25, lwTownIndicatorDto.getUserNo());
    dbManager.setString(26, lwTownIndicatorDto.getStatMonth());
    dbManager.executePreparedUpdate();
  }