Example #1
0
  /**
   * <一句话功能简述>
   *
   * <p>查询所有符合条件的模板信息
   *
   * <p><功能详细描述>
   *
   * @param templetVO
   * @return
   * @throws CcpException
   * @see [类、类#方法、类#成员]
   */
  @Override
  public List<TempletVO> search(TempletVO templetVO) throws CcpException {
    try {
      logger.info("templetVO:{}", templetVO.toString());

      StringBuffer sql = new StringBuffer();
      sql.append("select ");
      sql.append(
          TempletVO.FIELD_TEM_ID
              + ", "
              + TempletVO.FIELD_TEM_NAME
              + ", "
              + TempletVO.FIELD_TEM_DESC
              + " ");
      sql.append("from " + TempletVO.TABLE_NAME + " ");
      sql.append("where " + TempletVO.FIELD_DEL_FLAG + " = " + TempletVO.VALUE_DEL_FLAG);
      sql.append("order by " + TempletVO.FIELD_UPDATE_DATE + " desc ");

      logger.info("sql:{}", sql.toString());

      return queryForList(sql.toString(), templetVO, TempletVO.class);
    } catch (Exception e) {
      throw new CcpException(CcpErrorCode.ERROR_DB_EXECUTE_FAIL, e);
    }
  }
Example #2
0
  /**
   * <一句话功能简述>
   *
   * <p>更新指定的模板信息
   *
   * <p><功能详细描述>
   *
   * @param templetVO
   * @return
   * @throws CcpException
   * @see [类、类#方法、类#成员]
   */
  @Override
  public int update(TempletVO templetVO) throws CcpException {
    try {
      logger.info("templetVO:{}", templetVO.toString());

      StringBuilder sql = new StringBuilder();
      sql.append("update " + TempletVO.TABLE_NAME + " ");
      sql.append("set " + TempletVO.FIELD_TEM_NAME + " = " + TempletVO.VALUE_TEM_NAME + ", ");
      sql.append(TempletVO.FIELD_TEM_DESC + " = " + TempletVO.VALUE_TEM_DESC + ", ");
      sql.append(TempletVO.FIELD_UPDATE_DATE + " = now() ");
      sql.append(
          "where "
              + TempletVO.FIELD_DEL_FLAG
              + " = "
              + TempletVO.VALUE_DEL_FLAG
              + " and "
              + TempletVO.FIELD_TEM_ID
              + " = "
              + TempletVO.VALUE_TEM_ID);

      logger.info("sql:{}", sql.toString());

      return super.update(sql.toString(), templetVO);
    } catch (Exception e) {
      throw new CcpException(CcpErrorCode.ERROR_DB_EXECUTE_FAIL, e);
    }
  }
Example #3
0
  /**
   * <一句话功能简述>
   *
   * <p>查询指定的模板信息
   *
   * <p><功能详细描述>
   *
   * @param templetVO
   * @return
   * @throws CcpException
   * @see [类、类#方法、类#成员]
   */
  @Override
  public TempletVO get(TempletVO templetVO) throws CcpException {
    try {
      logger.info("templetVO:{}", templetVO.toString());

      StringBuilder sql = new StringBuilder();
      sql.append("select ");
      sql.append(
          TempletVO.FIELD_TEM_ID
              + ", "
              + TempletVO.FIELD_TEM_NAME
              + ", "
              + TempletVO.FIELD_TEM_DESC
              + " ");
      sql.append("from " + TempletVO.TABLE_NAME + " ");
      sql.append(
          "where "
              + TempletVO.FIELD_DEL_FLAG
              + " = "
              + TempletVO.VALUE_DEL_FLAG
              + " and "
              + TempletVO.FIELD_TEM_ID
              + " = "
              + TempletVO.VALUE_TEM_ID);

      logger.info("sql:{}", sql.toString());

      return super.queryForObject(sql.toString(), templetVO, TempletVO.class);
    } catch (Exception e) {
      throw new CcpException(CcpErrorCode.ERROR_DB_EXECUTE_FAIL, e);
    }
  }
Example #4
0
  /**
   * <一句话功能简述>
   *
   * <p>新增模板信息
   *
   * <p><功能详细描述>
   *
   * @param templetVO
   * @return
   * @throws CcpException
   * @see [类、类#方法、类#成员]
   */
  @Override
  public int save(TempletVO templetVO) throws CcpException {

    try {
      logger.info("templetVO:{}", templetVO.toString());

      StringBuilder sql = new StringBuilder();
      sql.append("insert into " + TempletVO.TABLE_NAME + " ");
      sql.append(
          "("
              + TempletVO.FIELD_TEM_NAME
              + ", "
              + TempletVO.FIELD_TEM_DESC
              + " ,"
              + TempletVO.FIELD_DEL_FLAG
              + ", "
              + TempletVO.FIELD_ADD_DATE
              + ", "
              + TempletVO.FIELD_UPDATE_DATE
              + ") ");
      sql.append(
          "values("
              + TempletVO.VALUE_TEM_NAME
              + ", "
              + TempletVO.VALUE_TEM_DESC
              + ", "
              + TempletVO.VALUE_DEL_FLAG
              + ", now(), now()) ");

      logger.info("sql:{}", sql.toString());

      return super.update(sql.toString(), templetVO);
    } catch (Exception e) {
      throw new CcpException(CcpErrorCode.ERROR_DB_EXECUTE_FAIL, e);
    }
  }